@param $part

@return array
161717
protected function parse($part) {
			$subPos = strpos($part, self::TOKEN_SUBFIELD_OPEN);

			if ($subPos === false)
				return [$part => true];

			$key = substr($part, 0, $subPos++);
			$fields = [];

			$subSelector = substr($part, $subPos, -1);
			$subLength = strlen($subSelector);
			$subPos = 0;

			while ($fragment = $this->getNextFragment($subSelector, $subLength, $subPos))
				if (($index = strpos($fragment, self::TOKEN_SUBFIELD_OPEN)) !== false) {
					$subfields = $this->parse($fragment);

					foreach ($subfields as $k => $v)
						$fields[$k] = $v;
				} else
					$fields[$fragment] = true;

			return [$key => $fields];
		}
1324630
private function getPartsFromSegment(string $segment): array
    {
        $parts = explode(DIRECTORY_SEPARATOR, $segment);

        return array_filter($parts, function ($part) {
            return $this->isNotEmpty($part);
        });
    }
1258368
private static function gatherAttachments(PartInterface $part): array
    {
        $attachments = [];
        foreach ($part->getParts() as $childPart) {
            if ($childPart instanceof Attachment) {
                $attachments[] = $childPart;
            }
            if ($childPart->hasChildren()) {
                $attachments = \array_merge($attachments, self::gatherAttachments($childPart));
            }
        }

        return $attachments;
    }
993493
public function getPartsByName($name)
    {
        $parts = array();

        foreach ($this->getParts() as $part) {
            if ($part->getName() === $name) {
                $parts[] = $part;
            }
        }

        return $parts;
    }
242615
public function increment($part)
    {
        foreach (array_reverse(self::$ordinality) as $currentPart) {
            if ($currentPart === $part) {
                switch ($part) {
                    case self::STABILITY:
                        $this->set(
                            $currentPart, 
                            self::$stabilities[
                                array_search(
                                    $this->get($currentPart), 
                                    self::$stabilities
                                ) +1
                            ]
                        );
                        break;
                    default:
                        $this->set($currentPart, $this->get($currentPart) +1);
                        break;
                }
                break;
            } else {
                switch ($currentPart) {
                    case self::STABILITY_NO:
                        $this->set($currentPart, null);
                        break;
                    case self::STABILITY:
                        $this->set($currentPart, 'dev');
                        break;
                    default:
                        $this->set($currentPart, '0');
                }
            }
        }

        return $this;
    }
540359
protected function parsePart($stream, $uid, $part, $partNo = 1)
    {
        if (!in_array($part->type, [TYPETEXT, TYPEMULTIPART])) {
            return null;
        }

        $body = imap_fetchbody($stream, $uid, $partNo, static::$bodyFlags);

        $body = static::decode($body, $part->encoding);
        if ('' !== ($charset = $this->findCharset($part))) {
            $body = static::convertBodyEncoding($body, $charset, $part->encoding);
        }

        return (object) [
            'body' => $body,
            'mime_type' => strtolower($part->subtype)
        ];
    }
235700
private static function localeFormat($part = 'datetime')
    {
        if (self::$localeFormat === null) {
            $locale = self::getLocale();
            $file = resource_path('lang/' . $locale . '/datetime.php');
            if (file_exists($file)) {
                /** @noinspection PhpIncludeInspection */
                self::$localeFormat = include $file;
            }
            else {
                $file = resource_path('lang/' . config('locale.fallback') . '/datetime.php');
                /** @noinspection PhpIncludeInspection */
                self::$localeFormat = file_exists($file) ? include $file : ['datetime' => 'Y-m-d H:i', 'date' => 'Y-m-d', 'time' => 'H:i'];
            }
        }

        return self::$localeFormat[$part];
    }
889409
public static function getStructurePartData($structure, $part)
    {
        $part_a = self::getStructurePartArray($structure, $part);
        $data   = array();

        if (empty($part_a)) {
            return $data;
        }

        // content-type
        if (is_array($part_a[0])) {
            $data['type'] = 'multipart';
        }
        else {
            $data['type']     = strtolower($part_a[0]);
            $data['encoding'] = strtolower($part_a[5]);

            // charset
            if (is_array($part_a[2])) {
               foreach ($part_a[2] as $key => $val) {
                    if (strcasecmp($val, 'charset') == 0) {
                        $data['charset'] = $part_a[2][$key+1];
                        break;
                    }
                }
            }
        }

        // size
        $data['size'] = intval($part_a[6]);

        return $data;
    }
524706
protected function _basicQuoter($part)
    {
        $result = [];
        foreach ((array)$part as $alias => $value) {
            $value = !is_string($value) ? $value : $this->_driver->quoteIdentifier($value);
            $alias = is_numeric($alias) ? $alias : $this->_driver->quoteIdentifier($alias);
            $result[$alias] = $value;
        }

        return $result;
    }
861057
private function createValueKey(string $part): array
    {
        $parts = explode('=', $part, 2);
        $key = trim($parts[0]);
        $value = isset($parts[1]) ? trim($parts[1]) : true;

        return [$key, $value];
    }
139490
protected function validatePart($part)
    {
        if (strpos($part, '=>') !== false) {
            $subs = explode('=>', $part);
            $subs = array_filter($subs);

            foreach ($subs as $sub) {
                if (!$this->validateNoSpaces($sub)) {
                    return false;
                }
            }

            return true;
        }

        return $this->validateNoSpaces($part);
    }
423864
protected function getPartBodyFromFile(&$part)
    {
        $start = $part['starting-pos-body'];
        $end = $part['ending-pos-body'];
        $body = '';
        if ($end - $start > 0) {
            fseek($this->stream, $start, SEEK_SET);
            $body = fread($this->stream, $end - $start);
        }

        return $body;
    }
434112
public function getParts()
    {
        $parts = explode('.', $this->value);

        return (object) [
            'major' => !empty($parts[0]) ? intval($parts[0]) : 0,
            'minor' => !empty($parts[1]) ? intval($parts[1]) : 0,
            'patch' => !empty($parts[2]) ? intval($parts[2]) : 0,
        ];
    }
1198707
protected function getPartHeaderFromFile(&$part)
    {
        $start = $part['starting-pos'];
        $end = $part['starting-pos-body'];
        fseek($this->stream, $start, SEEK_SET);
        $header = fread($this->stream, $end - $start);
        return $header;
    }
263759
protected function processParts(array $parts)
    {
        return array_values(array_filter($parts, function ($part) {
            if (empty($part) || $part instanceof CommentPart) {
                return false;
            }
            return true;
        }));
    }
1058307
public function map(array $parts): array
    {
        if (!$this->matchSinglePart && count($parts) < 2) {
            return $parts;
        }

        return $this->mapParts($parts);
    }
771180
public static function join_paths($part = null)
    {
        $args = func_get_args();
        if (count($args) === 1 && is_array($args[0])) {
            $args = $args[0];
        }

        $parts = array();
        foreach ($args as $arg) {
            $part = trim($arg, ' \\/');
            if ($part) {
                $parts[] = $part;
            }
        }

        return implode('/', $parts);
    }