PostsResponse::getCount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Model;
4
5
use JMS\Serializer\Annotation\Accessor;
6
use JMS\Serializer\Annotation\ExclusionPolicy;
7
use JMS\Serializer\Annotation\Expose;
8
use JMS\Serializer\Annotation\Type;
9
10
/**
11
 * Class PostsResponse
12
 * @package App\Model
13
 * @ExclusionPolicy("all")
14
 */
15
class PostsResponse extends AbstractPaginatedModel
16
{
17
    /**
18
     * @var Array[]
19
     * @Type("array<App\Entity\Post>")
20
     * @Expose
21
     */
22
    protected $posts;
23
24
    /**
25
     * @var int
26
     *
27
     * @Type("integer")
28
     * @Accessor(getter="getCount")
29
     * @Expose
30
     */
31
    protected $count;
32
33
    /**
34
     * @return mixed
35
     */
36 3
    public function getPosts()
37
    {
38 3
        return $this->posts;
39
    }
40
41
    /**
42
     * @param  mixed $posts
43
     * @return $this
44
     */
45 3
    public function setPosts($posts)
46
    {
47 3
        $this->posts = $posts;
48
49 3
        return $this;
50
    }
51
52
    /**
53
     * @return int
54
     */
55 3
    public function getCount()
56
    {
57 3
        return count($this->getPosts());
58
    }
59
}
60