Skips the token stream until a token of the given type.

@param integer $type

@throws \RuntimeException When the token is not found
499869
public function skipUntil($type)
    {
        while ( ! $this->isNext($type) && $this->moveNext());

        if ( ! $this->isNext($type)) {
            throw new \RuntimeException(sprintf('Could not find the token %s.', $this->getName($type)));
        }
    }
1127888
public function dataType(string $type)
    {
        if (!in_array($type, $this->possible_types)) {
            throw new RuntimeException('Wrong data type, available: ' . implode(', ', $this->possible_types));
        }

        $this->data_type = $type;


        // Pre-format
        switch ($this->data_type) {
            case 'ts2datetime':
            case 'ts2date':
                $this->setWidth('1%');
                $this->disableNewlines();
                break;

            case 'truefalse':
                $this->setWidth('1%');
                $this->disableNewlines();
                $this->enableCenterAlign();
                break;
        }

        return $this;
    }
837917
public function setByType($type)
    {
        if (isset(self::$statusList[$type])) {
            $this->value = self::$statusList[$type];
        } else {
            throw new Exception("undefined index $type");
        }
    }
1359232
public function moveToNext($type, callable $callback = NULL)
	{
		$delim = (array)$type;

		while($this->valid())
		{
			$token = $this->current();

			if($token->isOneOf($delim))
			{
				return $token;
			}

			if($callback !== NULL)
			{
				$callback($token);
			}

			$this->next();
		}
	}
1062550
protected function getToken($type, $tokenRequired = true)
    {
        $token = $this->tokenStorage->getToken();

        if ($tokenRequired && null === $token) {
            throw new RuntimeException(sprintf('The current %s cannot be added in security token because the security token is empty', $type));
        }

        return $token;
    }
230373
public function getTokenName($type)
    {
        if (!isset($this->tokenNames[$type])) {
            throw new \RuntimeException(
                "Unknown token $type."
            );
        }

        return $this->tokenNames[$type];
    }
915233
public function removeType(string $type)
    {
        if (!$this->removing && Type::hasType($type)) {
            $this->removing = true;
            Type::overrideType($type, null);
        }

        $this->removing = false;
        unset($this->types[$type]);
    }
611639
public function skip($type)
  {
    switch ($type) {
    case TType::BOOL:
      return $this->readBool($bool);
    case TType::BYTE:
      return $this->readByte($byte);
    case TType::I16:
      return $this->readI16($i16);
    case TType::I32:
      return $this->readI32($i32);
    case TType::I64:
      return $this->readI64($i64);
    case TType::DOUBLE:
      return $this->readDouble($dub);
    case TType::STRING:
      return $this->readString($str);
    case TType::STRUCT:
      {
        $result = $this->readStructBegin($name);
        while (true) {
          $result += $this->readFieldBegin($name, $ftype, $fid);
          if ($ftype == TType::STOP) {
            break;
          }
          $result += $this->skip($ftype);
          $result += $this->readFieldEnd();
        }
        $result += $this->readStructEnd();

        return $result;
      }
    case TType::MAP:
      {
        $result = $this->readMapBegin($keyType, $valType, $size);
        for ($i = 0; $i < $size; $i++) {
          $result += $this->skip($keyType);
          $result += $this->skip($valType);
        }
        $result += $this->readMapEnd();

        return $result;
      }
    case TType::SET:
      {
        $result = $this->readSetBegin($elemType, $size);
        for ($i = 0; $i < $size; $i++) {
          $result += $this->skip($elemType);
        }
        $result += $this->readSetEnd();

        return $result;
      }
    case TType::LST:
      {
        $result = $this->readListBegin($elemType, $size);
        for ($i = 0; $i < $size; $i++) {
          $result += $this->skip($elemType);
        }
        $result += $this->readListEnd();

        return $result;
      }
    default:
      throw new TProtocolException('Unknown field type: '.$type,
                                   TProtocolException::INVALID_DATA);
    }
  }
1020910
public function setType(Type $type = null)
    {
        if ($this->type !== $type) {
            $this->type = $type;
        }

        return $this;
    }
209551
private function load($type)
    {
        if (!$this->has($type)) {
            throw new \RuntimeException(sprintf('The block service `%s` does not exist', $type));
        }

        if (!$this->services[$type] instanceof BlockServiceInterface) {
            $this->services[$type] = $this->container->get($type);
        }

        if (!$this->services[$type] instanceof BlockServiceInterface) {
            throw new \RuntimeException(sprintf('The service %s does not implement BlockServiceInterface', $type));
        }

        return $this->services[$type];
    }
853769
private function isEmpty($type) {
        switch ($type) {
            case static::GET:
                $global = &$_GET;
                break;
            case static::POST:
                $global = &$this->_getPost();
                break;
            case static::SESSION:
                $global = &$_SESSION;
                break;

            default:
                throw new \Exception("Unknown global type : " . $type);
                break;
        }
        return empty($global);
    }
554367
public function setTokenType(TokenTypeInterface $tokenType)
    {
        $this->issuer->setTokenType($tokenType);
        $this->checker->setTokenType($tokenType);
    }
759831
public function start($type)
    {
        if ($this->enabled) {
            $this->start = microtime(true);

            $this->hydrations[++$this->currentHydration]['type'] = $type;
        }
    }
1292549
public function setType( $type )
	{
		if ( $type == $this->getType() ) { return; }

		$this->_checkType( $type );

		$this->_values['type'] = (string) $type;
		$this->setModified();
	}
341438
protected function setType($type)
    {
        return Match::on($type)
            ->string(function ($type) {
                $this->type = $type;
                return FTry::with($type);
            })
            ->any(function () {
                return FTry::with(function () {
                    return new \RuntimeException('Type must be specified by string');
                });
            })
            ->value();
    }
494764
private function checkForMixedType(string $type): self
    {
        if (strtolower($type) === 'mixed') {
            throw (new CodeWarning(static::CODE_MIXED_TYPE, self::MESSAGE_MIXED_TYPE, $this->stackPos))
                ->setToken($this->token);
        }

        return $this;
    }
874680
private function skipUntilSearchedToken($searchFor)
    {
        while ($this->token) {
            if ((is_string($searchFor) && ($searchFor == $this->token))
                || (is_int($searchFor) && is_array($this->token) && ($searchFor == $this->token[0]))
            ) {
                break;
            }
            $this->advanceToken();
        }
    }