本文整理汇总了PHP中Command::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::execute方法的具体用法?PHP Command::execute怎么用?PHP Command::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command::execute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param Context $context
* @return boolean
**/
public function execute(Context $context)
{
if ($context->getCurrentCommand() != 'begin') {
throw new \Exception('構文が正しくありません');
}
if (is_null($this->next_command)) {
throw new \Exception('次のコマンドが指定されていません');
}
$this->next_command->execute($context->next());
return true;
}
示例2: testParseDefaultValueIsDefined
/**
* Test that the default value is overwritten when the parameter
* is defined.
*/
public function testParseDefaultValueIsDefined()
{
$config = ['default' => ['test' => 'testing1234']];
$arguments = ['script-name.php', '--test=foobar'];
$cmd = new Command();
$result = $cmd->execute($arguments, $config);
$this->assertEquals('foobar', $result['test']);
}
示例3: actionEditMarkdown
/**
* 编辑md文件 /docx/usage/start.md
* @param $file
* @param $route
* @throws Exception
*/
public function actionEditMarkdown($file, $route)
{
$title = DirectoryIndex::trimFileExtension(basename($file));
if (!is_file($file)) {
$cmd[] = sprintf("mkdir -p %s", dirname($file));
$cmd[] = sprintf("echo '# %s%s-------------' > %s", $title, PHP_EOL, $file);
$command = join(" && ", $cmd);
$ret = Command::execute($command);
}
$content = file_get_contents($file);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$content = $_POST['content'];
$ret = file_put_contents($file, $content);
$htmlFile = static::md2HtmlFile($route);
$url = sprintf("/%s?action=%s", $htmlFile, static::PUSH_GIT_URL);
$this->redirect($url);
}
$time = time();
$this->render(static::VIEW_EDITOR, ['timestamp' => $time, 'token' => md5($this->_config['validationKey'] . $time), 'returnUrl' => DirectoryIndex::file2Url($file), 'title' => $title, 'content' => $content]);
}
示例4: runCommand
/**
* Run a command that will talk to the transport
*
* @param Command $command
* @return mixed
*/
protected function runCommand(Command $command)
{
$result = $command->execute();
return $result;
}
示例5: execCommand
/**
* Run a command that will talk to the connection
*
* @param Command $command
* @return boolean
*/
public function execCommand(Command $command)
{
return $command->execute($this);
}
示例6: intval
Utils::redirect('login.php');
}
$actualUrl = Utils::getActualUrl();
$room = intval($_GET['id']);
if (!$room) {
Utils::redirect('rooms.php');
}
Room::addUser($loggedUser['id'], $room);
$gameRepository = new GameRepository();
$game = $gameRepository->getOneByRoom($room);
if ($game) {
$GLOBALS['smarty']->assign('game', $game);
}
if ($_POST && trim($_POST['message'])) {
if (strpos($_POST['message'], '.') === 0) {
$commandResult = Command::execute($_POST['message'], $game);
} else {
Chat::addMessage(trim($_POST['message']), $room);
}
Room::updateUserLastActivity($loggedUser['id'], $room);
Utils::redirect($actualUrl);
}
$messages = Chat::getMessages($room, $loggedUser['id']);
$emoticons = Emoticons::getEmoticons();
$GLOBALS['smarty']->assign('loggedUser', $loggedUser);
$GLOBALS['smarty']->assign('room', $room);
$GLOBALS['smarty']->assign('messages', $messages);
$GLOBALS['smarty']->assign('users', Room::getUsers($room));
$GLOBALS['smarty']->assign('emoticonDir', EMOTICONS_DIR);
$GLOBALS['smarty']->assign('emoticons', $emoticons);
$GLOBALS['smarty']->assign('content', $GLOBALS['smarty']->fetch('room.tpl'));
示例7: storeAndExecute
public function storeAndExecute(Command $cmd)
{
$this->history[] = $cmd;
// optional
return $cmd->execute();
}
示例8: commandAction
/**
*
*/
public static function commandAction()
{
if ($bundles = self::getBundles()) {
foreach ($bundles as $name => $path) {
$command_path = $path . '/command';
if (is_dir($command_path)) {
if ($dh = opendir($command_path)) {
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != ".." && preg_match("/\\.php\$/", $file)) {
require_once $command_path . '/' . $file;
$command_name = pathinfo($file, PATHINFO_FILENAME);
CommandController::add($command_name);
}
}
closedir($dh);
}
}
}
}
Command::execute();
}
示例9: execute
public function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
$jwks_file = $input->getArgument('jwks_file');
if (!file_exists($jwks_file)) {
$output->writeln('File not found: ' . $jwks_file);
return 1;
}
$set = $this->loadKeySet(file_get_contents($jwks_file));
$table = new Table($output);
$table->setStyle('borderless');
$table->setHeaders(array('ID', 'Type', 'Size', 'Use', 'Ops'));
foreach ($set->getKeys() as $key) {
$id = $key->getKeyId();
if (strlen($id) > 7) {
$id = substr($id, 0, 7) . '...';
}
$kty = $key->getKeyType();
if (!$key->isPublic()) {
$kty .= '*';
}
$size = $key->getSize();
$use = $key->getUse();
if ($use == null) {
$use = '';
}
$ops = $key->getOperations();
if ($ops == null) {
$ops = array();
}
$ops = implode(',', $ops);
$table->addRow(array($id, $kty, $size, $use, $ops));
}
$table->render();
}