AcmeCalculator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 2
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