protected function getSections($type = null)
    {
        if (!$type) {
            return $this->section;
        }
        $types = null;
        switch ($type) {
            case self::SECTION_ATTACHMENTS:
                $types = TypeAttachments::get();
                break;
            case self::SECTION_BODY:
                $types = TypeBody::get();
                break;
            default:
                throw new ImapClientException('Section type not recognised/supported');
                break;
        }
        $sections = array();
        foreach ($this->section as $section) {
            $obj = $this->getSectionStructure($section);
            if (!isset($obj->subtype)) {
                continue;
            }
            if (in_array($obj->subtype, $types, false)) {
                $sections[] = $section;
            }
        }

        return $sections;
    }
protected function getSections($type = null)
    {
        if (!$type) {
            return $this->section;
        }
        $types = null;
        switch ($type) {
            case self::SECTION_ATTACHMENTS:
                $types = TypeAttachments::get();
                break;
            case self::SECTION_BODY:
                $types = TypeBody::get();
                break;
            default:
                throw new ImapClientException('Section type not recognised/supported');
                break;
        }
        $sections = array();
        foreach ($this->section as $section) {
            $obj = $this->getSectionStructure($section);
            if (!isset($obj->subtype)) {
                continue;
            }
            if (in_array($obj->subtype, $types, false)) {
                $sections[] = $section;
            }
        }

        return $sections;
    }
protected function getSections ( $ type = null ) { if ( ! $ type ) { return $ this -> section ; } $ types = null ; switch ( $ type ) { case self :: SECTION_ATTACHMENTS : $ types = TypeAttachments :: get ( ) ; break ; case self :: SECTION_BODY : $ types = TypeBody :: get ( ) ; break ; default : throw new ImapClientException ( 'Section type not recognised/supported' ) ; break ; } $ sections = array ( ) ; foreach ( $ this -> section as $ section ) { $ obj = $ this -> getSectionStructure ( $ section ) ; if ( ! isset ( $ obj -> subtype ) ) { continue ; } if ( in_array ( $ obj -> subtype , $ types , false ) ) { $ sections [ ] = $ section ; } } return $ sections ; }
Gets all sections, or if parameter is specified sections by type.

@param string $type

@throws ImapClientException

@return array
Gets all sections or if parameter is specified sections by type .