Returns an array in the form of var association:
list($controller, $request, $view) = self::getEverythingFromArgs($args);

@param \Enlight_Event_EventArgs $args
@param null $element
@return array|mixed|null
425675
final public static function getEverythingFromArgs(\Enlight_Event_EventArgs $args, $element = null)
    {
        /**
         * @var \Enlight_Controller_Action $controller
         */
        $controller = $args->get('subject');

        /**
         * @var \Enlight_Controller_Request_Request $request
         */
        $request = $controller->Request();

        /**
         * @var \Enlight_View_Default $view
         */
        $view = $controller->View();

        $result = [
            'controller' => $controller,
            'request' => $request,
            'view' => $view
        ];

        if ($element !== null) {
            if (array_key_exists($element, $result)) {
                $result = $result[$element];
            } else {
                $result = null;
            }
        }

        return $result;
    }
382783
public function elementsAction(Request $request)
    {
        $siterootId = $request->get('siteroot_id');
        $language = $request->get('language');
        $query = $request->get('query');

        $treeManager = $this->get('phlexible_tree.tree_manager');
        $iconResolver = $this->get('phlexible_element.icon_resolver');
        $conn = $this->get('database_connection');

        $tree = $treeManager->getBySiteRootId($siterootId);

        $qb = $conn->createQueryBuilder();
        $qb
            ->select('t.id AS tid', 'e.latest_version AS version', 'evmf.backend AS title')
            ->from('tree', 't')
            ->join('t', 'element', 'e', 't.type_id = e.eid')
            ->join('e', 'element_version', 'ev', 'ev.eid = e.eid AND ev.version = e.latest_version')
            ->join('ev', 'element_version_mapped_field', 'evmf', 'evmf.element_version_id = ev.id')
            ->where($qb->expr()->eq('evmf.language', $qb->expr()->literal($language)))
            ->andWhere($qb->expr()->eq('t.siteroot_id', $qb->expr()->literal($siterootId)))
            ->andWhere($qb->expr()->like('evmf.backend', $qb->expr()->literal("%$query%")));

        $result = $conn->fetchAll($qb->getSQL());

        foreach ($result as $key => $row) {
            $treeNode = $tree->get($row['tid']);
            $result[$key]['icon'] = $iconResolver->resolveTreeNode($treeNode, $language);
        }

        return new JsonResponse(['results' => $result]);
    }
949357
protected function triggerParamsMergeEvent($event, $argv = array(), $callback = null)
    {
        $eventRet = $this->triggerEvent($event, $argv, $callback);
        foreach ($eventRet as $event) {
            if (is_array($event) || $event instanceof Traversable) {
                $argv = array_merge_recursive($argv, $event);
            }
        }

        return $argv;
    }
620575
function getExtensionArgs($request = null)
    {
        $ns_args = array();
        if (count($this->auth_policies) > 0) {
            $ns_args['auth_policies'] = implode(' ', $this->auth_policies);
        } else {
            $ns_args['auth_policies'] = 'none';
        }

        if ($this->nist_auth_level !== null) {
            if (!in_array($this->nist_auth_level, range(0, 4), true)) {
                return false;
            }
            $ns_args['nist_auth_level'] = strval($this->nist_auth_level);
        }

        if ($this->auth_time !== null) {
            if (!preg_match(PAPE_TIME_VALIDATOR, $this->auth_time)) {
                return false;
            }

            $ns_args['auth_time'] = $this->auth_time;
        }

        return $ns_args;
    }
1258130
static function createOperatorElement( $name, $parameters = array(), $variablePlacement = false )
    {
        return array( eZTemplate::TYPE_ATTRIBUTE,
                      array_merge( array( $name ), $parameters ), $variablePlacement );
    }
