Casts the elements to the specified type.

@param string $type Type
@return Queryable
345759
public function Cast( $type )
	{

		$obj = $this->getClone();

		foreach ($obj->repository as &$value) {
			settype($value, $type);
		}

		return $obj;

	}
1159930
public function build($type)
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown request type.");
        }
        return new $this->types[$type]();
    }
655433
public function to($type)
    {
        switch ($type) {
            case 'ini':
                $this->string = Ini::encode($this->data);
                break;

            case 'json':
                $this->string = Json::encode($this->data, $this->prettyOutput);
                break;

            case 'php':
                $this->string = Php::encode($this->data);
                break;

            case 'xml':
                $this->string = Xml::encode($this->data, $this->prettyOutput);
                break;

            case 'yml':
            case 'yaml':
                $this->string = Yaml::encode($this->data);
                break;
            
            default:
                throw new \Exception("Format not supported: " . $type);
        }

        return $this->string;
    }
366812
public function forType(string $type): HandlerInterface
    {
        if (!in_array($type, ['integer', 'float', 'integer|float', 'float|integer'])) {
            throw new LogicException("Unable to use " . get_class($this) . " to cast to $type");
        }

        if ($this->type === $type || ((strpos($this->type, '|') !== false && strpos($type, '|') !== false))) {
            return $this;
        }

        $handler = clone $this;
        $handler->type = $type;

        return $handler;
    }
148888
public function prototype($type)
    {
        return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this);
    }
508745
public function forType(string $type): HandlerInterface
    {
        if ($type !== $this->getType()) {
            throw new LogicException("Unable to use " . get_class($this) . " to cast to $type");
        }
        
        return $this;
    }
292399
public function setType(?string $type): Workflow
    {
        if ($type !== null) {
            Assert::oneOf($type, self::VALID_TYPES);
        }
        $this->type = $type;

        return $this;
    }
456084
public function castInBuffer($limit, $type)
    {
        $castFunction = function ($value) use ($limit) {
            return abs($value) < $limit ? $value : $limit;
        };

        if (is_numeric($this->value) && abs($this->value) < $limit) {
            return $castFunction($this->value);
        }

        return $this->handleMismatch($castFunction, $type);
    }
247290
public function mustBeTypeOf(string $type) : Slot
    {
        static $allowed_types = [
            'boolean',
            'bool',
            'integer',
            'int',
            'float',
            'double',
            'string',
            'array',
            'object',
            'resource',
            'NULL',
            'null',
        ];
        $this->type = in_array($type,$allowed_types) ? $type : self::TYPE_ANY;
        return $this;
    }
1073689
public function type($type = null)
    {
        if (is_null($type)) {
            return $this->type;
        }

        $this->type = $type;

        return $this;
    }
503849
public static function factory($type)
    {
        if (isset(self::$transports[$type])) {
            return self::$transports[$type];
        }

        self::$transports[$type] = new Transport($type);
        return self::$transports[$type];
    }
1148264
public static function getCodeByType($type)
    {
        if (isset(self::$typeList[$type])) {
            return self::$typeList[$type];
        } else {
            return false;
        }
    }
435439
public function type($type = null)
    {
        if (is_null($type)) {
            unset($this->filters['post_type']);
        } else {
            $this->filters['post_type'] = $type;
        }
        return $this;
    }
261736
public function setType(?string $type): self
    {
        $this->type                          = $this->validateType($type);
        $this->type_hint || $this->type_hint = $this->type;

        return $this;
    }
325613
public function setType(Type $type)
    {
        if ($this->type !== $type) {
            $this->type = $type;
            $type->setItem($this);
        }

        return $this;
    }
1321784
public function getType($type)
    {
        if (!$this->hasType($type)) {
            $this->metaTypeList[$type] = new $type();
        }

        return $this->metaTypeList[$type];
    }
183681
public function forType(string $type): HandlerInterface
    {
        $traversable = null;
        $subtype = null;

        if (strpos($type, '|') !== false && substr($type, -2) === '[]') {
            list($traversable, $type) = explode('|', $type, 2);
            $subtype = substr($type, 0, -2);
        } elseif (substr($type, -2) === '[]') {
            $subtype = substr($type, 0, -2);
        } elseif (is_a($type, Traversable::class, true)) {
            $traversable = $type;
        } elseif ($type !== 'array') {
            throw new LogicException("Unable to use " . get_class($this) . " to cast to $type");
        }

        if ($traversable === $this->traversable && $subtype === $this->subtype) {
            return $this;
        }

        $handler = clone $this;
        $handler->traversable = $traversable;
        $handler->subtype = $subtype;

        return $handler;
    }