Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
Opt
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
5 / 5
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 set
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 all
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isset
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Cli;
6
7/**
8 * @api
9 */
10final class Opt
11{
12    private array $values;
13
14    public function __construct(?string $value = null)
15    {
16        $this->values = $value === null ? [] : [$value];
17    }
18
19    public function set(string $value): void
20    {
21        $this->values[] = $value;
22    }
23
24    public function get(int $index = 0): string
25    {
26        return $this->values[$index];
27    }
28
29    public function all(): array
30    {
31        return $this->values;
32    }
33
34    public function isset(): bool
35    {
36        return count($this->values) > 0;
37    }
38}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Opt->__construct
14    public function __construct(?string $value = null)
15    {
16        $this->values = $value === null ? [] : [$value];
16        $this->values = $value === null ? [] : [$value];
16        $this->values = $value === null ? [] : [$value];
16        $this->values = $value === null ? [] : [$value];
17    }
Opt->all
31        return $this->values;
32    }
Opt->get
24    public function get(int $index = 0): string
25    {
26        return $this->values[$index];
27    }
Opt->isset
36        return count($this->values) > 0;
37    }
Opt->set
19    public function set(string $value): void
20    {
21        $this->values[] = $value;
22    }