| Conditions | 9 |
| Paths | 9 |
| Total Lines | 55 |
| Code Lines | 37 |
| 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 |
||
| 37 | public static function getMap() |
||
| 38 | { |
||
| 39 | if (!is_null(static::$map['IBLOCK_CODE'])) { |
||
| 40 | return static::$map['IBLOCK_CODE']; |
||
| 41 | } |
||
| 42 | |||
| 43 | $propertyList = PropertyTable::getList([ |
||
| 44 | 'filter' => [ |
||
| 45 | 'IBLOCK_ID' => static::getIblockId(), |
||
| 46 | ], |
||
| 47 | 'cache' => [ |
||
| 48 | 'ttl' => static::TTL * 60, |
||
| 49 | ], |
||
| 50 | ])->fetchAll(); |
||
| 51 | |||
| 52 | $fields = [ |
||
| 53 | 'IBLOCK_ELEMENT_ID' => new IntegerField( |
||
| 54 | 'IBLOCK_ELEMENT_ID', |
||
| 55 | [ |
||
| 56 | 'title' => 'Идентификатор элемента инфоблока', |
||
| 57 | ] |
||
| 58 | ), |
||
| 59 | ]; |
||
| 60 | foreach ($propertyList as $property) { |
||
| 61 | $class = StringField::class; |
||
| 62 | switch ($property['PROPERTY_TYPE']) { |
||
| 63 | case PropertyTable::TYPE_STRING: |
||
| 64 | $class = StringField::class; |
||
| 65 | break; |
||
| 66 | case PropertyTable::TYPE_NUMBER: |
||
| 67 | $class = NumberField::class; |
||
| 68 | break; |
||
| 69 | case PropertyTable::TYPE_FILE: |
||
| 70 | $class = NumberField::class; |
||
| 71 | break; |
||
| 72 | case PropertyTable::TYPE_ELEMENT: |
||
| 73 | $class = StringField::class; |
||
| 74 | break; |
||
| 75 | case PropertyTable::TYPE_SECTION: |
||
| 76 | $class = StringField::class; |
||
| 77 | break; |
||
| 78 | case PropertyTable::TYPE_LIST: |
||
| 79 | $class = StringField::class; |
||
| 80 | break; |
||
| 81 | } |
||
| 82 | |||
| 83 | $fields[$property['CODE']] = new $class( |
||
| 84 | 'PROPERTY_' . $property['ID'], |
||
| 85 | [ |
||
| 86 | 'title' => $property['NAME'], |
||
| 87 | ] |
||
| 88 | ); |
||
| 89 | } |
||
| 90 | |||
| 91 | return static::$map['IBLOCK_CODE'] = $fields; |
||
| 92 | } |
||
| 94 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths