Captures outline into the ivar on outline BEFORE event.

@param Event $event
322511
private function captureOutlineOnBeforeOutlineEvent(Event $event)
    {
        if (!$event instanceof BeforeOutlineTested) {
            return;
        }

        $outline = $event->getOutline();
        foreach ($outline->getExamples() as $example) {
            $this->lineScenarioMap[$example->getLine()] = $outline;
        }
    }
1205514
protected function beforeValidate($event)
    {
        if ($this->autoSave) {
            $this->owner->{$this->uploadAttribute} = $this->getUploadedFile();
        }
    }
411662
public function preRender(Event $event)
    {
        $markdown = $event->getParam('markdown');

        $markdownHash = md5($markdown);

        $success = false;
        $renderedMarkdown = $this->cache->getItem($markdownHash, $success);
        if ($success) {
            $event->stopPropagation(true);

            return $renderedMarkdown;
        }

        return false;
    }
1158052
private function captureScenarioOrExampleStatsOnAfterEvent(Event $event)
    {
        if (!$event instanceof AfterScenarioTested) {
            return;
        }

        $scenario = $event->getScenario();
        $title = $scenario->getTitle();
        $path = sprintf('%s:%d', $this->currentFeaturePath, $scenario->getLine());
        $resultCode = $event->getTestResult()->getResultCode();

        $stat = new ScenarioStat($title, $path, $resultCode);
        $this->statistics->registerScenarioStat($stat);
    }
937281
public function beforeJavascriptStep($event)
    {
        /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
        // Make sure the feature is registered in case this hook fires before
        // ::registerFeature() which is also a @BeforeStep. Behat doesn't
        // support ordering hooks.
        $this->registerFeature($event);
        if (!$this->hasTag('javascript')) {
            return;
        }
        $text = $event->getStep()->getText();
        if (preg_match('/(follow|press|click|submit)/i', $text)) {
            $this->iWaitForAjaxToFinish($event);
        }
    }
42724
public function onBefore(BeforeEvent $event)
    {
        $request = $event->getRequest();
        $context = Tracer::spanContext();
        if ($context->enabled()) {
            $request->setHeader($this->propagator->key(), $this->propagator->formatter()->serialize($context));
        }
        $span = Tracer::startSpan([
            'name' => 'GuzzleHttp::request',
            'attributes' => [
                'method' => $request->getMethod(),
                'uri' => $request->getUrl()
            ],
            'kind' => Span::KIND_CLIENT
        ]);
        $this->scope = Tracer::withSpan($span);
    }
780049
public static function onPreUpdate(Event $event)
    {
        $page = $event->getTarget();
        $eventArgs = $event->getEventArgs();
        $updateParents = false;
        $new = $old = null;

        $pageCountModifier = -1;
        if ($eventArgs instanceof PreUpdateEventArgs) {
            if ($page instanceof Page && $eventArgs->hasChangedField('_section')) {
                $old = $eventArgs->getOldValue('_section');
                $new = $eventArgs->getNewValue('_section');

                if ($new->getUid() === $page->getUid()) {
                    return;
                }
                $updateParents = true;
            }

            if ($page instanceof Page && $eventArgs->hasChangedField('_state')) {
                if ($page->getParent() !== null) {
                    if ($eventArgs->getNewValue('_state') >= 4) {
                        $old = $page->getParent()->getSection();
                        if (!$page->isLeaf()) {
                            $pageCountModifier = 0;
                        }
                    } else {
                        $new = $page->getParent()->getSection();
                    }
                    $updateParents = true;
                }
            }

            if ($page instanceof Section && $eventArgs->hasChangedField('_parent')) {
                $old = $eventArgs->getOldValue('_parent');
                $new = $eventArgs->getNewValue('_parent');
                $updateParents = true;
            }

            if ($updateParents) {
                $em = $event->getApplication()->getEntityManager();

                self::setSectionHasChildren($em, $old, $pageCountModifier);
                self::setSectionHasChildren($em, $new, +1);
            }
        }
    }
807893
public function onReflectSuccess($event)
    {
        $filename = $event['file']->getPathname();
        $appEvent = $this->stopwatch->stop($filename);
        $time     = $appEvent->getDuration();

        self::$logger->info(
            'AST built in {time} on file "{file}"',
            array('time' => Timer::toTimeString($time), 'file' => $filename)
        );
    }
710643
public function beforeSave(Event $Event) {
		if ($this->_checkEvent($Event)) {
			$data = $Event->getData();

			if (in_array($data['record']['model'], (array)$this->getConfig('autoRotate'))) {
				$imageFile = $data['record']['file']['tmp_name'];
				$format = StorageUtils::fileExtension($data['record']['file']['name']);
				$this->_autoRotate($imageFile, $format);
			}
		}
	}
