Completed
Push — master ( 42e47f...3113fa )
by Rafał
06:11
created

MetaCollection::getTotalItemsCount()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Templates System.
5
 *
6
 * Copyright 2015 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Component\TemplatesSystem\Gimme\Meta;
16
17
use Doctrine\Common\Collections\ArrayCollection;
18
19
class MetaCollection extends ArrayCollection implements MetaCollectionInterface
20
{
21
    /**
22
     * @var int
23
     */
24
    protected $totalItemsCount = 0;
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getTotalItemsCount()
30
    {
31
        if ($this->totalItemsCount === 0 && $this->count() > 0) {
32
            return $this->count();
33
        }
34
35
        return $this->totalItemsCount;
36
    }
37
38
    public function setTotalItemsCount($totalItemsCount)
39
    {
40
        $this->totalItemsCount = $totalItemsCount;
41
42
        return $this;
43
    }
44
}
45