Returns the raw string to use in IMAP server calls.

@param integer $type  The RFC type to use (RFC_* constant).

@return string  The string representation of the ACL.
550915
public function getString($type = self::RFC_4314)
    {
        $acl = strval($this);

        if ($type == self::RFC_2086) {
            foreach ($this->_virtual as $key => $val) {
                $acl = str_replace($val, '', $acl, $count);
                if ($count) {
                    $acl .= $key;
                }
            }
        }

        return $acl;
    }
463385
protected function formatType($type)
    {
        if (preg_match('/^(?:(.*)\.)?_(.*)$/', $type, $matches)) {
            if ($matches[1] !== '') {
                return sprintf("%s.%s[]", $matches[1], $matches[2]);
            } else {
                return $matches[2].'[]';
            }
        } else {
            return $type;
        }
    }
1306114
public static function fetchType($type): string
    {
        if(\is_int($type)) {
            switch($type) {
                case self::TYPE_UNKNOWN:
                    return "unknown";
                case self::TYPE_INT:
                    return "integer";
                case self::TYPE_LONG:
                    return "long";
                case self::TYPE_SHORT:
                    return "short";
                case self::TYPE_BOOLEAN:
                    return "boolean";
                case self::TYPE_FLOAT:
                    return "float";
                case self::TYPE_STRING:
                    return "string";
                case self::TYPE_CHAR:
                    return "char";
                case self::TYPE_VARCHAR:
                    return "varchar";
                case self::TYPE_ARRAY:
                    return "array";
                case self::TYPE_OBJECT:
                    return "object";
                case self::TYPE_DATE:
                    return "date";
            }
        }
        return (string) $type;
    }
930804
public function getMessageBody($type = 'text')
    {
        $mime_types = [
            'text'         => 'text/plain',
            'html'         => 'text/html',
            'htmlEmbedded' => 'text/html',
        ];

        if (in_array($type, array_keys($mime_types))) {
            $part_type = $type === 'htmlEmbedded' ? 'html' : $type;
            $inline_parts = $this->getInlineParts($part_type);
            $body = empty($inline_parts) ? '' : $inline_parts[0];
        } else {
            throw new Exception(
                'Invalid type specified for getMessageBody(). Expected: text, html or htmlEmbeded.'
            );
        }

        if ($type == 'htmlEmbedded') {
            $attachments = $this->getAttachments();
            foreach ($attachments as $attachment) {
                if ($attachment->getContentID() != '') {
                    $body = str_replace(
                        '"cid:'.$attachment->getContentID().'"',
                        '"'.$this->getEmbeddedData($attachment->getContentID()).'"',
                        $body
                    );
                }
            }
        }

        return $body;
    }
355795
protected function getPhpType(Type $type): string
    {
        switch ($builtinType = $type->getBuiltinType()) {
            case Type::BUILTIN_TYPE_ARRAY:
            case Type::BUILTIN_TYPE_INT:
            case Type::BUILTIN_TYPE_FLOAT:
            case Type::BUILTIN_TYPE_BOOL:
            case Type::BUILTIN_TYPE_STRING:
                return $builtinType;
            case Type::BUILTIN_TYPE_OBJECT:
                if (null !== ($className = $type->getClassName()) && is_a($className, \DateTimeInterface::class, true)) {
                    return \DateTimeInterface::class;
                }

            // no break
            default:
                return 'string';
        }
    }
138578
protected function normalizeTypeBeforeParse(string $type) : string
    {
        $type = trim(str_replace(" ", "", $type));

        $l = -1;
        $parseType = "";
        $arrType = str_split($type);
        foreach ($arrType as $c) {
            if ($c === "[") {
                $l++;
                $parseType .= $c;
            } elseif ($c === "]") {
                $l--;
                $parseType .= $c;
            } else {
                if ($c === ",") {
                    $parseType .= ("<" . $l . ">");
                } else {
                    $parseType .= $c;
                }
            }
        }

        return $parseType;
    }
881129
protected function getTokenPattern(int $type): string
    {
        $patternMap = [
            Token::TYPE_SLASH => '/',
            Token::TYPE_ESCAPED => '~(0|1)',
            Token::TYPE_UNESCAPED => '[^/~]',
            Token::TYPE_ERROR_INVALID_ESCAPE => '~',
        ];
        if (!isset($patternMap[$type])) {
            throw new DomainException("Unknown token type: {$type}");
        }
        $pattern = $patternMap[$type];
        return "#{$pattern}#uA";
    }
