本文整理匯總了PHP中Container::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::run方法的具體用法?PHP Container::run怎麽用?PHP Container::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Container
的用法示例。
在下文中一共展示了Container::run方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ArgParser
#!/usr/bin/php
<?php
$argParser = new ArgParser();
$command = $argParser->getCommand();
if ($command == ArgParser::CMD_START) {
Container::checkDocker();
foreach (Framework::getFrameworks() as $framework) {
$container = new Container($framework);
$container->run();
}
} else {
if ($command == ArgParser::CMD_STOP) {
Container::checkDocker();
foreach (Framework::getFrameworks() as $framework) {
$container = new Container($framework);
$container->stop();
}
} else {
if ($command == ArgParser::CMD_BENCHMARK) {
out("Doing " . Benchmark::NUMBER_OF_CALLS . " calls per framework. Displaying averages.");
foreach (Framework::getFrameworks() as $framework) {
$benchmark = new Benchmark($framework);
$benchmark->run()->outputTimes();
}
} else {
out("== Available commands: ==");
out(ArgParser::CMD_BENCHMARK);
out(ArgParser::CMD_START);
out(ArgParser::CMD_STOP);
}
}
示例2: implode
$this->formatter($ok, 'Version Control', implode(', ', $availableVcs), 'This only checks for subversion, git, and mercurial as they are the most common. I recommend git. You may safely ignore this check if you\'re using somethign else, but you *should* be using something.');
}
public function checkKernel()
{
$availableVcs = [];
$kernel = strtolower(php_uname('s'));
$ok = $kernel == 'darwin' || $kernel == 'linux';
$this->formatter($ok, 'Kernel', $kernel, 'If you are not running on linux or osx, you\'re in uncharted territory. If on windows, you should probably look into cygwin or setting up some kind of unix-like environment on your machine.');
}
public function checkCaseSensitive()
{
$ok = !(file_exists(strtoupper(__FILE__)) && file_exists(strtolower(__FILE__)));
$caseSensitive = true;
$this->formatter($ok, 'FS Case Sensitive', $ok ? 'Sensitive' : 'Insensitive', 'Your current filesystem appears to be case-insensitive, which may lead to problems if you deploy your code to a case-sensitive production server.');
}
}
Container::addTask(new SystemReport());
# load additional tasks from the project directories, if we're in a valid project
Container::findTasks();
# Determine what the task we're trying to run is
# the first element of the array is simply this filename, so get rid of it right away
array_shift($argv);
# Determine if a task is being passed. If not, default to 'usage'
if (count($argv) > 0) {
$task = array_shift($argv);
} else {
$task = 'usage';
}
# run the task and exit.
Container::run($task, $argv);
exit;