Completed
Push — master ( 1baeb0...6744a4 )
by Guilh
9s
created

View::setStatusCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the FOSRestBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\RestBundle\Controller\Annotations;
13
14
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
15
16
/**
17
 * View annotation class.
18
 *
19
 * @Annotation
20
 * @Target({"METHOD","CLASS"})
21
 */
22
class View extends Template
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $templateVar;
28
29
    /**
30
     * @var int
31
     */
32
    protected $statusCode;
33
34
    /**
35
     * @var array
36
     */
37
    protected $serializerGroups;
38
39
    /**
40
     * @var bool
41
     */
42
    protected $populateDefaultVars = true;
43
44
    /**
45
     * @var bool
46
     */
47
    protected $serializerEnableMaxDepthChecks;
48
49
    /**
50
     * Sets the template var name to be used for templating formats.
51
     *
52
     * @param string $templateVar
53
     */
54
    public function setTemplateVar($templateVar)
55
    {
56
        $this->templateVar = $templateVar;
57
    }
58
59
    /**
60
     * Returns the template var name to be used for templating formats.
61
     *
62
     * @return string
63
     */
64 12
    public function getTemplateVar()
65
    {
66 12
        return $this->templateVar;
67
    }
68
69
    /**
70
     * @param int $statusCode
71
     */
72 3
    public function setStatusCode($statusCode)
73
    {
74 3
        $this->statusCode = $statusCode;
75 3
    }
76
77
    /**
78
     * @return int
79
     */
80 12
    public function getStatusCode()
81
    {
82 12
        return $this->statusCode;
83
    }
84
85
    /**
86
     * @param array $serializerGroups
87
     */
88
    public function setSerializerGroups($serializerGroups)
89
    {
90
        $this->serializerGroups = $serializerGroups;
91
    }
92
93
    /**
94
     * @return array
95
     */
96 12
    public function getSerializerGroups()
97
    {
98 12
        return $this->serializerGroups;
99
    }
100
101
    /**
102
     * @param bool $populateDefaultVars
103
     */
104 2
    public function setPopulateDefaultVars($populateDefaultVars)
105
    {
106 2
        $this->populateDefaultVars = (bool) $populateDefaultVars;
107 2
    }
108
109
    /**
110
     * @return bool
111
     */
112 12
    public function isPopulateDefaultVars()
113
    {
114 12
        return $this->populateDefaultVars;
115
    }
116
117
    /**
118
     * @param bool $serializerEnableMaxDepthChecks
119
     */
120 2
    public function setSerializerEnableMaxDepthChecks($serializerEnableMaxDepthChecks)
121
    {
122 2
        $this->serializerEnableMaxDepthChecks = $serializerEnableMaxDepthChecks;
123 2
    }
124
125
    /**
126
     * @return bool
127
     */
128 12
    public function getSerializerEnableMaxDepthChecks()
129
    {
130 12
        return $this->serializerEnableMaxDepthChecks;
131
    }
132
}
133