<?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($Mczr_, $Nxn6E = true) { goto Wz9E0; Wz9E0: if (!$Mczr_) { return array(); } goto knw0m; WP15S: if (is_array($Mczr_)) { } elseif ($Mczr_ instanceof Jsonable) { $Mczr_ = json_decode($Mczr_->toJson(), true); } elseif ($Mczr_ instanceof Arrayable) { $Mczr_ = $Mczr_->toArray(); } elseif (is_string($Mczr_)) { goto RxaQx; RxaQx: $nPice = null; goto Ic1uH; Ic1uH: try { $nPice = json_decode($Mczr_, true); } catch (\Throwable $Xlb8r) { } goto KD3Ww; KD3Ww: $Mczr_ = is_array($nPice) ? $nPice : explode(',', $Mczr_); goto Z97Tz; Z97Tz: } else { $Mczr_ = (array) $Mczr_; } goto vwFoh; knw0m: if ($Mczr_ instanceof \Closure) { $Mczr_ = $Mczr_(); } goto WP15S; vwFoh: return $Nxn6E ? array_filter($Mczr_, function ($Xz28r) { return $Xz28r !== '' && $Xz28r !== null; }) : $Mczr_; goto VXTuW; VXTuW: } public static function render($Mczr_, $foKec = array(), $dMx1f = null) { goto dPFwS; gPJYM: return (string) $Mczr_; goto WOt8D; nRIGW: if ($Mczr_ instanceof Htmlable) { return (string) $Mczr_->toHtml(); } goto gPJYM; EXn6d: if ($Mczr_ instanceof \Closure) { $dMx1f && ($Mczr_ = $Mczr_->bindTo($dMx1f)); $Mczr_ = $Mczr_(...(array) $foKec); } goto TZmPo; dPFwS: if (is_string($Mczr_)) { return $Mczr_; } goto EXn6d; TZmPo: if ($Mczr_ instanceof Renderable) { return (string) $Mczr_->render(); } goto nRIGW; WOt8D: } }