Skip to content

Commit 0fae480

Browse files
committed
TASK: Apply fixes from styleci
1 parent 61dd282 commit 0fae480

File tree

3 files changed

+33
-35
lines changed

3 files changed

+33
-35
lines changed

Classes/Domain/ValueObject/AbstractColor.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public function getHexString(): string
2222
$rgba = $this->asRgba();
2323
if ($rgba->getAlpha() == 255) {
2424
return '#'
25-
.str_pad(dechex((int)round($rgba->getRed())), 2, '0')
26-
.str_pad(dechex((int)round($rgba->getGreen())), 2, '0')
27-
.str_pad(dechex((int)round($rgba->getBlue())), 2, '0');
25+
.str_pad(dechex((int) round($rgba->getRed())), 2, '0')
26+
.str_pad(dechex((int) round($rgba->getGreen())), 2, '0')
27+
.str_pad(dechex((int) round($rgba->getBlue())), 2, '0');
2828
} else {
2929
return '#'
30-
.str_pad(dechex((int)round($rgba->getRed())), 2, '0')
31-
.str_pad(dechex((int)round($rgba->getGreen())), 2, '0')
32-
.str_pad(dechex((int)round($rgba->getBlue())), 2, '0')
33-
.str_pad(dechex((int)round($rgba->getAlpha())), 2, '0');
30+
.str_pad(dechex((int) round($rgba->getRed())), 2, '0')
31+
.str_pad(dechex((int) round($rgba->getGreen())), 2, '0')
32+
.str_pad(dechex((int) round($rgba->getBlue())), 2, '0')
33+
.str_pad(dechex((int) round($rgba->getAlpha())), 2, '0');
3434
}
3535
}
3636

Tests/Unit/ColorBuilderTest.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use PackageFactory\ColorHelper\Domain\ValueObject\HslaColor;
77
use PackageFactory\ColorHelper\Domain\ValueObject\RgbaColor;
88
use PackageFactory\ColorHelper\Eel\ColorBuilder;
9-
use PackageFactory\ColorHelper\Eel\ColorHelper;
109

1110
class ColorBuilderTest extends AbstractColorTest
1211
{
@@ -17,51 +16,51 @@ public function setUp(): void
1716
$this->builder = new ColorBuilder();
1817
}
1918

20-
public function colorsCanBeCreatedViaRgbFactoryMethodDataProvider():array
19+
public function colorsCanBeCreatedViaRgbFactoryMethodDataProvider(): array
2120
{
2221
return [
23-
[100,0,255,null, new RgbaColor(100, 0, 255)],
24-
[0,0,0,null, new RgbaColor(0, 0, 0)],
25-
[100,0,255,128, new RgbaColor(100, 0, 255, 128)]
22+
[100, 0, 255, null, new RgbaColor(100, 0, 255)],
23+
[0, 0, 0, null, new RgbaColor(0, 0, 0)],
24+
[100, 0, 255, 128, new RgbaColor(100, 0, 255, 128)],
2625
];
2726
}
2827

2928
/**
3029
* @test
3130
* @dataProvider colorsCanBeCreatedViaRgbFactoryMethodDataProvider
3231
*/
33-
public function colorsCanBeCreatedViaRgbFactoryMethod(float $red, float $green, float $blue, float $alpha = null, ColorInterface $expectation)
32+
public function colorsCanBeCreatedViaRgbFactoryMethod(float $red, float $green, float $blue, float $alpha = null, ColorInterface $expectation)
3433
{
3534
$color = $this->builder->rgb($red, $green, $blue, $alpha ?? 255)->getColor();
3635
$this->assertSameColor($expectation, $color);
3736
}
3837

39-
public function colorsCanBeCreatedViaHslFactoryMethodDataProvider():array
38+
public function colorsCanBeCreatedViaHslFactoryMethodDataProvider(): array
4039
{
4140
return [
42-
[100,25,75,1, new HslaColor(100,25,75,1)],
43-
[100,25,100,1, new HslaColor(100,25,100,1)],
44-
[100,25,0,1, new HslaColor(0,0,0,1)]
41+
[100, 25, 75, 1, new HslaColor(100, 25, 75, 1)],
42+
[100, 25, 100, 1, new HslaColor(100, 25, 100, 1)],
43+
[100, 25, 0, 1, new HslaColor(0, 0, 0, 1)],
4544
];
4645
}
4746

