Completed
Push — master ( bf375b...cc5661 )
by Rafał
07:07
created

MetaCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTotalItemCount() 0 8 3
A setTotalItemsCount() 0 6 1
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 getTotalItemCount()
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