| Conditions | 12 | 
| Paths | 28 | 
| Total Lines | 40 | 
| Code Lines | 26 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 83 | public function load($type, $parameters = [], $responseType = LoaderInterface::SINGLE)  | 
            ||
| 84 |     { | 
            ||
| 85 | $criteria = new Criteria();  | 
            ||
| 86 |         if ($responseType === LoaderInterface::COLLECTION) { | 
            ||
| 87 |             if (array_key_exists('contentListId', $parameters) && is_numeric($parameters['contentListId'])) { | 
            ||
| 88 | $contentList = $this->contentListRepository->findOneBy(['id' => $parameters['contentListId']]);  | 
            ||
| 89 |                 $criteria->set('contentList', $contentList); | 
            ||
| 90 |             } elseif (array_key_exists('contentListName', $parameters) && is_string($parameters['contentListName'])) { | 
            ||
| 91 | $contentList = $this->contentListRepository->findOneBy(['name' => $parameters['contentListName']]);  | 
            ||
| 92 |                 $criteria->set('contentList', $contentList); | 
            ||
| 93 | }  | 
            ||
| 94 | |||
| 95 |             if (!$criteria->has('contentList')) { | 
            ||
| 96 | return false;  | 
            ||
| 97 | }  | 
            ||
| 98 | |||
| 99 |             if (array_key_exists('sticky', $parameters) && is_bool($parameters['sticky'])) { | 
            ||
| 100 |                 $criteria->set('sticky', $parameters['sticky']); | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 103 | $criteria = $this->applyPaginationToCriteria($criteria, $parameters);  | 
            ||
| 104 |             $contentListItems = $this->contentListItemsRepository->getPaginatedByCriteria($criteria, $criteria->get('order', [ | 
            ||
| 105 | 'sticky' => 'desc',  | 
            ||
| 106 | ]));  | 
            ||
| 107 | $itemsCollection = new ArrayCollection($contentListItems->getItems());  | 
            ||
| 108 |             if ($itemsCollection->count() > 0) { | 
            ||
| 109 | $metaCollection = new MetaCollection();  | 
            ||
| 110 | $metaCollection->setTotalItemsCount($contentListItems->getTotalItemCount());  | 
            ||
| 111 |                 foreach ($itemsCollection as $item) { | 
            ||
| 112 | $itemMeta = $this->getItemMeta($item);  | 
            ||
| 113 |                     if (null !== $itemMeta) { | 
            ||
| 114 | $metaCollection->add($itemMeta);  | 
            ||
| 115 | }  | 
            ||
| 116 | }  | 
            ||
| 117 | unset($itemsCollection, $criteria);  | 
            ||
| 118 | |||
| 119 | return $metaCollection;  | 
            ||
| 120 | }  | 
            ||
| 121 | }  | 
            ||
| 122 | }  | 
            ||
| 123 | |||
| 145 |