-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLEANUP: Move $multiplier and $sizes to ScalungConfiguration Object
- Loading branch information
1 parent
3e4c5fa
commit 491c101
Showing
14 changed files
with
107 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Codappix\ResponsiveImages\Sizes; | ||
|
||
class ScalingConfiguration | ||
{ | ||
/** | ||
* @var float[] | ||
*/ | ||
private array $multiplier = []; | ||
|
||
/** | ||
* @var int[] | ||
*/ | ||
private array $sizes = []; | ||
|
||
public function __construct(array $configuration) | ||
{ | ||
if (isset($configuration['multiplier'])) { | ||
$this->multiplier = array_map(static fn ($multiplier): float => (float) $multiplier, $configuration['multiplier']); | ||
} | ||
|
||
if (isset($configuration['sizes'])) { | ||
$this->sizes = array_map(static fn ($size): int => (int) $size, $configuration['sizes']); | ||
} | ||
} | ||
|
||
/** | ||
* @return float[] | ||
*/ | ||
public function getMultiplier(): array | ||
{ | ||
return $this->multiplier; | ||
} | ||
|
||
/** | ||
* @return int[] | ||
*/ | ||
public function getSizes(): array | ||
{ | ||
return $this->sizes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.