<?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($vVYCS, $pbpff = 12) { if ($vVYCS instanceof \Closure) { call_user_func($vVYCS, $this); } else { $this->append($vVYCS); } if (is_null($pbpff) || is_array($pbpff) && count($pbpff) === 0) { $this->width['md'] = 12; } elseif (is_numeric($pbpff)) { $this->width['md'] = $pbpff; } else { $this->width = $pbpff; } } public function append($vVYCS) { $this->contents[] = $vVYCS; return $this; } public function row($vVYCS) { goto XF5IG; Q9Ks3: return $this->append($zg3kc); goto p2Jaw; CKRvy: $hcOFW->build(); goto MBZVi; MBZVi: $zg3kc = ob_get_contents(); goto sDWsx; DAUbR: ob_start(); goto CKRvy; sDWsx: ob_end_clean(); goto Q9Ks3; XF5IG: if (!$vVYCS instanceof \Closure) { $hcOFW = new Row($vVYCS); } else { $hcOFW = new Row(); call_user_func($vVYCS, $hcOFW); } goto DAUbR; p2Jaw: } public function build() { goto K9Ubl; oJR5M: $this->endColumn(); goto y1X0D; WmloT: foreach ($this->contents as $vVYCS) { if ($vVYCS instanceof Renderable || $vVYCS instanceof Grid) { echo $vVYCS->render(); } else { echo (string) $vVYCS; } } goto oJR5M; K9Ubl: $this->startColumn(); goto WmloT; y1X0D: } protected function startColumn() { $qlsz_ = collect($this->width)->map(function ($Mczr_, $l6tBV) { return $l6tBV ? "col-{$l6tBV}-{$Mczr_}" : "col-{$Mczr_}"; })->implode(' '); echo "<div class=\"{$qlsz_}\">"; } protected function endColumn() { echo '</div>'; } }