Conditions | 12 |
Paths | 51 |
Total Lines | 58 |
Code Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
74 | public function isVisibleForRecord(AppRecord $record) |
||
75 | { |
||
76 | if(empty($this->visibilityCriteria)){ |
||
77 | return true; |
||
78 | } |
||
79 | |||
80 | $App = \bab_functionality::get('App'); |
||
81 | $recordSet = $record->getParentSet(); |
||
82 | |||
83 | $arrCriteria = json_decode($this->visibilityCriteria, true); |
||
84 | if(bab_charset::getIso() != bab_charset::UTF_8){ |
||
85 | $arrCriteria = app_utf8Encode($arrCriteria); |
||
86 | } |
||
87 | foreach ($arrCriteria as $fieldName => $condition){ |
||
88 | if(strpos($fieldName, '/') !== false){ |
||
89 | list ($oneField, $foreignField) = explode('/', $fieldName); |
||
90 | $field = $recordSet->$oneField()->$foreignField; |
||
91 | } |
||
92 | else{ |
||
93 | $field = $recordSet->$fieldName; |
||
94 | } |
||
95 | foreach ($condition as $op => $value){ |
||
96 | if(! is_array($value)){ |
||
97 | $criteria = $field->$op($value); |
||
98 | } |
||
99 | else{ |
||
100 | foreach ($value as $foreignClassName => $foreignValues){ |
||
101 | $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set'; |
||
102 | $foreignSet = $App->$foreignClassName(); |
||
103 | $foreignField = ''; |
||
104 | $foreignCondition = ''; |
||
105 | foreach ($foreignValues as $foreignFieldName => $foreignConditions){ |
||
106 | if($foreignFieldName === '_foreignField'){ |
||
107 | $foreignField = $foreignConditions; |
||
108 | } |
||
109 | else{ |
||
110 | foreach ($foreignConditions as $key => $val){ |
||
111 | $foreignCondition = $foreignSet->$foreignFieldName->$key($val); |
||
112 | } |
||
113 | } |
||
114 | } |
||
115 | } |
||
116 | if(method_exists($foreignSet, 'getDefaultCriteria')){ |
||
117 | $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria()); |
||
118 | } |
||
119 | $criteria = $field->in($foreignCondition, $foreignField); |
||
120 | } |
||
121 | } |
||
122 | } |
||
123 | |||
124 | $criteria = $criteria->_AND_($recordSet->id->is($record->id)); |
||
125 | |||
126 | /** |
||
127 | * @var ORMMySqlIterator |
||
128 | */ |
||
129 | $records = $recordSet->select($criteria); |
||
130 | |||
131 | return ($records->count() != 0); |
||
132 | } |
||
134 |
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