Get a table part lines array

@param string $part One of the table `$_table_parts`
@return array The lines array
@throws \InvalidArgumentException if the part doesn't exist in the table
359438
protected function _getPart($part)
    {
        if (property_exists($this, $part)) {
            return $this->{$part};
        } elseif (!in_array($part, self::$_table_parts)) {
            throw new InvalidArgumentException(
                sprintf('Unknown table part "%s"!', $part)
            );
        }
    }
968784
public function toString(array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'))
	{
		// Make sure the query is created
		$query = $this->getQuery();

		$uri = '';
		$uri .= in_array('scheme', $parts) ? (!empty($this->scheme) ? $this->scheme . '://' : '') : '';
		$uri .= in_array('user', $parts) ? $this->user : '';
		$uri .= in_array('pass', $parts) ? (!empty($this->pass) ? ':' : '') . $this->pass . (!empty($this->user) ? '@' : '') : '';
		$uri .= in_array('host', $parts) ? $this->host : '';
		$uri .= in_array('port', $parts) ? (!empty($this->port) ? ':' : '') . $this->port : '';
		$uri .= in_array('path', $parts) ? $this->path : '';
		$uri .= in_array('query', $parts) ? (!empty($query) ? '?' . $query : '') : '';
		$uri .= in_array('fragment', $parts) ? (!empty($this->fragment) ? '#' . $this->fragment : '') : '';

		return $uri;
	}
1187253
public function getPart($part)
    {
        $part = strtolower($part);
        if (!array_key_exists($part, $this->_parts)) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception("Invalid Select part '$part'");
        }
        return $this->_parts[$part];
    }
1250950
private function getParts($content, array $parts = array())
    {
        //separate the head and the body
        list($head, $body) = preg_split("/\n\s*\n/", $content, 2);
        //get the headers
        $head = $this->getHeaders($head);
        //if content type is not set
        if (!isset($head['content-type'])) {
            return $parts;
        }

        //split the content type
        if (is_array($head['content-type'])) {
            $type = array($head['content-type'][1]);
            if (strpos($type[0], ';') !== false) {
                $type = explode(';', $type[0], 2);
            }
        } else {
            $type = explode(';', $head['content-type'], 2);
        }

        //see if there are any extra stuff
        $extra = array();
        if (count($type) == 2) {
            $extra = explode('; ', str_replace(array('"', "'"), '', trim($type[1])));
        }

        //the content type is the first part of this
        $type = trim($type[0]);


        //foreach extra
        foreach ($extra as $i => $attr) {
            //transform the extra array to a key value pair
            $attr = explode('=', $attr, 2);
            if (count($attr) > 1) {
                list($key, $value) = $attr;
                $extra[strtolower($key)] = $value;
            }
            unset($extra[$i]);
        }

        //if a boundary is set
        if (isset($extra['boundary'])) {
            //split the body into sections
            $sections = explode('--'.str_replace(array('"', "'"), '', $extra['boundary']), $body);
            //we only want what's in the middle of these sections
            array_pop($sections);
            array_shift($sections);

            //foreach section
            foreach ($sections as $section) {
                //get the parts of that
                $parts = $this->getParts($section, $parts);
            }
        } else {
            //if name is set, it's an attachment
            //if encoding is set
            if (isset($head['content-transfer-encoding'])) {
                //the goal here is to make everytihg utf-8 standard
                switch (strtolower($head['content-transfer-encoding'])) {
                    case 'binary':
                        $body = imap_binary($body);
                        break;
                    case 'base64':
                        $body = base64_decode($body);
                        break;
                    case 'quoted-printable':
                        $body = quoted_printable_decode($body);
                        break;
                    case '7bit':
                        $body = mb_convert_encoding($body, 'UTF-8', 'ISO-2022-JP');
                        break;
                    default:
                        $body = str_replace(array("\n", ' '), '', $body);
                        break;
                }
            }

            if (isset($extra['name'])) {
                //add to parts
                $parts['attachment'][$extra['name']][$type] = $body;
            } else {
                //it's just a regular body
                //add to parts
                $parts[$type] = $body;
            }
        }
        return $parts;
    }
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;
    }
324068
public function getQueryParts()
    {
        $result = [
            'type' => $this->getQueryType(),
            'fields' => $this->fields,
            'table' => $this->getTable()
        ];

        if (!empty($this->values)) {
            $result['values'] = $this->values;
        }

        if (!empty($this->set)) {
            $result['set'] = $this->set;
        }

        if (!empty($this->joins)) {
            $result['join'] = $this->joins;
        }

        if (!empty($this->wheres)) {
            $result['where'] = $this->wheres;
        }

        if (!empty($this->group)) {
            $result['group'] = $this->group;
        }

        if (!empty($this->order)) {
            $result['order'] = $this->order;
        }

        if (!empty($this->limit)) {
            $result['limit'] = $this->limit;
        }

        return $result;
    }
