Completed
Push — develop ( 7f4a0b...601ff8 )
by Arkadiusz
03:21
created

ArrayDataset::getTargets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare (strict_types = 1);
4
5
namespace Phpml\Dataset;
6
7
use Phpml\Exception\InvalidArgumentException;
8
9
class ArrayDataset implements Dataset
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $samples = [];
15
16
    /**
17
     * @var array
18
     */
19
    protected $targets = [];
20
21
    /**
22
     * @param array $samples
23
     * @param array $targets
24
     *
25
     * @throws InvalidArgumentException
26
     */
27
    public function __construct(array $samples, array $targets)
28
    {
29
        if (count($samples) != count($targets)) {
30
            throw InvalidArgumentException::arraySizeNotMatch();
31
        }
32
33
        $this->samples = $samples;
34
        $this->targets = $targets;
35
    }
36
37
    /**
38
     * @return array
39
     */
40
    public function getSamples(): array
41
    {
42
        return $this->samples;
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    public function getTargets(): array
49
    {
50
        return $this->targets;
51
    }
52
}
53