当前位置: 首页>>代码示例>>PHP>>正文


PHP GenericEvent::getArgument方法代码示例

本文整理汇总了PHP中Symfony\Component\EventDispatcher\GenericEvent::getArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP GenericEvent::getArgument方法的具体用法?PHP GenericEvent::getArgument怎么用?PHP GenericEvent::getArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\EventDispatcher\GenericEvent的用法示例。


在下文中一共展示了GenericEvent::getArgument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
         }
     }
 }
开发者ID:mazelab,项目名称:phantomjsstarter,代码行数:30,代码来源:Starter.php

示例2: generateEditorLink

 /**
  * Generates editor's link
  *
  * @param GenericEvent $event Symfony Event
  */
 public function generateEditorLink(GenericEvent $event)
 {
     $articleNumber = $event->getArgument('articleNumber');
     $articleLanguage = $event->getArgument('articleLanguage');
     if ($this->pluginsService->isEnabled($this->getPluginName()) && $this->hasAccessToEditor()) {
         $articleLink = $this->router->generate('newscoop_admin_aes', array('articleNumber' => $articleNumber, 'language' => $articleLanguage));
     }
     $event->setArgument('link', $articleLink);
 }
开发者ID:AtomLaw,项目名称:plugin-Scoopwriter,代码行数:14,代码来源:EditorListener.php

示例3: onBuilderPostTask

 public function onBuilderPostTask(GenericEvent $event)
 {
     if (true === $this->showProgress) {
         $index = $event->getArgument('index');
         $total = $event->getArgument('total');
         $percentage = ++$index * 100 / $total;
         $this->io->overwrite(sprintf('Progress: <comment>%d%%</comment>', $percentage), false);
         $this->needsNewline = true;
     } else {
         $this->io->decreaseIndention(2);
     }
 }
开发者ID:webcreate,项目名称:conveyor,代码行数:12,代码来源:BuilderSubscriber.php

示例4: initializeRequest

 public function initializeRequest(GenericEvent $event)
 {
     if (null === $this->request) {
         return;
     }
     $this->request->attributes->set('easyadmin', array('entity' => $entity = $event->getArgument('entity'), 'view' => $this->request->query->get('action', 'list'), 'item' => ($id = $this->request->query->get('id')) ? $this->findCurrentItem($entity, $id) : null));
 }
开发者ID:artggd,项目名称:EasyAdminBundle,代码行数:7,代码来源:RequestPostInitializeListener.php

