mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-18 13:10:08 -07:00
Update Brickset client + Fix coding style
This commit is contained in:
parent
a2e270de14
commit
f2f4e086e6
@ -6,12 +6,15 @@ use AppBundle\Client\Brickset\Entity\AdditionalImage;
|
|||||||
use AppBundle\Client\Brickset\Entity\Instructions;
|
use AppBundle\Client\Brickset\Entity\Instructions;
|
||||||
use AppBundle\Client\Brickset\Entity\Review;
|
use AppBundle\Client\Brickset\Entity\Review;
|
||||||
use AppBundle\Client\Brickset\Entity\Set;
|
use AppBundle\Client\Brickset\Entity\Set;
|
||||||
|
use AppBundle\Client\Brickset\Entity\Subtheme;
|
||||||
|
use AppBundle\Client\Brickset\Entity\Theme;
|
||||||
|
use AppBundle\Client\Brickset\Entity\Year;
|
||||||
use Symfony\Component\Asset\Exception\LogicException;
|
use Symfony\Component\Asset\Exception\LogicException;
|
||||||
use Symfony\Component\Debug\Exception\ContextErrorException;
|
use Symfony\Component\Debug\Exception\ContextErrorException;
|
||||||
|
|
||||||
class Brickset extends \SoapClient
|
class Brickset extends \SoapClient
|
||||||
{
|
{
|
||||||
const WSDL = 'http://brickset.com/api/v2.asmx?WSDL';
|
const WSDL = 'http://brickset.com/api/v2.asmx?WSDL';
|
||||||
|
|
||||||
private $apiKey = '';
|
private $apiKey = '';
|
||||||
private $userHash = '';
|
private $userHash = '';
|
||||||
@ -24,6 +27,9 @@ class Brickset extends \SoapClient
|
|||||||
'additionalImages' => AdditionalImage::class,
|
'additionalImages' => AdditionalImage::class,
|
||||||
'instructions' => Instructions::class,
|
'instructions' => Instructions::class,
|
||||||
'reviews' => Review::class,
|
'reviews' => Review::class,
|
||||||
|
'themes' => Theme::class,
|
||||||
|
'subthemes' => Subtheme::class,
|
||||||
|
'years' => Year::class,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,49 +60,46 @@ class Brickset extends \SoapClient
|
|||||||
$this->apiKey = $apiKey;
|
$this->apiKey = $apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function call($method, $parameters)
|
||||||
* @param $query
|
|
||||||
* @param $theme
|
|
||||||
* @param $subtheme
|
|
||||||
* @param $setNumber
|
|
||||||
* @param $year
|
|
||||||
* @param $owned
|
|
||||||
* @param $wanted
|
|
||||||
* @param $orderBy
|
|
||||||
* @param $pageSize
|
|
||||||
* @param $pageNumber
|
|
||||||
* @param $userName
|
|
||||||
*
|
|
||||||
* @return Set[]
|
|
||||||
*/
|
|
||||||
public function getSets($query, $theme, $subtheme, $setNumber, $year, $owned, $wanted, $orderBy, $pageSize, $pageNumber, $userName)
|
|
||||||
{
|
{
|
||||||
$parameters = [
|
$parameters['apiKey'] = $this->apiKey;
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'userHash' => $this->userHash,
|
|
||||||
'query' => $query,
|
|
||||||
'theme' => $theme,
|
|
||||||
'subtheme' => $subtheme,
|
|
||||||
'setNumber' => $setNumber,
|
|
||||||
'year' => $year,
|
|
||||||
'owned' => $owned,
|
|
||||||
'wanted' => $wanted,
|
|
||||||
'orderBy' => $orderBy,
|
|
||||||
'pageSize' => $pageSize,
|
|
||||||
'pageNumber' => $pageNumber,
|
|
||||||
'userName' => $userName,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->__soapCall('getSets', [$parameters])->getSetsResult->sets;
|
return $this->__soapCall($method, [$parameters]);
|
||||||
} catch (ContextErrorException $e) {
|
|
||||||
return [];
|
|
||||||
} catch (\SoapFault $e) {
|
} catch (\SoapFault $e) {
|
||||||
//TODO
|
//TODO
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a list of sets.
|
||||||
|
*
|
||||||
|
* @param array $parameters
|
||||||
|
*
|
||||||
|
* @return Set[]
|
||||||
|
*/
|
||||||
|
public function getSets($parameters)
|
||||||
|
{
|
||||||
|
$parameters['userHash'] = $this->userHash;
|
||||||
|
|
||||||
|
// Add blank required parameters to api call in order to recieve response
|
||||||
|
$required_keys = ['query', 'theme', 'subtheme', 'setNumber', 'year', 'owned', 'wanted', 'orderBy', 'pageSize', 'pageNumber', 'userName'];
|
||||||
|
foreach ($required_keys as $key) {
|
||||||
|
if (!array_key_exists($key, $parameters)) {
|
||||||
|
$parameters[$key] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->call('getSets', $parameters)->getSetsResult->sets;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
|
} catch (ContextErrorException $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $SetID
|
* @param $SetID
|
||||||
*
|
*
|
||||||
@ -104,139 +107,180 @@ class Brickset extends \SoapClient
|
|||||||
*/
|
*/
|
||||||
public function getSet($SetID)
|
public function getSet($SetID)
|
||||||
{
|
{
|
||||||
$parameters = [
|
$parameters = ['userHash' => $this->userHash, 'SetID' => $SetID];
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'userHash' => $this->userHash,
|
|
||||||
'SetID' => $SetID,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->__soapCall('getSet', [$parameters])->getSetResult->sets[0];
|
return $this->call('getSet', $parameters)->getSetResult->sets;
|
||||||
} catch (ContextErrorException $e) {
|
} catch (ContextErrorException $e) {
|
||||||
return null;
|
return null;
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get a list of sets that have changed in the last {minutesAgo} minutes.
|
||||||
|
*
|
||||||
* @param int $minutesAgo
|
* @param int $minutesAgo
|
||||||
*
|
*
|
||||||
* @return Set[]
|
* @return Set[]
|
||||||
*/
|
*/
|
||||||
public function getRecentlyUpdatedSets($minutesAgo)
|
public function getRecentlyUpdatedSets($minutesAgo)
|
||||||
{
|
{
|
||||||
$parameters = [
|
$parameters = ['minutesAgo' => $minutesAgo];
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'minutesAgo' => $minutesAgo,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->__soapCall('getRecentlyUpdatedSets', [$parameters])->getRecentlyUpdatedSetsResult->sets;
|
$response = $this->call('getRecentlyUpdatedSets', $parameters)->getRecentlyUpdatedSetsResult->sets;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
} catch (ContextErrorException $e) {
|
} catch (ContextErrorException $e) {
|
||||||
return [];
|
return [];
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $setID
|
* Get a list of URLs of additional set images for the specified set.
|
||||||
|
*
|
||||||
|
* @param int $setID Brickset unique id of set
|
||||||
*
|
*
|
||||||
* @return AdditionalImage[]
|
* @return AdditionalImage[]
|
||||||
*/
|
*/
|
||||||
public function getAdditionalImages($setID)
|
public function getAdditionalImages($setID)
|
||||||
{
|
{
|
||||||
$parameters = [
|
$parameters = ['setID' => $setID];
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'setID' => $setID,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->__soapCall('getAdditionalImages', [$parameters])->getAdditionalImagesResult->additionalImages;
|
$response = $this->call('getAdditionalImages', $parameters)->getAdditionalImagesResult->additionalImages;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
} catch (ContextErrorException $e) {
|
} catch (ContextErrorException $e) {
|
||||||
return [];
|
return [];
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getReviews($setID)
|
|
||||||
{
|
|
||||||
$parameters = [
|
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'setID' => $setID,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
|
||||||
return $this->__soapCall('getReviews', [$parameters])->getReviewsResult->reviews;
|
|
||||||
} catch (ContextErrorException $e) {
|
|
||||||
return [];
|
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getInstructions($setID)
|
|
||||||
{
|
|
||||||
$parameters = [
|
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'setID' => $setID,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
|
||||||
return $this->__soapCall('getInstructions', [$parameters])->getInstructionsResult->instructions;
|
|
||||||
} catch (ContextErrorException $e) {
|
|
||||||
return [];
|
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function login($username, $password)
|
|
||||||
{
|
|
||||||
$parameters = [
|
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
'username' => $username,
|
|
||||||
'password' => $password,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
|
||||||
$response = $this->__soapCall('login', [$parameters])->loginResult;
|
|
||||||
if ($response == 'INVALIDKEY') {
|
|
||||||
return false;
|
|
||||||
} elseif (strpos($response, 'ERROR:') === 0) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
$this->userHash = $response;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* Get the reviews for the specified set.
|
||||||
|
*
|
||||||
|
* @param int $setID Brickset unique id of set
|
||||||
|
*
|
||||||
|
* @return Review[]
|
||||||
|
*/
|
||||||
|
public function getReviews($setID)
|
||||||
|
{
|
||||||
|
$parameters = ['setID' => $setID];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->call('getReviews', $parameters)->getReviewsResult->reviews;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
|
} catch (ContextErrorException $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of instructions for the specified set.
|
||||||
|
*
|
||||||
|
* @param int $setID Brickset unique id of set
|
||||||
|
*
|
||||||
|
* @return Instructions[]
|
||||||
|
*/
|
||||||
|
public function getInstructions($setID)
|
||||||
|
{
|
||||||
|
$parameters = ['setID' => $setID];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->call('getInstructions', $parameters)->getInstructionsResult->instructions;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
|
} catch (ContextErrorException $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of themes, with the total number of sets in each.
|
||||||
|
*
|
||||||
|
* @return Theme[]
|
||||||
|
*/
|
||||||
|
public function getThemes()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $this->call('getThemes', [])->getThemesResult->themes;
|
||||||
|
} catch (ContextErrorException $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of subthemes for a given theme, with the total number of sets in each.
|
||||||
|
*
|
||||||
|
* @param string $theme Name of theme
|
||||||
|
*
|
||||||
|
* @return Subtheme[]
|
||||||
|
*/
|
||||||
|
public function getSubthemes($theme)
|
||||||
|
{
|
||||||
|
$parameters = ['theme' => $theme];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->call('getSubthemes', $parameters)->getSubthemesResult->subthemes;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
|
} catch (ContextErrorException $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of years for a given theme, with the total number of sets in each.
|
||||||
|
*
|
||||||
|
* @param string $theme Name of theme
|
||||||
|
*
|
||||||
|
* @return Year[]
|
||||||
|
*/
|
||||||
|
public function getYears($theme)
|
||||||
|
{
|
||||||
|
$parameters = ['theme' => $theme];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->call('getYears', $parameters)->getYearsResult->years;
|
||||||
|
|
||||||
|
return is_array($response) ? $response : [$response];
|
||||||
|
} catch (ContextErrorException $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log in as a user and retrieve a token that can be used in subsequent API calls.
|
||||||
|
*
|
||||||
|
* @param string $username
|
||||||
|
* @param string $password
|
||||||
|
*
|
||||||
|
* @return bool True if successful
|
||||||
|
*/
|
||||||
|
public function login($username, $password)
|
||||||
|
{
|
||||||
|
$parameters = ['username' => $username, 'password' => $password];
|
||||||
|
|
||||||
|
$response = $this->call('login', $parameters)->loginResult;
|
||||||
|
if ($response == 'INVALIDKEY') {
|
||||||
|
return false;
|
||||||
|
} elseif (strpos($response, 'ERROR:') === 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$this->userHash = $response;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if an API key is valid.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkKey()
|
public function checkKey()
|
||||||
{
|
{
|
||||||
$parameters = [
|
return ($this->call('checkKey', [])->checkKeyResult) == 'OK' ? true : false;
|
||||||
'apiKey' => $this->apiKey,
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
|
||||||
return ($this->__soapCall('checkKey', [$parameters])->checkKeyResult) == 'OK' ? true : false;
|
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
//TODO
|
|
||||||
throw new LogicException($e->getCode().' - '.$e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,26 +4,23 @@ namespace AppBundle\Client\Brickset\Entity;
|
|||||||
|
|
||||||
class AdditionalImage
|
class AdditionalImage
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $thumbnailURL
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $thumbnailURL = null;
|
protected $thumbnailURL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $largeThumbnailURL
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $largeThumbnailURL = null;
|
protected $largeThumbnailURL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $imageURL
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $imageURL = null;
|
protected $imageURL = null;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,17 +28,19 @@ class AdditionalImage
|
|||||||
*/
|
*/
|
||||||
public function getThumbnailURL()
|
public function getThumbnailURL()
|
||||||
{
|
{
|
||||||
return $this->thumbnailURL;
|
return $this->thumbnailURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $thumbnailURL
|
* @param string $thumbnailURL
|
||||||
|
*
|
||||||
* @return AdditionalImage
|
* @return AdditionalImage
|
||||||
*/
|
*/
|
||||||
public function setThumbnailURL($thumbnailURL)
|
public function setThumbnailURL($thumbnailURL)
|
||||||
{
|
{
|
||||||
$this->thumbnailURL = $thumbnailURL;
|
$this->thumbnailURL = $thumbnailURL;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,17 +48,19 @@ class AdditionalImage
|
|||||||
*/
|
*/
|
||||||
public function getLargeThumbnailURL()
|
public function getLargeThumbnailURL()
|
||||||
{
|
{
|
||||||
return $this->largeThumbnailURL;
|
return $this->largeThumbnailURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $largeThumbnailURL
|
* @param string $largeThumbnailURL
|
||||||
|
*
|
||||||
* @return AdditionalImage
|
* @return AdditionalImage
|
||||||
*/
|
*/
|
||||||
public function setLargeThumbnailURL($largeThumbnailURL)
|
public function setLargeThumbnailURL($largeThumbnailURL)
|
||||||
{
|
{
|
||||||
$this->largeThumbnailURL = $largeThumbnailURL;
|
$this->largeThumbnailURL = $largeThumbnailURL;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,17 +68,18 @@ class AdditionalImage
|
|||||||
*/
|
*/
|
||||||
public function getImageURL()
|
public function getImageURL()
|
||||||
{
|
{
|
||||||
return $this->imageURL;
|
return $this->imageURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $imageURL
|
* @param string $imageURL
|
||||||
|
*
|
||||||
* @return AdditionalImage
|
* @return AdditionalImage
|
||||||
*/
|
*/
|
||||||
public function setImageURL($imageURL)
|
public function setImageURL($imageURL)
|
||||||
{
|
{
|
||||||
$this->imageURL = $imageURL;
|
$this->imageURL = $imageURL;
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,19 +5,17 @@ namespace AppBundle\Client\Brickset\Entity;
|
|||||||
class Instructions
|
class Instructions
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string $URL
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $URL = null;
|
protected $URL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $description
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = null;
|
protected $description = null;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,17 +23,19 @@ class Instructions
|
|||||||
*/
|
*/
|
||||||
public function getURL()
|
public function getURL()
|
||||||
{
|
{
|
||||||
return $this->URL;
|
return $this->URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $URL
|
* @param string $URL
|
||||||
|
*
|
||||||
* @return Instructions
|
* @return Instructions
|
||||||
*/
|
*/
|
||||||
public function setURL($URL)
|
public function setURL($URL)
|
||||||
{
|
{
|
||||||
$this->URL = $URL;
|
$this->URL = $URL;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,17 +43,18 @@ class Instructions
|
|||||||
*/
|
*/
|
||||||
public function getDescription()
|
public function getDescription()
|
||||||
{
|
{
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $description
|
* @param string $description
|
||||||
|
*
|
||||||
* @return Instructions
|
* @return Instructions
|
||||||
*/
|
*/
|
||||||
public function setDescription($description)
|
public function setDescription($description)
|
||||||
{
|
{
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,75 +4,74 @@ namespace AppBundle\Client\Brickset\Entity;
|
|||||||
|
|
||||||
class Review
|
class Review
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $author
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $author = null;
|
protected $author = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime $datePosted
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
protected $datePosted = null;
|
protected $datePosted = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $overallRating
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $overallRating = null;
|
protected $overallRating = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $parts
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $parts = null;
|
protected $parts = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $buildingExperience
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $buildingExperience = null;
|
protected $buildingExperience = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $playability
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $playability = null;
|
protected $playability = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $valueForMoney
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $valueForMoney = null;
|
protected $valueForMoney = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $title
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $title = null;
|
protected $title = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $review
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $review = null;
|
protected $review = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean $HTML
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $HTML = null;
|
protected $HTML = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \DateTime $datePosted
|
* @param \DateTime $datePosted
|
||||||
* @param int $overallRating
|
* @param int $overallRating
|
||||||
* @param int $parts
|
* @param int $parts
|
||||||
* @param int $buildingExperience
|
* @param int $buildingExperience
|
||||||
* @param int $playability
|
* @param int $playability
|
||||||
* @param int $valueForMoney
|
* @param int $valueForMoney
|
||||||
* @param boolean $HTML
|
* @param bool $HTML
|
||||||
*/
|
*/
|
||||||
public function __construct(\DateTime $datePosted, $overallRating, $parts, $buildingExperience, $playability, $valueForMoney, $HTML)
|
public function __construct(\DateTime $datePosted, $overallRating, $parts, $buildingExperience, $playability, $valueForMoney, $HTML)
|
||||||
{
|
{
|
||||||
$this->datePosted = $datePosted->format(\DateTime::ATOM);
|
$this->datePosted = $datePosted->format(\DateTime::ATOM);
|
||||||
$this->overallRating = $overallRating;
|
$this->overallRating = $overallRating;
|
||||||
$this->parts = $parts;
|
$this->parts = $parts;
|
||||||
$this->buildingExperience = $buildingExperience;
|
$this->buildingExperience = $buildingExperience;
|
||||||
$this->playability = $playability;
|
$this->playability = $playability;
|
||||||
$this->valueForMoney = $valueForMoney;
|
$this->valueForMoney = $valueForMoney;
|
||||||
$this->HTML = $HTML;
|
$this->HTML = $HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,17 +79,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getAuthor()
|
public function getAuthor()
|
||||||
{
|
{
|
||||||
return $this->author;
|
return $this->author;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $author
|
* @param string $author
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setAuthor($author)
|
public function setAuthor($author)
|
||||||
{
|
{
|
||||||
$this->author = $author;
|
$this->author = $author;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,25 +99,27 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getDatePosted()
|
public function getDatePosted()
|
||||||
{
|
{
|
||||||
if ($this->datePosted == null) {
|
if ($this->datePosted == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
return new \DateTime($this->datePosted);
|
return new \DateTime($this->datePosted);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \DateTime $datePosted
|
* @param \DateTime $datePosted
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setDatePosted(\DateTime $datePosted)
|
public function setDatePosted(\DateTime $datePosted)
|
||||||
{
|
{
|
||||||
$this->datePosted = $datePosted->format(\DateTime::ATOM);
|
$this->datePosted = $datePosted->format(\DateTime::ATOM);
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,17 +127,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getOverallRating()
|
public function getOverallRating()
|
||||||
{
|
{
|
||||||
return $this->overallRating;
|
return $this->overallRating;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $overallRating
|
* @param int $overallRating
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setOverallRating($overallRating)
|
public function setOverallRating($overallRating)
|
||||||
{
|
{
|
||||||
$this->overallRating = $overallRating;
|
$this->overallRating = $overallRating;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,17 +147,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getParts()
|
public function getParts()
|
||||||
{
|
{
|
||||||
return $this->parts;
|
return $this->parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $parts
|
* @param int $parts
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setParts($parts)
|
public function setParts($parts)
|
||||||
{
|
{
|
||||||
$this->parts = $parts;
|
$this->parts = $parts;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,17 +167,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getBuildingExperience()
|
public function getBuildingExperience()
|
||||||
{
|
{
|
||||||
return $this->buildingExperience;
|
return $this->buildingExperience;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $buildingExperience
|
* @param int $buildingExperience
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setBuildingExperience($buildingExperience)
|
public function setBuildingExperience($buildingExperience)
|
||||||
{
|
{
|
||||||
$this->buildingExperience = $buildingExperience;
|
$this->buildingExperience = $buildingExperience;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,17 +187,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getPlayability()
|
public function getPlayability()
|
||||||
{
|
{
|
||||||
return $this->playability;
|
return $this->playability;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $playability
|
* @param int $playability
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setPlayability($playability)
|
public function setPlayability($playability)
|
||||||
{
|
{
|
||||||
$this->playability = $playability;
|
$this->playability = $playability;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,17 +207,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getValueForMoney()
|
public function getValueForMoney()
|
||||||
{
|
{
|
||||||
return $this->valueForMoney;
|
return $this->valueForMoney;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $valueForMoney
|
* @param int $valueForMoney
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setValueForMoney($valueForMoney)
|
public function setValueForMoney($valueForMoney)
|
||||||
{
|
{
|
||||||
$this->valueForMoney = $valueForMoney;
|
$this->valueForMoney = $valueForMoney;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,17 +227,19 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getTitle()
|
public function getTitle()
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $title
|
* @param string $title
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setTitle($title)
|
public function setTitle($title)
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,35 +247,38 @@ class Review
|
|||||||
*/
|
*/
|
||||||
public function getReview()
|
public function getReview()
|
||||||
{
|
{
|
||||||
return $this->review;
|
return $this->review;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $review
|
* @param string $review
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setReview($review)
|
public function setReview($review)
|
||||||
{
|
{
|
||||||
$this->review = $review;
|
$this->review = $review;
|
||||||
return $this;
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getHTML()
|
public function getHTML()
|
||||||
{
|
{
|
||||||
return $this->HTML;
|
return $this->HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boolean $HTML
|
* @param bool $HTML
|
||||||
|
*
|
||||||
* @return Review
|
* @return Review
|
||||||
*/
|
*/
|
||||||
public function setHTML($HTML)
|
public function setHTML($HTML)
|
||||||
{
|
{
|
||||||
$this->HTML = $HTML;
|
$this->HTML = $HTML;
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
119
src/AppBundle/Client/Brickset/Entity/Subtheme.php
Normal file
119
src/AppBundle/Client/Brickset/Entity/Subtheme.php
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: hubnedav
|
||||||
|
* Date: 11/11/16
|
||||||
|
* Time: 7:13 PM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace AppBundle\Client\Brickset\Entity;
|
||||||
|
|
||||||
|
class Subtheme
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $theme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $subtheme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var
|
||||||
|
*/
|
||||||
|
protected $setCount;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $yearFrom;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $yearTo;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getTheme()
|
||||||
|
{
|
||||||
|
return $this->theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $theme
|
||||||
|
*/
|
||||||
|
public function setTheme($theme)
|
||||||
|
{
|
||||||
|
$this->theme = $theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getSetCount()
|
||||||
|
{
|
||||||
|
return $this->setCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $setCount
|
||||||
|
*/
|
||||||
|
public function setSetCount($setCount)
|
||||||
|
{
|
||||||
|
$this->setCount = $setCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSubtheme()
|
||||||
|
{
|
||||||
|
return $this->subtheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $subtheme
|
||||||
|
*/
|
||||||
|
public function setSubtheme($subtheme)
|
||||||
|
{
|
||||||
|
$this->subtheme = $subtheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getYearFrom()
|
||||||
|
{
|
||||||
|
return $this->yearFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $yearFrom
|
||||||
|
*/
|
||||||
|
public function setYearFrom($yearFrom)
|
||||||
|
{
|
||||||
|
$this->yearFrom = $yearFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getYearTo()
|
||||||
|
{
|
||||||
|
return $this->yearTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $yearTo
|
||||||
|
*/
|
||||||
|
public function setYearTo($yearTo)
|
||||||
|
{
|
||||||
|
$this->yearTo = $yearTo;
|
||||||
|
}
|
||||||
|
}
|
117
src/AppBundle/Client/Brickset/Entity/Theme.php
Normal file
117
src/AppBundle/Client/Brickset/Entity/Theme.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: hubnedav
|
||||||
|
* Date: 11/11/16
|
||||||
|
* Time: 7:13 PM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace AppBundle\Client\Brickset\Entity;
|
||||||
|
|
||||||
|
class Theme
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $theme;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $setCount;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $subthemeCount;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $yearFrom;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $yearTo;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getTheme()
|
||||||
|
{
|
||||||
|
return $this->theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $theme
|
||||||
|
*/
|
||||||
|
public function setTheme($theme)
|
||||||
|
{
|
||||||
|
$this->theme = $theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getSetCount()
|
||||||
|
{
|
||||||
|
return $this->setCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $setCount
|
||||||
|
*/
|
||||||
|
public function setSetCount($setCount)
|
||||||
|
{
|
||||||
|
$this->setCount = $setCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getSubthemeCount()
|
||||||
|
{
|
||||||
|
return $this->subthemeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $subthemeCount
|
||||||
|
*/
|
||||||
|
public function setSubthemeCount($subthemeCount)
|
||||||
|
{
|
||||||
|
$this->subthemeCount = $subthemeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getYearFrom()
|
||||||
|
{
|
||||||
|
return $this->yearFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $yearFrom
|
||||||
|
*/
|
||||||
|
public function setYearFrom($yearFrom)
|
||||||
|
{
|
||||||
|
$this->yearFrom = $yearFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getYearTo()
|
||||||
|
{
|
||||||
|
return $this->yearTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $yearTo
|
||||||
|
*/
|
||||||
|
public function setYearTo($yearTo)
|
||||||
|
{
|
||||||
|
$this->yearTo = $yearTo;
|
||||||
|
}
|
||||||
|
}
|
78
src/AppBundle/Client/Brickset/Entity/Year.php
Normal file
78
src/AppBundle/Client/Brickset/Entity/Year.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: hubnedav
|
||||||
|
* Date: 11/20/16
|
||||||
|
* Time: 11:17 PM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace AppBundle\Client\Brickset\Entity;
|
||||||
|
|
||||||
|
class Year
|
||||||
|
{
|
||||||
|
protected $theme;
|
||||||
|
protected $year;
|
||||||
|
protected $setCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Year constructor.
|
||||||
|
*
|
||||||
|
* @param $theme
|
||||||
|
* @param $year
|
||||||
|
* @param $setCount
|
||||||
|
*/
|
||||||
|
public function __construct($theme, $year, $setCount)
|
||||||
|
{
|
||||||
|
$this->theme = $theme;
|
||||||
|
$this->year = $year;
|
||||||
|
$this->setCount = $setCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getTheme()
|
||||||
|
{
|
||||||
|
return $this->theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $theme
|
||||||
|
*/
|
||||||
|
public function setTheme($theme)
|
||||||
|
{
|
||||||
|
$this->theme = $theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getYear()
|
||||||
|
{
|
||||||
|
return $this->year;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $year
|
||||||
|
*/
|
||||||
|
public function setYear($year)
|
||||||
|
{
|
||||||
|
$this->year = $year;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getSetCount()
|
||||||
|
{
|
||||||
|
return $this->setCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $setCount
|
||||||
|
*/
|
||||||
|
public function setSetCount($setCount)
|
||||||
|
{
|
||||||
|
$this->setCount = $setCount;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user