public function getAllParts(PartFilter $filter = null)
    {
        $parts = $this->getAllNonFilteredParts();
        if (!empty($filter)) {
            return array_values(array_filter(
                $parts,
                [ $filter, 'filter' ]
            ));
        }
        return $parts;
    }
public function getAllParts(PartFilter $filter = null)
    {
        $parts = $this->getAllNonFilteredParts();
        if (!empty($filter)) {
            return array_values(array_filter(
                $parts,
                [ $filter, 'filter' ]
            ));
        }
        return $parts;
    }
public function getAllParts ( PartFilter $ filter = null ) { $ parts = $ this -> getAllNonFilteredParts ( ) ; if ( ! empty ( $ filter ) ) { return array_values ( array_filter ( $ parts , [ $ filter , 'filter' ] ) ) ; } return $ parts ; }
Returns the current part, all child parts, and child parts of all
children optionally filtering them with the provided PartFilter.

The first part returned is always the current MimePart.  This is often
desirable as it may be a valid MimePart for the provided PartFilter.

@param PartFilter $filter an optional filter
@return MessagePart[]
Returns the current part all child parts and child parts of all children optionally filtering them with the provided PartFilter .