Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
ArrayDepth | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
up | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
down | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
current | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * @license MIT |
5 | * @author hazuki3417<hazuki3417@gmail.com> |
6 | * @copyright 2022 hazuki3417 all rights reserved. |
7 | */ |
8 | |
9 | namespace Selen\Data; |
10 | |
11 | class ArrayDepth |
12 | { |
13 | /** @var int 階層の深さ */ |
14 | private int $currentIndex = 0; |
15 | |
16 | public function up(): bool |
17 | { |
18 | if ($this->currentIndex <= 0) { |
19 | return false; |
20 | } |
21 | --$this->currentIndex; |
22 | return true; |
23 | } |
24 | |
25 | public function down(): bool |
26 | { |
27 | ++$this->currentIndex; |
28 | return true; |
29 | } |
30 | |
31 | public function current(): int |
32 | { |
33 | return $this->currentIndex; |
34 | } |
35 | } |