Scope   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 7
Bugs 3 Features 0
Metric Value
wmc 8
c 7
b 3
f 0
lcom 0
cbo 1
dl 0
loc 71
ccs 0
cts 21
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A setName() 0 4 1
A __toString() 0 4 1
A __construct() 0 12 3
A isDefaultScope() 0 4 1
A setDefaultScope() 0 4 1
1
<?php
2
/**
3
 * @author Stefano Torresi (http://stefanotorresi.it)
4
 * @license See the file LICENSE.txt for copying permission.
5
 * ************************************************
6
 */
7
8
namespace Thorr\OAuth2\Entity;
9
10
use Thorr\Persistence\Entity\AbstractEntity;
11
12
class Scope extends AbstractEntity
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $name;
18
19
    /**
20
     * @var bool
21
     */
22
    protected $defaultScope = false;
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @param string $name
28
     * @param bool   $default
29
     */
30
    public function __construct($uuid = null, $name = null, $default = null)
31
    {
32
        parent::__construct($uuid);
33
34
        if ($name) {
35
            $this->setName($name);
36
        }
37
38
        if ($default) {
39
            $this->setDefaultScope($default);
40
        }
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getName()
47
    {
48
        return $this->name;
49
    }
50
51
    /**
52
     * @param string $name
53
     */
54
    public function setName($name)
55
    {
56
        $this->name = (string) $name;
57
    }
58
59
    /**
60
     * @return bool
61
     */
62
    public function isDefaultScope()
63
    {
64
        return $this->defaultScope;
65
    }
66
67
    /**
68
     * @param bool $default
69
     */
70
    public function setDefaultScope($default)
71
    {
72
        $this->defaultScope = (bool) $default;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function __toString()
79
    {
80
        return $this->getName();
81
    }
82
}
83