<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Renderable; class ConvertUtil { public static function toArray($Gttsd, $z8oGH = true) { goto afy1r; DiriQ: if ($Gttsd instanceof \Closure) { $Gttsd = $Gttsd(); } goto pooUJ; afy1r: if (!$Gttsd) { return array(); } goto DiriQ; pooUJ: if (is_array($Gttsd)) { } elseif ($Gttsd instanceof Jsonable) { $Gttsd = json_decode($Gttsd->toJson(), true); } elseif ($Gttsd instanceof Arrayable) { $Gttsd = $Gttsd->toArray(); } elseif (is_string($Gttsd)) { goto zpBoy; lUaMY: try { $LHCVv = json_decode($Gttsd, true); } catch (\Throwable $WVwSN) { } goto VH2J3; VH2J3: $Gttsd = is_array($LHCVv) ? $LHCVv : explode(',', $Gttsd); goto kR2GB; zpBoy: $LHCVv = null; goto lUaMY; kR2GB: } else { $Gttsd = (array) $Gttsd; } goto TghQG; TghQG: return $z8oGH ? array_filter($Gttsd, function ($F6Fus) { return $F6Fus !== '' && $F6Fus !== null; }) : $Gttsd; goto I2IkI; I2IkI: } public static function render($Gttsd, $zIOpr = array(), $KCS2v = null) { goto aAcrd; rcHF_: return (string) $Gttsd; goto nJwdC; aAcrd: if (is_string($Gttsd)) { return $Gttsd; } goto VF4l7; B7pde: if ($Gttsd instanceof Renderable) { return (string) $Gttsd->render(); } goto yUHU3; yUHU3: if ($Gttsd instanceof Htmlable) { return (string) $Gttsd->toHtml(); } goto rcHF_; VF4l7: if ($Gttsd instanceof \Closure) { $KCS2v && ($Gttsd = $Gttsd->bindTo($KCS2v)); $Gttsd = $Gttsd(...(array) $zIOpr); } goto B7pde; nJwdC: } }