4847
/**
4948
* @test
5049
* @dataProvider colorsCanBeCreatedViaHslFactoryMethodDataProvider
5150
*/
52-
public function colorsCanBeCreatedViaHslFactoryMethod(float $hue, float $saturation, float $lightness, float $alpha, ColorInterface $expectation)
51+
public function colorsCanBeCreatedViaHslFactoryMethod(float $hue, float $saturation, float $lightness, float $alpha, ColorInterface $expectation)
5352
{
5453
$color = $this->builder->hsl($hue, $saturation, $lightness, $alpha ?? 1)->getColor();
5554
$this->assertSameColor($expectation, $color);
5655
}
5756

58-
public function colorsCanBeCreatedViaHexFactoryMethodDataProvider():array
57+
public function colorsCanBeCreatedViaHexFactoryMethodDataProvider(): array
5958
{
6059
return [
61-
['#ae8','#aaee88'],
62-
['#6400ff','#6400ff'],
63-
['#FFAAEEDD','#ffaaeedd'],
64-
['#ffeeaa88','#ffeeaa88']
60+
['#ae8', '#aaee88'],
61+
['#6400ff', '#6400ff'],
62+
['#FFAAEEDD', '#ffaaeedd'],
63+
['#ffeeaa88', '#ffeeaa88'],
6564
];
6665
}
6766

@@ -76,17 +75,17 @@ public function colorsCanBeCreatedViaHexFactoryMethod($hexString, $hex)
7675
$this->assertSameColor($expectation, $color);
7776
}
7877

79-
public function colorsCanBeCreatedViaCssFactoryMethodDataProvider():array
78+
public function colorsCanBeCreatedViaCssFactoryMethodDataProvider(): array
8079
{
8180
return [
82-
['#ae8','#aaee88'],
83-
['#6400ff','#6400ff'],
84-
['#FFAAEEDD','#ffaaeedd'],
85-
['#ffeeaa88','#ffeeaa88'],
86-
['rgb(128,128,128)','#808080'],
87-
['rgba(128,128,128,255)','#808080'],
88-
['hsl(66,100%,75%)','#f2ff80'],
89-
['hsl(66,100%,75%,1)','#f2ff80']
81+
['#ae8', '#aaee88'],
82+
['#6400ff', '#6400ff'],
83+
['#FFAAEEDD', '#ffaaeedd'],
84+
['#ffeeaa88', '#ffeeaa88'],
85+
['rgb(128,128,128)', '#808080'],
86+
['rgba(128,128,128,255)', '#808080'],
87+
['hsl(66,100%,75%)', '#f2ff80'],
88+
['hsl(66,100%,75%,1)', '#f2ff80'],
9089
];
9190
}
9291

Tests/Unit/ColorTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace PackageFactory\ColorHelper\Tests\Unit;
34

45
use PackageFactory\ColorHelper\Domain\ValueObject\ColorInterface;
@@ -7,7 +8,6 @@
78

89
class ColorTest extends AbstractColorTest
910
{
10-
1111
/**
1212
* @test
1313
* @dataProvider rgbSpectrumDataProvider
@@ -40,7 +40,7 @@ public function conversionOfRgbToHslWorks($colorFixture)
4040
$hsl = $colorFixture['hsl'];
4141
$rgbColor = new RgbaColor($rgb[0], $rgb[1], $rgb[2]);
4242
$hslColor = $rgbColor->asHsla();
43-
$expectation = new HslaColor($hsl[0],$hsl[1],$hsl[2]);
43+
$expectation = new HslaColor($hsl[0], $hsl[1], $hsl[2]);
4444
self::assertSimilarColor($hslColor, $expectation);
4545
}
4646

@@ -155,7 +155,6 @@ public function colorMixingWorks(ColorInterface $colorA, ColorInterface $colorB,
155155
{
156156
$mixed = $colorA->withMixedColor($colorB, $weight)->asRgba();
157157
self::assertSimilarColor($mixed, $expectation);
158-
159158
}
160159

161160
public function lightnessAdjustmentWorksDataProvider(): array

0 commit comments

Comments
 (0)