Returns the direct child at the given 0-based index, or null if none is
set.

@param int $index
@param PartFilter $filter
@return MessagePart
547796
public function getChild($index, PartFilter $filter = null)
    {
        $parts = $this->getChildParts($filter);
        if (!isset($parts[$index])) {
            return null;
        }
        return $parts[$index];
    }
564153
public function getPart($num)
    {
        --$num;
        if (!isset($this->_partPos[$num])) {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('part not found');
        }

        return new self(array('file' => $this->_fh, 'startPos' => $this->_partPos[$num][0],
                              'endPos' => $this->_partPos[$num][1]));
    }
83196
public function getParamClean($index){
        if(isset($this->params[$index])){
            return $this->params[$index];
        }else{
            return NULL;
        }
    }
1160825
public function getPart($part)
    {
        return isset($this->parts[$part]) ? $this->parts[$part] : null;
    }
1361439
public function getIndex($part1 = null, $part2 = null)
	{
		$size = empty($part2) ? null : $part1;
		$filename = empty($part2) ? $part1 : $part2;
		
		if (!$image = Image::where('filename', $filename)->first()) {
			App::abort(404);
		}
		
		if (!$path = $image->path($size)) {
			App::abort(404);
		}
		
		return Storage::render($path);
	}
149175
public function getPartByIndex($index)
    {
        if (!isset($this->_parts[$index])) {
            return null;
        }

        $part = $this->_parts[$index];
        $part->parent = $this;

        return $part;
    }
594824
private function failsMultiPartFilter(MessagePart $part)
    {
        if (!($part instanceof MimePart)) {
            return $this->multipart !== static::FILTER_EXCLUDE;
        }
        return ($this->multipart === static::FILTER_EXCLUDE && $part->isMultiPart())
            || ($this->multipart === static::FILTER_INCLUDE && !$part->isMultiPart());
    }
1021644
public function indexOf($filter)
    {
        foreach ($this->children as $i => $child) {
            if ($child === $filter) {
                return $i;
            }
        }

        return -1;
    }
363573
public function getMessage($index)
    {
        if (!$this->hasMessage($index)) {
            throw new \Exception('Message not found : ' . $index);
        }

        return $this->messages[$index];
    }
815593
public function getSegment($index, $default = null)
    {
        return $index > 0 && count($this->urlParts) - 1 <= $index ? $this->urlParts[$index]
                : $default;
    }
508272
public function segment($index) {
		if (isset($this->segments[$index])) {
			return $this->segments[$index];
		}

		return null;
	}
353087
private function applyFilter(Filter $filter)
    {
        list($filtered, $errors) = $filter->apply($this->value);
        if (count($errors) === 0) {
            return $filtered;
        }

        foreach ($errors as $error) {
            $this->paramErrors->append($this->paramName, $error);
        }

        return null;
    }
1058131
public function filter($filter)
    {
        preg_match_all("/(#\w+)/", $filter, $entityNames);
        preg_match_all("/(:\w+)/", $filter, $positions);

        $entityName = is_array($entityNames[0]) && isset($entityNames[0][0]) ? ltrim($entityNames[0][0], '#') : null;
        $position   = is_array($positions[0]) && isset($positions[0][0]) ? $positions[0][0] : null;

        $i = 0;

        $filtered = [];

        foreach ($this->entities as $name => $entity) {
            if ($i === 0 && ($entityName === $name || $entityName === null) && ($position === ':first' || $position === ':highest' || $position === null)) {
                $filtered[] = $entity;
            }

            if ($position === ':any' && ($entityName === $name || $entityName === null)) {
                $filtered[] = $entity;
            }

            if ($i + 1 === $this->entities->count() && ($entityName === $name || $entityName === null) && ($position === ':last' || $position === ':lowest')) {
                $filtered[] = $entity;
            }

            $i++;
        }

        $this->filtered = $filtered;

        return $this;
    }
806111
private function failsHasContentFilter(MessagePart $part)
    {
        return ($this->hascontent === static::FILTER_EXCLUDE && $part->hasContent())
            || ($this->hascontent === static::FILTER_INCLUDE && !$part->hasContent());
    }
290222
public function getResolverForPart(EmailPart $part): EmailPartResolver
    {
        $identifier = get_class($part);

        if (!array_key_exists($identifier, $this->resolvers)) {
            throw new InvalidArgumentException(sprintf(
                'Resolver for the part "%s" does not exists. Please choose one of the following: %s',
                $identifier,
                implode(', ', array_keys($this->resolvers))
            ));
        }

        return $this->resolvers[$identifier];
    }
558590
private function failsHeaderPartFilter(MessagePart $part)
    {
        foreach ($this->headers as $type => $values) {
            foreach ($values as $name => $header) {
                if ($this->failsHeaderFor($part, $type, $name, $header)) {
                    return true;
                }
            }
        }
        return false;
    }
342255
public function get($index, $defaultValue = null, $filtered = true)
    {
        if ($this->data->offsetExists($index)) {

            if ($filtered === true) {
                // pretty high-level filtering here...
                return self::filter($this->data->offsetGet($index));
            }

            return $this->data->offsetGet($index);
        }

        return $defaultValue;
    }