Passed
Push — main ( a046ab...113669 )
by Nicolaas
38:03 queued 29:48
created
Category
src/Extension/DefaultPredictExtension.php 1 patch
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,14 +38,11 @@  discard block
 block discarded – undo
38 38
         $className = $owner->ClassName;
39 39
 
40 40
         // work out limit and treshold
41
-        $limit = Config::inst()->get($className, 'default_predictor_limit') ?:
42
-            Config::inst()->get(DefaultPredictExtension::class, 'base_default_predictor_limit');
41
+        $limit = Config::inst()->get($className, 'default_predictor_limit') ?: Config::inst()->get(DefaultPredictExtension::class, 'base_default_predictor_limit');
43 42
 
44
-        $threshold = Config::inst()->get($className, 'default_predictor_threshold') ?:
45
-            Config::inst()->get(DefaultPredictExtension::class, 'base_default_predictor_threshold');
43
+        $threshold = Config::inst()->get($className, 'default_predictor_threshold') ?: Config::inst()->get(DefaultPredictExtension::class, 'base_default_predictor_threshold');
46 44
 
47
-        $recencyFactor = Config::inst()->get($className, 'default_predictor_recency_factor') ?:
48
-            Config::inst()->get(DefaultPredictExtension::class, 'base_default_predictor_recency_factor');
45
+        $recencyFactor = Config::inst()->get($className, 'default_predictor_recency_factor') ?: Config::inst()->get(DefaultPredictExtension::class, 'base_default_predictor_recency_factor');
49 46
 
50 47
         $predicts = $this->getDefaultPredictionPredictor($limit, $threshold, $recencyFactor);
51 48
 
@@ -93,7 +90,7 @@  discard block
 block discarded – undo
93 90
             $max = 0;
94 91
             foreach ($objectArray as $pos => $object) {
95 92
                 $value = $object->{$fieldName};
96
-                if (! $value) {
93
+                if (!$value) {
97 94
                     $value = '';
98 95
                 }
99 96
                 // give more weight to the last one used.
@@ -127,7 +124,7 @@  discard block
 block discarded – undo
127 124
         $fieldsHasOne = array_keys(Config::inst()->get($className, 'has_one'));
128 125
 
129 126
         // add ID part to has_one fields
130
-        array_walk($fieldsHasOne, function (&$value, $key) {
127
+        array_walk($fieldsHasOne, function(&$value, $key) {
131 128
             $value .= 'ID';
132 129
         });
133 130
 
@@ -159,7 +156,7 @@  discard block
 block discarded – undo
159 156
         $num = count($array); // provides the value for num
160 157
 
161 158
         return array_map(
162
-            function ($val) use ($num) {
159
+            function($val) use ($num) {
163 160
                 return $val / $num;
164 161
             },
165 162
             array_count_values($array) // provides the value for $val
Please login to merge, or discard this patch.