Completed
Push — develop-3.0 ( 5ab583...f20237 )
by Mohamed
06:33
created

Counter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A countOpenIssues() 0 4 1
A countClosedIssues() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
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 Tinyissue\Repository\Project\Issue;
13
14
use Tinyissue\Model\Project\Issue;
15
use Tinyissue\Repository\Repository;
16
17
class Counter extends Repository
18
{
19
    /**
20
     * @var Issue
21
     */
22
    protected $model;
23
24
    public function __construct(Issue $model)
25
    {
26
        $this->model = $model;
27
    }
28
29
    /**
30
     * Count number of open issues.
31
     *
32
     * @return int
33
     */
34
    public function countOpenIssues()
35
    {
36
        return $this->model->open()->count();
37
    }
38
39
    /**
40
     * Count number of closed issues.
41
     *
42
     * @return int
43
     */
44
    public function countClosedIssues()
45
    {
46
        return $this->model->closed()->count();
47
    }
48
}
49