Marks beginning or end of the background.

@param string $eventName
359492
private function markBeginningOrEndOfTheBackground($eventName)
    {
        if (BackgroundTested::BEFORE === $eventName) {
            $this->inBackground = true;
        }

        if (BackgroundTested::AFTER === $eventName) {
            $this->inBackground = false;
        }
    }
1282514
private void fireEvent(EventName eventName) {        
        switch (eventName.getEventIdentifier().intValue()) {
            case MgcpEvent.REPORT_ON_COMPLETION :
                //parse options
                Options options = new Options(eventName.getEventIdentifier().getParms());
                switch (options.getReturnCode()) {
                    case 100 :                    	
                    	if (options.getPatternIndex() >= 0) {
                            recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.RTC_TRIGGERED, triggers.get(options.getPatternIndex()), 0);
                        } else if (options.getDigitsCollected() != null) {
                            recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.RTC_TRIGGERED, SignalDetector.DETECTION_OF_ONE_SIGNAL, 0);
                        } else {
                            recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.NO_QUALIFIER, null, 0);
                        } 
                        signal(SIGNAL_COMPLETE);
                        break;
                    case 328 :
                        recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.DURATION_EXCEEDED, null, 0);
                        signal(SIGNAL_COMPLETE);
                        break;
                    case 327 :
                        recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.SILENCE, null, 0);
                        signal(SIGNAL_COMPLETE);
                        break;
                }
                break;
            case MgcpEvent.REPORT_FAILURE :
                recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, MediaErr.NOT_FOUND, "Not found");
                signal(SIGNAL_FAILURE);
                break;
        }
        
    }
41716
public function hasListeners($eventName = '')
    {
        $count = 0;

        if (empty($eventName)) {
            $count = count($this->listeners);
        } elseif (isset($this->listeners[$eventName])) {
            $count = count($this->listeners[$eventName]);
        }

        return (boolean) $count;
    }
1085170
protected function lazyLoad($eventName)
    {
        parent::lazyLoad($eventName);

        if (isset($this->listenerIds[$eventName])) {
            foreach ($this->listenerIds[$eventName] as $args) {
                list($serviceId, $method, $priority, $queueName) = $args;
                if ($queueName != null) {
                    $listener = $this->container->get($serviceId);
                    $key = $serviceId.'.'.$method;
                    $this->listeners[$eventName][$key] = array($listener, $queueName);
                }
            }
        }
    }
1290733
public function hasListeners($eventName)
    {
        if ($listeners = $this->events->getListeners($eventName)) {
            return true;
        }

        if ($listeners = $this->events->getListeners($eventName, 'before')) {
            return true;
        }

        if ($listeners = $this->events->getListeners($eventName, 'after')) {
            return true;
        }

        return false;
    }
884849
public function bind($eventName, $callback, $mode = EventsHandlerInterface::BINDING_MODE_LAST)
    {
        if ($eventsHandler = $this->getEventsHandler()) {
            $eventsHandler->bind($eventName, $callback, $mode);
        }
    }
318770
public function fireEvent($eventName, Event $event = null)
    {
        /** @var EventDispatcher $events */
        $events = $this['events'];

        return $events->dispatch($eventName, $event);
    }
656655
protected function endRenderBlock($blockName)
    {
        $contents = ob_get_contents();
        ob_end_clean();
        foreach ($this->plugins as $plugin) {
            $blockRenderList = $plugin->getBlockRenderList();
            if (in_array($blockName, $blockRenderList) === true) {
                echo $plugin->callBlockRenderEnd($blockName, $contents);
                return;
            }
        }
        echo $contents;
        throw new JigException("Block $blockName not known for ending block in plugins.");
    }
509337
public function markComponentSuccessfullyUninstalled($name)
    {
        try {
            Option::delete(self::getNameInOptionTable($name));
        } catch (\Exception $e) {
            // case when the option table is not yet created (before 0.2.10)
        }

        /**
         * Event triggered after a component has been uninstalled.
         *
         * @param string $name The component that has been uninstalled.
         */
        Piwik::postEvent('Updater.componentUninstalled', array($name));
    }
128998
public function endElement($name)
    {
        if (self::DEBUG) {
            print("endElement(" . $name . ") called\n");
        }
        if ($name == "dataset") {
            if ($this->currBuilder !== null) {
                $this->sqlWriter->write($this->currBuilder->getTableEndSql());
            }
            $this->sqlWriter->write(call_user_func(array($this->builderClazz, 'getDatabaseEndSql')));
        }
    }
332915
public function hasListeners(string $eventName) : bool
    {
        return isset($this->events[$eventName]) && count($this->events[$eventName]) > 0;
    }
979305
function(eventName, selector, callback) {
        if (!isString(selector)) {
            callback = selector;
            selector = '';
        }

        if (callback) {
            var events = this.events[eventName];
            if (events) {
                events = events[selector];
                if (events) {
                    for (var i = 0; i < events.length; i++) {
                        if (events[i] === callback) {
                            events.splice(i, 1);
                            i--;
                        }
                    }
                }
            }
        } else {
            this.events[eventName][selector] = [];
        }
    }
593596
public function getBackgroundColorEscapeSequence ( $colorName = '' ) {
        if ( $this->_isDefinedColor($colorName) === true ) {
            $colors = self::getDefinedColors();
            list($textColor, $backgroundColor) = $colors[$colorName];
            return $backgroundColor;
        }
        return '';
    }
1238041
protected function sortEventListeners(string $eventName): array
    {
        $listeners = $this->listeners[$eventName];
        $normalised = [];

        ksort($listeners);

        foreach ($listeners as $priorityListeners) {
            foreach ($priorityListeners as $listener) {
                $normalised[] = $listener;
            }
        }

        return $normalised;
    }
1076217
public function listeners(string $eventName) : array
    {
        if (!isset($this->listeners[$eventName])) {
            return [];
        }

        // The list is not sorted
        if (!$this->listeners[$eventName][0]) {
            // Sorting
            /** @psalm-suppress MixedArgument */
            \array_multisort($this->listeners[$eventName][1], SORT_NUMERIC, $this->listeners[$eventName][2]);

            // Marking the listeners as sorted
            $this->listeners[$eventName][0] = true;
        }

        return $this->listeners[$eventName][2];
    }
566530
public function removeEventHandler($eventName, $eventHandlerName, $priority = 50)
    {
        $this->removeHandler(self::EVENT, $eventName, $eventHandlerName, $priority);
    }
739502
public function dispatch($eventName = null)
    {
        // Tries to fetch the event by the given eventname
        $event = null;
        if (null !== $eventName) {
            $event = $this->fetchEvent($eventName);
        }

        // Fetches the last saved event
        if (null === $event && !empty($this->events)) {
            $eventNames = array_keys($this->events);
            $events = array_values($this->events);
            $elemens = count($events) - 1;
            $event = $events[$elemens];
            $eventName = $eventNames[$elemens];
        }

        if (null === $event) {
            throw new RuntimeException('exception_no_events');
        }

        $this->eventDispatcher->dispatch($eventName, $event);

        return $this;
    }