本文整理匯總了PHP中Symfony\Component\EventDispatcher\GenericEvent::hasArgument方法的典型用法代碼示例。如果您正苦於以下問題:PHP GenericEvent::hasArgument方法的具體用法?PHP GenericEvent::hasArgument怎麽用?PHP GenericEvent::hasArgument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\EventDispatcher\GenericEvent
的用法示例。
在下文中一共展示了GenericEvent::hasArgument方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: up
/**
* Starts a new phantomjs process in background
*
* @throws \Symfony\Component\Process\Exception\RuntimeException
*/
public function up()
{
$this->killAllRunning();
$this->process = new Process('phantomjs --webdriver=' . $this->port . ' ' . $this->options);
$process = $this->process;
$output = new GenericEvent();
$process->setTimeout(null);
$process->start(function () use($process, $output) {
$output->setArgument('output', $process->getIncrementalOutput());
});
$phantomjsOnline = false;
$portScan = false;
while (!$phantomjsOnline) {
if ($output->hasArgument('output')) {
$portScan = strpos($output->getArgument('output'), 'running on port ' . $this->port);
}
if ($portScan) {
echo $output->getArgument('output');
}
$phantomjsOnline = $process->isStarted() && $process->isRunning() && $portScan;
if ($process->isTerminated()) {
throw new RuntimeException('Phantomjs could not been started with webdriver on port ' . $this->port);
}
}
}
示例2: testHasArgument
public function testHasArgument()
{
$this->assertTrue($this->event->hasArgument('name'));
$this->assertFalse($this->event->hasArgument('nameNotExist'));
}