Completed
Push — master ( 817fef...b9c500 )
by Allan
06:04
created

Client::setMeta()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

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 6
ccs 0
cts 5
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
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
8
/**
9
 * @ORM\Entity
10
 */
11
class Client extends BaseClient
12
{
13
    /**
14
     * @ORM\Id
15
     * @ORM\Column(type="integer")
16
     * @ORM\GeneratedValue(strategy="AUTO")
17
     */
18
    protected $id;
19
20
    /**
21
     * @ORM\Column(type="string")
22
     */
23
    public $type;
24
25
    /**
26
     * @ORM\Column(type="json_array", nullable=true)
27
     */
28
    public $meta;
29
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    public function setType($type)
36
    {
37
        $this->type = $type;
38
39
        return $this;
40
    }
41
42
    public function getType()
43
    {
44
        return $this->type;
45
    }
46
47
    public function setMeta($meta)
48
    {
49
        $this->meta = $meta;
50
51
        return $this;
52
    }
53
54
    public function getMeta()
55
    {
56
        return $this->meta;
57
    }
58
59
    /**
60
     * Check if the given client type is the same as the current user.
61
     *
62
     * @param string $typeToCheck client type to check
63
     *
64
     * @return bool
65
     */
66
    public function isTypeEqualsTo($typeToCheck)
67
    {
68
        return $this->getType() === $typeToCheck;
69
    }
70
}
71