Files
wticreatorstudio/Modules/LaraBuilder/Support/Arr.php
T

35 lines
695 B
PHP

<?php
namespace Modules\LaraBuilder\Support;
use Illuminate\Support\Str;
class Arr
{
public static function toCssStyles($array)
{
$styleList = static::wrap($array);
$styles = [];
foreach ($styleList as $class => $constraint) {
if (is_numeric($class)) {
$styles[] = Str::finish($constraint, ';');
} else if ($constraint) {
$styles[] = Str::finish($class, ';');
}
}
return implode(' ', $styles);
}
public static function wrap($value)
{
if (is_null($value)) {
return [];
}
return is_array($value) ? $value : [$value];
}
}