126067
public function checkInOrder(...$events): ?EventCollection
    {
        if (!count($events)) {
            return null;
        }

        $isMatch = true;
        $matchingEvents = [];
        $earliestEvent = null;

        foreach ($events as $event) {
            if ($event instanceof Event) {
                if (
                    !$earliestEvent ||
                    $event->sequenceNumber() > $earliestEvent->sequenceNumber()
                ) {
                    $matchingEvents[] = $earliestEvent = $event;

                    continue;
                }
            } elseif ($event instanceof EventCollection) {
                if (!$event->hasEvents()) {
                    throw new InvalidArgumentException(
                        'Cannot verify event order with empty results.'
                    );
                }

                foreach ($event->allEvents() as $subEvent) {
                    if (
                        !$earliestEvent ||
                        (
                            $subEvent->sequenceNumber() >
                            $earliestEvent->sequenceNumber()
                        )
                    ) {
                        $matchingEvents[] = $earliestEvent = $subEvent;

                        continue 2;
                    }
                }
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        'Cannot verify event order with supplied value %s.',
                        $this->assertionRenderer->renderValue($event)
                    )
                );
            }

            $isMatch = false;

            break;
        }

        if ($isMatch) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
1085138
public static function fetchArguments($_class = null, $_method = null, $args = null)
    {
        if (empty($_class) || empty($_method)) {
            return null;
        }
        $args_def = array();
        if (!empty($args)) {
            $analyze = new ReflectionMethod($_class, $_method);
            foreach($analyze->getParameters() as $_param) {
                $arg_index = $_param->getName();
                $args_def[$_param->getPosition()] = isset($args[$arg_index]) ?
                    $args[$arg_index] : ( $_param->isOptional() ? $_param->getDefaultValue() : null );
            }
        }
        return call_user_func_array( array($_class, $_method), $args_def );
    }
258598
public function getArgs($event)
    {
        $extra = $event->getCommand()->getExtra();

        return [
            $event->getModel()->getPropertiesAsArray(),
            $this->buildHref($event->getCommand()),
            $event->getLabel(),
            $event->getTitle(),
            ($extra['icon'] ?? null),
            $event->getAttributes(),
            $event->getEnvironment()->getDataDefinition()->getName(),
            $event->getEnvironment()->getDataDefinition()->getBasicDefinition()->getRootEntries(),
            $event->getChildRecordIds(),
            $event->isCircularReference(),
            $event->getPrevious() ? $event->getPrevious()->getId() : null,
            $event->getNext() ? $event->getNext()->getId() : null
        ];
    }
334991
protected function processArgumentNull(Element $arg) {
		$definition = new stdClass();
		
		$definition->type  = 'value';
		$definition->value = null;
		
		return $definition;
	}
795399
protected function getEventAdapter(EventArgs $args)
    {
        $class = get_class($args);
        if (preg_match('@Doctrine\\\([^\\\]+)@', $class, $m) && in_array($m[1], ['ODM', 'ORM'])) {
            if (!isset($this->adapters[$m[1]])) {
                $adapterClass = 'Gedmo\\Mapping\\Event\\Adapter\\' . $m[1];
                $this->adapters[$m[1]] = new $adapterClass();
            }

            $this->adapters[$m[1]]->setEventArgs($args);
            return $this->adapters[$m[1]];
        }

        throw new \InvalidArgumentException('Session continaer does not support event arg class: ' . $class);
    }
745313
public function getParams($element, $returnRaw=false)
	{
		$params = null;

		if ($this->baseDb->tableExists('#__components'))
		{
			if (substr($element, 0, 4) == 'plg_')
			{
				$ext = explode('_', $element);
				$query = "SELECT `params` FROM `#__plugins` WHERE `folder` = " . $this->baseDb->quote($ext[1]) . " AND `element` = " . $this->baseDb->quote($ext[2]);
			}
			else
			{
				$query = "SELECT `params` FROM `#__components` WHERE `option` = " . $this->baseDb->quote($element);
			}

			$this->baseDb->setQuery($query);
			$params = $this->baseDb->loadResult();
		}
		elseif ($this->baseDb->tableExists('#__extensions'))
		{
			if (substr($element, 0, 4) == 'plg_')
			{
				$ext = explode('_', $element);
				$query = "SELECT `params` FROM `#__extensions` WHERE `folder` = " . $this->baseDb->quote($ext[1]) . " AND `element` = " . $this->baseDb->quote($ext[2]);
			}
			else
			{
				$query = "SELECT `params` FROM `#__extensions` WHERE `element` = " . $this->baseDb->quote($element);
			}

			$this->baseDb->setQuery($query);
			$params = $this->baseDb->loadResult();
		}
		else
		{
			$this->log(sprintf('Required table not found for retrieving "%s" params', $element), 'warning');
		}

		if (!$returnRaw)
		{
			if ($params)
			{
				$params = new Registry($params);
			}
			else
			{
				$params = new Registry();
			}
		}

		return $params;
	}
