@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @return object|AnnotationInterface|null |
| 46 | 46 | */ |
| 47 | 47 | protected function getClassAnnotation( |
| 48 | - ReflectionClass $class, |
|
| 49 | - string $annotation |
|
| 48 | + ReflectionClass $class, |
|
| 49 | + string $annotation |
|
| 50 | 50 | ): ?object { |
| 51 | 51 | return $this->annotationReader->getClassAnnotation($class, $annotation); |
| 52 | 52 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @return array<object|AnnotationInterface> |
| 72 | 72 | */ |
| 73 | 73 | protected function getPropertyAnnotations( |
| 74 | - ReflectionProperty $property |
|
| 74 | + ReflectionProperty $property |
|
| 75 | 75 | ): array { |
| 76 | 76 | return $this->annotationReader->getPropertyAnnotations($property); |
| 77 | 77 | } |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | * @return object|AnnotationInterface|null |
| 86 | 86 | */ |
| 87 | 87 | protected function getMethodAnnotation( |
| 88 | - ReflectionMethod $method, |
|
| 89 | - string $annotation |
|
| 88 | + ReflectionMethod $method, |
|
| 89 | + string $annotation |
|
| 90 | 90 | ): ?object { |
| 91 | 91 | return $this->annotationReader->getMethodAnnotation( |
| 92 | - $method, |
|
| 93 | - $annotation |
|
| 92 | + $method, |
|
| 93 | + $annotation |
|
| 94 | 94 | ); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | 37 | public function configureFields( |
| 38 | - ReflectionClass $class, |
|
| 39 | - DatagridMapper $datagridMapper |
|
| 38 | + ReflectionClass $class, |
|
| 39 | + DatagridMapper $datagridMapper |
|
| 40 | 40 | ): void { |
| 41 | 41 | $propertiesWithPosition = []; |
| 42 | 42 | $propertiesWithoutPosition = []; |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | if ($annotation instanceof DatagridAssociationField) { |
| 53 | 53 | if (!isset($annotation->field)) { |
| 54 | 54 | throw new MissingAnnotationArgumentException( |
| 55 | - $annotation, |
|
| 56 | - 'field', |
|
| 55 | + $annotation, |
|
| 56 | + 'field', |
|
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -62,30 +62,30 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | if (!isset($annotation->position)) { |
| 64 | 64 | $propertiesWithoutPosition[] = [ |
| 65 | - 'name' => $name, |
|
| 66 | - 'annotation' => $annotation, |
|
| 65 | + 'name' => $name, |
|
| 66 | + 'annotation' => $annotation, |
|
| 67 | 67 | ]; |
| 68 | 68 | |
| 69 | 69 | continue; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if (array_key_exists( |
| 73 | - $annotation->position, |
|
| 74 | - $propertiesWithPosition |
|
| 73 | + $annotation->position, |
|
| 74 | + $propertiesWithPosition |
|
| 75 | 75 | )) { |
| 76 | 76 | throw new InvalidArgumentException( |
| 77 | - sprintf( |
|
| 77 | + sprintf( |
|
| 78 | 78 | 'Position "%s" is already in use by "%s", try setting a different position for "%s".', |
| 79 | 79 | $annotation->position, |
| 80 | 80 | $propertiesWithPosition[$annotation->position]['name'], |
| 81 | 81 | $property->getName() |
| 82 | - ) |
|
| 82 | + ) |
|
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $propertiesWithPosition[$annotation->position] = [ |
| 87 | - 'name' => $name, |
|
| 88 | - 'annotation' => $annotation, |
|
| 87 | + 'name' => $name, |
|
| 88 | + 'annotation' => $annotation, |
|
| 89 | 89 | ]; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | ksort($propertiesWithPosition); |
| 94 | 94 | |
| 95 | 95 | $properties = array_merge( |
| 96 | - $propertiesWithPosition, |
|
| 97 | - $propertiesWithoutPosition |
|
| 96 | + $propertiesWithPosition, |
|
| 97 | + $propertiesWithoutPosition |
|
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | 100 | foreach ($properties as $property) { |
| 101 | 101 | $datagridMapper->add( |
| 102 | - $property['name'], |
|
| 103 | - ...$property['annotation']->getSettings() |
|
| 102 | + $property['name'], |
|
| 103 | + ...$property['annotation']->getSettings() |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | if ($annotation instanceof ExportAssociationField) { |
| 38 | 38 | if (!isset($annotation->field)) { |
| 39 | 39 | throw new MissingAnnotationArgumentException( |
| 40 | - $annotation, |
|
| 41 | - 'field', |
|
| 40 | + $annotation, |
|
| 41 | + 'field', |
|
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $fieldName = $property->getName() |
| 46 | - . '.' |
|
| 47 | - . $annotation->field; |
|
| 46 | + . '.' |
|
| 47 | + . $annotation->field; |
|
| 48 | 48 | |
| 49 | 49 | $fields[$annotation->label ?? $fieldName] = $fieldName; |
| 50 | 50 | continue; |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | foreach ($class->getMethods() as $method) { |
| 61 | 61 | if ($annotation = $this->getMethodAnnotation( |
| 62 | - $method, |
|
| 63 | - ExportField::class |
|
| 62 | + $method, |
|
| 63 | + ExportField::class |
|
| 64 | 64 | )) { |
| 65 | 65 | $label = $annotation->label ?? $method->getName(); |
| 66 | 66 | $fields[$label] = $method->getName(); |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | /** @var ExportFormats|null $annotation */ |
| 83 | 83 | if ($annotation = $this->getClassAnnotation( |
| 84 | - $class, |
|
| 85 | - ExportFormats::class |
|
| 84 | + $class, |
|
| 85 | + ExportFormats::class |
|
| 86 | 86 | )) { |
| 87 | 87 | return $annotation->formats; |
| 88 | 88 | } |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | 38 | public function configureFields( |
| 39 | - ReflectionClass $class, |
|
| 40 | - ListMapper $listMapper |
|
| 39 | + ReflectionClass $class, |
|
| 40 | + ListMapper $listMapper |
|
| 41 | 41 | ): void { |
| 42 | 42 | $propertiesAndMethodsWithPosition = []; |
| 43 | 43 | $propertiesAndMethodsWithoutPosition = []; |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | if ($annotation instanceof ListAssociationField) { |
| 58 | 58 | if (!isset($annotation->field)) { |
| 59 | 59 | throw new MissingAnnotationArgumentException( |
| 60 | - $annotation, |
|
| 61 | - 'field', |
|
| 60 | + $annotation, |
|
| 61 | + 'field', |
|
| 62 | 62 | ); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -67,30 +67,30 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if (!isset($annotation->position)) { |
| 69 | 69 | $propertiesAndMethodsWithoutPosition[] = [ |
| 70 | - 'name' => $name, |
|
| 71 | - 'annotation' => $annotation, |
|
| 70 | + 'name' => $name, |
|
| 71 | + 'annotation' => $annotation, |
|
| 72 | 72 | ]; |
| 73 | 73 | |
| 74 | 74 | continue; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if (array_key_exists( |
| 78 | - $annotation->position, |
|
| 79 | - $propertiesAndMethodsWithPosition |
|
| 78 | + $annotation->position, |
|
| 79 | + $propertiesAndMethodsWithPosition |
|
| 80 | 80 | )) { |
| 81 | 81 | throw new InvalidArgumentException( |
| 82 | - sprintf( |
|
| 82 | + sprintf( |
|
| 83 | 83 | 'Position "%s" is already in use by "%s", try setting a different position for "%s".', |
| 84 | 84 | $annotation->position, |
| 85 | 85 | $propertiesAndMethodsWithPosition[$annotation->position]['name'], |
| 86 | 86 | $property->getName() |
| 87 | - ) |
|
| 87 | + ) |
|
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $propertiesAndMethodsWithPosition[$annotation->position] = [ |
| 92 | - 'name' => $name, |
|
| 93 | - 'annotation' => $annotation, |
|
| 92 | + 'name' => $name, |
|
| 93 | + 'annotation' => $annotation, |
|
| 94 | 94 | ]; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -102,37 +102,37 @@ discard block |
||
| 102 | 102 | foreach ($class->getMethods() as $method) { |
| 103 | 103 | /** @var ListField|null $annotation */ |
| 104 | 104 | if ($annotation = $this->getMethodAnnotation( |
| 105 | - $method, |
|
| 106 | - ListField::class |
|
| 105 | + $method, |
|
| 106 | + ListField::class |
|
| 107 | 107 | )) { |
| 108 | 108 | $name = $method->getName(); |
| 109 | 109 | |
| 110 | 110 | if (!isset($annotation->position)) { |
| 111 | 111 | $propertiesAndMethodsWithoutPosition[] = [ |
| 112 | - 'name' => $name, |
|
| 113 | - 'annotation' => $annotation, |
|
| 112 | + 'name' => $name, |
|
| 113 | + 'annotation' => $annotation, |
|
| 114 | 114 | ]; |
| 115 | 115 | |
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (array_key_exists( |
| 120 | - $annotation->position, |
|
| 121 | - $propertiesAndMethodsWithPosition |
|
| 120 | + $annotation->position, |
|
| 121 | + $propertiesAndMethodsWithPosition |
|
| 122 | 122 | )) { |
| 123 | 123 | throw new InvalidArgumentException( |
| 124 | - sprintf( |
|
| 124 | + sprintf( |
|
| 125 | 125 | 'Position "%s" is already in use by "%s", try setting a different position for "%s".', |
| 126 | 126 | $annotation->position, |
| 127 | 127 | $propertiesAndMethodsWithPosition[$annotation->position]['name'], |
| 128 | 128 | $name |
| 129 | - ) |
|
| 129 | + ) |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $propertiesAndMethodsWithPosition[$annotation->position] = [ |
| 134 | - 'name' => $name, |
|
| 135 | - 'annotation' => $annotation, |
|
| 134 | + 'name' => $name, |
|
| 135 | + 'annotation' => $annotation, |
|
| 136 | 136 | ]; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -144,15 +144,15 @@ discard block |
||
| 144 | 144 | ksort($propertiesAndMethodsWithPosition); |
| 145 | 145 | |
| 146 | 146 | $propertiesAndMethods = array_merge( |
| 147 | - $propertiesAndMethodsWithPosition, |
|
| 148 | - $propertiesAndMethodsWithoutPosition |
|
| 147 | + $propertiesAndMethodsWithPosition, |
|
| 148 | + $propertiesAndMethodsWithoutPosition |
|
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | 151 | foreach ($propertiesAndMethods as $propertyAndMethod) { |
| 152 | 152 | $this->addField( |
| 153 | - $propertyAndMethod['name'], |
|
| 154 | - $propertyAndMethod['annotation'], |
|
| 155 | - $listMapper |
|
| 153 | + $propertyAndMethod['name'], |
|
| 154 | + $propertyAndMethod['annotation'], |
|
| 155 | + $listMapper |
|
| 156 | 156 | ); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($actions = $this->getListActions($class)) { |
| 164 | 164 | $listMapper->add('_action', null, [ |
| 165 | - 'actions' => $actions, |
|
| 165 | + 'actions' => $actions, |
|
| 166 | 166 | ]); |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | * @return void |
| 178 | 178 | */ |
| 179 | 179 | private function addField( |
| 180 | - string $name, |
|
| 181 | - ListField $annotation, |
|
| 182 | - ListMapper $listMapper |
|
| 180 | + string $name, |
|
| 181 | + ListField $annotation, |
|
| 182 | + ListMapper $listMapper |
|
| 183 | 183 | ): void { |
| 184 | 184 | $listMapper->add($name, ...$annotation->getSettings()); |
| 185 | 185 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | if ($annotation instanceof ListAction) { |
| 202 | 202 | if (!isset($annotation->name)) { |
| 203 | 203 | throw new MissingAnnotationArgumentException( |
| 204 | - $annotation, |
|
| 205 | - 'name', |
|
| 206 | - $class |
|
| 204 | + $annotation, |
|
| 205 | + 'name', |
|
| 206 | + $class |
|
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -38,9 +38,9 @@ |
||
| 38 | 38 | || $annotation instanceof RemoveRoute) |
| 39 | 39 | && !isset($annotation->name)) { |
| 40 | 40 | throw new MissingAnnotationArgumentException( |
| 41 | - $annotation, |
|
| 42 | - 'name', |
|
| 43 | - $class |
|
| 41 | + $annotation, |
|
| 42 | + 'name', |
|
| 43 | + $class |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -37,17 +37,17 @@ |
||
| 37 | 37 | |
| 38 | 38 | if (!isset($annotation->class)) { |
| 39 | 39 | throw new MissingAnnotationArgumentException( |
| 40 | - $annotation, |
|
| 41 | - 'class', |
|
| 42 | - $class |
|
| 40 | + $annotation, |
|
| 41 | + 'class', |
|
| 42 | + $class |
|
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if (!isset($annotation->field)) { |
| 47 | 47 | throw new MissingAnnotationArgumentException( |
| 48 | - $annotation, |
|
| 49 | - 'field', |
|
| 50 | - $class |
|
| 48 | + $annotation, |
|
| 49 | + 'field', |
|
| 50 | + $class |
|
| 51 | 51 | ); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -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->name, |
|
| 287 | - $route->path ? $this->replaceIdParameterInRoutePath( |
|
| 286 | + $route->name, |
|
| 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 | |