@param string $name
@param null|string $uniqueKey Used when args are present
@param mixed ...$args

@return MenuItemInterface
@throws InvalidMenuNameException
434970
public function getMenu(string $name, ?string $uniqueKey = null, ...$args): MenuItemInterface
    {
        if ($uniqueKey && $args) {
            return $this->container->getMenuWithArgs($name, $uniqueKey, ...$args);
        }

        return $this->container->getMenu($name);
    }
574571
public function deleteQueue($name)
    {
        if (!isset($this->queues)) {
            throw new InvalidKeyException(['delete `:queue` queue failed: it is not exists', 'queue' => $name]);
        }

        try {
            $this->_queues[$name]->delete();
        } catch (\Exception $e) {
            throw new AmqpException(['delete `:queue` queue failed: error', 'queue' => $name, 'error' => $e->getMessage()]);
        }

        unset($this->_queues[$name]);

        return $this;
    }
1012099
protected function &internalGetModular(string $name) : ModularAbstract
    {
        $modularName = $this->sanitizeModularName($name);
        if (!$modularName) {
            throw new InvalidArgumentException(
                "Please insert not an empty arguments",
                E_USER_ERROR
            );
        }

        if (!$this->exist($modularName)) {
            throw new InvalidModularException(
                sprintf(
                    '%1$s %2$s has not found',
                    $this->modularParser->getName(),
                    $name
                )
            );
        }

        if (is_array($this->validModular[$modularName])) {
            $className = empty($this->validModular[$modularName][static::CLASS_NAME_KEY])
                ? null
                : (string) $this->validModular[$modularName][static::CLASS_NAME_KEY];

            if (! $className
                || ! class_exists($this->validModular[$modularName][static::CLASS_NAME_KEY])
            ) {
                throw new InvalidModularException(
                    sprintf(
                        '%1$s %2$s has not found',
                        $this->modularParser->getName(),
                        $name
                    )
                );
            }

            $modular = new $className(
                $this->modularParser->getContainer(),
                $modularName
            );

            $this->validModular[$modularName] = $modular;
        }

        if (! $this->validModular[$modularName] instanceof ModularAbstract) {
            unset($this->validModular[$modularName]);
            $e = new InvalidModularException(
                sprintf(
                    '%1$s %2$s Is not valid.',
                    $this->modularParser->getName(),
                    $name
                )
            );

            $this->invalidModular[$modularName] = $e;
            throw $e;
        }

        return $this->validModular[$modularName];
    }
364709
public function table($name, $callback = null)
    {   
        if (! $callback instanceof \Closure) {
            throw InvalidArgumentPassedException::isNotClosure();
        }

        $this->setTableName($name);

        $callback($this);
        
        $tableNamePrefixed = $this->getTableNamePrefix($this->getTableName());
        $tableStructure = \substr($this->getColumnsQuery() . $this->getPrimaryKeyQuery(), 0, -2);
        $tableCharsetCollate = $this->getCharacterSetCollate();

        $this->buildCreateTableQuery($tableNamePrefixed, $tableStructure, $tableCharsetCollate);

        $this->flushColumns();
        $this->flushPrimaryKey();
    }
293278
public function findOneByName($name)
    {
        $as = $this->getAlias();
        $qb = $this->getQueryBuilder();

        $qb->andWhere($qb->expr()->eq($as . '.name', ':name'));

        $parameters = ['name' => $name];

        if (0 < strpos($name, ':')) {
            list($rootName, $menuName) = explode(':', $name);

            /** @var \Ekyna\Bundle\CmsBundle\Model\MenuInterface $root */
            if (null === $root = $this->findOneBy(['name' => $rootName])) {
                throw new \InvalidArgumentException(sprintf('Root menu "%s" not found.', $rootName));
            }

            $qb->andWhere($qb->expr()->eq($as . '.root', ':root'));

            $parameters = [
                'name' => $menuName,
                'root' => $root,
            ];
        }

        return $qb
            ->getQuery()
            ->useQueryCache(true)
            // TODO ->useResultCache(true, 3600, Menu::getEntityTagPrefix() . '[name=' . $name . ']')
            ->setMaxResults(1)
            ->setParameters($parameters)
            ->getOneOrNullResult();
    }
