@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function requestPasswordReset($emailAddress) |
78 | 78 | { |
79 | - $response = $this->query('POST', 'v1/accounts/reset-password/' . $emailAddress . '/'); |
|
79 | + $response = $this->query('POST', 'v1/accounts/reset-password/'.$emailAddress.'/'); |
|
80 | 80 | |
81 | 81 | if (!$response->hasProperty('reset_token')) { |
82 | 82 | throw new RuntimeException('Missing "token" property in response content'); |
83 | 83 | } |
84 | 84 | |
85 | - return (string)$response->getProperty('reset_token'); |
|
85 | + return (string) $response->getProperty('reset_token'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function resetPassword($token, $password) |
96 | 96 | { |
97 | - $response = $this->query('POST', 'v1/accounts/update-password/' . $token . '/', array(), array( |
|
97 | + $response = $this->query('POST', 'v1/accounts/update-password/'.$token.'/', array(), array( |
|
98 | 98 | 'password' => $password |
99 | 99 | )); |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | throw new RuntimeException('Missing "success" property in response content'); |
103 | 103 | } |
104 | 104 | |
105 | - return (bool)$response->getProperty('success'); |
|
105 | + return (bool) $response->getProperty('success'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function updatePassword($currentPassword, $newPassword) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | throw new RuntimeException('Missing "success" property in response content'); |
120 | 120 | } |
121 | 121 | |
122 | - return (bool)$response->getProperty('success'); |
|
122 | + return (bool) $response->getProperty('success'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | throw new \RuntimeException('Missing "token" property in response content'); |
166 | 166 | } |
167 | 167 | |
168 | - return (string)$response->getProperty('token'); |
|
168 | + return (string) $response->getProperty('token'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | public function updateUser(\PhraseanetSDK\Entity\User $user) |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | throw new RuntimeException('Missing "success" property in response content'); |
195 | 195 | } |
196 | 196 | |
197 | - return (bool)$response->getProperty('success'); |
|
197 | + return (bool) $response->getProperty('success'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | public function deleteAccount() |
@@ -210,12 +210,12 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function unlockAccount($token) |
212 | 212 | { |
213 | - $response = $this->query('POST', 'v1/accounts/unlock/' . $token . '/', array(), array()); |
|
213 | + $response = $this->query('POST', 'v1/accounts/unlock/'.$token.'/', array(), array()); |
|
214 | 214 | |
215 | 215 | if (!$response->hasProperty('success')) { |
216 | 216 | throw new \RuntimeException('Missing "success" property in response content'); |
217 | 217 | } |
218 | 218 | |
219 | - return (bool)$response->getProperty('success'); |
|
219 | + return (bool) $response->getProperty('success'); |
|
220 | 220 | } |
221 | 221 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | try { |
97 | 97 | $responseContent = $this->adapter->call( |
98 | 98 | 'POST', |
99 | - $this->getUrl() . static::TOKEN_ENDPOINT, |
|
99 | + $this->getUrl().static::TOKEN_ENDPOINT, |
|
100 | 100 | array(), |
101 | 101 | $postFields |
102 | 102 | ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $app['recorder.config'] = $app['sdk.config'] = $app['cache.config'] = array(); |
42 | 42 | |
43 | - $app['phraseanet-sdk.recorder.config'] = $app->share(function () use ($app) { |
|
43 | + $app['phraseanet-sdk.recorder.config'] = $app->share(function() use ($app) { |
|
44 | 44 | return array_replace_recursive( |
45 | 45 | array( |
46 | 46 | 'type' => 'file', |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ); |
54 | 54 | }); |
55 | 55 | |
56 | - $app['phraseanet-sdk.config'] = $app->share(function () use ($app) { |
|
56 | + $app['phraseanet-sdk.config'] = $app->share(function() use ($app) { |
|
57 | 57 | return array_replace( |
58 | 58 | array( |
59 | 59 | 'client-id' => null, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ); |
65 | 65 | }); |
66 | 66 | |
67 | - $app['phraseanet-sdk.cache.config'] = $app->share(function () use ($app) { |
|
67 | + $app['phraseanet-sdk.cache.config'] = $app->share(function() use ($app) { |
|
68 | 68 | return array_replace( |
69 | 69 | array( |
70 | 70 | 'type' => 'array', |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | ); |
75 | 75 | }); |
76 | 76 | |
77 | - $app['phraseanet-sdk.cache.factory'] = $app->share(function () use ($app) { |
|
77 | + $app['phraseanet-sdk.cache.factory'] = $app->share(function() use ($app) { |
|
78 | 78 | return new BackendCacheFactory(); |
79 | 79 | }); |
80 | 80 | |
81 | - $app['phraseanet-sdk.cache.adapter'] = $app->share(function () use ($app) { |
|
81 | + $app['phraseanet-sdk.cache.adapter'] = $app->share(function() use ($app) { |
|
82 | 82 | $config = $app['phraseanet-sdk.cache.config']; |
83 | 83 | |
84 | 84 | $backend = $app['phraseanet-sdk.cache.factory']->create( |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return new DoctrineCacheAdapter($backend); |
91 | 91 | }); |
92 | 92 | |
93 | - $app['phraseanet-sdk.cache.revalidation'] = $app->share(function (SilexApplication $app) { |
|
93 | + $app['phraseanet-sdk.cache.revalidation'] = $app->share(function(SilexApplication $app) { |
|
94 | 94 | $config = $app['phraseanet-sdk.cache.config']; |
95 | 95 | if (isset($config['revalidation']) && is_string($config['revalidation'])) { |
96 | 96 | $factory = new RevalidationFactory(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return; |
104 | 104 | }); |
105 | 105 | |
106 | - $app['phraseanet-sdk.cache.can_cache'] = $app->share(function (SilexApplication $app) { |
|
106 | + $app['phraseanet-sdk.cache.can_cache'] = $app->share(function(SilexApplication $app) { |
|
107 | 107 | $config = $app['phraseanet-sdk.cache.config']; |
108 | 108 | if (isset($config['can_cache'])) { |
109 | 109 | return $config['can_cache']; |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | return new CanCacheStrategy(); |
113 | 113 | }); |
114 | 114 | |
115 | - $app['phraseanet-sdk.cache.key_provider'] = $app->share(function (SilexApplication $app) { |
|
115 | + $app['phraseanet-sdk.cache.key_provider'] = $app->share(function(SilexApplication $app) { |
|
116 | 116 | $config = $app['phraseanet-sdk.cache.config']; |
117 | 117 | |
118 | 118 | return isset($config['key_provider']) ? $config['key_provider'] : null; |
119 | 119 | }); |
120 | 120 | |
121 | - $app['phraseanet-sdk.cache.plugin'] = $app->share(function () use ($app) { |
|
121 | + $app['phraseanet-sdk.cache.plugin'] = $app->share(function() use ($app) { |
|
122 | 122 | $cacheConfig = array_merge( |
123 | 123 | $app['phraseanet-sdk.cache.config'], |
124 | 124 | array( |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return new CachePlugin($cacheConfig); |
134 | 134 | }); |
135 | 135 | |
136 | - $app['phraseanet-sdk.guzzle.plugins'] = $app->share(function ($app) { |
|
136 | + $app['phraseanet-sdk.guzzle.plugins'] = $app->share(function($app) { |
|
137 | 137 | $plugins = array( |
138 | 138 | $app['phraseanet-sdk.cache.plugin'], |
139 | 139 | ); |
@@ -145,26 +145,26 @@ discard block |
||
145 | 145 | return $plugins; |
146 | 146 | }); |
147 | 147 | |
148 | - $app['phraseanet-sdk.guzzle-adapter'] = $app->share(function (SilexApplication $app) { |
|
148 | + $app['phraseanet-sdk.guzzle-adapter'] = $app->share(function(SilexApplication $app) { |
|
149 | 149 | return GuzzleAdapter::create( |
150 | 150 | $app['phraseanet-sdk.config']['url'], |
151 | 151 | $app['phraseanet-sdk.guzzle.plugins'] |
152 | 152 | ); |
153 | 153 | }); |
154 | 154 | |
155 | - $app['phraseanet-sdk.guzzle-connected-adapter'] = $app->protect(function ($token) use ($app) { |
|
155 | + $app['phraseanet-sdk.guzzle-connected-adapter'] = $app->protect(function($token) use ($app) { |
|
156 | 156 | return new ConnectedGuzzleAdapter($token, $app['phraseanet-sdk.guzzle-adapter']); |
157 | 157 | }); |
158 | 158 | |
159 | - $app['phraseanet-sdk.guzzle-api-adapter'] = $app->protect(function ($token) use ($app) { |
|
159 | + $app['phraseanet-sdk.guzzle-api-adapter'] = $app->protect(function($token) use ($app) { |
|
160 | 160 | return new APIGuzzleAdapter($app['phraseanet-sdk.guzzle-connected-adapter']($token)); |
161 | 161 | }); |
162 | 162 | |
163 | - $app['phraseanet-sdk'] = $app->share(function (SilexApplication $app) { |
|
163 | + $app['phraseanet-sdk'] = $app->share(function(SilexApplication $app) { |
|
164 | 164 | return Application::create($app['phraseanet-sdk.config'], $app['phraseanet-sdk.guzzle-adapter']); |
165 | 165 | }); |
166 | 166 | |
167 | - $app['phraseanet-sdk.guzzle.history-plugin'] = $app->share(function (SilexApplication $app) { |
|
167 | + $app['phraseanet-sdk.guzzle.history-plugin'] = $app->share(function(SilexApplication $app) { |
|
168 | 168 | $plugin = new HistoryPlugin(); |
169 | 169 | $plugin->setLimit($app['phraseanet-sdk.recorder.config']['limit']); |
170 | 170 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | if (isset($app['profiler'])) { |
177 | 177 | $app['data_collectors'] = array_merge($app['data_collectors'], array( |
178 | - 'phraseanet-sdk' => $app->share(function ($app) { |
|
178 | + 'phraseanet-sdk' => $app->share(function($app) { |
|
179 | 179 | return new PhraseanetSDKDataCollector($app['phraseanet-sdk.guzzle.history-plugin']); |
180 | 180 | }), |
181 | 181 | )); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $app['twig.loader.filesystem'] = $app->share($app->extend( |
189 | 189 | 'twig.loader.filesystem', |
190 | - function ($loader, $app) { |
|
190 | + function($loader, $app) { |
|
191 | 191 | $loader->addPath($app['phraseanet-sdk.profiler.templates_path'], 'PhraseanetSDK'); |
192 | 192 | |
193 | 193 | return $loader; |
@@ -195,21 +195,21 @@ discard block |
||
195 | 195 | )); |
196 | 196 | } |
197 | 197 | |
198 | - $app['phraseanet-sdk.recorder.storage-factory'] = $app->share(function (SilexApplication $app) { |
|
198 | + $app['phraseanet-sdk.recorder.storage-factory'] = $app->share(function(SilexApplication $app) { |
|
199 | 199 | return new StorageFactory($app['phraseanet-sdk.cache.factory']); |
200 | 200 | }); |
201 | 201 | |
202 | - $app['phraseanet-sdk.recorder.request-extractor'] = $app->share(function (SilexApplication $app) { |
|
202 | + $app['phraseanet-sdk.recorder.request-extractor'] = $app->share(function(SilexApplication $app) { |
|
203 | 203 | return new RequestExtractor(); |
204 | 204 | }); |
205 | 205 | |
206 | - $app['phraseanet-sdk.recorder.storage'] = $app->share(function (SilexApplication $app) { |
|
206 | + $app['phraseanet-sdk.recorder.storage'] = $app->share(function(SilexApplication $app) { |
|
207 | 207 | $config = $app['phraseanet-sdk.recorder.config']; |
208 | 208 | |
209 | 209 | return $app['phraseanet-sdk.recorder.storage-factory']->create($config['type'], $config['options']); |
210 | 210 | }); |
211 | 211 | |
212 | - $app['phraseanet-sdk.recorder.filters'] = $app->share(function (SilexApplication $app) { |
|
212 | + $app['phraseanet-sdk.recorder.filters'] = $app->share(function(SilexApplication $app) { |
|
213 | 213 | return array( |
214 | 214 | new MonitorFilter(), |
215 | 215 | new DuplicateFilter(), |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ); |
218 | 218 | }); |
219 | 219 | |
220 | - $app['phraseanet-sdk.recorder'] = $app->share(function (SilexApplication $app) { |
|
220 | + $app['phraseanet-sdk.recorder'] = $app->share(function(SilexApplication $app) { |
|
221 | 221 | $recorder = new Recorder( |
222 | 222 | $app['phraseanet-sdk.guzzle.history-plugin'], |
223 | 223 | $app['phraseanet-sdk.recorder.storage'], |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | return $recorder; |
232 | 232 | }); |
233 | 233 | |
234 | - $app['phraseanet-sdk.player.factory'] = $app->protect(function ($token) use ($app) { |
|
234 | + $app['phraseanet-sdk.player.factory'] = $app->protect(function($token) use ($app) { |
|
235 | 235 | return new Player( |
236 | 236 | $app['phraseanet-sdk.guzzle-api-adapter']($token), |
237 | 237 | $app['phraseanet-sdk.recorder.storage'] |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | public function boot(SilexApplication $app) |
243 | 243 | { |
244 | 244 | if ($app['recorder.enabled']) { |
245 | - $app->finish(function () use ($app) { |
|
245 | + $app->finish(function() use ($app) { |
|
246 | 246 | $app['phraseanet-sdk.recorder']->save(); |
247 | 247 | }); |
248 | 248 | } |
@@ -112,8 +112,8 @@ |
||
112 | 112 | { |
113 | 113 | $entity = new static::$mappings[$name]['entity'](); |
114 | 114 | |
115 | - array_walk($data, function ($value, $property) use ($entity) { |
|
116 | - $method = 'set'.implode('', array_map(function ($chunk) { |
|
115 | + array_walk($data, function($value, $property) use ($entity) { |
|
116 | + $method = 'set'.implode('', array_map(function($chunk) { |
|
117 | 117 | return ucfirst($chunk); |
118 | 118 | }, preg_split('/[-_]/', $property))); |
119 | 119 |
@@ -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 | ]); |
@@ -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 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setExtended($extended) |
78 | 78 | { |
79 | - $this->extended = (boolean)$extended; |
|
79 | + $this->extended = (boolean) $extended; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setSslVerification($sslVerification) |
96 | 96 | { |
97 | - $this->sslVerification = (boolean)$sslVerification; |
|
97 | + $this->sslVerification = (boolean) $sslVerification; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | 'Accept' => $this->extended ? 'application/vnd.phraseanet.record-extended+json' : 'application/json' |
126 | 126 | ); |
127 | 127 | |
128 | - if(!$this->sslVerification) { |
|
129 | - $this->guzzle->setSslVerification(false,false,0); |
|
128 | + if (!$this->sslVerification) { |
|
129 | + $this->guzzle->setSslVerification(false, false, 0); |
|
130 | 130 | } |
131 | 131 | $request = $this->guzzle->createRequest($method, $path, array_merge($acceptHeader, $headers)); |
132 | 132 | $this->addRequestParameters($request, $query, $postFields, $files); |
@@ -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.'/searchraw/', array(), array_merge( |
|
83 | + $response = $this->query('POST', 'v'.$pAPINumber.'/searchraw/', array(), array_merge( |
|
84 | 84 | array('search_type' => 0), |
85 | 85 | $parameters |
86 | 86 | )); |
@@ -99,8 +99,8 @@ |
||
99 | 99 | $results->results->stories = []; |
100 | 100 | $results->count = $res->count; |
101 | 101 | $results->total = $res->total; |
102 | - $results->limit = isset($res->limit) ? $res->limit : 10; // TODO: just $res->limit after a phraseanet PR in searchraw |
|
103 | - $results->offset = isset($res->offset) ? $res->offset : 0; // TODO: just $res->offset after a phraseanet PR |
|
102 | + $results->limit = isset($res->limit) ? $res->limit : 10; // TODO: just $res->limit after a phraseanet PR in searchraw |
|
103 | + $results->offset = isset($res->offset) ? $res->offset : 0; // TODO: just $res->offset after a phraseanet PR |
|
104 | 104 | } |
105 | 105 | |
106 | 106 |