/** * Displays a caught exception. * * @param \Exception $e */ protected function showError(\Exception $e) { CLI::error($e->getMessage()); CLI::write($e->getFile() . ' - ' . $e->getLine(), 'white'); }
} $attributes[] = $att; continue; } $output .= str_repeat("\t", $nesting) . "{$line}\n"; } $this->currentDocString = $output; $this->currentDocAttributes = $attributes; } } //-------------------------------------------------------------------- // Take Input and make it work //-------------------------------------------------------------------- $source_file = CLI::prompt('Source file'); $source_file = realpath($source_file); if (empty($source_file)) { CLI::error('Unable to locate the source file.'); die; } /* * Try to determine the class name based on the file */ $class_name = 'CodeIgniter\\' . str_ireplace(realpath(BASEPATH) . '/', '', $source_file); $class_name = str_replace('.php', '', $class_name); $class_name = str_replace('/', '\\', $class_name); $doc = new Document(); $doc->readSource(realpath($source_file))->build($class_name); $dest_file = CLI::prompt('Destination in user_guide_src'); $doc->writeTo($dest_file); CLI::write('Done');
/** * Loads the specified seeder and runs it. * * @param string $class * * @throws RuntimeException */ public function call(string $class) { if (empty($class)) { throw new \InvalidArgumentException('No Seeder was specified.'); } $path = $this->seedPath . str_replace('.php', '', $class) . '.php'; if (!is_file($path)) { throw new \InvalidArgumentException('The specified Seeder is not a valid file: ' . $path); } if (!class_exists($class, false)) { require $path; } $seeder = new $class($this->config); $seeder->run(); unset($seeder); if (is_cli() && !$this->silent) { CLI::write("Seeded: {$class}", 'green'); } }