public function read(
        ReadOptionsInterface $options,
        SectionConfig $sectionConfig = null
    ): \ArrayIterator {
        $sectionData = new \ArrayIterator();

        $this->dispatcher->dispatch(
            SectionBeforeRead::NAME,
            new SectionBeforeRead($sectionData, $options, $sectionConfig)
        );

        if ($sectionConfig === null && count($options->getSection()) > 0) {
            $sectionConfig = $this->sectionManager->readByHandle(
                $options->getSection()[0]->toHandle()
            )->getConfig();
        }

        // Make sure we are passing the fully qualified class name as the section
        if (count($options->getSection()) > 0) {
            $optionsArray = $options->toArray();
            $optionsArray[ReadOptions::SECTION] = (string)$sectionConfig->getFullyQualifiedClassName();
            $options = ReadOptions::fromArray($optionsArray);
        }

        /** @var ReadSectionInterface $reader */
        foreach ($this->readers as $reader) {
            foreach ($reader->read($options, $sectionConfig) as $entry) {
                $sectionData->append($entry);
            }
        }

        $this->dispatcher->dispatch(
            SectionDataRead::NAME,
            new SectionDataRead($sectionData, $options, $sectionConfig)
        );

        return $sectionData;
    }
public function read(
        ReadOptionsInterface $options,
        SectionConfig $sectionConfig = null
    ): \ArrayIterator {
        $sectionData = new \ArrayIterator();

        $this->dispatcher->dispatch(
            SectionBeforeRead::NAME,
            new SectionBeforeRead($sectionData, $options, $sectionConfig)
        );

        if ($sectionConfig === null && count($options->getSection()) > 0) {
            $sectionConfig = $this->sectionManager->readByHandle(
                $options->getSection()[0]->toHandle()
            )->getConfig();
        }

        // Make sure we are passing the fully qualified class name as the section
        if (count($options->getSection()) > 0) {
            $optionsArray = $options->toArray();
            $optionsArray[ReadOptions::SECTION] = (string)$sectionConfig->getFullyQualifiedClassName();
            $options = ReadOptions::fromArray($optionsArray);
        }

        /** @var ReadSectionInterface $reader */
        foreach ($this->readers as $reader) {
            foreach ($reader->read($options, $sectionConfig) as $entry) {
                $sectionData->append($entry);
            }
        }

        $this->dispatcher->dispatch(
            SectionDataRead::NAME,
            new SectionDataRead($sectionData, $options, $sectionConfig)
        );

        return $sectionData;
    }
public function read ( ReadOptionsInterface $ options , SectionConfig $ sectionConfig = null ) : \ ArrayIterator { $ sectionData = new \ ArrayIterator ( ) ; $ this -> dispatcher -> dispatch ( SectionBeforeRead :: NAME , new SectionBeforeRead ( $ sectionData , $ options , $ sectionConfig ) ) ; if ( $ sectionConfig === null && count ( $ options -> getSection ( ) ) > 0 ) { $ sectionConfig = $ this -> sectionManager -> readByHandle ( $ options -> getSection ( ) [ 0 ] -> toHandle ( ) ) -> getConfig ( ) ; } // Make sure we are passing the fully qualified class name as the section if ( count ( $ options -> getSection ( ) ) > 0 ) { $ optionsArray = $ options -> toArray ( ) ; $ optionsArray [ ReadOptions :: SECTION ] = ( string ) $ sectionConfig -> getFullyQualifiedClassName ( ) ; $ options = ReadOptions :: fromArray ( $ optionsArray ) ; } /** @var ReadSectionInterface $reader */ foreach ( $ this -> readers as $ reader ) { foreach ( $ reader -> read ( $ options , $ sectionConfig ) as $ entry ) { $ sectionData -> append ( $ entry ) ; } } $ this -> dispatcher -> dispatch ( SectionDataRead :: NAME , new SectionDataRead ( $ sectionData , $ options , $ sectionConfig ) ) ; return $ sectionData ; }
Read from one or more data-sources

@param ReadOptionsInterface $options
@param SectionConfig|null $sectionConfig
@return \ArrayIterator
Read from one or more data - sources