Handle on session leaved

@param array $args
@param array $kwArgs
@param array $options
@return void
@link https://github.com/crossbario/crossbar/wiki/Session-Metaevents
769145
public function onSessionLeave($args, $kwArgs, $options)
    {
        if (!empty($args[0]['session'])) {
            foreach ($this->_sessions as $key => $details) {
                if ($args[0]['session'] == $details['session']) {
                    echo "Session {$details['session']} leaved\n";
                    unset($this->_sessions[$key]);
                    return;
                }
            }
        }
    }
809622
public function withArgs($args = [])
    {
        if (!is_array($args)) {
            $args = func_get_args();
        }

        $this->args = $args;
        return $this;
    }
997680
public function execute(array $args = [], array $options = [])
    {
        $argv = $_SERVER['argv'];
        array_shift($argv);
        array_shift($argv);

        $argvString = '';
        foreach ($argv as $arg) {
            $argvString .= ($argvString ? ' ' : '').'"'.str_replace('"', '\\"', $arg).'"';
        }
        $found = null;
        foreach ($this->getConfig()->get('_shell_scripts_dirs', []) as $dir) {
            $path = sprintf('%s/%s', $dir, $this->script);
            if (!is_file($path)) {
                continue;
            }
            $found = $path;
        }
        if (null === $found) {
            throw new \RuntimeException(sprintf("Unknown shell script '%s'", $this->script), 412);
        }

        $this->executeShellCommand(sprintf('%s %s', $found, $argvString), $options);
    }
109139
public function onClassMetadataNotFound(OnClassMetadataNotFoundEventArgs $args)
    {
        if (! array_key_exists($args->getClassName(), $this->resolveTargetDocuments)) {
            return;
        }

        $args->setFoundMetadata(
            $args
                ->getDocumentManager()
                ->getClassMetadata($this->resolveTargetDocuments[$args->getClassName()]['targetDocument'])
        );
    }
437474
public function execute(array $args = [], array $options = [])
    {
        /** @var CommandInterface[] $commands */
        $commands = $this->getConfig()->get('commands');

        $all = isset($options['all']) && true === $options['all'];

        $selectedCommands = [];
        foreach ($commands as $n => $c) {
            $hidden = false;
            $realName = $n;
            if ('_' === $n{0}) {
                if (!$all) {
                    continue;
                }
                $hidden = true;
                $n = substr($n, 1);
            }
            $selectedCommands[$n] = ['hidden' => $hidden, 'realName' => $realName, 'command' => $c];
        }

        ksort($selectedCommands);

        $user = $this->getConfig()->get('user_name');

        if ($user) {
            $this->writeln('<comment>DEV Console command</comment> (Happy hacking %s !)', $user);
        } else {
            $this->writeln('<comment>DEV Console command</comment>');
        }
        $this->writeln();
        $this->writeln('%d commands:', count($selectedCommands));

        $max = 0;

        foreach ($selectedCommands as $commandName => $def) {
            $len = strlen($commandName);
            $max = $max < $len ? $len : $max;
        }

        $lastLetter = null;

        foreach ($selectedCommands as $commandName => $def) {
            $letter = $commandName{0};
            if ($lastLetter !== $letter) {
                $this->writeln();
            }
            /** @var CommandInterface $command */
            $command = $def['command'];
            $command->setConfig($this->getConfig());
            $this->writeln("  <".($def['hidden'] ? 'comment' : 'info').">%-".$max."s</".($def['hidden'] ? 'comment' : 'info').">  <comment>%s</comment>", $commandName, $command->getDescription());
            $lastLetter = $letter;
        }

        $this->writeln();
    }
316916
public static function sortArgs(array &$args) {
        ksort($args);
        foreach ($args as $key => $val) {
            if (is_array($val)) {
                ksort($val);
                $args [ $key ] = $val;
                self::sortArgs($val);
            }
        }
    }
1284218
public function onClear($eventArgs)
    {
        parent::onClear($eventArgs);

        $aliases             = array_keys($this->identifierMap);
        $this->identifierMap = array();

        foreach ($aliases as $alias) {
            $this->identifierMap[$alias] = array();
        }
    }