938178
protected static function buildUrlMergeUrlParts($parts)
    {
        $partsDefault = array(
            'scheme'    => null,
            'host'      => null,
            'port'      => null,
            'path'      => '/',
            'query'     => '',
            'fragment'  => null,
        );
        if (!empty($parts['url'])) {
            $urlParts = self::parseUrl(htmlspecialchars_decode($parts['url']));
            if (!$urlParts['scheme']) {
                $urlParts['scheme'] = 'omit';
            }
            if (!empty($parts['path'])) {
                // discard url's query and fragment
                $urlParts['query']      = null;
                $urlParts['params']     = array();
                $urlParts['fragment']   = null;
            }
            if ($urlParts['query'] && !empty($parts['query'])) {
                // merge the queries
                $paramsParts = Str::parse($parts['query']);
                $params = ArrayUtil::mergeDeep($urlParts['params'], $paramsParts);
                $parts['query'] = self::buildQueryString($params);
            }
            $partsDefault = array_merge($partsDefault, $urlParts);
        }
        $parts = array_merge($partsDefault, $parts);
        return $parts;
    }
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];
		}
605167
protected function getPartFromText(&$part)
    {
        $start = $part['starting-pos'];
        $end = $part['ending-pos'];

        return substr($this->data, $start, $end - $start);
    }
1182915
public function getPartData($part = null)
    {
        if ($part === null) {
            $part = $this->resource;
        }

        return mailparse_msg_get_part_data($part);
    }
1122883
protected function splitLine($line)
    {
        $chunks = explode(';', $line);
        if (count($chunks) !== 6) {
            throw new InvalidValueException('Line "' . $line . '" is malformed');
        }

        return array_map('trim', $chunks);
    }
1220530
public static function hydrateCollection(array $parts)
    {
        $hydrated = [];

        foreach ($parts as $part) {
            $hydrated[] = self::hydrate($part);
        }

        return $hydrated;
    }
929954
public function parsePart($text)
    {
        $text = str_replace("\r", '', $text); // acceptable

        $this->content = $text;
        $this->cursor  = 0;

        try {
            return $this->doParsePart();
        } catch (\Exception $e) {
            $text = substr($this->content, $this->cursor, 10);

            throw new \InvalidArgumentException(sprintf('Error while parsing "%s" (cursor: %d, text: "%s").'."\n%s", $e->getMessage(), $this->cursor, $text, $e->getTraceAsString()));
        }
    }
987112
protected function evalSelectorPart($part)
    {
        foreach ($part as &$p) {
            if (is_array($p) && ($p[0] === Type::T_INTERPOLATE || $p[0] === Type::T_STRING)) {
                $p = $this->compileValue($p);

                // force re-evaluation
                if (strpos($p, '&') !== false || strpos($p, ',') !== false) {
                    $this->shouldEvaluate = true;
                }
            } elseif (is_string($p) && strlen($p) >= 2 &&
                ($first = $p[0]) && ($first === '"' || $first === "'") &&
                substr($p, -1) === $first
            ) {
                $p = substr($p, 1, -1);
            }
        }

        return $this->flattenSelectorSingle($part);
    }
455997
protected function processParts(array $parts)
    {
        $strValue = '';
        foreach ($parts as $part) {
            $strValue .= $part->getValue();
        }
        return [$this->partFactory->newDatePart($strValue)];
    }
835314
public static function getNamespaceFromParts($parts) {
		$resultArray = [ ];
		if (! \is_array ( $parts )) {
			$parts = [ $parts ];
		}
		foreach ( $parts as $part ) {
			$resultArray = \array_merge ( $resultArray, \explode ( "\\", $part ) );
		}
		$resultArray = \array_diff ( $resultArray, [ "" ] );
		return \implode ( "\\", $resultArray );
	}
551267
public function getPart($type)
    {
        $parts = $this->getParts();

        foreach ($parts as $part) {
            if (0 === strpos($part->getHeaders()->get('Content-Type'), $type)) {
                return $part;
            }
        }

        throw new \InvalidArgumentException(sprintf('Unable to find part with Content-Type "%s" in parts. Got: %s', $type, implode("", array_map(function ($part) {
            return "\n- ".$part->getHeaders()->get('Content-Type');
        }, $parts))));
    }