本文整理汇总了PHP中Phalcon\Script\Color::colorize方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::colorize方法的具体用法?PHP Color::colorize怎么用?PHP Color::colorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Script\Color
的用法示例。
在下文中一共展示了Color::colorize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHelp
/**
* {@inheritdoc}
*
* @return void
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Creates a module') . PHP_EOL . PHP_EOL;
print Color::head('Example') . PHP_EOL;
print Color::colorize(' phalcon module backend', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
$this->printParameters($this->getPossibleParams());
}
示例2: getHelp
/**
* Prints the help for current command.
*
* @return void
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Creates a controller') . PHP_EOL . PHP_EOL;
print Color::head('Usage:') . PHP_EOL;
print Color::colorize(' controller [name] [directory]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Arguments:') . PHP_EOL;
print Color::colorize(' ?', Color::FG_GREEN);
print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
$this->printParameters($this->_possibleParameters);
}
示例3: getHelp
/**
* {@inheritdoc}
*
* @return void
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Creates a scaffold from a database table') . PHP_EOL . PHP_EOL;
print Color::head('Usage:') . PHP_EOL;
print Color::colorize(' scaffold [tableName] [options]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Arguments:') . PHP_EOL;
print Color::colorize(' help', Color::FG_GREEN);
print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
$this->printParameters($this->getPossibleParams());
}
示例4: getHelp
/**
* Prints help on the usage of the command
*
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Enables/disables webtools in a project') . PHP_EOL . PHP_EOL;
print Color::head('Usage:') . PHP_EOL;
print Color::colorize(' webtools [action]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Arguments:') . PHP_EOL;
print Color::colorize(' ?', Color::FG_GREEN);
print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
$this->printParameters($this->_possibleParameters);
}
示例5: getHelp
/**
* Prints the help for current command.
*
* @return void
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Creates a project') . PHP_EOL . PHP_EOL;
print Color::head('Usage:') . PHP_EOL;
print Color::colorize(' project [name] [type] [directory] [enable-webtools]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Arguments:') . PHP_EOL;
print Color::colorize(' help', Color::FG_GREEN);
print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
print Color::head('Example') . PHP_EOL;
print Color::colorize(' phalcon project store simple', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
$this->printParameters($this->_possibleParameters);
}
示例6: getHelp
/**
* {@inheritdoc}
*
* @return void
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Lists the commands available in Phalcon devtools') . PHP_EOL . PHP_EOL;
$this->run([]);
}
示例7: dirname
$extensionLoaded = true;
if (!extension_loaded('phalcon')) {
$extensionLoaded = false;
include dirname(__FILE__) . '/scripts/Phalcon/Script.php';
throw new Exception(sprintf("Phalcon extension isn't installed, follow these instructions to install it: %s", Script::DOC_INSTALL_URL));
}
$loader = new Loader();
$loader->registerDirs(array(__DIR__ . '/scripts/'))->registerNamespaces(array('Phalcon' => __DIR__ . '/scripts/'))->register();
if (Version::getId() < Script::COMPATIBLE_VERSION) {
throw new Exception(sprintf("Your Phalcon version isn't compatible with Developer Tools, download the latest at: %s", Script::DOC_DOWNLOAD_URL));
}
if (!defined('TEMPLATE_PATH')) {
define('TEMPLATE_PATH', __DIR__ . '/templates');
}
$vendor = sprintf('Phalcon DevTools (%s)', Version::get());
print PHP_EOL . Color::colorize($vendor, Color::FG_GREEN, Color::AT_BOLD) . PHP_EOL . PHP_EOL;
$eventsManager = new EventsManager();
$eventsManager->attach('command', new CommandsListener());
$script = new Script($eventsManager);
$commandsToEnable = array('\\Phalcon\\Commands\\Builtin\\Enumerate', '\\Phalcon\\Commands\\Builtin\\Controller', '\\Phalcon\\Commands\\Builtin\\Model', '\\Phalcon\\Commands\\Builtin\\AllModels', '\\Phalcon\\Commands\\Builtin\\Project', '\\Phalcon\\Commands\\Builtin\\Scaffold', '\\Phalcon\\Commands\\Builtin\\Migration', '\\Phalcon\\Commands\\Builtin\\Webtools');
foreach ($commandsToEnable as $command) {
$script->attach(new $command($script, $eventsManager));
}
$script->run();
} catch (PhalconException $e) {
print Color::error($e->getMessage()) . PHP_EOL;
} catch (Exception $e) {
if ($extensionLoaded) {
print Color::error($e->getMessage()) . PHP_EOL;
} else {
print 'ERROR: ' . $e->getMessage() . PHP_EOL;
示例8: printParameters
/**
* Prints the available options in the script
*
* @param array $parameters
*/
public function printParameters($parameters)
{
$length = 0;
foreach ($parameters as $parameter => $description) {
if ($length == 0) {
$length = strlen($parameter);
}
if (strlen($parameter) > $length) {
$length = strlen($parameter);
}
}
print Color::head('Options:') . PHP_EOL;
foreach ($parameters as $parameter => $description) {
print Color::colorize(' --' . $parameter . str_repeat(' ', $length - strlen($parameter)), Color::FG_GREEN);
print Color::colorize(" " . $description) . PHP_EOL;
}
}
示例9: getHelp
/**
* {@inheritdoc}
*
* @return void
*/
public function getHelp()
{
echo Color::head('Help:') . PHP_EOL;
echo Color::colorize(' Enables/disables webtools in a project') . PHP_EOL . PHP_EOL;
print Color::head('Usage: Enable webtools') . PHP_EOL;
print Color::colorize(' webtools enable', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Usage: Disable webtools') . PHP_EOL;
print Color::colorize(' webtools disable', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
echo Color::head('Arguments:') . PHP_EOL;
echo Color::colorize(' help', Color::FG_GREEN);
echo Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
$this->printParameters($this->getPossibleParams());
}
示例10: getHelp
/**
* {@inheritdoc}
*
* @return void
*/
public function getHelp()
{
print Color::head('Help:') . PHP_EOL;
print Color::colorize(' Generates/Run a Migration') . PHP_EOL . PHP_EOL;
print Color::head('Usage: Generate a Migration') . PHP_EOL;
print Color::colorize(' migration generate', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Usage: Run a Migration') . PHP_EOL;
print Color::colorize(' migration run', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
print Color::head('Arguments:') . PHP_EOL;
print Color::colorize(' help', Color::FG_GREEN);
print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
$this->printParameters($this->getPossibleParams());
}
示例11: mainAction
/**
* Initialize task
*/
public function mainAction()
{
// define error handler
$this->setSilentErrorHandler();
try {
// init configurations // init logger
$this->setConfig($this->getDI()->get('config'))->setLogger();
// run server
$this->sonar = new Application($this->getConfig());
$this->sonar->run();
} catch (AppServiceException $e) {
echo Color::colorize($e->getMessage(), Color::FG_RED, Color::AT_BOLD) . PHP_EOL;
if ($this->logger != null) {
// logging all error exceptions
$this->getLogger()->log($e->getMessage(), Logger::CRITICAL);
}
}
}