@@ -24,7 +24,7 @@ |
||
24 | 24 | $config['directory'] ?? $container->getParameter('kernel.project_dir') . '/src/' |
25 | 25 | ); |
26 | 26 | |
27 | - $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
27 | + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
28 | 28 | $loader->load('reader.xml'); |
29 | 29 | } |
30 | 30 | } |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | * reader. |
118 | 118 | */ |
119 | 119 | public function __construct( |
120 | - ActionButtonReader $actionButtonReader, |
|
121 | - DatagridReader $datagridReader, |
|
122 | - DatagridValuesReader $datagridValuesReader, |
|
123 | - DashboardActionReader $dashboardActionReader, |
|
124 | - ExportReader $exportReader, |
|
125 | - FormReader $formReader, |
|
126 | - ListReader $listReader, |
|
127 | - RouteReader $routeReader, |
|
128 | - ShowReader $showReader |
|
120 | + ActionButtonReader $actionButtonReader, |
|
121 | + DatagridReader $datagridReader, |
|
122 | + DatagridValuesReader $datagridValuesReader, |
|
123 | + DashboardActionReader $dashboardActionReader, |
|
124 | + ExportReader $exportReader, |
|
125 | + FormReader $formReader, |
|
126 | + ListReader $listReader, |
|
127 | + RouteReader $routeReader, |
|
128 | + ShowReader $showReader |
|
129 | 129 | ) { |
130 | 130 | parent::__construct(); |
131 | 131 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function getExportFormats(): array |
150 | 150 | { |
151 | 151 | return $this->exportReader->getFormats( |
152 | - $this->getReflectionClass() |
|
152 | + $this->getReflectionClass() |
|
153 | 153 | ) ?: parent::getExportFormats(); |
154 | 154 | } |
155 | 155 | |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | * @throws ReflectionException |
165 | 165 | */ |
166 | 166 | protected function configureActionButtons( |
167 | - array $buttonList, |
|
168 | - string $action, |
|
167 | + array $buttonList, |
|
168 | + string $action, |
|
169 | 169 | ?object $object = null |
170 | 170 | ): array { |
171 | 171 | return $this->actionButtonReader |
172 | - ->getActions( |
|
172 | + ->getActions( |
|
173 | 173 | $this->getReflectionClass(), |
174 | 174 | parent::configureActionButtons( |
175 | - $buttonList, |
|
176 | - $action, |
|
177 | - $object |
|
175 | + $buttonList, |
|
176 | + $action, |
|
177 | + $object |
|
178 | 178 | ) |
179 | - ); |
|
179 | + ); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | protected function configureDashboardActions(array $actions): array |
191 | 191 | { |
192 | 192 | return $this->dashboardActionReader |
193 | - ->getActions( |
|
193 | + ->getActions( |
|
194 | 194 | $this->getReflectionClass(), |
195 | 195 | parent::configureDashboardActions($actions) |
196 | - ); |
|
196 | + ); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | protected function configureDatagridFilters(DatagridMapper $filter): void |
208 | 208 | { |
209 | 209 | $this->datagridReader->configureFields( |
210 | - $this->getReflectionClass(), |
|
211 | - $filter |
|
210 | + $this->getReflectionClass(), |
|
211 | + $filter |
|
212 | 212 | ); |
213 | 213 | } |
214 | 214 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | protected function configureExportFields(): array |
222 | 222 | { |
223 | 223 | return $this->exportReader->getFields( |
224 | - $this->getReflectionClass() |
|
224 | + $this->getReflectionClass() |
|
225 | 225 | ) ?: parent::getExportFields(); |
226 | 226 | } |
227 | 227 | |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | { |
238 | 238 | if ($this->getRequest()->get($this->getIdParameter())) { |
239 | 239 | $this->formReader->configureEditFields( |
240 | - $this->getReflectionClass(), |
|
241 | - $form |
|
240 | + $this->getReflectionClass(), |
|
241 | + $form |
|
242 | 242 | ); |
243 | 243 | return; |
244 | 244 | } |
245 | 245 | |
246 | 246 | $this->formReader->configureCreateFields( |
247 | - $this->getReflectionClass(), |
|
248 | - $form |
|
247 | + $this->getReflectionClass(), |
|
248 | + $form |
|
249 | 249 | ); |
250 | 250 | } |
251 | 251 | |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | protected function configureListFields(ListMapper $list): void |
261 | 261 | { |
262 | 262 | $this->listReader |
263 | - ->configureFields( |
|
263 | + ->configureFields( |
|
264 | 264 | $this->getReflectionClass(), |
265 | 265 | $list |
266 | - ); |
|
266 | + ); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -277,16 +277,16 @@ discard block |
||
277 | 277 | protected function configureRoutes(RouteCollectionInterface $collection |
278 | 278 | ): void { |
279 | 279 | [$addRoutes, $removeRoutes] = $this->routeReader->getRoutes( |
280 | - $this->getReflectionClass() |
|
280 | + $this->getReflectionClass() |
|
281 | 281 | ); |
282 | 282 | |
283 | 283 | /** @var AddRoute $route */ |
284 | 284 | foreach ($addRoutes as $route) { |
285 | 285 | $collection->add( |
286 | - $route->getName(), |
|
287 | - $route->path ? $this->replaceIdParameterInRoutePath( |
|
286 | + $route->getName(), |
|
287 | + $route->path ? $this->replaceIdParameterInRoutePath( |
|
288 | 288 | $route->path |
289 | - ) : $route->getName() |
|
289 | + ) : $route->getName() |
|
290 | 290 | ); |
291 | 291 | } |
292 | 292 | |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | protected function configureShowFields(ShowMapper $show): void |
308 | 308 | { |
309 | 309 | $this->showReader->configureFields( |
310 | - $this->getReflectionClass(), |
|
311 | - $show |
|
310 | + $this->getReflectionClass(), |
|
311 | + $show |
|
312 | 312 | ); |
313 | 313 | } |
314 | 314 | |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | private function replaceIdParameterInRoutePath(string $path): string |
324 | 324 | { |
325 | 325 | return str_replace( |
326 | - AddRoute::ID_PARAMETER, |
|
327 | - $this->getRouterIdParameter(), |
|
328 | - $path |
|
326 | + AddRoute::ID_PARAMETER, |
|
327 | + $this->getRouterIdParameter(), |
|
328 | + $path |
|
329 | 329 | ); |
330 | 330 | } |
331 | 331 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->annotationReader = $container->get('annotation_reader'); |
47 | 47 | $files = $this->findFiles( |
48 | - $container->getParameter('sonata_annotation.directory') |
|
48 | + $container->getParameter('sonata_annotation.directory') |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | foreach ($files as $file) { |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!($annotation = $this->getClassAnnotation( |
61 | - new ReflectionClass($className) |
|
61 | + new ReflectionClass($className) |
|
62 | 62 | ))) { |
63 | 63 | continue; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $definition = new Definition( |
67 | - $annotation->admin, |
|
68 | - [ |
|
67 | + $annotation->admin, |
|
68 | + [ |
|
69 | 69 | new Reference('sonata.annotation.reader.action_button'), |
70 | 70 | new Reference('sonata.annotation.reader.datagrid'), |
71 | 71 | new Reference('sonata.annotation.reader.datagrid_values'), |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | new Reference('sonata.annotation.reader.list'), |
76 | 76 | new Reference('sonata.annotation.reader.route'), |
77 | 77 | new Reference('sonata.annotation.reader.show'), |
78 | - ] |
|
78 | + ] |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | $definition->addTag( |
82 | - 'sonata.admin', |
|
83 | - array_merge( |
|
82 | + 'sonata.admin', |
|
83 | + array_merge( |
|
84 | 84 | $annotation->getTagOptions(), |
85 | 85 | ['model_class' => $className], |
86 | - ) |
|
86 | + ) |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | $container->setDefinition( |
90 | - $annotation->serviceId ?? $this->getServiceId($file), |
|
91 | - $definition |
|
90 | + $annotation->serviceId ?? $this->getServiceId($file), |
|
91 | + $definition |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 | } |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | private function findFiles(string $directory): IteratorAggregate |
104 | 104 | { |
105 | 105 | return Finder::create() |
106 | - ->in($directory) |
|
107 | - ->files() |
|
108 | - ->name('*.php'); |
|
106 | + ->in($directory) |
|
107 | + ->files() |
|
108 | + ->name('*.php'); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | private function getClassAnnotation(ReflectionClass $class): ?Admin |
167 | 167 | { |
168 | 168 | return $this->annotationReader->getClassAnnotation( |
169 | - $class, |
|
170 | - Admin::class |
|
169 | + $class, |
|
170 | + Admin::class |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | return self::DEFAULT_SERVICE_PREFIX . $this->getClassName( |
184 | 184 | $file->getFilename() |
185 | - ); |
|
185 | + ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $class = $this->getClass($container, $id); |
45 | 45 | |
46 | 46 | if ($permissions = $this->getRoles( |
47 | - new ReflectionClass($class), |
|
48 | - $this->getRolePrefix($id) |
|
47 | + new ReflectionClass($class), |
|
48 | + $this->getRolePrefix($id) |
|
49 | 49 | )) { |
50 | 50 | $roles = array_merge_recursive($roles, $permissions); |
51 | 51 | } |
@@ -87,17 +87,17 @@ discard block |
||
87 | 87 | |
88 | 88 | if (!isset($annotation->role)) { |
89 | 89 | throw new MissingAnnotationArgumentException( |
90 | - $annotation, |
|
91 | - 'role', |
|
92 | - $class |
|
90 | + $annotation, |
|
91 | + 'role', |
|
92 | + $class |
|
93 | 93 | ); |
94 | 94 | } |
95 | 95 | |
96 | 96 | $roles[$annotation->role] = array_map( |
97 | - function (string $permission) use ($prefix) { |
|
98 | - return $prefix . strtoupper($permission); |
|
99 | - }, |
|
100 | - $annotation->permissions |
|
97 | + function (string $permission) use ($prefix) { |
|
98 | + return $prefix . strtoupper($permission); |
|
99 | + }, |
|
100 | + $annotation->permissions |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 |
@@ -94,7 +94,7 @@ |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $roles[$annotation->role] = array_map( |
97 | - function (string $permission) use ($prefix) { |
|
97 | + function(string $permission) use ($prefix) { |
|
98 | 98 | return $prefix . strtoupper($permission); |
99 | 99 | }, |
100 | 100 | $annotation->permissions |
@@ -57,9 +57,9 @@ |
||
57 | 57 | public function getSettings(): array |
58 | 58 | { |
59 | 59 | return [ |
60 | - $this->type ?? null, |
|
61 | - $this->options, |
|
62 | - $this->fieldDescriptionOptions, |
|
60 | + $this->type ?? null, |
|
61 | + $this->options, |
|
62 | + $this->fieldDescriptionOptions, |
|
63 | 63 | ]; |
64 | 64 | } |
65 | 65 |
@@ -47,10 +47,10 @@ |
||
47 | 47 | public function getSettings(): array |
48 | 48 | { |
49 | 49 | return [ |
50 | - $this->type ?? null, |
|
51 | - $this->filterOptions, |
|
52 | - $this->fieldOptions, |
|
53 | - $this->fieldDescriptionOptions, |
|
50 | + $this->type ?? null, |
|
51 | + $this->filterOptions, |
|
52 | + $this->fieldOptions, |
|
53 | + $this->fieldDescriptionOptions, |
|
54 | 54 | ]; |
55 | 55 | } |
56 | 56 |
@@ -129,18 +129,18 @@ |
||
129 | 129 | public function getTagOptions(): array |
130 | 130 | { |
131 | 131 | return [ |
132 | - 'code' => $this->code ?? null, |
|
133 | - 'controller' => $this->controller ?? null, |
|
134 | - 'manager_type' => $this->managerType, |
|
135 | - 'group' => $this->group ?? null, |
|
136 | - 'label' => $this->label ?? null, |
|
137 | - 'show_in_dashboard' => $this->showInDashboard, |
|
138 | - 'keep_open' => $this->keepOpen, |
|
139 | - 'on_top' => $this->onTop, |
|
140 | - 'icon' => $this->icon ?? null, |
|
141 | - 'label_translator_strategy' => $this->labelTranslatorStrategy ?? null, |
|
142 | - 'label_catalogue' => $this->labelCatalogue ?? null, |
|
143 | - 'pager_type' => $this->pagerType ?? null, |
|
132 | + 'code' => $this->code ?? null, |
|
133 | + 'controller' => $this->controller ?? null, |
|
134 | + 'manager_type' => $this->managerType, |
|
135 | + 'group' => $this->group ?? null, |
|
136 | + 'label' => $this->label ?? null, |
|
137 | + 'show_in_dashboard' => $this->showInDashboard, |
|
138 | + 'keep_open' => $this->keepOpen, |
|
139 | + 'on_top' => $this->onTop, |
|
140 | + 'icon' => $this->icon ?? null, |
|
141 | + 'label_translator_strategy' => $this->labelTranslatorStrategy ?? null, |
|
142 | + 'label_catalogue' => $this->labelCatalogue ?? null, |
|
143 | + 'pager_type' => $this->pagerType ?? null, |
|
144 | 144 | ]; |
145 | 145 | } |
146 | 146 |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | * annotation. |
21 | 21 | */ |
22 | 22 | public function __construct( |
23 | - $annotation, |
|
24 | - string $argumentName, |
|
25 | - $class = null |
|
23 | + $annotation, |
|
24 | + string $argumentName, |
|
25 | + $class = null |
|
26 | 26 | ) { |
27 | 27 | if ($annotation instanceof AnnotationInterface) { |
28 | 28 | $annotation = get_class($annotation); |
@@ -34,31 +34,31 @@ discard block |
||
34 | 34 | |
35 | 35 | if (!is_string($annotation)) { |
36 | 36 | throw new InvalidArgumentException( |
37 | - sprintf( |
|
37 | + sprintf( |
|
38 | 38 | 'Invalid annotation (string|%s) attribute.', |
39 | 39 | AnnotationInterface::class, |
40 | - ) |
|
40 | + ) |
|
41 | 41 | ); |
42 | 42 | } |
43 | 43 | |
44 | 44 | if ($class !== null && !is_string($class)) { |
45 | 45 | throw new InvalidArgumentException( |
46 | - 'Invalid class (string|ReflectionClass|null) attribute.', |
|
46 | + 'Invalid class (string|ReflectionClass|null) attribute.', |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
50 | 50 | if ($class) { |
51 | 51 | $message = sprintf( |
52 | - 'Argument "%s" is mandatory for annotation %s on %s.', |
|
53 | - $argumentName, |
|
54 | - $annotation, |
|
55 | - $class |
|
52 | + 'Argument "%s" is mandatory for annotation %s on %s.', |
|
53 | + $argumentName, |
|
54 | + $annotation, |
|
55 | + $class |
|
56 | 56 | ); |
57 | 57 | } else { |
58 | 58 | $message = sprintf( |
59 | - 'Argument "%s" is mandatory for annotation %s.', |
|
60 | - $argumentName, |
|
61 | - $annotation, |
|
59 | + 'Argument "%s" is mandatory for annotation %s.', |
|
60 | + $argumentName, |
|
61 | + $annotation, |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 |
@@ -38,16 +38,16 @@ |
||
38 | 38 | if ($this->isSupported($annotation)) { |
39 | 39 | if (!isset($annotation->template)) { |
40 | 40 | throw new MissingAnnotationArgumentException( |
41 | - $annotation, |
|
42 | - 'template', |
|
43 | - $class |
|
41 | + $annotation, |
|
42 | + 'template', |
|
43 | + $class |
|
44 | 44 | ); |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** @var AbstractAction $annotation */ |
48 | 48 | $actions[random_int( |
49 | 49 | -99999, |
50 | - 99999 |
|
50 | + 99999 |
|
51 | 51 | )]['template'] = $annotation->template; |
52 | 52 | } |
53 | 53 | } |