Complex classes like Crud often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Crud, and based on these observations, apply Extract Interface, too.
1 | <?php declare (strict_types = 1); |
||
60 | class Crud implements CrudInterface |
||
61 | { |
||
62 | use HasContainerTrait; |
||
63 | |||
64 | /** Internal constant. Path constant. */ |
||
65 | protected const ROOT_PATH = ''; |
||
66 | |||
67 | /** Internal constant. Path constant. */ |
||
68 | protected const PATH_SEPARATOR = DocumentInterface::PATH_SEPARATOR; |
||
69 | |||
70 | /** |
||
71 | * @var FactoryInterface |
||
72 | */ |
||
73 | private $factory; |
||
74 | |||
75 | /** |
||
76 | * @var string |
||
77 | */ |
||
78 | private $modelClass; |
||
79 | |||
80 | /** |
||
81 | * @var ModelSchemaInfoInterface |
||
82 | */ |
||
83 | private $modelSchemas; |
||
84 | |||
85 | /** |
||
86 | * @var RelationshipPaginationStrategyInterface |
||
87 | */ |
||
88 | private $relPagingStrategy; |
||
89 | |||
90 | /** |
||
91 | * @var Connection |
||
92 | */ |
||
93 | private $connection; |
||
94 | |||
95 | /** |
||
96 | * @var iterable|null |
||
97 | */ |
||
98 | private $filterParameters = null; |
||
99 | |||
100 | /** |
||
101 | * @var bool |
||
102 | */ |
||
103 | private $areFiltersWithAnd = true; |
||
104 | |||
105 | /** |
||
106 | * @var iterable|null |
||
107 | */ |
||
108 | private $sortingParameters = null; |
||
109 | |||
110 | /** |
||
111 | * @var array |
||
112 | */ |
||
113 | private $relFiltersAndSorts = []; |
||
114 | |||
115 | /** |
||
116 | * @var iterable|null |
||
117 | */ |
||
118 | private $includePaths = null; |
||
119 | |||
120 | /** |
||
121 | * @var int|null |
||
122 | */ |
||
123 | private $pagingOffset = null; |
||
124 | |||
125 | /** |
||
126 | * @var Closure|null |
||
127 | */ |
||
128 | private $columnMapper = null; |
||
129 | |||
130 | /** |
||
131 | * @var bool |
||
132 | */ |
||
133 | private $isFetchTyped; |
||
134 | |||
135 | /** |
||
136 | * @var int|null |
||
137 | */ |
||
138 | private $pagingLimit = null; |
||
139 | |||
140 | /** internal constant */ |
||
141 | private const REL_FILTERS_AND_SORTS__FILTERS = 0; |
||
142 | |||
143 | /** internal constant */ |
||
144 | private const REL_FILTERS_AND_SORTS__SORTS = 1; |
||
145 | |||
146 | /** |
||
147 | * @param ContainerInterface $container |
||
148 | * @param string $modelClass |
||
149 | * |
||
150 | * @throws ContainerExceptionInterface |
||
151 | * @throws NotFoundExceptionInterface |
||
152 | */ |
||
153 | 61 | public function __construct(ContainerInterface $container, string $modelClass) |
|
165 | |||
166 | /** |
||
167 | * @param Closure $mapper |
||
168 | * |
||
169 | * @return self |
||
170 | */ |
||
171 | 1 | public function withColumnMapper(Closure $mapper): self |
|
177 | |||
178 | /** |
||
179 | * @inheritdoc |
||
180 | */ |
||
181 | 43 | public function withFilters(iterable $filterParameters): CrudInterface |
|
187 | |||
188 | /** |
||
189 | * @inheritdoc |
||
190 | */ |
||
191 | 21 | public function withIndexFilter(string $index): CrudInterface |
|
202 | |||
203 | /** |
||
204 | * @inheritdoc |
||
205 | */ |
||
206 | 3 | public function withIndexesFilter(array $indexes): CrudInterface |
|
231 | |||
232 | /** |
||
233 | * @inheritdoc |
||
234 | */ |
||
235 | 7 | public function withRelationshipFilters(string $name, iterable $filters): CrudInterface |
|
243 | |||
244 | /** |
||
245 | * @inheritdoc |
||
246 | */ |
||
247 | 1 | public function withRelationshipSorts(string $name, iterable $sorts): CrudInterface |
|
255 | |||
256 | /** |
||
257 | * @inheritdoc |
||
258 | */ |
||
259 | 16 | public function combineWithAnd(): CrudInterface |
|
265 | |||
266 | /** |
||
267 | * @inheritdoc |
||
268 | */ |
||
269 | 2 | public function combineWithOr(): CrudInterface |
|
275 | |||
276 | /** |
||
277 | * @return bool |
||
278 | */ |
||
279 | 38 | private function hasColumnMapper(): bool |
|
283 | |||
284 | /** |
||
285 | * @return Closure |
||
286 | */ |
||
287 | 1 | private function getColumnMapper(): Closure |
|
291 | |||
292 | /** |
||
293 | * @return bool |
||
294 | */ |
||
295 | 47 | private function hasFilters(): bool |
|
299 | |||
300 | /** |
||
301 | * @return iterable |
||
302 | */ |
||
303 | 36 | private function getFilters(): iterable |
|
307 | |||
308 | /** |
||
309 | * @return bool |
||
310 | */ |
||
311 | 36 | private function areFiltersWithAnd(): bool |
|
315 | |||
316 | /** |
||
317 | * @inheritdoc |
||
318 | */ |
||
319 | 17 | public function withSorts(iterable $sortingParameters): CrudInterface |
|
325 | |||
326 | /** |
||
327 | * @return bool |
||
328 | */ |
||
329 | 38 | private function hasSorts(): bool |
|
333 | |||
334 | /** |
||
335 | * @return iterable |
||
336 | */ |
||
337 | 11 | private function getSorts(): ?iterable |
|
341 | |||
342 | /** |
||
343 | * @inheritdoc |
||
344 | */ |
||
345 | 21 | public function withIncludes(iterable $includePaths): CrudInterface |
|
351 | |||
352 | /** |
||
353 | * @return bool |
||
354 | */ |
||
355 | 36 | private function hasIncludes(): bool |
|
359 | |||
360 | /** |
||
361 | * @return iterable |
||
362 | */ |
||
363 | 21 | private function getIncludes(): iterable |
|
367 | |||
368 | /** |
||
369 | * @inheritdoc |
||
370 | */ |
||
371 | 20 | public function withPaging(int $offset, int $limit): CrudInterface |
|
378 | |||
379 | /** |
||
380 | * @inheritdoc |
||
381 | */ |
||
382 | 1 | public function withoutPaging(): CrudInterface |
|
389 | |||
390 | /** |
||
391 | * @return self |
||
392 | */ |
||
393 | 61 | public function shouldBeTyped(): self |
|
399 | |||
400 | /** |
||
401 | * @return self |
||
402 | */ |
||
403 | 4 | public function shouldBeUntyped(): self |
|
409 | |||
410 | /** |
||
411 | * @return bool |
||
412 | */ |
||
413 | 45 | private function hasPaging(): bool |
|
417 | |||
418 | /** |
||
419 | * @return int |
||
420 | */ |
||
421 | 18 | private function getPagingOffset(): int |
|
425 | |||
426 | /** |
||
427 | * @return int |
||
428 | */ |
||
429 | 18 | private function getPagingLimit(): int |
|
433 | |||
434 | /** |
||
435 | * @return bool |
||
436 | */ |
||
437 | 43 | private function isFetchTyped(): bool |
|
441 | |||
442 | /** |
||
443 | * @return Connection |
||
444 | */ |
||
445 | 52 | protected function getConnection(): Connection |
|
449 | |||
450 | /** |
||
451 | * @param string $modelClass |
||
452 | * |
||
453 | * @return ModelQueryBuilder |
||
454 | */ |
||
455 | 50 | protected function createBuilder(string $modelClass): ModelQueryBuilder |
|
459 | |||
460 | /** |
||
461 | * @param Connection $connection |
||
462 | * @param string $modelClass |
||
463 | * |
||
464 | * @return ModelQueryBuilder |
||
465 | */ |
||
466 | 52 | private function createBuilderFromConnection(Connection $connection, string $modelClass): ModelQueryBuilder |
|
470 | |||
471 | /** |
||
472 | * @param ModelQueryBuilder $builder |
||
473 | * |
||
474 | * @return Crud |
||
475 | */ |
||
476 | 38 | protected function applyColumnMapper(ModelQueryBuilder $builder): self |
|
484 | |||
485 | /** |
||
486 | * @param ModelQueryBuilder $builder |
||
487 | * |
||
488 | * @return Crud |
||
489 | * |
||
490 | * @throws DBALException |
||
491 | */ |
||
492 | 38 | protected function applyAliasFilters(ModelQueryBuilder $builder): self |
|
502 | |||
503 | /** |
||
504 | * @param ModelQueryBuilder $builder |
||
505 | * |
||
506 | * @return self |
||
507 | * |
||
508 | * @throws DBALException |
||
509 | */ |
||
510 | 4 | protected function applyTableFilters(ModelQueryBuilder $builder): self |
|
520 | |||
521 | /** |
||
522 | * @param ModelQueryBuilder $builder |
||
523 | * |
||
524 | * @return self |
||
525 | * |
||
526 | * @throws DBALException |
||
527 | */ |
||
528 | 38 | protected function applyRelationshipFiltersAndSorts(ModelQueryBuilder $builder): self |
|
549 | |||
550 | /** |
||
551 | * @param ModelQueryBuilder $builder |
||
552 | * |
||
553 | * @return self |
||
554 | * |
||
555 | * @throws DBALException |
||
556 | */ |
||
557 | 38 | protected function applySorts(ModelQueryBuilder $builder): self |
|
565 | |||
566 | /** |
||
567 | * @param ModelQueryBuilder $builder |
||
568 | * |
||
569 | * @return self |
||
570 | */ |
||
571 | 45 | protected function applyPaging(ModelQueryBuilder $builder): self |
|
580 | |||
581 | /** |
||
582 | * @return self |
||
583 | */ |
||
584 | 61 | protected function clearBuilderParameters(): self |
|
596 | |||
597 | /** |
||
598 | * @return self |
||
599 | */ |
||
600 | 61 | private function clearFetchParameters(): self |
|
607 | |||
608 | /** |
||
609 | * @param ModelQueryBuilder $builder |
||
610 | * |
||
611 | * @return ModelQueryBuilder |
||
612 | */ |
||
613 | 2 | protected function builderOnCount(ModelQueryBuilder $builder): ModelQueryBuilder |
|
617 | |||
618 | /** |
||
619 | * @param ModelQueryBuilder $builder |
||
620 | * |
||
621 | * @return ModelQueryBuilder |
||
622 | */ |
||
623 | 38 | protected function builderOnIndex(ModelQueryBuilder $builder): ModelQueryBuilder |
|
627 | |||
628 | /** |
||
629 | * @param ModelQueryBuilder $builder |
||
630 | * |
||
631 | * @return ModelQueryBuilder |
||
632 | */ |
||
633 | 7 | protected function builderOnReadRelationship(ModelQueryBuilder $builder): ModelQueryBuilder |
|
637 | |||
638 | /** |
||
639 | * @param ModelQueryBuilder $builder |
||
640 | * |
||
641 | * @return ModelQueryBuilder |
||
642 | */ |
||
643 | 5 | protected function builderSaveResourceOnCreate(ModelQueryBuilder $builder): ModelQueryBuilder |
|
647 | |||
648 | /** |
||
649 | * @param ModelQueryBuilder $builder |
||
650 | * |
||
651 | * @return ModelQueryBuilder |
||
652 | */ |
||
653 | 5 | protected function builderSaveResourceOnUpdate(ModelQueryBuilder $builder): ModelQueryBuilder |
|
657 | |||
658 | /** |
||
659 | * @param string $relationshipName |
||
660 | * @param ModelQueryBuilder $builder |
||
661 | * |
||
662 | * @return ModelQueryBuilder |
||
663 | * |
||
664 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
665 | */ |
||
666 | 2 | protected function builderSaveRelationshipOnCreate(/** @noinspection PhpUnusedParameterInspection */ |
|
672 | |||
673 | /** |
||
674 | * @param string $relationshipName |
||
675 | * @param ModelQueryBuilder $builder |
||
676 | * |
||
677 | * @return ModelQueryBuilder |
||
678 | * |
||
679 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
680 | */ |
||
681 | 2 | protected function builderSaveRelationshipOnUpdate(/** @noinspection PhpUnusedParameterInspection */ |
|
687 | |||
688 | /** |
||
689 | * @param string $relationshipName |
||
690 | * @param ModelQueryBuilder $builder |
||
691 | * |
||
692 | * @return ModelQueryBuilder |
||
693 | * |
||
694 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
695 | */ |
||
696 | 1 | protected function builderOnCreateInBelongsToManyRelationship(/** @noinspection PhpUnusedParameterInspection */ |
|
702 | |||
703 | /** |
||
704 | * @param string $relationshipName |
||
705 | * @param ModelQueryBuilder $builder |
||
706 | * |
||
707 | * @return ModelQueryBuilder |
||
708 | * |
||
709 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
710 | */ |
||
711 | 1 | protected function builderOnRemoveInBelongsToManyRelationship(/** @noinspection PhpUnusedParameterInspection */ |
|
717 | |||
718 | /** |
||
719 | * @param string $relationshipName |
||
720 | * @param ModelQueryBuilder $builder |
||
721 | * |
||
722 | * @return ModelQueryBuilder |
||
723 | * |
||
724 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
725 | */ |
||
726 | 2 | protected function builderCleanRelationshipOnUpdate(/** @noinspection PhpUnusedParameterInspection */ |
|
732 | |||
733 | /** |
||
734 | * @param ModelQueryBuilder $builder |
||
735 | * |
||
736 | * @return ModelQueryBuilder |
||
737 | */ |
||
738 | 4 | protected function builderOnDelete(ModelQueryBuilder $builder): ModelQueryBuilder |
|
742 | |||
743 | /** |
||
744 | * @param PaginatedDataInterface|mixed|null $data |
||
745 | * |
||
746 | * @return void |
||
747 | * |
||
748 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
749 | * |
||
750 | * @throws DBALException |
||
751 | */ |
||
752 | 21 | private function loadRelationships($data): void |
|
801 | |||
802 | /** |
||
803 | * A helper to remember all model related data. Helps to ensure we consistently handle models in CRUD. |
||
804 | * |
||
805 | * @param mixed $model |
||
806 | * @param string $path |
||
807 | * @param ModelSchemaInfoInterface $modelSchemas |
||
808 | * @param ModelStorageInterface $modelStorage |
||
809 | * @param TagStorageInterface $modelsAtPath |
||
810 | * @param ArrayObject $idsAtPath |
||
811 | * |
||
812 | * @return mixed |
||
813 | */ |
||
814 | 21 | private static function registerModelAtPath( |
|
832 | |||
833 | /** |
||
834 | * @param iterable $paths (string[]) |
||
835 | * |
||
836 | * @return iterable |
||
837 | */ |
||
838 | 21 | private static function getPaths(iterable $paths): iterable |
|
875 | |||
876 | /** |
||
877 | * @inheritdoc |
||
878 | * |
||
879 | * @throws DBALException |
||
880 | */ |
||
881 | 3 | public function createIndexBuilder(iterable $columns = null): QueryBuilder |
|
885 | |||
886 | /** |
||
887 | * @inheritdoc |
||
888 | * |
||
889 | * @throws DBALException |
||
890 | */ |
||
891 | 4 | public function createDeleteBuilder(): QueryBuilder |
|
895 | |||
896 | /** |
||
897 | * @param iterable|null $columns |
||
898 | * |
||
899 | * @return ModelQueryBuilder |
||
900 | * |
||
901 | * @throws DBALException |
||
902 | */ |
||
903 | 38 | protected function createIndexModelBuilder(iterable $columns = null): ModelQueryBuilder |
|
926 | |||
927 | /** |
||
928 | * @return ModelQueryBuilder |
||
929 | * |
||
930 | * @throws DBALException |
||
931 | */ |
||
932 | 4 | protected function createDeleteModelBuilder(): ModelQueryBuilder |
|
946 | |||
947 | /** |
||
948 | * @inheritdoc |
||
949 | * |
||
950 | * @throws DBALException |
||
951 | */ |
||
952 | 17 | public function index(): PaginatedDataInterface |
|
959 | |||
960 | /** |
||
961 | * @inheritdoc |
||
962 | * |
||
963 | * @throws DBALException |
||
964 | */ |
||
965 | 4 | public function indexIdentities(): array |
|
975 | |||
976 | /** |
||
977 | * @inheritdoc |
||
978 | * |
||
979 | * @throws DBALException |
||
980 | */ |
||
981 | 13 | public function read(string $index) |
|
990 | |||
991 | /** |
||
992 | * @inheritdoc |
||
993 | * |
||
994 | * @throws DBALException |
||
995 | */ |
||
996 | 2 | public function count(): ?int |
|
1004 | |||
1005 | /** |
||
1006 | * @param string $relationshipName |
||
1007 | * @param iterable|null $relationshipFilters |
||
1008 | * @param iterable|null $relationshipSorts |
||
1009 | * @param iterable|null $columns |
||
1010 | * |
||
1011 | * @return ModelQueryBuilder |
||
1012 | * |
||
1013 | * @throws DBALException |
||
1014 | */ |
||
1015 | 7 | public function createReadRelationshipBuilder( |
|
1059 | |||
1060 | /** |
||
1061 | * @inheritdoc |
||
1062 | * |
||
1063 | * @throws DBALException |
||
1064 | */ |
||
1065 | 6 | public function indexRelationship( |
|
1088 | |||
1089 | /** |
||
1090 | * @inheritdoc |
||
1091 | * |
||
1092 | * @throws DBALException |
||
1093 | */ |
||
1094 | 2 | public function indexRelationshipIdentities( |
|
1124 | |||
1125 | /** |
||
1126 | * @inheritdoc |
||
1127 | */ |
||
1128 | 3 | public function readRelationship( |
|
1136 | |||
1137 | /** |
||
1138 | * @inheritdoc |
||
1139 | */ |
||
1140 | 1 | public function hasInRelationship(string $parentId, string $name, string $childId): bool |
|
1158 | |||
1159 | /** |
||
1160 | * @inheritdoc |
||
1161 | * |
||
1162 | * @throws DBALException |
||
1163 | */ |
||
1164 | 1 | public function delete(): int |
|
1172 | |||
1173 | /** |
||
1174 | * @inheritdoc |
||
1175 | * |
||
1176 | * @throws DBALException |
||
1177 | */ |
||
1178 | 4 | public function remove(string $index): bool |
|
1188 | |||
1189 | /** |
||
1190 | * @inheritdoc |
||
1191 | * |
||
1192 | * @throws DBALException |
||
1193 | * |
||
1194 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1195 | */ |
||
1196 | 5 | public function create(?string $index, array $attributes, array $toMany): string |
|
1222 | |||
1223 | /** |
||
1224 | * @inheritdoc |
||
1225 | * |
||
1226 | * @throws DBALException |
||
1227 | * |
||
1228 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1229 | */ |
||
1230 | 5 | public function update(string $index, array $attributes, array $toMany): int |
|
1277 | |||
1278 | /** |
||
1279 | * @param string $parentId |
||
1280 | * @param string $name |
||
1281 | * @param iterable $childIds |
||
1282 | * |
||
1283 | * @return int |
||
1284 | * |
||
1285 | * @throws DBALException |
||
1286 | * |
||
1287 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1288 | */ |
||
1289 | 1 | public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
|
1307 | |||
1308 | /** |
||
1309 | * @inheritdoc |
||
1310 | * |
||
1311 | * @throws DBALException |
||
1312 | */ |
||
1313 | 1 | public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
|
1329 | |||
1330 | /** |
||
1331 | * @return FactoryInterface |
||
1332 | */ |
||
1333 | 52 | protected function getFactory(): FactoryInterface |
|
1337 | |||
1338 | /** |
||
1339 | * @return string |
||
1340 | */ |
||
1341 | 53 | protected function getModelClass(): string |
|
1345 | |||
1346 | /** |
||
1347 | * @return ModelSchemaInfoInterface |
||
1348 | */ |
||
1349 | 53 | protected function getModelSchemas(): ModelSchemaInfoInterface |
|
1353 | |||
1354 | /** |
||
1355 | * @return RelationshipPaginationStrategyInterface |
||
1356 | */ |
||
1357 | 8 | protected function getRelationshipPagingStrategy(): RelationshipPaginationStrategyInterface |
|
1361 | |||
1362 | /** |
||
1363 | * @param Closure $closure |
||
1364 | * |
||
1365 | * @return void |
||
1366 | * |
||
1367 | * @throws DBALException |
||
1368 | */ |
||
1369 | 10 | public function inTransaction(Closure $closure): void |
|
1379 | |||
1380 | /** |
||
1381 | * @inheritdoc |
||
1382 | * |
||
1383 | * @throws DBALException |
||
1384 | */ |
||
1385 | 22 | public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface |
|
1396 | |||
1397 | /** |
||
1398 | * @inheritdoc |
||
1399 | * |
||
1400 | * @throws DBALException |
||
1401 | */ |
||
1402 | 14 | public function fetchResource(QueryBuilder $builder, string $modelClass) |
|
1413 | |||
1414 | /** |
||
1415 | * @inheritdoc |
||
1416 | * |
||
1417 | * @throws DBALException |
||
1418 | * |
||
1419 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1420 | */ |
||
1421 | 2 | public function fetchRow(QueryBuilder $builder, string $modelClass): ?array |
|
1442 | |||
1443 | /** |
||
1444 | * @inheritdoc |
||
1445 | * |
||
1446 | * @throws DBALException |
||
1447 | * |
||
1448 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1449 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1450 | */ |
||
1451 | 5 | public function fetchColumn(QueryBuilder $builder, string $modelClass, string $columnName): iterable |
|
1476 | |||
1477 | /** |
||
1478 | * @param QueryBuilder $builder |
||
1479 | * |
||
1480 | * @return ModelQueryBuilder |
||
1481 | */ |
||
1482 | 2 | protected function createCountBuilderFromBuilder(QueryBuilder $builder): ModelQueryBuilder |
|
1490 | |||
1491 | /** |
||
1492 | * @param Connection $connection |
||
1493 | * @param string $primaryIdentity |
||
1494 | * @param string $name |
||
1495 | * @param iterable $secondaryIdentities |
||
1496 | * @param Closure $builderHook |
||
1497 | * |
||
1498 | * @return int |
||
1499 | * |
||
1500 | * @throws DBALException |
||
1501 | */ |
||
1502 | 5 | private function addInToManyRelationship( |
|
1533 | |||
1534 | /** |
||
1535 | * @param Connection $connection |
||
1536 | * @param string $primaryIdentity |
||
1537 | * @param string $name |
||
1538 | * @param iterable $secondaryIdentities |
||
1539 | * |
||
1540 | * @return int |
||
1541 | * |
||
1542 | * @throws DBALException |
||
1543 | */ |
||
1544 | 1 | private function removeInToManyRelationship( |
|
1560 | |||
1561 | /** |
||
1562 | * @param QueryBuilder $builder |
||
1563 | * @param string $modelClass |
||
1564 | * |
||
1565 | * @return mixed|null |
||
1566 | * |
||
1567 | * @throws DBALException |
||
1568 | * |
||
1569 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1570 | */ |
||
1571 | 14 | private function fetchResourceWithoutRelationships(QueryBuilder $builder, string $modelClass) |
|
1592 | |||
1593 | /** |
||
1594 | * @param QueryBuilder $builder |
||
1595 | * @param string $modelClass |
||
1596 | * @param string $keyColumnName |
||
1597 | * |
||
1598 | * @return iterable |
||
1599 | * |
||
1600 | * @throws DBALException |
||
1601 | * |
||
1602 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1603 | */ |
||
1604 | 9 | private function fetchResourcesWithoutRelationships( |
|
1626 | |||
1627 | /** |
||
1628 | * @param QueryBuilder $builder |
||
1629 | * @param string $modelClass |
||
1630 | * |
||
1631 | * @return PaginatedDataInterface |
||
1632 | * |
||
1633 | * @throws DBALException |
||
1634 | */ |
||
1635 | 27 | private function fetchPaginatedResourcesWithoutRelationships( |
|
1651 | |||
1652 | /** |
||
1653 | * @param QueryBuilder $builder |
||
1654 | * @param string $modelClass |
||
1655 | * |
||
1656 | * @return array |
||
1657 | * |
||
1658 | * @throws DBALException |
||
1659 | * |
||
1660 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1661 | */ |
||
1662 | 27 | private function fetchResourceCollection(QueryBuilder $builder, string $modelClass): array |
|
1697 | |||
1698 | /** |
||
1699 | * @param null|string $index |
||
1700 | * @param iterable $attributes |
||
1701 | * |
||
1702 | * @return iterable |
||
1703 | */ |
||
1704 | 5 | protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable |
|
1718 | |||
1719 | /** |
||
1720 | * @param iterable $attributes |
||
1721 | * |
||
1722 | * @return iterable |
||
1723 | */ |
||
1724 | 5 | protected function filterAttributesOnUpdate(iterable $attributes): iterable |
|
1733 | |||
1734 | /** |
||
1735 | * @param TagStorageInterface $modelsAtPath |
||
1736 | * @param ArrayObject $classAtPath |
||
1737 | * @param ArrayObject $idsAtPath |
||
1738 | * @param ModelStorageInterface $deDup |
||
1739 | * @param string $parentsPath |
||
1740 | * @param array $childRelationships |
||
1741 | * |
||
1742 | * @return void |
||
1743 | * |
||
1744 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
||
1745 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
||
1746 | * |
||
1747 | * @throws DBALException |
||
1748 | */ |
||
1749 | 10 | private function loadRelationshipsLayer( |
|
1858 | |||
1859 | /** |
||
1860 | * @param string $message |
||
1861 | * |
||
1862 | * @return string |
||
1863 | * |
||
1864 | * @throws ContainerExceptionInterface |
||
1865 | * @throws NotFoundExceptionInterface |
||
1866 | */ |
||
1867 | 2 | private function getMessage(string $message): string |
|
1876 | |||
1877 | /** |
||
1878 | * @param string $class |
||
1879 | * @param array $attributes |
||
1880 | * @param Type[] $typeNames |
||
1881 | * @param AbstractPlatform $platform |
||
1882 | * |
||
1883 | * @return mixed |
||
1884 | * |
||
1885 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1886 | * |
||
1887 | * @throws DBALException |
||
1888 | */ |
||
1889 | 34 | private function readResourceFromAssoc( |
|
1902 | |||
1903 | /** |
||
1904 | * @param array $attributes |
||
1905 | * @param Type[] $typeNames |
||
1906 | * @param AbstractPlatform $platform |
||
1907 | * |
||
1908 | * @return array |
||
1909 | * |
||
1910 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1911 | * |
||
1912 | * @throws DBALException |
||
1913 | */ |
||
1914 | 1 | private function readRowFromAssoc(array $attributes, array $typeNames, AbstractPlatform $platform): array |
|
1923 | |||
1924 | /** |
||
1925 | * @param iterable $attributes |
||
1926 | * @param array $typeNames |
||
1927 | * @param AbstractPlatform $platform |
||
1928 | * |
||
1929 | * @return iterable |
||
1930 | * |
||
1931 | * @throws DBALException |
||
1932 | */ |
||
1933 | 35 | private function readTypedAttributes(iterable $attributes, array $typeNames, AbstractPlatform $platform): iterable |
|
1940 | } |
||
1941 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..