250460
private function getTypeSuffix($type)
    {
        self::$TYP_MAPPING = array_merge(self::$TYP_COMPLEX_MAPPING, self::$TYP_SIMPLE_MAPPING);

        if ($type == '') {
            return '';
        }

        if (!isset(self::$TYP_MAPPING[$this->type])) {
            return '';
        }

        return self::$TYP_MAPPING[$this->type];
    }
563591
public static function getTypeDescription(?string $type): ?string
    {
        $descriptions = self::typeDescriptions();
        if (isset($descriptions[$type])) {
            return $descriptions[$type];
        }

        return $type;
    }
658943
public function getChatClassString($type) {
        /** @var EntityManager $em */
        $em = $this->container->get('doctrine')->getManager();

        $chatClass = "Sopinet\ChatBundle\Entity\Chat";

        $cmf = $em->getMetadataFactory();
        $meta = $cmf->getMetadataFor($chatClass);

        $config = $this->container->getParameter('sopinet_chat.config');
        foreach($meta->discriminatorMap as $typeString => $typeClass) {
            if ($typeString == $type) {
                return $typeClass;
            }
        }

        // Type unknow
        return null;
    }
1308896
public function getFlashText($type)
    {
        if ($this->{$type}) {
            return $this->{$type};
        } elseif ($this->parent) {
            return $this->parent->getFlashText($type);
        }

        return $type;
    }
725922
public function getMessage($type = null)
    {
        do {
            if (false !== strpos($this->current()->contenttype, 'text/html')) {
                $currentType = 'text/html';
            } else {
                $currentType = 'text';
            }
        } while ($type && $type != $currentType && $this->countParts() > $this->key() && !$this->next());

        $message = new Email();
        $message->setSubject($this->subject);
        $message->setTo($this->to);
        $message->setFrom($this->from);
        $part = new Part($this->current());
        $body = (string)$part->getContent();
        if ('text/html' == $currentType) {
            $body = quoted_printable_decode($body);
        }
        $message->setBody($body);
        return $message;
    }
735628
public static function permissionType($type)
    {
        if ($type == Teamspeak::PERM_TYPE_SERVERGROUP) {
            return "Server Group";
        }
        if ($type == Teamspeak::PERM_TYPE_CLIENT) {
            return "Client";
        }
        if ($type == Teamspeak::PERM_TYPE_CHANNEL) {
            return "Channel";
        }
        if ($type == Teamspeak::PERM_TYPE_CHANNELGROUP) {
            return "Channel Group";
        }
        if ($type == Teamspeak::PERM_TYPE_CHANNELCLIENT) {
            return "Channel Client";
        }

        return "Unknown";
    }
1097483
private function type2format( $type ) {
		if ( ! isset( self::$_type2format[ $type ] ) ) {
			$format = '%s';
			switch ( true ) {
				case stristr( $type, 'INT' ) !== false:
					$format = '%d';
					break;
				case stristr( $type, 'BIT' ) !== false:
					$format = '%d';
					break;
				case stristr( $type, 'BOOLEAN' ) !== false:
					$format = '%d';
					break;
				case stristr( $type, 'DECIMAL' ) !== false:
					$format = '%f';
					break;
				case stristr( $type, 'FLOAT' ) !== false:
					$format = '%f';
					break;
				case stristr( $type, 'DOUBLE' ) !== false:
					$format = '%f';
					break;
				case stristr( $type, 'REAL' ) !== false:
					$format = '%f';
					break;
			}
			self::$_type2format[ $type ] = $this->apply_filters( 'type2format', $format, $type );
		}

		return self::$_type2format[ $type ];
	}
682601
public function resolve(string $type) : string
    {
        $pos = strpos($type, '\\');

        if ($pos === 0) {
            return substr($type, 1); // Already fully qualified.
        }

        if ($pos === false) {
            $first = $type;
            $next = '';
        } else {
            $first = substr($type, 0, $pos);
            $next = substr($type, $pos);
        }

        $first = strtolower($first);

        if (isset($this->aliases[$first])) {
            return $this->aliases[$first] . $next;
        }

        return $this->namespace . '\\' . $type;
    }
939412
public static function showContentType($type) {
        $result = '';
        try {
            $config = AgileCore::getInstance()->getConfig('statics');
            if (!empty($config[$type]['content_type'])) {
                $result = $config[$type]['content_type'];
            }
        }catch (\Exception $exception) {
            $result = 'text/html';
        }finally{
            if($result == '') {
                $result = 'text/html';
            }
        }
        return $result;
    }
1304820
public function getDerivedKey($type)
    {
        if ($this->_masterKey === null) {
            throw new CryptException(['getDerivedKey for `:type` type Failed: master key is not set', 'type' => $type]);
        }

        return md5($this->_masterKey . ':' . $type);
    }