1254736
protected function processArgumentArray(Element $arg) {
		$definition = new stdClass();
		
		$definition->type  = 'value';
		$definition->value = [];
				
		foreach ($arg->getContent() as $element) {
			if ($element->getName() !== 'element') {
				throw new InvalidConfig('Array definition must contain only "element" elements', null, null, $arg);
			}
			
			if (isset($element->key)) {
				$definition->value[$element->key] = $this->processArgument($element);
			} else {
				$definition->value[] = $this->processArgument($element);
			}
		}
		
		return $definition;
	}
579526
function onQuickFormEvent($event, $arg, &$caller)
    {
        switch ($event) {
            case 'createElement':
                static::__construct($arg[0], $arg[1], $arg[2]);
                $caller->_registerCancelButton($this->getName());
                return true;
                break;
        }
        return parent::onQuickFormEvent($event, $arg, $caller);
    }
561246
public function find(string $method, $value, array $args = [])
    {
        $isMethod = null;

        $clone = clone $this;
        $clone->elements = array_filter($this->elements, function ($item) use ($method, $value, &$isMethod, $args) {
            return $this->elementMethodCall($method, $item, $isMethod, $args) === $value;
        });

        return $clone;
    }
968843
private function mapArguments(AbstractController $controller, string $method, array $args) : array
    {
        $return = [];

        $reflection = new \ReflectionClass($controller);
        if (!$reflection->hasMethod($method)) {
            throw new \InvalidArgumentException(sprintf(
                "Method '%s' does not exist on '%s' for route '%s'",
                $method,
                get_class($controller),
                $this->currentRoute->getName()
            ));
        }

        $method = $reflection->getMethod($method);

        foreach ($method->getParameters() as $parameter) {
            if (!isset($args[$parameter->getName()]) && $parameter->isOptional() === false) {
                if ($method->getName() === 'init') {
                    continue;
                }

                throw new \InvalidArgumentException(sprintf(
                    "Missing mandatory arguments on controller definition '%s' on '%s'",
                    $parameter->getName(),
                    get_class($controller)
                ));
            }

            $return[$parameter->getName()] = null;

            if (array_key_exists($parameter->getName(), $args) && $args[$parameter->getName()] !== '') {
                $value = $args[$parameter->getName()];

                if ($parameter->getClass() && $parameter->getClass()->getName() == 'Cawa\Date\DateTime') {
                    $value = new DateTime($value);
                }

                $return[$parameter->getName()] = $value;
            } elseif (!array_key_exists($parameter->getName(), $args)) {
                $return[$parameter->getName()] = $parameter->getDefaultValue();
            }
        }

        return $return;
    }
950812
function getEventAndAnchor (arg1, arg2) {
  var ev = null
  var anchor = null

  if (arguments.length === 2) {
    // Two arguments will come in this order
    ev = arg1
    anchor = arg2
  } else if (isHTMLElement(arg1)) {
    // If our first arg is an element
    // then use that as our anchor
    anchor = arg1
  } else {
    // Otherwise our argument is an event
    ev = arg1
  }

    // If there is no anchor, but we have an event
    // then use event.target
  if (!anchor && ev && ev.target) {
    anchor = ev.target
  }

    // Return an array so that it can be used with Function.apply
  return [ev, anchor]
}
1235626
public function getArgs($event)
    {
        return [
            $event->getGroupField(),
            $event->getGroupingMode(),
            $event->getValue(),
            $event->getModel()->getPropertiesAsArray()
        ];
    }