Skip to content

Commit 6bb387d

Browse files
committed
~
1 parent bacc7bc commit 6bb387d

33 files changed

+154
-124
lines changed

.tools/.report/.build/coverage.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
Code Coverage Report Summary:
44
Classes: 100.00% (213/213)
55
Methods: 100.00% (771/771)
6-
Lines: 100.00% (3834/3834)
6+
Lines: 100.00% (3832/3832)
77

.tools/.report/.deptrac/.deptrac.report

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Violations 0
66
Skipped violations 0
77
Uncovered 177
8-
Allowed 2775
8+
Allowed 2785
99
Warnings 0
1010
Errors 0
1111
-------------------- ------

.tools/.report/.phploc/.src.phploc.report

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Directories 77
44
Files 427
55

66
Size
7-
Lines of Code (LOC) 14108
8-
Comment Lines of Code (CLOC) 804 (5.70%)
9-
Non-Comment Lines of Code (NCLOC) 13304 (94.30%)
10-
Logical Lines of Code (LLOC) 1505 (10.67%)
11-
Classes 1404 (93.29%)
7+
Lines of Code (LOC) 14133
8+
Comment Lines of Code (CLOC) 804 (5.69%)
9+
Non-Comment Lines of Code (NCLOC) 13329 (94.31%)
10+
Logical Lines of Code (LLOC) 1506 (10.66%)
11+
Classes 1405 (93.29%)
1212
Average Class Length 3
1313
Minimum Class Length 0
1414
Maximum Class Length 28
@@ -20,7 +20,7 @@ Size
2020
Maximum Methods Per Class 13
2121
Functions 38 (2.52%)
2222
Average Function Length 1
23-
Not in classes or functions 63 (4.19%)
23+
Not in classes or functions 63 (4.18%)
2424

2525
Cyclomatic Complexity
2626
Average Complexity per LLOC 0.34
@@ -36,12 +36,12 @@ Dependencies
3636
Global Constants 0 (0.00%)
3737
Global Variables 0 (0.00%)
3838
Super-Global Variables 0 (0.00%)
39-
Attribute Accesses 659
40-
Non-Static 643 (97.57%)
41-
Static 16 (2.43%)
42-
Method Calls 823
43-
Non-Static 741 (90.04%)
44-
Static 82 (9.96%)
39+
Attribute Accesses 660
40+
Non-Static 644 (97.58%)
41+
Static 16 (2.42%)
42+
Method Calls 824
43+
Non-Static 742 (90.05%)
44+
Static 82 (9.95%)
4545

4646
Structure
4747
Namespaces 77

.tools/.report/.phploc/.test.phploc.report

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Directories 74
44
Files 280
55

66
Size
7-
Lines of Code (LOC) 32647
8-
Comment Lines of Code (CLOC) 457 (1.40%)
9-
Non-Comment Lines of Code (NCLOC) 32190 (98.60%)
10-
Logical Lines of Code (LLOC) 7262 (22.24%)
11-
Classes 7254 (99.89%)
7+
Lines of Code (LOC) 32672
8+
Comment Lines of Code (CLOC) 461 (1.41%)
9+
Non-Comment Lines of Code (NCLOC) 32211 (98.59%)
10+
Logical Lines of Code (LLOC) 7268 (22.25%)
11+
Classes 7260 (99.89%)
1212
Average Class Length 26
1313
Minimum Class Length 0
1414
Maximum Class Length 871
@@ -24,7 +24,7 @@ Size
2424

2525
Cyclomatic Complexity
2626
Average Complexity per LLOC 0.06
27-
Average Complexity per Class 2.63
27+
Average Complexity per Class 2.64
2828
Minimum Class Complexity 1.00
2929
Maximum Class Complexity 16.00
3030
Average Complexity per Method 1.25
@@ -39,9 +39,9 @@ Dependencies
3939
Attribute Accesses 28
4040
Non-Static 23 (82.14%)
4141
Static 5 (17.86%)
42-
Method Calls 9989
43-
Non-Static 6679 (66.86%)
44-
Static 3310 (33.14%)
42+
Method Calls 9995
43+
Non-Static 6677 (66.80%)
44+
Static 3318 (33.20%)
4545

