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

Predictable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A predict() 0 13 3
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