@@ -14,7 +14,6 @@ |
||
14 | 14 | use PhraseanetSDK\AbstractRepository; |
15 | 15 | use PhraseanetSDK\Exception\RuntimeException; |
16 | 16 | use Doctrine\Common\Collections\ArrayCollection; |
17 | -use PhraseanetSDK\EntityHydrator; |
|
18 | 17 | |
19 | 18 | class Quarantine extends AbstractRepository |
20 | 19 | { |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use PhraseanetSDK\AbstractRepository; |
15 | 15 | use PhraseanetSDK\Exception\RuntimeException; |
16 | 16 | use Doctrine\Common\Collections\ArrayCollection; |
17 | -use PhraseanetSDK\EntityHydrator; |
|
18 | 17 | |
19 | 18 | class RecordStatus extends AbstractRepository |
20 | 19 | { |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | { |
22 | 22 | // 't' param is used for cache busting |
23 | 23 | $parameters = [ |
24 | - 'includes' => [ 'elements' ], |
|
24 | + 'includes' => ['elements'], |
|
25 | 25 | 't' => time() |
26 | 26 | ]; |
27 | 27 | |
28 | - $response = $this->query('GET', 'v2/orders/' . $orderId, $parameters); |
|
28 | + $response = $this->query('GET', 'v2/orders/'.$orderId, $parameters); |
|
29 | 29 | |
30 | 30 | if ($response->isEmpty()) { |
31 | 31 | throw new RuntimeException('Response content is empty'); |
32 | 32 | } |
33 | 33 | |
34 | - if (! $response->hasProperty('data')) { |
|
34 | + if (!$response->hasProperty('data')) { |
|
35 | 35 | throw new RuntimeException('Missing \'data\' property in response'); |
36 | 36 | } |
37 | 37 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $parameters = [ |
45 | 45 | 'page' => max($pageIndex, 0), |
46 | 46 | 'per_page' => max($pageSize, 1), |
47 | - 'includes' => [ 'elements' ], |
|
47 | + 'includes' => ['elements'], |
|
48 | 48 | 't' => time() |
49 | 49 | ]; |
50 | 50 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | throw new RuntimeException('Response content is empty'); |
55 | 55 | } |
56 | 56 | |
57 | - if (! $response->hasProperty('data')) { |
|
57 | + if (!$response->hasProperty('data')) { |
|
58 | 58 | throw new RuntimeException('Missing \'data\' property in response'); |
59 | 59 | } |
60 | 60 | |
61 | - if (! $response->hasProperty('meta')) { |
|
61 | + if (!$response->hasProperty('meta')) { |
|
62 | 62 | throw new RuntimeException('Missing \'meta\' property in response'); |
63 | 63 | } |
64 | 64 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'records' => $recordsIds |
75 | 75 | ]; |
76 | 76 | |
77 | - $response = $this->query('POST', 'v2/orders/', [], [ 'data' => $parameters ], [ |
|
77 | + $response = $this->query('POST', 'v2/orders/', [], ['data' => $parameters], [ |
|
78 | 78 | 'Accept' => 'application/json', |
79 | 79 | 'Content-Type' => 'application/json' |
80 | 80 | ]); |
@@ -74,13 +74,13 @@ |
||
74 | 74 | * Search for records |
75 | 75 | * |
76 | 76 | * @param array $parameters Query parameters |
77 | - * @param int $pAPINumber API number (e.g. 3) |
|
77 | + * @param int $pAPINumber API number (e.g. 3) |
|
78 | 78 | * @return \PhraseanetSDK\Entity\Query object |
79 | 79 | * @throws RuntimeException |
80 | 80 | */ |
81 | 81 | public function search(array $parameters = array(), $pAPINumber = 1) |
82 | 82 | { |
83 | - $response = $this->query('POST', 'v'.$pAPINumber.'/search/', array(), array_merge( |
|
83 | + $response = $this->query('POST', 'v'.$pAPINumber.'/search/', array(), array_merge( |
|
84 | 84 | array('search_type' => 0), |
85 | 85 | $parameters |
86 | 86 | )); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * Search for stories |
69 | 69 | * |
70 | 70 | * @param array $parameters Query parameters |
71 | - * @param int $pAPINumber API number (e.g. 3) |
|
71 | + * @param int $pAPINumber API number (e.g. 3) |
|
72 | 72 | * @return \PhraseanetSDK\Entity\Query object |
73 | 73 | * @throws RuntimeException |
74 | 74 | */ |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $response = $this->query('POST', 'v'.$pAPINumber.'/search/', array(), array_merge( |
78 | 78 | $parameters, |
79 | - array('search_type' => SearchResult::TYPE_STORY) |
|
79 | + array('search_type' => SearchResult::TYPE_STORY) |
|
80 | 80 | )); |
81 | 81 | |
82 | 82 | if ($response->isEmpty()) { |
@@ -15,123 +15,123 @@ |
||
15 | 15 | |
16 | 16 | class MeCollection |
17 | 17 | { |
18 | - public static function fromList($values) |
|
19 | - { |
|
20 | - $collections = array(); |
|
21 | - |
|
22 | - foreach ($values as $value) { |
|
23 | - $collections[$value->base_id] = self::fromValue($value); |
|
24 | - } |
|
25 | - |
|
26 | - return $collections; |
|
27 | - } |
|
28 | - |
|
29 | - public static function fromValue(\stdClass $value) |
|
30 | - { |
|
31 | - return new self($value); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * @var \stdClass |
|
36 | - */ |
|
37 | - protected $source; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var ArrayCollection |
|
41 | - */ |
|
42 | - protected $labels; |
|
43 | - |
|
44 | - /** |
|
45 | - * @param \stdClass $source |
|
46 | - */ |
|
47 | - public function __construct(\stdClass $source) |
|
48 | - { |
|
49 | - $this->source = $source; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @return \stdClass |
|
54 | - */ |
|
55 | - public function getRawData() |
|
56 | - { |
|
57 | - return $this->source; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * The logo base64 |
|
62 | - * |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getLogo() |
|
66 | - { |
|
67 | - return $this->source->logo; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * The collection base id |
|
72 | - * |
|
73 | - * @return integer |
|
74 | - */ |
|
75 | - public function getBaseId() |
|
76 | - { |
|
77 | - return $this->source->base_id; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * The databox id |
|
82 | - * |
|
83 | - * @return integer |
|
84 | - */ |
|
85 | - public function getDataboxId() |
|
86 | - { |
|
87 | - return $this->source->databox_id; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * The collection id |
|
92 | - * |
|
93 | - * @return integer |
|
94 | - */ |
|
95 | - public function getCollectionId() |
|
96 | - { |
|
97 | - return $this->source->collection_id; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * The collection name |
|
102 | - * |
|
103 | - * @return string |
|
104 | - */ |
|
105 | - public function getName() |
|
106 | - { |
|
107 | - return $this->source->name; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * The collection rights |
|
112 | - * |
|
113 | - * @return array |
|
114 | - */ |
|
115 | - public function getRights() |
|
116 | - { |
|
117 | - return $this->source->rights; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * The collection rights |
|
122 | - * |
|
123 | - * @return array |
|
124 | - */ |
|
125 | - public function getStatuses() |
|
126 | - { |
|
127 | - return $this->source->statuses; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @return ArrayCollection|string[] |
|
132 | - */ |
|
133 | - public function getLabels() |
|
134 | - { |
|
135 | - return $this->labels ?: $this->labels = new ArrayCollection((array) $this->source->labels); |
|
136 | - } |
|
18 | + public static function fromList($values) |
|
19 | + { |
|
20 | + $collections = array(); |
|
21 | + |
|
22 | + foreach ($values as $value) { |
|
23 | + $collections[$value->base_id] = self::fromValue($value); |
|
24 | + } |
|
25 | + |
|
26 | + return $collections; |
|
27 | + } |
|
28 | + |
|
29 | + public static function fromValue(\stdClass $value) |
|
30 | + { |
|
31 | + return new self($value); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * @var \stdClass |
|
36 | + */ |
|
37 | + protected $source; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var ArrayCollection |
|
41 | + */ |
|
42 | + protected $labels; |
|
43 | + |
|
44 | + /** |
|
45 | + * @param \stdClass $source |
|
46 | + */ |
|
47 | + public function __construct(\stdClass $source) |
|
48 | + { |
|
49 | + $this->source = $source; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @return \stdClass |
|
54 | + */ |
|
55 | + public function getRawData() |
|
56 | + { |
|
57 | + return $this->source; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * The logo base64 |
|
62 | + * |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getLogo() |
|
66 | + { |
|
67 | + return $this->source->logo; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * The collection base id |
|
72 | + * |
|
73 | + * @return integer |
|
74 | + */ |
|
75 | + public function getBaseId() |
|
76 | + { |
|
77 | + return $this->source->base_id; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * The databox id |
|
82 | + * |
|
83 | + * @return integer |
|
84 | + */ |
|
85 | + public function getDataboxId() |
|
86 | + { |
|
87 | + return $this->source->databox_id; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * The collection id |
|
92 | + * |
|
93 | + * @return integer |
|
94 | + */ |
|
95 | + public function getCollectionId() |
|
96 | + { |
|
97 | + return $this->source->collection_id; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * The collection name |
|
102 | + * |
|
103 | + * @return string |
|
104 | + */ |
|
105 | + public function getName() |
|
106 | + { |
|
107 | + return $this->source->name; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * The collection rights |
|
112 | + * |
|
113 | + * @return array |
|
114 | + */ |
|
115 | + public function getRights() |
|
116 | + { |
|
117 | + return $this->source->rights; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * The collection rights |
|
122 | + * |
|
123 | + * @return array |
|
124 | + */ |
|
125 | + public function getStatuses() |
|
126 | + { |
|
127 | + return $this->source->statuses; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @return ArrayCollection|string[] |
|
132 | + */ |
|
133 | + public function getLabels() |
|
134 | + { |
|
135 | + return $this->labels ?: $this->labels = new ArrayCollection((array) $this->source->labels); |
|
136 | + } |
|
137 | 137 | } |
138 | 138 | \ No newline at end of file |
@@ -18,21 +18,21 @@ |
||
18 | 18 | |
19 | 19 | class MeCollection extends AbstractRepository |
20 | 20 | { |
21 | - /** |
|
22 | - * Return all collections available |
|
23 | - * |
|
24 | - * @return MeCollection[] |
|
25 | - * @throws NotFoundException |
|
26 | - * @throws UnauthorizedException |
|
27 | - */ |
|
28 | - public function getCollectionsList() |
|
29 | - { |
|
30 | - $response = $this->query('GET', 'v1/me/collections/'); |
|
21 | + /** |
|
22 | + * Return all collections available |
|
23 | + * |
|
24 | + * @return MeCollection[] |
|
25 | + * @throws NotFoundException |
|
26 | + * @throws UnauthorizedException |
|
27 | + */ |
|
28 | + public function getCollectionsList() |
|
29 | + { |
|
30 | + $response = $this->query('GET', 'v1/me/collections/'); |
|
31 | 31 | |
32 | - if ($response->hasProperty(('collections')) !== true) { |
|
33 | - throw new RuntimeException('Missing "collections" property in response content'); |
|
34 | - } |
|
32 | + if ($response->hasProperty(('collections')) !== true) { |
|
33 | + throw new RuntimeException('Missing "collections" property in response content'); |
|
34 | + } |
|
35 | 35 | |
36 | - return \PhraseanetSDK\Entity\MeCollection::fromList($response->getProperty('collections')); |
|
37 | - } |
|
36 | + return \PhraseanetSDK\Entity\MeCollection::fromList($response->getProperty('collections')); |
|
37 | + } |
|
38 | 38 | } |