4646
Structure
4747
Namespaces 74
@@ -52,19 +52,19 @@ Structure
5252
Concrete Classes 273 (98.56%)
5353
Final Classes 255 (93.41%)
5454
Non-Final Classes 18 (6.59%)
55-
Methods 1838
55+
Methods 1840
5656
Scope
57-
Non-Static Methods 1734 (94.34%)
58-
Static Methods 104 (5.66%)
57+
Non-Static Methods 1732 (94.13%)
58+
Static Methods 108 (5.87%)
5959
Visibility
60-
Public Methods 1114 (60.61%)
61-
Protected Methods 352 (19.15%)
62-
Private Methods 372 (20.24%)
60+
Public Methods 1114 (60.54%)
61+
Protected Methods 345 (18.75%)
62+
Private Methods 381 (20.71%)
6363
Functions 97
6464
Named Functions 2 (2.06%)
6565
Anonymous Functions 95 (97.94%)
6666
Constants 75
6767
Global Constants 0 (0.00%)
6868
Class Constants 75 (100.00%)
69-
Public Constants 1 (1.33%)
70-
Non-Public Constants 74 (98.67%)
69+
Public Constants 0 (0.00%)
70+
Non-Public Constants 75 (100.00%)

lib/Lib/Spinner/Contract/IIntervalFormatter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace AlecRabbit\Lib\Spinner\Contract;
66

77
use AlecRabbit\Spinner\Contract\IHasInterval;
8+
use AlecRabbit\Spinner\Contract\IInterval;
89

910
interface IIntervalFormatter
1011
{
1112
/**
1213
* Formats interval contained in object.
1314
*/
14-
public function format(IHasInterval $object): string;
15+
public function format(IInterval $interval): string;
1516
}

lib/Lib/Spinner/Core/DriverLinkerWithOutput.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
public function __construct(
1818
private IDriverLinker $linker,
1919
private IOutput $output,
20-
private IIntervalFormatter $formatter = new IntervalFormatter(),
20+
private IIntervalFormatter $intervalFormatter = new IntervalFormatter(),
2121
) {
2222
}
2323

@@ -42,9 +42,15 @@ public function link(IDriver $driver): void
4242

4343
private function write(IDriver $driver): void
4444
{
45-
$this->output->write(
46-
$this->formatter->format($driver)
47-
);
45+
$messages = [
46+
sprintf('%s:', $this::class),
47+
' ',
48+
sprintf('[%s]', $driver::class),
49+
' ',
50+
$this->intervalFormatter->format($driver->getInterval()),
51+
];
52+
53+
$this->output->write($messages);
4854
}
4955

5056
public function update(ISubject $subject): void

lib/Lib/Spinner/IntervalFormatter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
use AlecRabbit\Lib\Spinner\Contract\IIntervalFormatter;
88
use AlecRabbit\Spinner\Contract\IHasInterval;
9+
use AlecRabbit\Spinner\Contract\IInterval;
910

1011
final readonly class IntervalFormatter implements IIntervalFormatter
1112
{
1213
/** @inheritDoc */
13-
public function format(IHasInterval $object): string
14+
public function format(IInterval $interval): string
1415
{
1516
return sprintf(
16-
'[%s] Interval: %sms' . PHP_EOL,
17-
$object::class,
18-
$object->getInterval()->toMilliseconds()
17+
'Interval: %sms' . PHP_EOL,
18+
$interval->toMilliseconds()
1919
);
2020
}
2121
}

phpunit.coverage.path.xml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
cacheDirectory=".tools/.phpunit.cache"
1111
beStrictAboutCoverageMetadata="false"
1212
>
13-
<testsuites>
13+
<testsuites>
14+
<testsuite name="Spinner/Complex">
15+
<directory>tests/Spinner/Complex</directory>
16+
</testsuite>
1417
<testsuite name="Spinner/Functional">
1518
<directory>tests/Spinner/Functional</directory>
1619
</testsuite>
@@ -29,17 +32,17 @@
2932
<testsuite name="Benchmark/Unit">
3033
<directory>tests/Benchmark/Unit</directory>
3134
</testsuite>
32-
</testsuites>
33-
<coverage>
34-
<report>
35-
<text outputFile=".tools/.report/.build/coverage.path.txt" showOnlySummary="true"/>
36-
<html outputDirectory=".tools/.report/.build/coverage/path"/>
37-
</report>
38-
</coverage>
39-
<source>
40-
<include>
41-
<directory suffix=".php">lib</directory>
42-
<directory suffix=".php">src</directory>
43-
</include>
44-
</source>
35+
</testsuites>
36+
<coverage>
37+
<report>
38+
<text outputFile=".tools/.report/.build/coverage.path.txt" showOnlySummary="true"/>
39+
<html outputDirectory=".tools/.report/.build/coverage/path"/>
40+
</report>
41+
</coverage>
42+
<source>
43+
<include>
44+
<directory suffix=".php">lib</directory>
45+
<directory suffix=".php">src</directory>
46+
</include>
47+
</source>
4548
</phpunit>

