src/Storage/File/StorableFileFactory.php
public function makeFromFileInfo(SplFileInfo $data, $name = null, $mimeType = null)
    {
        $file = new SplFileInfoStorableFile;
        $file->setData($data);

        if (null !== $mimeType) {
            $file->setMimeType($mimeType);
        } else {
            $file->setMimeType(
                $this->mimeTypeHelper->guessMimeTypeForPath($data->getRealPath())
            );
        }

        if (empty($name)) {
            $name = pathinfo($data->getRealPath(), PATHINFO_BASENAME);
        }

        if (null !== $name) {
            $file->setName($name);
        }

        return $this->getReturnPreparedFile($file);
    }
public function makeFromFileInfo(SplFileInfo $data, $name = null, $mimeType = null)
    {
        $file = new SplFileInfoStorableFile;
        $file->setData($data);

        if (null !== $mimeType) {
            $file->setMimeType($mimeType);
        } else {
            $file->setMimeType(
                $this->mimeTypeHelper->guessMimeTypeForPath($data->getRealPath())
            );
        }

        if (empty($name)) {
            $name = pathinfo($data->getRealPath(), PATHINFO_BASENAME);
        }

        if (null !== $name) {
            $file->setName($name);
        }

        return $this->getReturnPreparedFile($file);
    }
public function makeFromFileInfo ( SplFileInfo $ data , $ name = null , $ mimeType = null ) { $ file = new SplFileInfoStorableFile ; $ file -> setData ( $ data ) ; if ( null !== $ mimeType ) { $ file -> setMimeType ( $ mimeType ) ; } else { $ file -> setMimeType ( $ this -> mimeTypeHelper -> guessMimeTypeForPath ( $ data -> getRealPath ( ) ) ) ; } if ( empty ( $ name ) ) { $ name = pathinfo ( $ data -> getRealPath ( ) , PATHINFO_BASENAME ) ; } if ( null !== $ name ) { $ file -> setName ( $ name ) ; } return $ this -> getReturnPreparedFile ( $ file ) ; }
Makes a storable file instance from an SplFileInfo instance.

@param SplFileInfo $data
@param string|null $name
@param string|null $mimeType
@return StorableFileInterface
Makes a storable file instance from an SplFileInfo instance .