Conditions | 14 |
Paths | 261 |
Total Lines | 43 |
Code Lines | 28 |
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 |
||
17 | public static function statementForward($org_id) { |
||
18 | $criteria = ObjectCompletionCriterion::where('org_id', $org_id)->whereHas(\Object::class, function($q){ |
||
19 | $q->where("completion_type", Types::XAPI); |
||
20 | })->with('object')->get(); |
||
21 | |||
22 | if (sizeof($criteria) === 0 ){ |
||
23 | // if there are no criteria |
||
24 | return false; |
||
25 | } else { |
||
26 | //if there is criteria |
||
27 | $queries = []; |
||
28 | |||
29 | foreach ($criteria as $criterion) { |
||
30 | $course = $criterion->object->course; |
||
31 | if (empty($course) || ($course && !empty($course->deleted_at))) { |
||
32 | continue; |
||
33 | } |
||
34 | $criteriaQuery = []; |
||
35 | $criteriaQuery['$comment'] = 'id:' . $criterion->id . ', object_id:' . $criterion->object_id; |
||
36 | $activity_id = $criterion->use_curatr_activity ? $criterion->object->getXapiUrl(true, true) : $criterion->activity_id; |
||
37 | $criteriaQuery['statement.object.id'] = $activity_id; |
||
38 | if (!empty($criterion->verb)) $criteriaQuery['statement.verb.id'] = $criterion->verb; |
||
39 | if (!empty($criterion->completion)) $criteriaQuery['statement.result.completion'] = true; |
||
40 | if (!empty($criterion->success)) $criteriaQuery['statement.result.success'] = true; |
||
41 | if (is_numeric($criterion->raw)) $criteriaQuery['statement.result.score.raw'] = ['$gte' => floatval($criterion->raw)]; |
||
42 | if (is_numeric($criterion->scaled)) $criteriaQuery['statement.result.score.scaled'] = ['$gte' => floatval($criterion->scaled)]; |
||
43 | |||
44 | if (sizeof($criteriaQuery) > 0) { |
||
45 | $queries[] = $criteriaQuery; |
||
46 | } |
||
47 | } |
||
48 | if (sizeof($queries) === 0 ){ |
||
49 | // if there are no quries |
||
50 | return false; |
||
51 | } |
||
52 | |||
53 | $query = [ |
||
54 | '$comment' => self::COMMENT, |
||
55 | '$or'=>$queries |
||
56 | ]; |
||
57 | } |
||
58 | |||
59 | return json_encode($query); |
||
60 | } |
||
90 |
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