Creates a Token from the given route expression

@param string $input
@return TokenInterface
@throws InvalidArgumentException if the route expression can not be parsed
168288
public function createToken($input)
    {
        $i = 0;
        $token = $this->readAlternativeSentenceOrSingle($input, $i);

        if (isset($input[$i])) {
            throw new \InvalidArgumentException('Invalid root token, expression has superfluous contents');
        }

        return $token;
    }
809298
public function setInput($input)
    {
        $allowed_values = $this->getInputAllowableValues();
        if (!is_null($input) && !in_array($input, $allowed_values)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'input', must be one of '%s'",
                    implode("', '", $allowed_values)
                )
            );
        }
        $this->container['input'] = $input;

        return $this;
    }
303231
public static function token(
        array $routeParams,
        ContainerInterface $container,
        ServerRequestInterface $request
    ): ResponseInterface {
        assert($routeParams !== null && $request !== null);

        /** @var PassportServerInterface $passportServer */
        $passportServer = $container->get(PassportServerInterface::class);
        $tokenResponse  = $passportServer->postCreateToken($request);

        return $tokenResponse;
    }
240413
public function sanitize(array $input)
    {
        if (!isset($input['text'])) {
            throw new InvalidArgumentException('A \'text\' entry should have been given in the input array');
        }
        if (!is_object($input['text']) || !($input['text'] instanceof Text)) {
            throw new InvalidArgumentException('The \'text\' entry should be an instance of Text');
        }

        return $input['text'];
    }
1339634
public function setToken($token) : self
    {
        if (! (is_string($token) || is_null($token))) {
            throw new InvalidArgumentException(
                sprintf('Invalid $token type: "%s". Must be "string" or "null"', gettype($token))
            );
        }

        $this->token = $token;
        return $this;
    }
29340
public function parse($input, $context = '')
    {
        $pos = $this->findInitialTokenPosition($input);
        if ($pos === null) {
            return [];
        }

        $this->context = $context;

        $this->lexer->setInput(trim(substr($input, $pos), '* /'));
        $this->lexer->moveNext();

        return $this->Annotations();
    }
464340
private function tokenize($input, $limit = -1)
    {
        $chunks = preg_split('!\s+!', $input, $limit);
        if ($limit !== -1 && count($chunks) != $limit) {
            $chunks += array_fill(count($chunks), $limit, '');
        }
        return $chunks;
    }
215072
public function setInput($input)
    {
        $this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input);

        return $this;
    }
1031928
public function build(InputInterface $input, $path)
    {
        $voters = [
            new ExtendsParent,
            new YieldsFromParent,
            new StacksFromParent,
            new SectionsInParent,
        ];

        /** @var \Sven\ArtisanView\Voters\Voter $voter */
        foreach ($voters as $voter) {
            if (! $voter->canHandle($input)) {
                continue;
            }

            $voter->inPath($path)->run($input, $this);
        }

        return $this;
    }
144402
private function getIdFromInput( $input ) {
		if( is_string( $input ) ) {
			return $input;
		} elseif( $input instanceof ItemId ) {
			return $input->getSerialization();
		} elseif( $input instanceof Item ) {
			return $input->getId()->getSerialization();
		} else {
			throw new InvalidArgumentException( 'Merge target should be either string, Item or ItemId' );
		}
	}
529224
public function findOrCreate($input)
    {
        if (is_null($input)) {
            return $input;
        }

        if (is_string($input) && is_object(json_decode($input)) && is_array(json_decode($input, true))) {
            $input = json_decode($input, true);
        }

        if (is_array($input)) {
            if (array_key_exists('id', $input) && $input['id']) {
                $object = $this->find($input['id']);
            } else {
                $object = $this->createEntity();
            }

            $object->setPropertiesEntity($input);

            return $object;
        }

        if (is_numeric($input) || is_string($input)) {
            return $this->find($input);
        }

        throw new \InvalidArgumentException('O parâmetro $input pode ser um null | string | array | numeric');
    }
421412
protected function createRoutes($input)
    {
        if ($input instanceof \Traversable) {
            $input = iterator_to_array($input, true);
        } elseif ($input instanceof \stdClass) {
            $input = get_object_vars($input);
        }

        return array_map([$this, 'createRoute'], $input);
    }
241093
public function input($input) {
        if(isset($this->inputs->$input)) 
            return $this->inputs->$input;
        return null;
    }
255642
protected function mapInputToCommand($command, array $input)
    {
        $dependencies = [];

        $class = new ReflectionClass($command);

        foreach ($class->getConstructor()->getParameters() as $parameter)
        {
            $name = $parameter->getName();

            if (array_key_exists($name, $input))
            {
                $dependencies[] = $input[$name];
            }
            elseif ($parameter->isDefaultValueAvailable())
            {
                $dependencies[] = $parameter->getDefaultValue();
            }
            else
            {
                throw new InvalidArgumentException("Unable to map input to command: {$name}");
            }
        }

        return $class->newInstanceArgs($dependencies);
    }
1140730
public static function fromString(string $input): StreamInterface
    {
        /** @var resource $stream */
        $stream = \fopen('php://temp', 'w+');
        if (!\is_resource($stream)) {
            throw new \Error('Could not create stream');
        }
        \fwrite($stream, $input);
        \rewind($stream);
        return new static($stream);
    }
5462
public function parse($input)
    {
        if (strlen($input) == 0) {
            return null;
        }
        return $this->parser->parse(new TokenStream($this->tokenizer->getTokens($input)));
    }
487696
public function execute(InputInterface $input, OutputInterface $output)
    {
        if (! $this->valid($input->getArgument('token'))) {
            return $this->tokenIsInvalid($output);
        }

        if (! $this->configExists()) {
            mkdir($this->homePath().'/.spark');
        }

        $this->storeToken($input->getArgument('token'));

        $this->tokenIsValid($output);
    }