Completed
Push — master ( b355e1...5b43bb )
by Allan
07:24
created

Client::getType()   A

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 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace SMG\OauthBundle\Entity;
4
5
use FOS\OAuthServerBundle\Entity\Client as BaseClient;
6
use Doctrine\ORM\Mapping as ORM;
7
use JMS\Serializer\Annotation as Serializer;
8
9
/**
10
 * @ORM\Entity
11
 */
12
class Client extends BaseClient
13
{
14
    /**
15
     * @ORM\Id
16
     * @ORM\Column(type="integer")
17
     * @ORM\GeneratedValue(strategy="AUTO")
18
     */
19
    protected $id;
20
21
    /**
22
     * @ORM\Column(type="string", nullable=true)
23
     */
24
    public $type;
25
26
    /**
27
     * @ORM\Column(type="json_array", nullable=true)
28
     */
29
    public $meta;
30
31
    /**
32
     * @Serializer\VirtualProperty
33
     * @Serializer\SerializedName("client_id")
34
     *
35
     * @return string
36
     */
37
    public function getClientId()
38
    {
39
        return $this->getPublicId();
40
    }
41
42
    public function __construct()
43
    {
44
        parent::__construct();
45
    }
46
47
    public function setType($type)
48
    {
49
        $this->type = $type;
50
51
        return $this;
52
    }
53
54
    public function getType()
55
    {
56
        return $this->type;
57
    }
58
59
    public function setMeta($meta)
60
    {
61
        $this->meta = $meta;
62
63
        return $this;
64
    }
65
66
    public function getMeta()
67
    {
68
        return $this->meta;
69
    }
70
71
    /**
72
     * Check if the given client type is the same as the current user.
73
     *
74
     * @param string $typeToCheck client type to check
75
     *
76
     * @return bool
77
     */
78
    public function isTypeEqualsTo($typeToCheck)
79
    {
80
        return $this->getType() === $typeToCheck;
81
    }
82
}
83