1362573
public function create($name, $argument = null)
    {
        $constructorArgs = func_get_args();
        array_shift($constructorArgs);
        return $this->createWithArgs($name, $constructorArgs);
    }
1315492
public function create($name, $options = [])
    {
        if ($this->menus->has($name)) {
            throw new MenuAlreadyExistsException("Can not create menu named `$name` because it already exists");
        }

        $this->menus->put($name, $instance = MenuFactory::create($name, $options));

        return $instance;
    }
234566
public function getUnique($name, $customParameters = [], $uniqueDependencies = false)
    {
        if (isset($this->services[$name])) {
            return $this->getService($name, $customParameters, $uniqueDependencies);
        }

        if (isset($this->parameters[$name])) {
            return $this->getParameter($name);
        }

        throw new \InvalidArgumentException(sprintf('This service/parameter %s does not exist', $name));
    }
1348902
private function buildArguments($key)
    {
        $newArguments = [];
        if ($this->serviceConfig->keyExists($key)) {
            $arguments = $this->serviceConfig->key($key);
            if (!$this->isArray($arguments)) {
                throw new ServiceManagerException(ServiceManagerException::INVALID_SERVICE_ARGUMENTS_TYPE,
                                                  [$this->serviceName]
                );
            }
            foreach ($arguments as $arg) {
                $newArguments[] = new Argument($arg);
            }
        }
        $this->serviceConfig->key($key, $newArguments);
    }
780448
public static function isUniqueIdValid($uniqueId, $class)
    {
        if (!$uniqueId) {
            throw new InvalidArgumentException(sprintf(
                __('For the service provider [%s], the container unique ID cannot be empty.', 'fulcrum'),
                $class
            ));
        }

        if (!is_string($uniqueId)) {
            throw new InvalidArgumentException(sprintf(
                __('For the service provider [%s], the container unique ID must be a string. %s given.', 'fulcrum'),
                $class,
                gettype($uniqueId)
            ));
        }

        return true;
    }
1232688
public function declareQueue($name, $flags = AMQP_DURABLE)
    {
        if (isset($this->queues[$name])) {
            throw new InvalidKeyException(['declare `:queue` queue failed: it is exists already', 'queue' => $name]);
        }

        try {
            $queue = new \AMQPQueue($this->_channel);

            $queue->setName($name);
            $queue->setFlags($flags);

            $queue->declareQueue();
        } catch (\Exception $e) {
            throw new AmqpException(['declare `:queue` queue failed: `:error`', 'queue' => $name, 'error' => $e->getMessage()]);
        }

        $this->_queues[$name] = $queue;

        return $queue;
    }
