@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function loadInternal(array $mergedConfig, ContainerBuilder $container) |
45 | 45 | { |
46 | - $locator = new FileLocator(__DIR__ . '/../Resources/config'); |
|
46 | + $locator = new FileLocator(__DIR__.'/../Resources/config'); |
|
47 | 47 | $loader = new YamlFileLoader($container, $locator); |
48 | 48 | |
49 | 49 | $loader->load('services.yml'); |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | $factory |
60 | 60 | ]); |
61 | 61 | |
62 | - $container->setDefinition('phraseanet.factories.' . $name, $factory); |
|
62 | + $container->setDefinition('phraseanet.factories.'.$name, $factory); |
|
63 | 63 | |
64 | 64 | $entityManager = new Definition(EntityManager::class, [$name]); |
65 | 65 | $entityManager->setFactory([ |
66 | - new Reference('phraseanet.factories.' . $name), |
|
66 | + new Reference('phraseanet.factories.'.$name), |
|
67 | 67 | 'getEntityManager' |
68 | 68 | ]); |
69 | 69 | |
70 | - $container->setDefinition('phraseanet.em.' . $name, $entityManager); |
|
70 | + $container->setDefinition('phraseanet.em.'.$name, $entityManager); |
|
71 | 71 | |
72 | 72 | if ($name == $mergedConfig['default_instance']) { |
73 | 73 | $registry->addMethodCall('setDefaultEntityManager', [ |
74 | 74 | $mergedConfig['default_instance'] |
75 | 75 | ]); |
76 | 76 | |
77 | - $container->setAlias('phraseanet.em', 'phraseanet.em.' . $name); |
|
78 | - $container->setAlias('phraseanet.helpers', 'phraseanet.helpers.' . $name); |
|
77 | + $container->setAlias('phraseanet.em', 'phraseanet.em.'.$name); |
|
78 | + $container->setAlias('phraseanet.helpers', 'phraseanet.helpers.'.$name); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $this->buildEntityRepositories($name, $configuration, $container); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $configuration['connection']['token'] |
107 | 107 | ]); |
108 | 108 | |
109 | - $tokenProvider->addMethodCall('setDefaultProvider', [ $applicationTokenProvider ]); |
|
109 | + $tokenProvider->addMethodCall('setDefaultProvider', [$applicationTokenProvider]); |
|
110 | 110 | |
111 | 111 | $container->setDefinition('phraseanet.token_provider', $tokenProvider); |
112 | 112 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | |
118 | 118 | $factory->addMethodCall( |
119 | 119 | 'setAnnotationCacheDirectory', |
120 | - array($container->getParameter('kernel.cache_dir') . '/phraseanet/annotations') |
|
120 | + array($container->getParameter('kernel.cache_dir').'/phraseanet/annotations') |
|
121 | 121 | ); |
122 | 122 | |
123 | 123 | $factory->addMethodCall( |
124 | 124 | 'setProxyCacheDirectory', |
125 | - array($container->getParameter('kernel.cache_dir') . '/phraseanet/proxies') |
|
125 | + array($container->getParameter('kernel.cache_dir').'/phraseanet/proxies') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $factory; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ); |
143 | 143 | |
144 | 144 | $definition->setFactory([ |
145 | - new Reference('phraseanet.factories.' . $instanceName), |
|
145 | + new Reference('phraseanet.factories.'.$instanceName), |
|
146 | 146 | 'getRepository' |
147 | 147 | ]); |
148 | 148 | |
@@ -162,33 +162,33 @@ discard block |
||
162 | 162 | ContainerBuilder $container, |
163 | 163 | Definition $registry |
164 | 164 | ) { |
165 | - $baseKey = 'phraseanet.helpers.' . $instanceName; |
|
165 | + $baseKey = 'phraseanet.helpers.'.$instanceName; |
|
166 | 166 | |
167 | - $container->setDefinition($baseKey . '.feeds', new Definition(FeedHelper::class)); |
|
168 | - $container->setDefinition($baseKey . '.meta', new Definition(MetadataHelper::class, [ |
|
167 | + $container->setDefinition($baseKey.'.feeds', new Definition(FeedHelper::class)); |
|
168 | + $container->setDefinition($baseKey.'.meta', new Definition(MetadataHelper::class, [ |
|
169 | 169 | new Definition(FieldMap::class, [$mergedConfig['mappings']]), |
170 | 170 | 'fr', |
171 | 171 | 'fr' |
172 | 172 | ])); |
173 | 173 | |
174 | - $container->setDefinition($baseKey . '.definitions', new Definition(DefinitionMap::class, [ |
|
174 | + $container->setDefinition($baseKey.'.definitions', new Definition(DefinitionMap::class, [ |
|
175 | 175 | $mergedConfig['subdefinitions'] |
176 | 176 | ])); |
177 | 177 | |
178 | - $container->setDefinition($baseKey . '.thumbs', new Definition(ThumbHelper::class, [ |
|
179 | - new Definition(DefinitionMap::class, [ $mergedConfig['thumbnails'] ]) |
|
178 | + $container->setDefinition($baseKey.'.thumbs', new Definition(ThumbHelper::class, [ |
|
179 | + new Definition(DefinitionMap::class, [$mergedConfig['thumbnails']]) |
|
180 | 180 | ])); |
181 | 181 | |
182 | 182 | $container->setDefinition($baseKey, new Definition(InstanceHelper::class, [ |
183 | - new Reference($baseKey . '.definitions'), |
|
184 | - new Reference($baseKey . '.feeds'), |
|
185 | - new Reference($baseKey . '.meta'), |
|
186 | - new Reference($baseKey . '.thumbs') |
|
183 | + new Reference($baseKey.'.definitions'), |
|
184 | + new Reference($baseKey.'.feeds'), |
|
185 | + new Reference($baseKey.'.meta'), |
|
186 | + new Reference($baseKey.'.thumbs') |
|
187 | 187 | ])); |
188 | 188 | |
189 | 189 | $container |
190 | 190 | ->getDefinition($baseKey) |
191 | - ->addMethodCall('setTokenProvider', [ new Reference('phraseanet.token_provider') ]); |
|
191 | + ->addMethodCall('setTokenProvider', [new Reference('phraseanet.token_provider')]); |
|
192 | 192 | |
193 | 193 | $registry->addMethodCall('addHelper', [ |
194 | 194 | $instanceName, |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - return ! class_exists("PhraseanetSDK\\Repository\\" . ucfirst($value)); |
|
40 | + return !class_exists("PhraseanetSDK\\Repository\\".ucfirst($value)); |
|
41 | 41 | }) |
42 | 42 | ->thenInvalid('Repository type does not exist.'); |
43 | 43 |
@@ -97,7 +97,7 @@ |
||
97 | 97 | return true; |
98 | 98 | }; |
99 | 99 | |
100 | - $class = 'PhraseanetSDK\Repository\\' . ucfirst($name); |
|
100 | + $class = 'PhraseanetSDK\Repository\\'.ucfirst($name); |
|
101 | 101 | |
102 | 102 | if ($name == 'search') { |
103 | 103 | $class = SearchRepository::class; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function getFunctions() |
23 | 23 | { |
24 | 24 | return array( |
25 | - new \Twig_SimpleFunction('record_hash', [ $this, 'getRecordHash' ]), |
|
25 | + new \Twig_SimpleFunction('record_hash', [$this, 'getRecordHash']), |
|
26 | 26 | new \Twig_SimpleFunction('record_caption', [$this, 'getRecordCaption']), |
27 | 27 | new \Twig_SimpleFunction('story_caption', [$this, 'getStoryCaption']), |
28 | 28 | new \Twig_SimpleFunction('fetch_thumbnail', [$this, 'fetchThumbnail']), |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $subdef = $this->fetchThumbnail($record, $thumbType, $instanceName); |
44 | 44 | |
45 | - if (! $subdef) { |
|
45 | + if (!$subdef) { |
|
46 | 46 | return ''; |
47 | 47 | } |
48 | 48 |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | self::RECORD_TYPE_VIDEO |
255 | 255 | ); |
256 | 256 | |
257 | - if (! in_array($recordType, $allowedTypes, true)) { |
|
257 | + if (!in_array($recordType, $allowedTypes, true)) { |
|
258 | 258 | throw new \InvalidArgumentException( |
259 | 259 | sprintf('Record type must be one of the RECORD_TYPE_* values, %s given.', $recordType) |
260 | 260 | ); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | self::SEARCH_STORIES_LIGHT |
281 | 281 | ); |
282 | 282 | |
283 | - if (! in_array($searchType, $allowedTypes, true)) { |
|
283 | + if (!in_array($searchType, $allowedTypes, true)) { |
|
284 | 284 | throw new \InvalidArgumentException('Search type must be one of the SEARCH_* values'); |
285 | 285 | } |
286 | 286 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | private function validateFieldName($fieldName, $errorMessage) |
378 | 378 | { |
379 | - if (! is_string($fieldName) || trim($fieldName) === '') { |
|
379 | + if (!is_string($fieldName) || trim($fieldName) === '') { |
|
380 | 380 | throw new \InvalidArgumentException($errorMessage); |
381 | 381 | } |
382 | 382 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | private function buildQueryTerm() |
441 | 441 | { |
442 | - if (! $this->conditionBuilder) { |
|
442 | + if (!$this->conditionBuilder) { |
|
443 | 443 | return $this->query; |
444 | 444 | } |
445 | 445 |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private $sortType = null; |
102 | 102 | |
103 | - /** |
|
104 | - * @var bool Type of truncature |
|
105 | - */ |
|
103 | + /** |
|
104 | + * @var bool Type of truncature |
|
105 | + */ |
|
106 | 106 | private $truncature = true; |
107 | 107 | |
108 | 108 | /** |
@@ -364,17 +364,17 @@ discard block |
||
364 | 364 | return $this; |
365 | 365 | } |
366 | 366 | |
367 | - /** |
|
368 | - * Set truncature search type |
|
369 | - * |
|
370 | - * @param bool $truncature |
|
371 | - * @return $this |
|
372 | - */ |
|
373 | - public function setTruncature(bool $truncature) |
|
374 | - { |
|
375 | - $this->truncature = $truncature; |
|
376 | - return $this; |
|
377 | - } |
|
367 | + /** |
|
368 | + * Set truncature search type |
|
369 | + * |
|
370 | + * @param bool $truncature |
|
371 | + * @return $this |
|
372 | + */ |
|
373 | + public function setTruncature(bool $truncature) |
|
374 | + { |
|
375 | + $this->truncature = $truncature; |
|
376 | + return $this; |
|
377 | + } |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Adds a field to the list of requested fields. |
@@ -525,16 +525,16 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | |
528 | - /** |
|
529 | - * @param $query |
|
530 | - * @return mixed |
|
531 | - */ |
|
528 | + /** |
|
529 | + * @param $query |
|
530 | + * @return mixed |
|
531 | + */ |
|
532 | 532 | private function appendTruncature($query) |
533 | - { |
|
534 | - $query['truncation'] = $this->truncature; |
|
533 | + { |
|
534 | + $query['truncation'] = $this->truncature; |
|
535 | 535 | |
536 | - return $query; |
|
537 | - } |
|
536 | + return $query; |
|
537 | + } |
|
538 | 538 | |
539 | 539 | /** |
540 | 540 | * @param $query |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | return $this->query; |
31 | 31 | } |
32 | 32 | |
33 | - /** |
|
34 | - * @param array $query |
|
35 | - * @return RecordQuery |
|
36 | - */ |
|
37 | - public function setRawQuery($query) |
|
38 | - { |
|
39 | - $this->query = $query; |
|
40 | - return $this; |
|
41 | - } |
|
33 | + /** |
|
34 | + * @param array $query |
|
35 | + * @return RecordQuery |
|
36 | + */ |
|
37 | + public function setRawQuery($query) |
|
38 | + { |
|
39 | + $this->query = $query; |
|
40 | + return $this; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @return int |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param $repository |
53 | - * @param int $pAPINumber API number (e.g. 3) |
|
53 | + * @param int $pAPINumber API number (e.g. 3) |
|
54 | 54 | * @return \Doctrine\Common\Collections\ArrayCollection |
55 | 55 | */ |
56 | 56 | public function execute($repository, $pAPINumber = 1) |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function execute($repository, $pAPINumber = 1) |
57 | 57 | { |
58 | - if (! $repository instanceof Record && ! $repository instanceof Story) { |
|
58 | + if (!$repository instanceof Record && !$repository instanceof Story) { |
|
59 | 59 | throw new \InvalidArgumentException('Invalid repository type (story or record required).'); |
60 | 60 | } |
61 | 61 |