1049464
private function processArguments(RawArgs $args, CommandCollection $namedCommands, array $argumentsToTest, array $optionsToTest)
    {
        $currentCommand = null;

        // Parse the arguments for command names until we fail to find a
        // matching command
        foreach ($argumentsToTest as $name) {
            if (!$namedCommands->contains($name)) {
                break;
            }

            $nextCommand = $namedCommands->get($name);

            if ($nextCommand->getConfig() instanceof OptionCommandConfig) {
                break;
            }

            $currentCommand = $nextCommand;
            $namedCommands = $currentCommand->getNamedSubCommands();
        }

        if (!$currentCommand) {
            return null;
        }

        return $this->processOptions($args, $currentCommand, $optionsToTest);
    }
634350
public function execute(array $args, array $options = [])
    {
        $this->bootstrap($args, $options);

        $format = isset($options['format']) ? $options['format'] : $options['f'];

        if (null !== $format) {
            Output::writeln('using format ' . $format);
        }

        $this->getManager()->printStatus($format);
    }
233028
public function removeSession(...$args)
    {
        $results = $this->remove('session', ...$args);

        // @codeCoverageIgnoreStart
        if (isset($_SESSION)) {
            $_SESSION = $this->get('session');
        }
        // @codeCoverageIgnoreEnd

        return $results;
    }
755990
protected function init_args($args)
    {
        parent::init_args($args);

        $this->env = $this->get_env_for_write_or_fail();
        $api = new Salts();

        try {
            $this->salts = $api->collect();
        } catch (Exception $e) {
            WP_CLI::error($e->getMessage());
        }
    }
282891
protected function handle($name, array $args = [])
    {
        if (isset($this->handlers[$name]) && is_callable($this->handlers[$name])) {
            array_unshift($args, $this);
            call_user_func_array($this->handlers[$name], $args);
        }
    }
714700
public function handle(array $args = [])
    {
        // remove source file name from argv
        $source = array_shift($args);

        /** @var ConsoleEvent $applicationEvent */
        $applicationEvent = $this->getApplicationEvent();
        $applicationEvent->setName(self::EVENT_REQUEST_RECEIVED);
        $applicationEvent->setSourceFile($source);
        $applicationEvent->setArguments($args);
        $this->emit($applicationEvent);

        // init dispatcher
        $dispatcher = new Dispatcher($this->commands, $this->container);

        $middlewareRunner = new MiddlewareRunner($this->getMiddlewares());

        $middlewareRunner->run([$applicationEvent->getArguments()], function ($args) use ($applicationEvent, $dispatcher) {
            // dispatch command with args from cli
            $dispatcher->dispatch($args);
        });
    }
1151736
public function execute(array $args, array $options = [])
    {
        $this->bootstrap($args, $options);

        $version = isset($options['target']) ? $options['target'] : $options['t'];
        $removeAll = isset($options['remove-all']) ? $options['remove-all'] : $options['r'];

        if ($version && $removeAll){
            throw new \InvalidArgumentException('Cannot toggle a breakpoint and remove all breakpoints at the same time.');
        }

        // Remove all breakpoints
        if ($removeAll){
            $this->getManager()->removeBreakpoints();
        } else {
            // Toggle the breakpoint.
            $this->getManager()->toggleBreakpoint($version);
        }
    }
399288
protected function main(Options $options)
    {
        if ($options->getOpt('longflag')) {
            $this->info("longflag was set");
        } else {
            $this->info("longflag was not set");
        }

        if ($options->getOpt('file')) {
            $this->info("file was given as " . $options->getOpt('file'));
        }

        $this->info("Number of arguments: " . count($options->getArgs()));

        $this->success("main finished");
    }
1050306
public function postPersist(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Execute published event after the object is persisted.
        if ($object->isPublished()) {
            $event = new EntityPublishedEvent($object);
            $this->event_dispatcher->dispatch(EntityPublishedEvent::NAME, $event);
        }
    }
968045
public function init($args)
    {
        if (empty($args) || OL_ZEUS_ISADMIN) {
            return;
        }

        // Special case
        if (is_bool($args) && $args) {
            $args = $this->available;
        }

        // Iterate on all
        foreach ($args as $key) {
            $key = strtolower($key);

            if (!in_array($key, $this->available)) {
                continue;
            }

            if (in_array($key, ['index_rel_link', 'parent_post_rel_link', 'rest_output_link_wp_head', 'rsd_link', 'start_post_rel_link', 'wp_dlmp_l10n_style', 'wp_resource_hints', 'wlwmanifest_link'])) {
                $this->headerWpHead($key);
                continue;
            }

            $key = str_replace('_', '-', $key);

            $function = Helpers::toFunctionFormat($key);
            $function = 'header'.ucfirst($function);
            $this->$function();
        }
    }