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

Client   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getClientId() 0 4 1
A __construct() 0 4 1
A setType() 0 6 1
A getType() 0 4 1
A setMeta() 0 6 1
A getMeta() 0 4 1
A isTypeEqualsTo() 0 4 1
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