<?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($BWI89, $GLdhF = 12) { if ($BWI89 instanceof \Closure) { call_user_func($BWI89, $this); } else { $this->append($BWI89); } if (is_null($GLdhF) || is_array($GLdhF) && count($GLdhF) === 0) { $this->width['md'] = 12; } elseif (is_numeric($GLdhF)) { $this->width['md'] = $GLdhF; } else { $this->width = $GLdhF; } } public function append($BWI89) { $this->contents[] = $BWI89; return $this; } public function row($BWI89) { goto otQ2n; K2jB8: ob_end_clean(); goto J0oO6; I6Uvx: $ZLTa0 = ob_get_contents(); goto K2jB8; J0oO6: return $this->append($ZLTa0); goto yBVWx; ifo6A: $EzOZh->build(); goto I6Uvx; otQ2n: if (!$BWI89 instanceof \Closure) { $EzOZh = new Row($BWI89); } else { $EzOZh = new Row(); call_user_func($BWI89, $EzOZh); } goto qlzuu; qlzuu: ob_start(); goto ifo6A; yBVWx: } public function build() { goto aOpFj; Fm58b: $this->endColumn(); goto oobiE; aOpFj: $this->startColumn(); goto nI8ap; nI8ap: foreach ($this->contents as $BWI89) { if ($BWI89 instanceof Renderable || $BWI89 instanceof Grid) { echo $BWI89->render(); } else { echo (string) $BWI89; } } goto Fm58b; oobiE: } protected function startColumn() { $S0esq = collect($this->width)->map(function ($HDpl6, $VFU9l) { return $VFU9l ? "col-{$VFU9l}-{$HDpl6}" : "col-{$HDpl6}"; })->implode(' '); echo "<div class=\"{$S0esq}\">"; } protected function endColumn() { echo '</div>'; } }