diff --git a/src/Strategies/BoxShadowStrategy.php b/src/Strategies/BoxShadowStrategy.php index d273583..036e496 100644 --- a/src/Strategies/BoxShadowStrategy.php +++ b/src/Strategies/BoxShadowStrategy.php @@ -23,31 +23,30 @@ public function convert(array $variantStyle): string } $property = 'box-shadow:'; + $value = $variantStyle['value']; - foreach ($variantStyle['value'] as $value) { - if (!$value['active']) { - return $property.' unset;'; - } + if (!$value['active']) { + return $property.' unset;'; + } - if (!empty($value['offset-x'])) { - $property .= ' '.$value['offset-x']; - } + if (!empty($value['offset-x'])) { + $property .= ' '.$value['offset-x']; + } - if (!empty($value['offset-y'])) { - $property .= ' '.$value['offset-y']; - } + if (!empty($value['offset-y'])) { + $property .= ' '.$value['offset-y']; + } - if (!empty($value['blur-radius'])) { - $property .= ' '.$value['blur-radius']; - } + if (!empty($value['blur-radius'])) { + $property .= ' '.$value['blur-radius']; + } - if (!empty($value['spread-radius'])) { - $property .= ' '.$value['spread-radius']; - } + if (!empty($value['spread-radius'])) { + $property .= ' '.$value['spread-radius']; + } - if (!empty($value['color'])) { - $property .= ' '.$value['color']; - } + if (!empty($value['color'])) { + $property .= ' '.$value['color']; } return $property.';'; diff --git a/tests/Unit/Strategies/BoxShadowStrategyTest.php b/tests/Unit/Strategies/BoxShadowStrategyTest.php index f9d6997..3265f99 100644 --- a/tests/Unit/Strategies/BoxShadowStrategyTest.php +++ b/tests/Unit/Strategies/BoxShadowStrategyTest.php @@ -5,7 +5,6 @@ namespace CssGenerator\Tests\Unit\Strategies; use CssGenerator\Strategies\BoxShadowStrategy; -use CssGenerator\Strategies\FilterStrategy; use PHPUnit\Framework\TestCase; class BoxShadowStrategyTest extends TestCase @@ -15,14 +14,12 @@ public function testConvert_WhenGivenBoxShadow_ReturnsBoxShadowString(): void $styles = [ "type" => "box-shadow", "value" => [ - [ - "offset-x" => "0px", - "offset-y" => "0px", - "blur-radius" => "0px", - "spread-radius" => "0px", - "color" => "rgba(0, 0, 0, 0.1)", - "active" => true - ] + "offset-x" => "0px", + "offset-y" => "0px", + "blur-radius" => "0px", + "spread-radius" => "0px", + "color" => "rgba(0, 0, 0, 0.1)", + "active" => true ] ]; @@ -38,14 +35,12 @@ public function testConvert_WhenBoxShadowIsNotActive_ReturnsBoxShadowUnset(): vo $styles = [ "type" => "box-shadow", "value" => [ - [ - "offset-x" => "0px", - "offset-y" => "0px", - "blur-radius" => "0px", - "spread-radius" => "0px", - "color" => "rgba(0, 0, 0, 0.1)", - "active" => false - ] + "offset-x" => "0px", + "offset-y" => "0px", + "blur-radius" => "0px", + "spread-radius" => "0px", + "color" => "rgba(0, 0, 0, 0.1)", + "active" => false ] ];