<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Layout; use Illuminate\Contracts\Support\Renderable; use ModStart\Grid\Grid; class Column implements Buildable { protected $width = array(); protected $contents = array(); public function __construct($xMSF0, $XJUHT = 12) { if ($xMSF0 instanceof \Closure) { call_user_func($xMSF0, $this); } else { $this->append($xMSF0); } if (is_null($XJUHT) || is_array($XJUHT) && count($XJUHT) === 0) { $this->width['md'] = 12; } elseif (is_numeric($XJUHT)) { $this->width['md'] = $XJUHT; } else { $this->width = $XJUHT; } } public function append($xMSF0) { $this->contents[] = $xMSF0; return $this; } public function row($xMSF0) { goto VxK9T; z6UyC: $hEabj->build(); goto Zk_dY; Gui9g: ob_start(); goto z6UyC; kQITY: ob_end_clean(); goto hxBDR; Zk_dY: $uWK2G = ob_get_contents(); goto kQITY; VxK9T: if (!$xMSF0 instanceof \Closure) { $hEabj = new Row($xMSF0); } else { $hEabj = new Row(); call_user_func($xMSF0, $hEabj); } goto Gui9g; hxBDR: return $this->append($uWK2G); goto L3Dn2; L3Dn2: } public function build() { goto X0Qto; X0Qto: $this->startColumn(); goto exYXn; exYXn: foreach ($this->contents as $xMSF0) { if ($xMSF0 instanceof Renderable || $xMSF0 instanceof Grid) { echo $xMSF0->render(); } else { echo (string) $xMSF0; } } goto OcIlP; OcIlP: $this->endColumn(); goto tkaYY; tkaYY: } protected function startColumn() { $Y0XS7 = collect($this->width)->map(function ($tzAUI, $m1RYi) { return "col-{$m1RYi}-{$tzAUI}"; })->implode(' '); echo "<div class=\"{$Y0XS7}\">"; } protected function endColumn() { echo '</div>'; } }