phpunit.coverage.xml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
cacheDirectory=".tools/.phpunit.cache"
1111
beStrictAboutCoverageMetadata="false"
1212
>
13-
<testsuites>
13+
<testsuites>
14+
<testsuite name="Spinner/Complex">
15+
<directory>tests/Spinner/Complex</directory>
16+
</testsuite>
1417
<testsuite name="Spinner/Functional">
1518
<directory>tests/Spinner/Functional</directory>
1619
</testsuite>
@@ -29,17 +32,17 @@
2932
<testsuite name="Benchmark/Unit">
3033
<directory>tests/Benchmark/Unit</directory>
3134
</testsuite>
32-
</testsuites>
33-
<coverage>
34-
<report>
35-
<text outputFile=".tools/.report/.build/coverage.txt" showOnlySummary="true"/>
36-
<html outputDirectory=".tools/.report/.build/coverage/generic"/>
37-
</report>
38-
</coverage>
39-
<source>
40-
<include>
41-
<directory suffix=".php">lib</directory>
42-
<directory suffix=".php">src</directory>
43-
</include>
44-
</source>
35+
</testsuites>
36+
<coverage>
37+
<report>
38+
<text outputFile=".tools/.report/.build/coverage.txt" showOnlySummary="true"/>
39+
<html outputDirectory=".tools/.report/.build/coverage/generic"/>
40+
</report>
41+
</coverage>
42+
<source>
43+
<include>
44+
<directory suffix=".php">lib</directory>
45+
<directory suffix=".php">src</directory>
46+
</include>
47+
</source>
4548
</phpunit>

phpunit.testdox.xml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
beStrictAboutCoverageMetadata="false"
1212
testdox="true"
1313
>
14-
<testsuites>
14+
<testsuites>
15+
<testsuite name="Spinner/Complex">
16+
<directory>tests/Spinner/Complex</directory>
17+
</testsuite>
1518
<testsuite name="Spinner/Functional">
1619
<directory>tests/Spinner/Functional</directory>
1720
</testsuite>
@@ -30,12 +33,12 @@
3033
<testsuite name="Benchmark/Unit">
3134
<directory>tests/Benchmark/Unit</directory>
3235
</testsuite>
33-
</testsuites>
34-
<coverage/>
35-
<source>
36-
<include>
37-
<directory suffix=".php">lib</directory>
38-
<directory suffix=".php">src</directory>
39-
</include>
40-
</source>
36+
</testsuites>
37+
<coverage/>
38+
<source>
39+
<include>
40+
<directory suffix=".php">lib</directory>
41+
<directory suffix=".php">src</directory>
42+
</include>
43+
</source>
4144
</phpunit>

phpunit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
stopOnFailure="false"
1414
>
1515
<testsuites>
16+
<testsuite name="Spinner/Complex">
17+
<directory>tests/Spinner/Complex</directory>
18+
</testsuite>
1619
<testsuite name="Spinner/Functional">
1720
<directory>tests/Spinner/Functional</directory>
1821
</testsuite>

src/Spinner/Container/CircularDependencyDetector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function push(string $id): void
2828

2929
public function pop(): void
3030
{
31-
$this->stack->offsetUnset(
32-
array_key_last(
33-
$this->stack->getArrayCopy()
34-
)
35-
);
31+
$key = array_key_last($this->stack->getArrayCopy());
32+
33+
if ($key !== null && $this->stack->offsetExists($key)) {
34+
$this->stack->offsetUnset($key);
35+
}
3636
}
3737
}

src/Spinner/Container/ServiceSpawner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function spawnByClassConstructor(string $definition): object
100100
return match (true) {
101101
class_exists($definition) => $this->createInstanceByReflection($definition),
102102
default => throw new ClassDoesNotExist(
103-
sprintf('Class does not exist: %s', (string)$definition)
103+
sprintf('Class does not exist: %s', $definition)
104104
),
105105
};
106106
}

0 commit comments

Comments
 (0)