Convert the type.

@param string $type The type name.

@return string
513744
public function inferType($type)
    {
        if (DataTypes::isPrimitive($type)) {
            return $type;
        } elseif (DataTypes::COLLECTION === strtolower($type)) {
            return $type;
        }
        return DataTypes::STRING;
    }
263583
public static function nameShape($type)
    {
        if (isset(self::$shape_names[$type])) {
            return self::$shape_names[$type];
        }

        return sprintf('Shape %d', $type);
    }
1161640
function convert($type)
    {
        if (in_array($type, array('gif','png','jpg'))){
            $this->_transforms_str.='convert('.$type.')';
            $this->_convert = $type;
        }
        return $this;
    }
1202323
public static function getTypeName($type = null)
    {
        $result = [
            Item::TYPE_PERMISSION => 'Permission',
            Item::TYPE_ROLE => 'Role',
        ];
        if ($type === null) {
            return $result;
        }

        return $result[$type];
    }
1187983
public function type($type)
    {
        if (is_string($type)) {
            $map = array(
                'double' => 1,
                'string' => 2,
                'object' => 3,
                'array' => 4,
                'binary' => 5,
                'undefined' => 6,
                'objectid' => 7,
                'boolean' => 8,
                'date' => 9,
                'null' => 10,
                'regex' => 11,
                'jscode' => 13,
                'symbol' => 14,
                'jscodewithscope' => 15,
                'integer32' => 16,
                'timestamp' => 17,
                'integer64' => 18,
                'maxkey' => 127,
                'minkey' => 255,
            );

            $type = isset($map[$type]) ? $map[$type] : $type;
        }

        return $this->operator('$type', $type);
    }
1110693
protected function valType($type)
    {
        $type = IriFactory::create($type);

        return strlen($type->name) ? $type : null;
    }
995630
public function type($type)
    {
        $fail = false;

        $value = $this->value();

        if (is_null($value)) {
            return $this;
        }

        switch (strtolower($type)) {

            case 'bool':
            case 'boolean':
                $fail =  ! is_bool($value);
                $message = sprintf('%s accepts only boolean values as argument %d.', $this->getCommandName(), $this->key + 1);
                break;

            case 'int':
            case 'integer':
                $fail =  ! is_integer($value);
                $message = sprintf('%s accepts only integer values as argument %d.', $this->getCommandName(), $this->key + 1);
                break;

            case 'num':
            case 'numeric':
                $fail =  ! is_numeric($value);
                $message = sprintf('%s accepts only numeric values as argument %d.', $this->getCommandName(), $this->key + 1);
                break;

            case 'str':
            case 'string':
                $fail =  ! is_string($value);
                $message = sprintf('%s accepts only string values as argument %d.', $this->getCommandName(), $this->key + 1);
                break;

            case 'array':
                $fail =  ! is_array($value);
                $message = sprintf('%s accepts only array as argument %d.', $this->getCommandName(), $this->key + 1);
                break;

            case 'closure':
                $fail =  ! is_a($value, '\Closure');
                $message = sprintf('%s accepts only Closure as argument %d.', $this->getCommandName(), $this->key + 1);
                break;

            case 'digit':
                $fail = ! $this->isDigit($value);
                $message = sprintf('%s accepts only integer values as argument %d.', $this->getCommandName(), $this->key + 1);
                break;
        }

        if ($fail) {

            $message = isset($message) ? $message : sprintf("Missing argument for %d.", $this->key);

            throw new \Intervention\Image\Exception\InvalidArgumentException(
                $message
            );
        }

        return $this;
    }
824161
public function resolveType($type)
    {
        if (is_numeric($type)) {
            return (int) $type;
        }

        $type = strtoupper($type);

        static $types = [
            'DOUBLE' => 1, 'STRING' => 2, 'OBJECT' => 3, 'ARRAY' => 4,
            'BINARY' => 5, 'ID' => 8, 'BOOL' => 8, 'BOOLEAN' => 8,
            'DATE' => 9, 'NULL' => 10, 'REGEX' => 11, 'JAVASCRIPT' => 13,
            'CODE' => 13, 'SYMBOL' => 14, 'JAVASCRIPT_SCOPE' => 15,
            'CODE_SCOPE' => 15, 'INT32' => 16, 'TS' => 17, 'TIMESTAMP' => 17,
            'INT64' => 18, 'MIN' => -1, 'MAX' => 127,
        ];

        if (! isset($types[$type])) {
            throw new \InvalidArgumentException('Type "'.$type.'" could not be resolved');
        }

        return $types[$type];
    }