124200
public function beforeRender(Event $event) {
		/** @var \Cake\Controller\Controller $controller */
		$controller = $event->getSubject();
		$controller->viewBuilder()->setClassName($this->_config['viewClass']);

		// Set flash messages to the view
		if ($this->_config['flashKey']) {
			$message = $controller->getRequest()->getSession()->consume($this->_config['flashKey']);
			if ($message || !array_key_exists('_message', $controller->viewVars)) {
				$controller->set('_message', $message);
			}
		}

		// If _serialize is true, *all* viewVars will be serialized; no need to add _message.
		if ($this->_isSerializeTrue($controller)) {
			return;
		}

		$serializeKeys = ['_message'];
		if (!empty($controller->viewVars['_serialize'])) {
			$serializeKeys = array_merge((array)$controller->viewVars['_serialize'], $serializeKeys);
		}
		$controller->set('_serialize', $serializeKeys);
	}
989639
public function onPreSerialize(PreSerializeEvent $event)
    {
        $object = $event->getObject();
        if ($object instanceof ExtRefHoldingDocumentInterface && $object->isEmptyExtRefObject() === true) {
            $event->setType('Empty', [$object]);
        }
    }
761496
public function onViewBeforeRender(Event $event)
    {
        /**
         * @var Container $container
         * @var Profiler  $profiler
         */
        $container = $event['view']->getPackage()->getContainer();
        $profiler  = $container->get('profiler');

        $name = $event['view']->getPackage()->name . '@' . $event['view']->getName();

        $profiler->mark(__FUNCTION__ . ' / ' . $name . ' (' . uniqid() . ')', [
            'tag' => 'package.process',
        ]);
    }
375404
public function evaluateAttributes($event)
    {
        if (in_array($event->name, $this->events)) {
            foreach ($this->attributes as $type => $attributes) {
                $method = 'get' . $type . 'value';
                if (method_exists($this, $method)) {
                    foreach ( (array) $attributes as $attribute) {
                        $this->owner->$attribute = $this->$method($this->owner->$attribute, $event->name);
                    }
                }
            }
        }
    }
981939
public static function onAfterRemove(Event $event)
    {
        $layout = $event->getTarget();
        if (!is_a($layout, 'BackBee\Site\Layout')) {
            return;
        }

        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            $dispatcher->getApplication()->getEntityManager()
                    ->getRepository('BackBee\Site\Layout')
                    ->removeThumbnail($layout, $dispatcher->getApplication());
        }

        $dispatcher->getApplication()->getRenderer()->removeLayout($layout);
    }
1106064
public function beforeFilter(Event $event)
    {
        $this->TimebasedCurrencyPayment = TableRegistry::getTableLocator()->get('TimebasedCurrencyPayments');
        $this->TimebasedCurrencyOrderDetail = TableRegistry::getTableLocator()->get('TimebasedCurrencyOrderDetails');
        parent::beforeFilter($event);
    }
1343445
public function onBeforeSend(Event $event)
    {
        /** @var $request Request */
        $request = $event['request'];

        $id = $this->signatureCredentials->getMacId();
        $ts = $this->timeProvider->getCurrentTime()->getTimestamp();
        $nonce = $this->randomProvider->generateStringForRanges($this->nonceLength, self::$characterRanges);
        $ext = $this->extensionProvider->getExtensionParameters($request, $this->signatureCredentials, $ts, $nonce);
        $ext = http_build_query($ext, null, '&');
        $mac = $this->algorithmManager->generateMac($request, $this->signatureCredentials, $ts, $nonce, $ext);

        $params = array(
            'id' => $id,
            'ts' => $ts,
            'nonce' => $nonce,
            'ext' => $ext,
            'mac' => $mac,
        );

        $list = array();
        foreach ($params as $key => $value) {
            $list[] = $key . '="' . $value . '"';
        }
        $header = 'MAC ' . implode(', ', $list);

        $request->setHeader('Authorization', $header);
    }
1114797
public static function onApplicationInit(Event $event)
    {
        $application = $event->getTarget();
        $container = $application->getContainer();
        if ($container->hasParameter('bbapp.classcontent.exception_on_unknown_classname')) {
            $parameter = $container->getParameter('bbapp.classcontent.exception_on_unknown_classname');
        } else {
            $parameter = true;
        }

        if ('debug' === strtolower($parameter)) {
            AbstractClassContent::throwExceptionOnUnknownClassname($application->isDebugMode());
        } else {
            AbstractClassContent::throwExceptionOnUnknownClassname($parameter);
        }
    }