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 namespace Limoncello\Flute\Api; |
||
59 | class Crud implements CrudInterface |
||
60 | { |
||
61 | use HasContainerTrait; |
||
62 | |||
63 | /** Internal constant. Path constant. */ |
||
64 | protected const ROOT_PATH = ''; |
||
65 | |||
66 | /** Internal constant. Path constant. */ |
||
67 | protected const PATH_SEPARATOR = DocumentInterface::PATH_SEPARATOR; |
||
68 | |||
69 | /** |
||
70 | * @var FactoryInterface |
||
71 | */ |
||
72 | private $factory; |
||
73 | |||
74 | /** |
||
75 | * @var string |
||
76 | */ |
||
77 | private $modelClass; |
||
78 | |||
79 | /** |
||
80 | * @var ModelSchemaInfoInterface |
||
81 | */ |
||
82 | private $modelSchemas; |
||
83 | |||
84 | /** |
||
85 | * @var RelationshipPaginationStrategyInterface |
||
86 | */ |
||
87 | private $relPagingStrategy; |
||
88 | |||
89 | /** |
||
90 | * @var Connection |
||
91 | */ |
||
92 | private $connection; |
||
93 | |||
94 | /** |
||
95 | * @var iterable|null |
||
96 | */ |
||
97 | private $filterParameters = null; |
||
98 | |||
99 | /** |
||
100 | * @var bool |
||
101 | */ |
||
102 | private $areFiltersWithAnd = true; |
||
103 | |||
104 | /** |
||
105 | * @var iterable|null |
||
106 | */ |
||
107 | private $sortingParameters = null; |
||
108 | |||
109 | /** |
||
110 | * @var array |
||
111 | */ |
||
112 | private $relFiltersAndSorts = []; |
||
113 | |||
114 | /** |
||
115 | * @var iterable|null |
||
116 | */ |
||
117 | private $includePaths = null; |
||
118 | |||
119 | /** |
||
120 | * @var int|null |
||
121 | */ |
||
122 | private $pagingOffset = null; |
||
123 | |||
124 | /** |
||
125 | * @var Closure|null |
||
126 | */ |
||
127 | private $columnMapper = null; |
||
128 | |||
129 | /** |
||
130 | * @var bool |
||
131 | */ |
||
132 | private $isFetchTyped; |
||
133 | |||
134 | /** |
||
135 | * @var int|null |
||
136 | */ |
||
137 | private $pagingLimit = null; |
||
138 | |||
139 | /** internal constant */ |
||
140 | private const REL_FILTERS_AND_SORTS__FILTERS = 0; |
||
141 | |||
142 | /** internal constant */ |
||
143 | private const REL_FILTERS_AND_SORTS__SORTS = 1; |
||
144 | |||
145 | /** |
||
146 | * @param ContainerInterface $container |
||
147 | * @param string $modelClass |
||
148 | * |
||
149 | * @throws ContainerExceptionInterface |
||
150 | * @throws NotFoundExceptionInterface |
||
151 | */ |
||
152 | 63 | public function __construct(ContainerInterface $container, string $modelClass) |
|
164 | |||
165 | /** |
||
166 | * @param Closure $mapper |
||
167 | * |
||
168 | * @return self |
||
169 | */ |
||
170 | 1 | public function withColumnMapper(Closure $mapper): self |
|
176 | |||
177 | /** |
||
178 | * @inheritdoc |
||
179 | */ |
||
180 | 43 | public function withFilters(iterable $filterParameters): CrudInterface |
|
186 | |||
187 | /** |
||
188 | * @inheritdoc |
||
189 | */ |
||
190 | 24 | public function withIndexFilter($index): CrudInterface |
|
205 | |||
206 | /** |
||
207 | * @inheritdoc |
||
208 | */ |
||
209 | 2 | public function withIndexesFilter(array $indexes): CrudInterface |
|
230 | |||
231 | /** |
||
232 | * @inheritdoc |
||
233 | */ |
||
234 | 7 | public function withRelationshipFilters(string $name, iterable $filters): CrudInterface |
|
242 | |||
243 | /** |
||
244 | * @inheritdoc |
||
245 | */ |
||
246 | 1 | public function withRelationshipSorts(string $name, iterable $sorts): CrudInterface |
|
254 | |||
255 | /** |
||
256 | * @inheritdoc |
||
257 | */ |
||
258 | 16 | public function combineWithAnd(): CrudInterface |
|
264 | |||
265 | /** |
||
266 | * @inheritdoc |
||
267 | */ |
||
268 | 2 | public function combineWithOr(): CrudInterface |
|
274 | |||
275 | /** |
||
276 | * @return bool |
||
277 | */ |
||
278 | 38 | private function hasColumnMapper(): bool |
|
282 | |||
283 | /** |
||
284 | * @return Closure |
||
285 | */ |
||
286 | 1 | private function getColumnMapper(): Closure |
|
290 | |||
291 | /** |
||
292 | * @return bool |
||
293 | */ |
||
294 | 47 | private function hasFilters(): bool |
|
298 | |||
299 | /** |
||
300 | * @return iterable |
||
301 | */ |
||
302 | 36 | private function getFilters(): iterable |
|
306 | |||
307 | /** |
||
308 | * @return bool |
||
309 | */ |
||
310 | 36 | private function areFiltersWithAnd(): bool |
|
314 | |||
315 | /** |
||
316 | * @inheritdoc |
||
317 | */ |
||
318 | 17 | public function withSorts(iterable $sortingParameters): CrudInterface |
|
324 | |||
325 | /** |
||
326 | * @return bool |
||
327 | */ |
||
328 | 38 | private function hasSorts(): bool |
|
332 | |||
333 | /** |
||
334 | * @return iterable |
||
335 | */ |
||
336 | 11 | private function getSorts(): ?iterable |
|
340 | |||
341 | /** |
||
342 | * @inheritdoc |
||
343 | */ |
||
344 | 21 | public function withIncludes(iterable $includePaths): CrudInterface |
|
350 | |||
351 | /** |
||
352 | * @return bool |
||
353 | */ |
||
354 | 36 | private function hasIncludes(): bool |
|
358 | |||
359 | /** |
||
360 | * @return iterable |
||
361 | */ |
||
362 | 21 | private function getIncludes(): iterable |
|
366 | |||
367 | /** |
||
368 | * @inheritdoc |
||
369 | */ |
||
370 | 20 | public function withPaging(int $offset, int $limit): CrudInterface |
|
377 | |||
378 | /** |
||
379 | * @inheritdoc |
||
380 | */ |
||
381 | 1 | public function withoutPaging(): CrudInterface |
|
388 | |||
389 | /** |
||
390 | * @return self |
||
391 | */ |
||
392 | 63 | public function shouldBeTyped(): self |
|
398 | |||
399 | /** |
||
400 | * @return self |
||
401 | */ |
||
402 | 4 | public function shouldBeUntyped(): self |
|
408 | |||
409 | /** |
||
410 | * @return bool |
||
411 | */ |
||
412 | 45 | private function hasPaging(): bool |
|
416 | |||
417 | /** |
||
418 | * @return int |
||
419 | */ |
||
420 | 18 | private function getPagingOffset(): int |
|
424 | |||
425 | /** |
||
426 | * @return int |
||
427 | */ |
||
428 | 18 | private function getPagingLimit(): int |
|
432 | |||
433 | /** |
||
434 | * @return bool |
||
435 | */ |
||
436 | 43 | private function isFetchTyped(): bool |
|
440 | |||
441 | /** |
||
442 | * @return Connection |
||
443 | */ |
||
444 | 50 | protected function getConnection(): Connection |
|
448 | |||
449 | /** |
||
450 | * @param string $modelClass |
||
451 | * |
||
452 | * @return ModelQueryBuilder |
||
453 | */ |
||
454 | 48 | protected function createBuilder(string $modelClass): ModelQueryBuilder |
|
458 | |||
459 | /** |
||
460 | * @param Connection $connection |
||
461 | * @param string $modelClass |
||
462 | * |
||
463 | * @return ModelQueryBuilder |
||
464 | */ |
||
465 | 50 | private function createBuilderFromConnection(Connection $connection, string $modelClass): ModelQueryBuilder |
|
469 | |||
470 | /** |
||
471 | * @param ModelQueryBuilder $builder |
||
472 | * |
||
473 | * @return Crud |
||
474 | */ |
||
475 | 38 | protected function applyColumnMapper(ModelQueryBuilder $builder): self |
|
483 | |||
484 | /** |
||
485 | * @param ModelQueryBuilder $builder |
||
486 | * |
||
487 | * @return Crud |
||
488 | * |
||
489 | * @throws DBALException |
||
490 | */ |
||
491 | 38 | protected function applyAliasFilters(ModelQueryBuilder $builder): self |
|
501 | |||
502 | /** |
||
503 | * @param ModelQueryBuilder $builder |
||
504 | * |
||
505 | * @return self |
||
506 | * |
||
507 | * @throws DBALException |
||
508 | */ |
||
509 | 4 | protected function applyTableFilters(ModelQueryBuilder $builder): self |
|
519 | |||
520 | /** |
||
521 | * @param ModelQueryBuilder $builder |
||
522 | * |
||
523 | * @return self |
||
524 | * |
||
525 | * @throws DBALException |
||
526 | */ |
||
527 | 38 | protected function applyRelationshipFiltersAndSorts(ModelQueryBuilder $builder): self |
|
548 | |||
549 | /** |
||
550 | * @param ModelQueryBuilder $builder |
||
551 | * |
||
552 | * @return self |
||
553 | */ |
||
554 | 38 | protected function applySorts(ModelQueryBuilder $builder): self |
|
562 | |||
563 | /** |
||
564 | * @param ModelQueryBuilder $builder |
||
565 | * |
||
566 | * @return self |
||
567 | */ |
||
568 | 45 | protected function applyPaging(ModelQueryBuilder $builder): self |
|
577 | |||
578 | /** |
||
579 | * @return self |
||
580 | */ |
||
581 | 63 | protected function clearBuilderParameters(): self |
|
593 | |||
594 | /** |
||
595 | * @return self |
||
596 | */ |
||
597 | 63 | private function clearFetchParameters(): self |
|
604 | |||
605 | /** |
||
606 | * @param ModelQueryBuilder $builder |
||
607 | * |
||
608 | * @return ModelQueryBuilder |
||
609 | */ |
||
610 | 2 | protected function builderOnCount(ModelQueryBuilder $builder): ModelQueryBuilder |
|
614 | |||
615 | /** |
||
616 | * @param ModelQueryBuilder $builder |
||
617 | * |
||
618 | * @return ModelQueryBuilder |
||
619 | */ |
||
620 | 38 | protected function builderOnIndex(ModelQueryBuilder $builder): ModelQueryBuilder |
|
624 | |||
625 | /** |
||
626 | * @param ModelQueryBuilder $builder |
||
627 | * |
||
628 | * @return ModelQueryBuilder |
||
629 | */ |
||
630 | 7 | protected function builderOnReadRelationship(ModelQueryBuilder $builder): ModelQueryBuilder |
|
634 | |||
635 | /** |
||
636 | * @param ModelQueryBuilder $builder |
||
637 | * |
||
638 | * @return ModelQueryBuilder |
||
639 | */ |
||
640 | 4 | protected function builderSaveResourceOnCreate(ModelQueryBuilder $builder): ModelQueryBuilder |
|
644 | |||
645 | /** |
||
646 | * @param ModelQueryBuilder $builder |
||
647 | * |
||
648 | * @return ModelQueryBuilder |
||
649 | */ |
||
650 | 4 | protected function builderSaveResourceOnUpdate(ModelQueryBuilder $builder): ModelQueryBuilder |
|
654 | |||
655 | /** |
||
656 | * @param string $relationshipName |
||
657 | * @param ModelQueryBuilder $builder |
||
658 | * |
||
659 | * @return ModelQueryBuilder |
||
660 | * |
||
661 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
662 | */ |
||
663 | 2 | protected function builderSaveRelationshipOnCreate(/** @noinspection PhpUnusedParameterInspection */ |
|
669 | |||
670 | /** |
||
671 | * @param string $relationshipName |
||
672 | * @param ModelQueryBuilder $builder |
||
673 | * |
||
674 | * @return ModelQueryBuilder |
||
675 | * |
||
676 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
677 | */ |
||
678 | 2 | protected function builderSaveRelationshipOnUpdate(/** @noinspection PhpUnusedParameterInspection */ |
|
684 | |||
685 | /** |
||
686 | * @param string $relationshipName |
||
687 | * @param ModelQueryBuilder $builder |
||
688 | * |
||
689 | * @return ModelQueryBuilder |
||
690 | * |
||
691 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
692 | */ |
||
693 | 1 | protected function builderOnCreateInBelongsToManyRelationship(/** @noinspection PhpUnusedParameterInspection */ |
|
699 | |||
700 | /** |
||
701 | * @param string $relationshipName |
||
702 | * @param ModelQueryBuilder $builder |
||
703 | * |
||
704 | * @return ModelQueryBuilder |
||
705 | * |
||
706 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
707 | */ |
||
708 | 1 | protected function builderOnRemoveInBelongsToManyRelationship(/** @noinspection PhpUnusedParameterInspection */ |
|
714 | |||
715 | /** |
||
716 | * @param string $relationshipName |
||
717 | * @param ModelQueryBuilder $builder |
||
718 | * |
||
719 | * @return ModelQueryBuilder |
||
720 | * |
||
721 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
722 | */ |
||
723 | 2 | protected function builderCleanRelationshipOnUpdate(/** @noinspection PhpUnusedParameterInspection */ |
|
729 | |||
730 | /** |
||
731 | * @param ModelQueryBuilder $builder |
||
732 | * |
||
733 | * @return ModelQueryBuilder |
||
734 | */ |
||
735 | 4 | protected function builderOnDelete(ModelQueryBuilder $builder): ModelQueryBuilder |
|
739 | |||
740 | /** |
||
741 | * @param PaginatedDataInterface|mixed|null $data |
||
742 | * |
||
743 | * @return void |
||
744 | * |
||
745 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
746 | * |
||
747 | * @throws DBALException |
||
748 | */ |
||
749 | 21 | private function loadRelationships($data): void |
|
798 | |||
799 | /** |
||
800 | * A helper to remember all model related data. Helps to ensure we consistently handle models in CRUD. |
||
801 | * |
||
802 | * @param mixed $model |
||
803 | * @param string $path |
||
804 | * @param ModelSchemaInfoInterface $modelSchemas |
||
805 | * @param ModelStorageInterface $modelStorage |
||
806 | * @param TagStorageInterface $modelsAtPath |
||
807 | * @param ArrayObject $idsAtPath |
||
808 | * |
||
809 | * @return mixed |
||
810 | */ |
||
811 | 21 | private static function registerModelAtPath( |
|
829 | |||
830 | /** |
||
831 | * @param iterable $paths (string[]) |
||
832 | * |
||
833 | * @return iterable |
||
834 | */ |
||
835 | 21 | private static function getPaths(iterable $paths): iterable |
|
872 | |||
873 | /** |
||
874 | * @inheritdoc |
||
875 | * |
||
876 | * @throws DBALException |
||
877 | */ |
||
878 | 3 | public function createIndexBuilder(iterable $columns = null): QueryBuilder |
|
882 | |||
883 | /** |
||
884 | * @inheritdoc |
||
885 | * |
||
886 | * @throws DBALException |
||
887 | */ |
||
888 | 4 | public function createDeleteBuilder(): QueryBuilder |
|
892 | |||
893 | /** |
||
894 | * @param iterable|null $columns |
||
895 | * |
||
896 | * @return ModelQueryBuilder |
||
897 | * |
||
898 | * @throws DBALException |
||
899 | */ |
||
900 | 38 | protected function createIndexModelBuilder(iterable $columns = null): ModelQueryBuilder |
|
923 | |||
924 | /** |
||
925 | * @return ModelQueryBuilder |
||
926 | * |
||
927 | * @throws DBALException |
||
928 | */ |
||
929 | 4 | protected function createDeleteModelBuilder(): ModelQueryBuilder |
|
943 | |||
944 | /** |
||
945 | * @inheritdoc |
||
946 | * |
||
947 | * @throws DBALException |
||
948 | */ |
||
949 | 17 | public function index(): PaginatedDataInterface |
|
956 | |||
957 | /** |
||
958 | * @inheritdoc |
||
959 | * |
||
960 | * @throws DBALException |
||
961 | */ |
||
962 | 4 | public function indexIdentities(): array |
|
972 | |||
973 | /** |
||
974 | * @inheritdoc |
||
975 | * |
||
976 | * @throws DBALException |
||
977 | */ |
||
978 | 15 | public function read($index) |
|
987 | |||
988 | /** |
||
989 | * @inheritdoc |
||
990 | * |
||
991 | * @throws DBALException |
||
992 | */ |
||
993 | 2 | public function count(): ?int |
|
1001 | |||
1002 | /** |
||
1003 | * @param string $relationshipName |
||
1004 | * @param iterable|null $relationshipFilters |
||
1005 | * @param iterable|null $relationshipSorts |
||
1006 | * @param iterable|null $columns |
||
1007 | * |
||
1008 | * @return ModelQueryBuilder |
||
1009 | * |
||
1010 | * @throws DBALException |
||
1011 | */ |
||
1012 | 7 | public function createReadRelationshipBuilder( |
|
1057 | |||
1058 | /** |
||
1059 | * @inheritdoc |
||
1060 | * |
||
1061 | * @throws DBALException |
||
1062 | */ |
||
1063 | 6 | public function indexRelationship( |
|
1086 | |||
1087 | /** |
||
1088 | * @inheritdoc |
||
1089 | * |
||
1090 | * @throws DBALException |
||
1091 | */ |
||
1092 | 2 | public function indexRelationshipIdentities( |
|
1122 | |||
1123 | /** |
||
1124 | * @inheritdoc |
||
1125 | */ |
||
1126 | 3 | public function readRelationship( |
|
1134 | |||
1135 | /** |
||
1136 | * @inheritdoc |
||
1137 | */ |
||
1138 | 3 | public function hasInRelationship($parentId, string $name, $childId): bool |
|
1163 | |||
1164 | /** |
||
1165 | * @inheritdoc |
||
1166 | * |
||
1167 | * @throws DBALException |
||
1168 | */ |
||
1169 | 1 | public function delete(): int |
|
1177 | |||
1178 | /** |
||
1179 | * @inheritdoc |
||
1180 | * |
||
1181 | * @throws DBALException |
||
1182 | */ |
||
1183 | 5 | public function remove($index): bool |
|
1193 | |||
1194 | /** |
||
1195 | * @inheritdoc |
||
1196 | * |
||
1197 | * @throws DBALException |
||
1198 | * |
||
1199 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1200 | */ |
||
1201 | 5 | public function create($index, iterable $attributes, iterable $toMany): string |
|
1231 | |||
1232 | /** |
||
1233 | * @inheritdoc |
||
1234 | * |
||
1235 | * @throws DBALException |
||
1236 | * |
||
1237 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1238 | */ |
||
1239 | 5 | public function update($index, iterable $attributes, iterable $toMany): int |
|
1290 | |||
1291 | /** |
||
1292 | * @param string $parentId |
||
1293 | * @param string $name |
||
1294 | * @param iterable $childIds |
||
1295 | * |
||
1296 | * @return int |
||
1297 | * |
||
1298 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1299 | */ |
||
1300 | 1 | public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
|
1318 | |||
1319 | /** |
||
1320 | * @inheritdoc |
||
1321 | * |
||
1322 | * @throws DBALException |
||
1323 | */ |
||
1324 | 1 | public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
|
1340 | |||
1341 | /** |
||
1342 | * @return FactoryInterface |
||
1343 | */ |
||
1344 | 50 | protected function getFactory(): FactoryInterface |
|
1348 | |||
1349 | /** |
||
1350 | * @return string |
||
1351 | */ |
||
1352 | 51 | protected function getModelClass(): string |
|
1356 | |||
1357 | /** |
||
1358 | * @return ModelSchemaInfoInterface |
||
1359 | */ |
||
1360 | 51 | protected function getModelSchemas(): ModelSchemaInfoInterface |
|
1364 | |||
1365 | /** |
||
1366 | * @return RelationshipPaginationStrategyInterface |
||
1367 | */ |
||
1368 | 8 | protected function getRelationshipPagingStrategy(): RelationshipPaginationStrategyInterface |
|
1372 | |||
1373 | /** |
||
1374 | * @param Closure $closure |
||
1375 | * |
||
1376 | * @return void |
||
1377 | * |
||
1378 | * @throws DBALException |
||
1379 | */ |
||
1380 | 8 | public function inTransaction(Closure $closure): void |
|
1390 | |||
1391 | /** |
||
1392 | * @inheritdoc |
||
1393 | * |
||
1394 | * @throws DBALException |
||
1395 | */ |
||
1396 | 22 | public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface |
|
1407 | |||
1408 | /** |
||
1409 | * @inheritdoc |
||
1410 | * |
||
1411 | * @throws DBALException |
||
1412 | */ |
||
1413 | 14 | public function fetchResource(QueryBuilder $builder, string $modelClass) |
|
1424 | |||
1425 | /** |
||
1426 | * @inheritdoc |
||
1427 | * |
||
1428 | * @throws DBALException |
||
1429 | * |
||
1430 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1431 | */ |
||
1432 | 2 | public function fetchRow(QueryBuilder $builder, string $modelClass): ?array |
|
1453 | |||
1454 | /** |
||
1455 | * @inheritdoc |
||
1456 | * |
||
1457 | * @throws DBALException |
||
1458 | * |
||
1459 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1460 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1461 | */ |
||
1462 | 5 | public function fetchColumn(QueryBuilder $builder, string $modelClass, string $columnName): iterable |
|
1487 | |||
1488 | /** |
||
1489 | * @param QueryBuilder $builder |
||
1490 | * |
||
1491 | * @return ModelQueryBuilder |
||
1492 | */ |
||
1493 | 2 | protected function createCountBuilderFromBuilder(QueryBuilder $builder): ModelQueryBuilder |
|
1501 | |||
1502 | /** |
||
1503 | * @param Connection $connection |
||
1504 | * @param string $primaryIdentity |
||
1505 | * @param string $name |
||
1506 | * @param iterable $secondaryIdentities |
||
1507 | * @param Closure $builderHook |
||
1508 | * |
||
1509 | * @return int |
||
1510 | */ |
||
1511 | 5 | private function addInToManyRelationship( |
|
1542 | |||
1543 | /** |
||
1544 | * @param Connection $connection |
||
1545 | * @param string $primaryIdentity |
||
1546 | * @param string $name |
||
1547 | * @param iterable $secondaryIdentities |
||
1548 | * |
||
1549 | * @return int |
||
1550 | * |
||
1551 | * @throws DBALException |
||
1552 | */ |
||
1553 | 1 | private function removeInToManyRelationship( |
|
1569 | |||
1570 | /** |
||
1571 | * @param QueryBuilder $builder |
||
1572 | * @param string $modelClass |
||
1573 | * |
||
1574 | * @return mixed|null |
||
1575 | * |
||
1576 | * @throws DBALException |
||
1577 | * |
||
1578 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1579 | */ |
||
1580 | 14 | private function fetchResourceWithoutRelationships(QueryBuilder $builder, string $modelClass) |
|
1601 | |||
1602 | /** |
||
1603 | * @param QueryBuilder $builder |
||
1604 | * @param string $modelClass |
||
1605 | * @param string $keyColumnName |
||
1606 | * |
||
1607 | * @return iterable |
||
1608 | * |
||
1609 | * @throws DBALException |
||
1610 | * |
||
1611 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1612 | */ |
||
1613 | 9 | private function fetchResourcesWithoutRelationships( |
|
1635 | |||
1636 | /** |
||
1637 | * @param QueryBuilder $builder |
||
1638 | * @param string $modelClass |
||
1639 | * |
||
1640 | * @return PaginatedDataInterface |
||
1641 | * |
||
1642 | * @throws DBALException |
||
1643 | */ |
||
1644 | 27 | private function fetchPaginatedResourcesWithoutRelationships( |
|
1660 | |||
1661 | /** |
||
1662 | * @param QueryBuilder $builder |
||
1663 | * @param string $modelClass |
||
1664 | * |
||
1665 | * @return array |
||
1666 | * |
||
1667 | * @throws DBALException |
||
1668 | * |
||
1669 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
1670 | */ |
||
1671 | 27 | private function fetchResourceCollection(QueryBuilder $builder, string $modelClass): array |
|
1706 | |||
1707 | /** |
||
1708 | * @param null|string $index |
||
1709 | * @param iterable $attributes |
||
1710 | * |
||
1711 | * @return iterable |
||
1712 | */ |
||
1713 | 4 | protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable |
|
1727 | |||
1728 | /** |
||
1729 | * @param iterable $attributes |
||
1730 | * |
||
1731 | * @return iterable |
||
1732 | */ |
||
1733 | 4 | protected function filterAttributesOnUpdate(iterable $attributes): iterable |
|
1742 | |||
1743 | /** |
||
1744 | * @param TagStorageInterface $modelsAtPath |
||
1745 | * @param ArrayObject $classAtPath |
||
1746 | * @param ArrayObject $idsAtPath |
||
1747 | * @param ModelStorageInterface $deDup |
||
1748 | * @param string $parentsPath |
||
1749 | * @param array $childRelationships |
||
1750 | * |
||
1751 | * @return void |
||
1752 | * |
||
1753 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
||
1754 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
||
1755 | * |
||
1756 | * @throws DBALException |
||
1757 | */ |
||
1758 | 10 | private function loadRelationshipsLayer( |
|
1867 | |||
1868 | /** |
||
1869 | * @param string $message |
||
1870 | * |
||
1871 | * @return string |
||
1872 | * |
||
1873 | * @throws ContainerExceptionInterface |
||
1874 | * @throws NotFoundExceptionInterface |
||
1875 | */ |
||
1876 | 8 | private function getMessage(string $message): string |
|
1885 | |||
1886 | /** |
||
1887 | * @param string $class |
||
1888 | * @param array $attributes |
||
1889 | * @param Type[] $typeNames |
||
1890 | * @param AbstractPlatform $platform |
||
1891 | * |
||
1892 | * @return mixed |
||
1893 | * |
||
1894 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1895 | * |
||
1896 | * @throws DBALException |
||
1897 | */ |
||
1898 | 34 | private function readResourceFromAssoc( |
|
1911 | |||
1912 | /** |
||
1913 | * @param array $attributes |
||
1914 | * @param Type[] $typeNames |
||
1915 | * @param AbstractPlatform $platform |
||
1916 | * |
||
1917 | * @return array |
||
1918 | * |
||
1919 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1920 | * |
||
1921 | * @throws DBALException |
||
1922 | */ |
||
1923 | 1 | private function readRowFromAssoc(array $attributes, array $typeNames, AbstractPlatform $platform): array |
|
1932 | |||
1933 | /** |
||
1934 | * @param iterable $attributes |
||
1935 | * @param array $typeNames |
||
1936 | * @param AbstractPlatform $platform |
||
1937 | * |
||
1938 | * @return iterable |
||
1939 | * |
||
1940 | * @throws DBALException |
||
1941 | */ |
||
1942 | 35 | private function readTypedAttributes(iterable $attributes, array $typeNames, AbstractPlatform $platform): iterable |
|
1949 | } |
||
1950 |
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..