Retrieve the arguments for the callback.

@param PostDuplicateModelEvent $event The event being emitted.

@return array
549774
public function getArgs($event)
    {
        return [$event->getModel()->getId(), new DcCompat($event->getEnvironment(), $event->getSourceModel())];
    }
1008128
public static function getRegistered($event) {
            $listeners = [];
            foreach (self::$listeners as $ev => $registered_listeners) {
                if ($ev & $event) {
                    $listeners = array_merge($listeners, $registered_listeners);
                }
            }

            return $listeners;
        }
833362
public function getArgs($event)
    {
        return [
            new DcCompat($event->getEnvironment()),
            $event->getEnvironment()->getDataProvider()->getEmptyModel()->getPropertiesAsArray(),
            $event->getEnvironment()->getDataDefinition()->getName(),
            false,
            [],
            null,
            null
        ];
    }
1085302
public static function listModules(Event $event)
    {
        $packageRepository = new PackageRepository();
        $packageRepository->injectComposer($event->getComposer());

        $modules = $packageRepository->findModules();
        $maximumPackageNameLength = static::calculateMaximumPackageNameLength($modules);

        foreach ($modules as $module) {
            $paddedName = str_pad($module->getName(), $maximumPackageNameLength + 1);
            echo $paddedName . ' ' . $module->getPrettyVersion() . PHP_EOL;
        }
    }
625964
protected function getSortedListeners($event)
    {
        if (! $this->hasListeners($event)) {
            return [];
        }

        $listeners = $this->listeners[$event] ?? [];

        if ($event !== '*') {
            $namesWithWildcard = array_filter(array_keys($this->listeners), function ($name) {
                return $name !== '*' && strpos($name, '*') !== false;
            });
            foreach ($namesWithWildcard as $name) {
                if (StringHelper::matchWildcard('*', $name)) {
                    $listeners = array_merge($listeners, $this->listeners[$name]);
                }
            }
        }

        if (empty($listeners)) {
            return [];
        }

        krsort($listeners);

        return call_user_func_array('array_merge', $listeners);
    }
788846
public function getByReferenceCallArguments($callNode)
    {
        $byReferenceArguments = $callNode->args;
        if (!$this->calleeReflector->supports($callNode)) {
            return $byReferenceArguments;
        }

        $reflection = $this->calleeReflector->reflect($callNode);
        $byReferenceParameterPositions = array_flip($reflection->getByReferenceParameterPositions());
        $byReferenceArguments = array_intersect_key($byReferenceArguments, $byReferenceParameterPositions);

        return $byReferenceArguments;
    }
1156200
public function argumentsForCallback(callable $callback): array
    {
        $definition = new ReflectionFunction($callback);
        $arguments = [];

        foreach ($definition->getParameters() as $parameter) {
            if ($type = $parameter->getType()) {
                $arguments[] = Phony::emptyValue($type);
            } else {
                $arguments[] = null;
            }
        }

        return $arguments;
    }
