Skip to content

Commit

Permalink
🐛 BEM helper accept now also integers as modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Aug 19, 2019
1 parent 3ee6866 commit 250366e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,23 @@ public function BEM($block = null, $element = null, $modifiers = []): array
*
* @return array
*/
private static function modifierArray($modifiers = []): array {
private static function modifierArray($modifiers = []): array
{
if (is_string($modifiers)) {
return [$modifiers];
} else if (is_int($modifiers)) {
return [strval($modifiers)];
}
$array = [];
if (is_array($modifiers)) {
foreach ($modifiers as $key => $value) {
if (!$value) {
if (!$value && !is_int($value)) {
continue;
}
if (is_array($value)) {
$array = array_merge($array, self::modifierArray($value));
} else if (is_int($value)) {
$array[] = strval($value);
} else if (is_string($value)) {
$array[] = $value;
} else if (is_string($key)) {
Expand Down

0 comments on commit 250366e

Please sign in to comment.