846028
public function execute($name, $args)
	{
	    if (!$this->__sock) {
	        return null;
	    }
	    
	    $args = (array) $args;
	    if(in_array($name, static::$keyCommands)) {
	        if ($this->options['prefix'] && strpos($args[0], $this->options['prefix']) === false) {
	            $args[0] = $this->options['prefix'] . $args[0];
	        }
	    }
	    
	    /* Build the Redis unified protocol command */
	    array_unshift($args, strtoupper($name));
	    $command = sprintf('*%d%s%s%s', count($args), CRLF, implode(array_map(array($this, 'formatArgument'), $args), CRLF), CRLF);
	    
	    /* Open a Redis connection and execute the command */
	    for ($written = 0; $written < strlen($command); $written += $fwrite) {
	        $fwrite = fwrite($this->__sock, substr($command, $written));
	        if ($fwrite === FALSE) {
	            throw new Exception('Failed to write entire command to stream');
	        }
	    }
	    
	    /* Parse the response based on the reply identifier */
	    $reply = trim(fgets($this->__sock, 512));
	    switch (substr($reply, 0, 1)) {
	        /* Error reply */
	        case '-':
	            throw new RedisException(substr(trim($reply), 4));
	            break;
	            /* Inline reply */
	        case '+':
	            $response = substr(trim($reply), 1);
	            break;
	            /* Bulk reply */
	        case '$':
	            $response = null;
	            if ($reply == '$-1') {
	                break;
	            }
	            $read = 0;
	            $size = substr($reply, 1);
	            do {
	                $block_size = ($size - $read) > 1024 ? 1024 : ($size - $read);
	                $response .= fread($this->__sock, $block_size);
	                $read += $block_size;
	            } while ($read < $size);
	            fread($this->__sock, 2); /* discard crlf */
	            break;
	            /* Multi-bulk reply */
	        case '*':
	            $count = substr($reply, 1);
	            if ($count == '-1') {
	                return null;
	            }
	            $response = array();
	            for ($i = 0; $i < $count; $i++) {
	                $bulk_head = trim(fgets($this->__sock, 512));
	                $size = substr($bulk_head, 1);
	                if ($size == '-1') {
	                    $response[] = null;
	                }
	                else {
	                    $read = 0;
	                    $block = "";
	                    do {
	                        $block_size = ($size - $read) > 1024 ? 1024 : ($size - $read);
	                        $block .= fread($this->__sock, $block_size);
	                        $read += $block_size;
	                    } while ($read < $size);
	                    fread($this->__sock, 2); /* discard crlf */
	                    $response[] = $block;
	                }
	            }
	            break;
	            /* Integer reply */
	        case ':':
	            $response = intval(substr(trim($reply), 1));
	            break;
	        default:
	            throw new RedisException("invalid server response: {$reply}");
	            break;
	    }
	    /* Party on */
	    return $response;
	}
1142188
public function createLocationMenuItem(string $name, int $locationId, array $options = []): ?ItemInterface
    {
        try {
            $location = $this->locationService->loadLocation($locationId);
            $contentInfo = $location->getContentInfo();
            $canRead = $this->permissionResolver->canUser('content', 'read', $contentInfo);
        } catch (\Exception $e) {
            return null;
        }

        $defaults = [
            'route' => '_ezpublishLocation',
            'routeParameters' => [
                'locationId' => $locationId,
            ],
        ];

        return $this->createItem($name, array_merge_recursive($defaults, $options));
    }
319406
public function setUniqueKey($uniqueKey)
    {
        if (! is_null($this->uniqueKey)) {
            throw new RuntimeException('The unique key was already set.');
        }
        if (! is_int($uniqueKey) && ! is_string($uniqueKey)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid type of specified unique key; must be an integer or '
                . 'an string, "%s" received.',
                gettype($uniqueKey)
            ));
        }
        $this->uniqueKey = $uniqueKey;
    }
842579
public function load($userid, $apikey, $scope, $name, $args)
    {
        $this->prepareStatements();

        $argumentString = $this->serializeArguments($args);

        $statement = $this->statements['load'];
        /* @var $statement \PDOStatement */

        if ($userid === null) {
            // Fix for null value userids
            // e. g. for global calls to /eve/
            $userid = 0;
        }

        try {
            $statement->execute(
                array(
                    ':userId' => $userid,
                    ':scope'  => $scope,
                    ':name'   => $name,
                    ':args'   => $argumentString,
                )
            );

            $result = $statement->fetch();
        } catch (\PDOException $e) {
            throw new PhealException('Loading from cache failed!', null, $e);
        }

        if (empty($result)) {
            return false;
        }

        if (!$this->validateCache($result['cachedUntil'])) {
            return false;
        }

        return $result['xml'];
    }
622848
public function getParameter($key)
    {
        if (empty($this->namedParameters[$key])) {
            throw new InvalidKeyException($key);
        }

        return $this->namedParameters[$key];
    }
410354
public static function withArgs( $context, $name, $ns, $args, $raise = true )
	{
		$result = new FuncNode( $context );
		$result->_func = FunctionTable::getInstance()->Bind( $name, $ns, count( $args ) );
		if ( is_null( $result->_func ) )
		{
			 if ( ! $raise ) return null;
			throw XPath2Exception::withErrorCodeAndParams( "XPST0017", Resources::XPST0017, array( $name, 0, $ns ) );
		}
		$result->_name = $name;
		$result->_ns = $ns;
		$result->AddRange( $args );
		return $result;
	}