872659
protected function collectListeners($event, array $args=[])
    {
        $event = $this->eventToString($event);

        $listeners = [];

        // Build args for * listeners
        array_unshift($args, $event);

        foreach ($this->root->getListeners('*', 'before') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        foreach ($this->root->getListeners($event, 'before') as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners($event) as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners('*') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        foreach ($this->root->getListeners($event, 'after') as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners('*', 'after') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        return $listeners;
    }
597850
public function listeners($event): array
    {
        $name = \get_class($event);

        $localListeners  = $this->events[$name] ?? [];
        $globalListeners = static::$globalEvents[$name] ?? [];

        return array_merge($globalListeners, $localListeners);
    }
116429
protected function getAfterOrBeforeListeners($event, $position)
    {
        if (!in_array($position, ['before', 'after'])) {
            throw new UnsupportedParameterException("Unsupported event position '$position'");
        }

        if ($position == 'before' && isset($this->beforeListeners[$event])) {
            return $this->beforeListeners[$event];
        }

        if ($position == 'after' && isset($this->afterListeners[$event])) {
            return $this->afterListeners[$event];
        }

        return [];
    }
320982
public function triggerEvent($event, $args = [])
    {
        if (!is_string($event) && !$event instanceof Event) {
            throw new \InvalidArgumentException(sprintf(
                '%s::%s only allow Event object or string.',
                get_called_class(),
                __FUNCTION__
            ));
        }

        if (!($event instanceof Event)) {
            if (isset($this->events[$event])) {
                $event = $this->events[$event];
            } else {
                $event = new Event($event);
            }
        }

        $event->mergeArguments($args);

        $listeners = [];

        if (isset($this->listeners[$event->getName()])) {
            foreach ($this->listeners[$event->getName()] as $listener) {
                if ($event->isStopped()) {
                    return $event;
                }

                if (!is_callable($listener)) {
                    $listener = [$listener, $event->getName()];
                }

                if (!is_callable($listener)) {
                    continue;
                }

                $listener($event);

                if ($this->debug) {
                    $listeners[] = $listener;
                }
            }
        }

        if ($this->debug) {
            $executedListeners = [];

            foreach ($listeners as $listener) {
                if ($listener instanceof \Closure) {
                    $ref = new \ReflectionFunction($listener);

                    $listener = ['{Closure}: ' . $ref->getFileName() . ' - Line: ' . $ref->getStartLine()];
                }

                if (is_object($listener[0])) {
                    $listener[0] = get_class($listener[0]);
                }

                $executedListeners[] = $listener;
            }

            $this->collector[] = [
                'event' => $event->getName(),
                'listeners' => $executedListeners,
            ];
        }

        return $event;
    }
747052
public function serialize(Event $event)
    {
        $editable = $event->getWorkspace() ?
            $this->authorization->isGranted('EDIT', $event) :
            false !== $event->isEditable();

        return [
            'id' => $event->getId(),
            'title' => $event->getTitle(),
            'start' => $event->getStart() ? DateNormalizer::normalize($event->getStart()) : null,
            'end' => $event->getEnd() ? DateNormalizer::normalize($event->getEnd()) : null,
            'color' => $event->getPriority(),
            'allDay' => $event->isAllDay(),
            'durationEditable' => !$event->isTask() && false !== $event->isEditable(),
            'owner' => $this->userSerializer->serialize($event->getUser()),
            'description' => $event->getDescription(),
            'workspace' => $event->getWorkspace() ? $this->workspaceSerializer->serialize($event->getWorkspace(), [Options::SERIALIZE_MINIMAL]) : null,
            'className' => 'event_'.$event->getId(),
            'editable' => $editable,
            'meta' => $this->serializeMeta($event),
        ];
    }
1204227
protected function parseEventAndPayload($event, $payload)
    {
        if (is_object($event)) {
            list($payload, $event) = [[$event], get_class($event)];
        }

        return [$event, array_wrap($payload)];
    }
1111072
public function getArgs($event)
    {
        return [
            $event->getProperty(),
            new DcCompat($event->getEnvironment(), $event->getModel(), $event->getProperty())
        ];
    }
1209492
public function match(string $event): array
    {
        $matches = [];

        //do the obvious match
        if (isset($this->observers[$event])) {
            $matches[$event] = array(
                'event' => $event,
                'pattern' => $event,
                'variables' => []
            );
        }

        //deal with regexp
        foreach ($this->regex as $pattern) {
            //if it matches
            if (preg_match_all($pattern, $event, $match)) {
                $variables = [];

                if (is_array($match) && !empty($match)) {
                    //flatten
                    $variables = call_user_func_array('array_merge', $match);
                    array_shift($variables);
                }

                $matches[$pattern] = array(
                    'event' => $event,
                    'pattern' => $pattern,
                    'variables' => $variables
                );
            }
        }

        return array_values($matches);
    }
1122846
public function getFilters(GetPropertyOptionsEvent $event)
    {
        if (!$this->isBackendOptionRequestFor($event, ['tag_filter'])) {
            return;
        }

        $model = $event->getModel();
        if (null === $metaModel = $this->factory->getMetaModel($model->getProperty('tag_table'))) {
            return;
        }
        $filters = $this->connection->createQueryBuilder()
            ->select('id', 'name')
            ->from('tl_metamodel_filter')
            ->where('pid=:pid')
            ->setParameter('pid', $metaModel->get('id'))
            ->orderBy('name')
            ->execute();

        $result = [];
        foreach ($filters->fetchAll(\PDO::FETCH_ASSOC) as $filter) {
            $result[$filter['id']] = $filter['name'];
        }

        $event->setOptions($result);
    }
982300
private function getOptionsData($event)
    {
        $items = [];
        
        foreach ($this->model->find()->asArray($this->asArray)->all() as $item) {
            if (is_callable($this->labelField, false)) {
                $label = call_user_func($this->labelField, $item);
            } else {
                if ($this->labelField === null) {
                    $this->labelField = array_keys($item);
                }
                $array = ArrayHelper::filter($item, $this->labelField);
                
                foreach ($array as $key => $value) {
                    if ($event->sender->isI18n($key)) {
                        $array[$key] = I18n::decodeFindActive($value);
                    }
                }
                
                $label = $this->labelTemplate ? vsprintf($this->labelTemplate, $array) : implode(', ', $array);
            }
        
            $items[] = ['value' => (int) $item[$this->modelPrimaryKey], 'label' => $label];
        }
        
        return ['items' => $items];
    }