435529
protected function getValidatorType($type)
    {
        switch ($type) {
            case 'int':
                $type = 'Integer';
                break;
            case 'bool':
                $type = 'Boolean';
                break;
            case 'double':
                $type = 'Float';
                break;
            case 'numeric':
                $type = 'Number';
                break;
            case 'mixed':
                $type = 'Raw';
                break;
            default:
                $type = ucfirst($type);
        }
        return $type;
    }
6533
public static function typeToString($type)
    {
        switch ($type) {
            case self::EOF_TYPE:
                return 'EOF';
            case self::BANG_TYPE:
                return '!';
            case self::DOLLAR_TYPE:
                return '$';
            case self::PAREN_L_TYPE:
                return '(';
            case self::PAREN_R_TYPE:
                return ')';
            case self::SPREAD_TYPE:
                return '...';
            case self::COLON_TYPE:
                return ':';
            case self::EQUALS_TYPE:
                return '=';
            case self::AT_TYPE:
                return '@';
            case self::BRACKET_L_TYPE:
                return '[';
            case self::BRACKET_R_TYPE:
                return ']';
            case self::BRACE_L_TYPE:
                return '{';
            case self::PIPE_TYPE:
                return '|';
            case self::BRACE_R_TYPE:
                return '}';
            case self::NAME_TYPE:
                return 'Name';
            case self::VARIABLE_TYPE:
                return 'Variable';
            case self::INT_TYPE:
                return 'Int';
            case self::FLOAT_TYPE:
                return 'Float';
            case self::STRING_TYPE:
                return 'String';
            default:
                throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type));
        }
    }
944236
public function getTypeName($type)
    {
        $allowedTypes = $this->getAllowedTypes();

        if ($type && isset($allowedTypes[$type])) {
            return $allowedTypes[$type];
        }

        return t("None"); // @todo
    }
914283
protected function convertSettingType($type)
    {
        if ($type === SettingType::BOOLEAN_TYPE) {
            $this->setting = filter_var($this->setting, FILTER_VALIDATE_BOOLEAN);
        } else {
            settype($this->setting, $type);
        }
    }
538281
public function returnType($type = null)
  {
    if (null === $type)
    {
      return $this->responseConfig['returnType'];
    }

    $this->responseConfig['returnType'] = $type;

    return $this;
  }
1260095
protected function getTypeConfig($type)
    {
        if (is_object($type)) {
            $type = $this->getTypeName($type);
        } else if (class_exists($type)) {
            $type = $this->getTypeFromClassName($type);
        }

        if (!$this->types->containsKey($type)) {
            $this->throwInvalidTypeException($type);
        }

        return $this->types->get($type);
    }
328958
private function checkType($type)
    {
        $isInType = true;

        foreach ($this->getKeys() as $key) {
            if (gettype($key) !== $type) {
                $isInType = false;
                break;
            }
        }

        return $isInType;
    }
1194423
public function type($type = null) {
		if ($type === false) {
			unset($this->headers['Content-Type']);
			$this->_type = false;
			return;
		}
		$media = $this->_classes['media'];

		if (!$type && $this->_type) {
			return $this->_type;
		}
		$headers = $this->headers + ['Content-Type' => null];
		$type = $type ?: $headers['Content-Type'];

		if (!$type) {
			return;
		}
		$header = $type;

		if (!$data = $media::type($type)) {
			$this->headers('Content-Type', $type);
			return ($this->_type = $type);
		}
		if (is_string($data)) {
			$type = $data;
		} elseif (!empty($data['content'])) {
			$header = is_string($data['content']) ? $data['content'] : reset($data['content']);
		}
		$this->headers('Content-Type', $header);
		return ($this->_type = $type);
	}
377147
public function getConverterForType($type)
    {
        if (!$this->hasType($type)) {
            throw new ConverterException(
                sprintf(
                    "No converters associated with type '%s'. Handled types are {%s}.",
                    $type,
                    join(', ', $this->getTypes())
                )
            );
        }

        return $this->converters[$this->types[$type]];
    }