/** * Get stub template for generated file. * * @return string */ public function getStub() { if ($this->plain) { return $this->getPath(); } if ($template = $this->template) { return Stub::create($template, $this->getReplacements())->render(); } return parent::getStub(); }
/** * Get replacements for $SHOW_BODY$. * * @param string $var * @return string */ public function toRows($var) { $results = PHP_EOL; foreach ($this->getColumns() as $column) { if (in_array($name = $column->getName(), $this->ignores)) { continue; } $results .= Stub::create(__DIR__ . '/../Stubs/scaffold/row.stub', ['label' => ucwords($name), 'column' => $name, 'var' => $var])->render(); } return $results . PHP_EOL; }