mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-09-28 18:13:06 -04:00
35 lines
695 B
PHP
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];
|
|
}
|
|
}
|