AcmeCalculator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 34
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A init() 0 3 1
A calculate() 0 3 1
1
<?php
2
3
namespace SimpleDIC\Dummy;
4
5
class AcmeCalculator
6
{
7
    private $a;
8
    private $b;
9
10
    /**
11
     * AcmeCalculator constructor.
12
     *
13
     * @param int $a
14
     * @param int $b
15
     */
16
    private function __construct($a, $b)
17
    {
18
        $this->a = $a;
19
        $this->b = $b;
20
    }
21
22
    /**
23
     * @return int
24
     */
25
    public function calculate()
26
    {
27
        return (int)($this->a + $this->b);
28
    }
29
30
    /**
31
     * @param int $a
32
     * @param int $b
33
     *
34
     * @return AcmeCalculator
35
     */
36
    public function init($a, $b)
37
    {
38
        return new self($a, $b);
39
    }
40
}
41