2016-08-20 23:02:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Shikiryu\LBCReposter;
|
|
|
|
|
|
|
|
class Deal
|
|
|
|
{
|
|
|
|
const TYPE_OFFER = 's';
|
|
|
|
const TYPE_ASK = 'k';
|
|
|
|
|
|
|
|
/** @var Account */
|
|
|
|
protected $account;
|
|
|
|
/** @var int */
|
|
|
|
protected $id;
|
|
|
|
/** @var int */
|
|
|
|
protected $category;
|
|
|
|
/** @var string type */
|
|
|
|
protected $type = self::TYPE_OFFER;
|
|
|
|
/** @var string title */
|
|
|
|
protected $subject;
|
|
|
|
/** @var string texte */
|
|
|
|
protected $body;
|
|
|
|
/** @var float */
|
|
|
|
protected $price;
|
|
|
|
|
|
|
|
protected $image0;
|
|
|
|
protected $image1;
|
|
|
|
protected $image2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deal constructor.
|
|
|
|
* @param int|null $id
|
|
|
|
*/
|
|
|
|
public function __construct($id = null)
|
|
|
|
{
|
|
|
|
$this->id = $id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function fromURL(Account $account, $url)
|
|
|
|
{
|
|
|
|
$client = $account->getClient();
|
|
|
|
$crawler = $client->request('GET', $url);
|
|
|
|
$deal = new self();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getId()
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int $id
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setId($id)
|
|
|
|
{
|
|
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getCategory()
|
|
|
|
{
|
|
|
|
return $this->category;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int $category
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setCategory($category)
|
|
|
|
{
|
|
|
|
$this->category = $category;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getType()
|
|
|
|
{
|
|
|
|
return $this->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $type
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setType($type)
|
|
|
|
{
|
|
|
|
$this->type = $type;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getSubject()
|
|
|
|
{
|
|
|
|
return $this->subject;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $subject
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setSubject($subject)
|
|
|
|
{
|
|
|
|
$this->subject = $subject;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getBody()
|
|
|
|
{
|
|
|
|
return $this->body;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $body
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setBody($body)
|
|
|
|
{
|
|
|
|
$this->body = $body;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getPrice()
|
|
|
|
{
|
|
|
|
return $this->price;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param float $price
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setPrice($price)
|
|
|
|
{
|
|
|
|
$this->price = $price;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getImage0()
|
|
|
|
{
|
|
|
|
return $this->image0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $image0
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setImage0($image0)
|
|
|
|
{
|
|
|
|
$this->image0 = $image0;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getImage1()
|
|
|
|
{
|
|
|
|
return $this->image1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $image1
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setImage1($image1)
|
|
|
|
{
|
|
|
|
$this->image1 = $image1;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getImage2()
|
|
|
|
{
|
|
|
|
return $this->image2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $image2
|
|
|
|
* @return Deal
|
|
|
|
*/
|
|
|
|
public function setImage2($image2)
|
|
|
|
{
|
|
|
|
$this->image2 = $image2;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-19 23:02:07 +02:00
|
|
|
}
|