Total Complexity | 4 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | class QuickGit |
||
7 | { |
||
8 | /** @var int */ |
||
9 | private $major = 1; |
||
10 | /** @var int */ |
||
11 | private $minor = 0; |
||
12 | /** @var string */ |
||
13 | private $patch = ''; |
||
14 | /** @var int */ |
||
15 | private $commits = 0; |
||
16 | /** @var string */ |
||
17 | private $commit = ''; |
||
18 | |||
19 | /** |
||
20 | * @method __construct |
||
21 | */ |
||
22 | public function __construct() |
||
31 | } |
||
32 | /** |
||
33 | * @return string |
||
34 | */ |
||
35 | public function toString($format = 'short') |
||
36 | { |
||
37 | switch ($format) { |
||
38 | case 'long': |
||
39 | return sprintf( |
||
40 | '%d.%d.%s (#%d, %s)', |
||
41 | $this->major, |
||
42 | $this->minor, |
||
43 | $this->patch, |
||
44 | $this->commits, |
||
45 | $this->commit |
||
46 | ); |
||
47 | default: |
||
48 | return sprintf( |
||
49 | '%d.%d.%s', |
||
50 | $this->major, |
||
51 | $this->minor, |
||
52 | $this->patch |
||
53 | ); |
||
54 | } |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @method __toString |
||
59 | */ |
||
60 | public function __toString() |
||
63 | } |
||
64 | } |