protected function getMailLocalFolderFileList($mail)
    {
        $spoolFolder = $this->_config->getHostSpoolerFolderPath() .
            DIRECTORY_SEPARATOR .
            $mail->getId() .
            DIRECTORY_SEPARATOR .
            self::ATTACHMENT_PATH;

        // create a folder for attachments if needed
        if (!is_dir($spoolFolder)) {
            $this->createFolder($spoolFolder);
        }

        /** @var RecursiveIteratorIterator $objects */
        $objects = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($spoolFolder),
            RecursiveIteratorIterator::LEAVES_ONLY,
            FilesystemIterator::SKIP_DOTS
        );

        /** @var array $files */
        $files = [];

        /**
         * @var string $name
         * @var SplFileObject $object
         */
        foreach ($objects as $path => $object) {
            /** @noinspection TypeUnsafeComparisonInspection */
            /** @noinspection NotOptimalIfConditionsInspection */
            if ($object->getFilename() != '.' && $object->getFilename() != '..') {
                $filePath = str_replace($spoolFolder, '', $path);
                $file = [
                    'name' => $object->getFilename(),
                    'path' => $path
                ];
                $files[$filePath] = $file;
            }
        }

        return $files;
    }
protected function getMailLocalFolderFileList($mail)
    {
        $spoolFolder = $this->_config->getHostSpoolerFolderPath() .
            DIRECTORY_SEPARATOR .
            $mail->getId() .
            DIRECTORY_SEPARATOR .
            self::ATTACHMENT_PATH;

        // create a folder for attachments if needed
        if (!is_dir($spoolFolder)) {
            $this->createFolder($spoolFolder);
        }

        /** @var RecursiveIteratorIterator $objects */
        $objects = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($spoolFolder),
            RecursiveIteratorIterator::LEAVES_ONLY,
            FilesystemIterator::SKIP_DOTS
        );

        /** @var array $files */
        $files = [];

        /**
         * @var string $name
         * @var SplFileObject $object
         */
        foreach ($objects as $path => $object) {
            /** @noinspection TypeUnsafeComparisonInspection */
            /** @noinspection NotOptimalIfConditionsInspection */
            if ($object->getFilename() != '.' && $object->getFilename() != '..') {
                $filePath = str_replace($spoolFolder, '', $path);
                $file = [
                    'name' => $object->getFilename(),
                    'path' => $path
                ];
                $files[$filePath] = $file;
            }
        }

        return $files;
    }
protected function getMailLocalFolderFileList ( $ mail ) { $ spoolFolder = $ this -> _config -> getHostSpoolerFolderPath ( ) . DIRECTORY_SEPARATOR . $ mail -> getId ( ) . DIRECTORY_SEPARATOR . self :: ATTACHMENT_PATH ; // create a folder for attachments if needed if ( ! is_dir ( $ spoolFolder ) ) { $ this -> createFolder ( $ spoolFolder ) ; } /** @var RecursiveIteratorIterator $objects */ $ objects = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ spoolFolder ) , RecursiveIteratorIterator :: LEAVES_ONLY , FilesystemIterator :: SKIP_DOTS ) ; /** @var array $files */ $ files = [ ] ; /**
         * @var string $name
         * @var SplFileObject $object
         */ foreach ( $ objects as $ path => $ object ) { /** @noinspection TypeUnsafeComparisonInspection */ /** @noinspection NotOptimalIfConditionsInspection */ if ( $ object -> getFilename ( ) != '.' && $ object -> getFilename ( ) != '..' ) { $ filePath = str_replace ( $ spoolFolder , '' , $ path ) ; $ file = [ 'name' => $ object -> getFilename ( ) , 'path' => $ path ] ; $ files [ $ filePath ] = $ file ; } } return $ files ; }
Get file list for a given mail

@param \Shockwavemk\Mail\Base\Model\Mail $mail
@return array
Get file list for a given mail