Completed
Push — develop ( fe8c75...3bcd98 )
by Tom
02:26
created

ClassifierResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getClassifier() 0 18 6
1
<?php
2
3
namespace Bobbyshaw\WatsonVisualRecognition\Message;
4
5
use Bobbyshaw\WatsonVisualRecognition\Classifier;
6
use DateTime;
7
8
/**
9
 * Class ClassifierResponse
10
 * @package Bobbyshaw\WatsonVisualRecognition\Message
11
 */
12
class ClassifierResponse extends Response
13
{
14
    /**
15
     * @var Classifier
16
     */
17
    protected $classifier;
18
19
    /**
20
     * Get Classifiers
21
     *
22
     * @return Classifier
23
     */
24
    public function getClassifier()
25
    {
26
        if (!isset($this->classifier)) {
27
            if (isset($this->data->classifier_id) && isset($this->data->name) && isset($this->data->owner)
28
                && isset($this->data->created)
29
            ) {
30
                $this->classifier = new Classifier(
31
                    $this->data->classifier_id,
32
                    $this->data->name,
33
                    null,
34
                    $this->data->owner,
35
                    new DateTime($this->data->created)
36
                );
37
            }
38
        }
39
40
        return $this->classifier;
41
    }
42
}
43