ClassifierResponse   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

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
ccs 15
cts 15
cp 1
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 4
    public function getClassifier()
25
    {
26 4
        if (!isset($this->classifier)) {
27 4
            if (isset($this->data->classifier_id) && isset($this->data->name) && isset($this->data->owner)
28 4
                && isset($this->data->created)
29 4
            ) {
30 4
                $this->classifier = new Classifier(
31 4
                    $this->data->classifier_id,
32 4
                    $this->data->name,
33 4
                    null,
34 4
                    $this->data->owner,
35 4
                    new DateTime($this->data->created)
36 4
                );
37 4
            }
38 4
        }
39
40 4
        return $this->classifier;
41
    }
42
}
43