Scope::setDefaultScope()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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