示例5:

 function it_does_not_set_locale_on_post_update_when_event_subject_is_different_from_current_user($translator, GenericEvent $event, UserInterface $user, RequestStack $requestStack, Request $request, LocaleInterface $locale)
 {
     $event->getSubject()->willReturn($user);
     $event->getArgument('current_user')->willReturn(null);
     $translator->setLocale('fr_FR')->shouldNotBeCalled();
     $this->onPostUpdate($event);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:7,代码来源:LocaleSubscriberSpec.php

示例6: onPostUpdate

 /**
  * @param GenericEvent $event
  */
 public function onPostUpdate(GenericEvent $event)
 {
     $user = $event->getSubject();
     if ($user === $event->getArgument('current_user')) {
         $request = $this->requestStack->getMasterRequest();
         $request->getSession()->set('_locale', $user->getUiLocale()->getCode());
         $this->translator->setLocale($user->getUiLocale()->getCode());
     }
 }
开发者ID:userz58,项目名称:pim-community-dev,代码行数:12,代码来源:LocaleSubscriber.php

示例7: onCrawlPreRequest

 /**
  * @param GenericEvent $event
  */
 public function onCrawlPreRequest(GenericEvent $event)
 {
     $currentHostname = $event->getArgument('uri')->getHost();
     if ($currentHostname === $this->previousHostname) {
         $this->totalDelay = $this->totalDelay + $this->requestDelay;
         usleep($this->requestDelay);
     }
     $this->previousHostname = $currentHostname;
 }
开发者ID:aktuba,项目名称:php-spider,代码行数:12,代码来源:PolitenessPolicyListener.php

示例8: let

 function let(OutputPrinter $printer, GenericEvent $event, InvokableMethod $method, \ReflectionMethod $refl, ExampleTestResult $result)
 {
     $this->beConstructedWith($printer, new ExceptionPresenter(), '/current/path');
     $event->getSubject()->willReturn($method);
     $event->getArgument('result')->willReturn($result);
     $method->getReflection()->willReturn($refl);
     $method->getPath()->willReturn('/current/path/to/spec');
     $refl->getName()->willReturn('it_does_stuff');
     $refl->getStartLine()->willReturn(42);
     $printer->write(' <comment>to/spec</comment> <lineno>+42</lineno>')->willReturn();
     $printer->writeln(Argument::type('string'))->shouldBeCalled();
     $printer->writeln(Argument::type('null'))->shouldBeCalled();
     $result->getStdOut()->willReturn();
 }
开发者ID:docteurklein,项目名称:funk-spec,代码行数:14,代码来源:PrettySpec.php

示例9: onTaskPreExecute

 public function onTaskPreExecute(GenericEvent $event)
 {
     $task = $event->getSubject();
     $io = $this->io;
     $self = $this;
     $task->setOutput(function ($output) use($io, $self) {
         if ($io->isVerbose()) {
             $io->write(sprintf('%s', $output));
             $self->needsNewline = false;
         } else {
             $io->overwrite(sprintf('%s', $output), false);
             $self->needsNewline = true;
         }
     });
     if ($event->getArgument('index') > 0) {
         if (true === $this->needsNewline) {
             $this->io->write('');
             $this->needsNewline = false;
         }
         $this->io->write('');
     }
     $this->io->write(sprintf('- Executing task <info>%s</info>', get_class($task)));
     $this->io->increaseIndention(2);
 }
开发者ID:webcreate,项目名称:conveyor,代码行数:24,代码来源:TaskRunnerSubscriber.php

示例10: testGetArgException

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testGetArgException()
 {
     $this->event->getArgument('nameNotExist');
 }
开发者ID:carlyns,项目名称:RESUSblog,代码行数:7,代码来源:GenericEventTest.php

示例11: onBlacklisted

 public function onBlacklisted(GenericEvent $event)
 {
     $url = $event->getArgument('uri')->toString();
     $this->logger->info(sprintf('blacklisted %s', $url), ['tags' => [parse_url($url, PHP_URL_HOST)]]);
 }
开发者ID:smolowik,项目名称:concurrent-spider-bundle,代码行数:5,代码来源:UrlBlacklistedListener.php

示例12: addToFailed

 public function addToFailed(GenericEvent $event)
 {
     $this->failed[$event->getArgument('uri')->toString()] = $event->getArgument('message');
 }
开发者ID:ggnet,项目名称:php-spider,代码行数:4,代码来源:StatsHandler.php

示例13: logEvent

 protected function logEvent($name, GenericEvent $event)
 {
     if ($this->debug === true) {
         echo "\n[{$name}]\t:" . $event->getArgument('uri')->toString();
     }
 }
开发者ID:aktuba,项目名称:php-spider,代码行数:6,代码来源:LogHandler.php

示例14: logEvent

 protected function logEvent($name, GenericEvent $event)
 {
     if ($this->debug === TRUE) {
         \Pimcore\Logger::debug('LuceneSearch [' . $name . ']: ' . $event->getArgument('uri')->toString());
     }
 }
开发者ID:dachcom-digital,项目名称:pimcore-lucene-search,代码行数:6,代码来源:Logger.php

示例15: getEntityClass

 /**
  *
  * @return string
  */
 protected function getEntityClass(GenericEvent $event)
 {
     $entity = $event->getArgument('entity');
     $entityNamespace = get_class($entity);
     $entityClasses = explode('\\', $entityNamespace);
     //get last string of the classname
     return $entityClasses[count($entityClasses) - 1];
 }
开发者ID:A5sys,项目名称:EasyAdminPopupBundle,代码行数:12,代码来源:CrudFlashbagListener.php


注:本文中的Symfony\Component\EventDispatcher\GenericEvent::getArgument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。