Completed
Push — develop ( bc21b0...0bdfd4 )
by Adam
24:26 queued 09:29
created

Image::getClassifiers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace IBM\Watson\VisualRecognition\Model;
4
5
use IBM\Watson\Common\Model\ApiResponseInterface;
6
7
class Image implements ApiResponseInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    private $classifiers;
13
14
    /**
15
     * @var string
16
     */
17
    private $resolvedUrl;
18
19
    /**
20
     * @var string
21
     */
22
    private $sourceUrl;
23
24
    /**
25
     * Image constructor.
26
     *
27
     * @param array     $classifiers
28
     * @param string    $resolvedUrl
29
     * @param string    $sourceUrl
30
     */
31
    public function __construct(array $classifiers, $resolvedUrl, $sourceUrl)
32
    {
33
        $this->classifiers = $classifiers;
34
        $this->resolvedUrl = $resolvedUrl;
35
        $this->sourceUrl = $sourceUrl;
36
    }
37
38
    /**
39
     * Create image
40
     *
41
     * @param array $data
42
     *
43
     * @return \IBM\Watson\VisualRecognition\Model\Image
44
     */
45
    public static function create(array $data)
46
    {
47
        $classifiers = [];
48
49
        foreach ($data['classifiers'] as $classifier) {
50
            $classifiers[] = Classifier::create($classifier);
51
        }
52
53
        return new self($classifiers, $data['resolved_url'], $data['source_url']);
54
    }
55
56
    /**
57
     * @return array
58
     */
59
    public function getClassifiers()
60
    {
61
        return $this->classifiers;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getResolvedUrl()
68
    {
69
        return $this->resolvedUrl;
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getSourceUrl()
76
    {
77
        return $this->sourceUrl;
78
    }
79
}
80