Completed
Push — develop ( 6f5f19...d2e0ce )
by Arkadiusz
02:17
created

Predictable::predict()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 3
eloc 8
nc 2
nop 1
1
<?php
2
3
declare (strict_types = 1);
4
5
namespace Phpml\Classifier\Traits;
6
7
trait Predictable
8
{
9
    /**
10
     * @param array $samples
11
     *
12
     * @return mixed
13
     */
14
    public function predict(array $samples)
15
    {
16
        if (!is_array($samples[0])) {
17
            $predicted = $this->predictSample($samples);
0 ignored issues
show
Bug introduced by
The method predictSample() does not exist on Phpml\Classifier\Traits\Predictable. Did you maybe mean predict()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
18
        } else {
19
            $predicted = [];
20
            foreach ($samples as $index => $sample) {
21
                $predicted[$index] = $this->predictSample($sample);
0 ignored issues
show
Bug introduced by
The method predictSample() does not exist on Phpml\Classifier\Traits\Predictable. Did you maybe mean predict()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
22
            }
23
        }
24
25
        return $predicted;
26
    }
27
}
28