Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php
public function canRead($pFilename)
    {
        File::assertFile($pFilename);

        $mimeType = 'UNKNOWN';

        // Load file

        $zip = new ZipArchive();
        if ($zip->open($pFilename) === true) {
            // check if it is an OOXML archive
            $stat = $zip->statName('mimetype');
            if ($stat && ($stat['size'] <= 255)) {
                $mimeType = $zip->getFromName($stat['name']);
            } elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
                $xml = simplexml_load_string(
                    $this->securityScan($zip->getFromName('META-INF/manifest.xml')),
                    'SimpleXMLElement',
                    Settings::getLibXmlLoaderOptions()
                );
                $namespacesContent = $xml->getNamespaces(true);
                if (isset($namespacesContent['manifest'])) {
                    $manifest = $xml->children($namespacesContent['manifest']);
                    foreach ($manifest as $manifestDataSet) {
                        $manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']);
                        if ($manifestAttributes->{'full-path'} == '/') {
                            $mimeType = (string) $manifestAttributes->{'media-type'};

                            break;
                        }
                    }
                }
            }

            $zip->close();

            return $mimeType === 'application/vnd.oasis.opendocument.spreadsheet';
        }

        return false;
    }
public function canRead($pFilename)
    {
        File::assertFile($pFilename);

        $mimeType = 'UNKNOWN';

        // Load file

        $zip = new ZipArchive();
        if ($zip->open($pFilename) === true) {
            // check if it is an OOXML archive
            $stat = $zip->statName('mimetype');
            if ($stat && ($stat['size'] <= 255)) {
                $mimeType = $zip->getFromName($stat['name']);
            } elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
                $xml = simplexml_load_string(
                    $this->securityScan($zip->getFromName('META-INF/manifest.xml')),
                    'SimpleXMLElement',
                    Settings::getLibXmlLoaderOptions()
                );
                $namespacesContent = $xml->getNamespaces(true);
                if (isset($namespacesContent['manifest'])) {
                    $manifest = $xml->children($namespacesContent['manifest']);
                    foreach ($manifest as $manifestDataSet) {
                        $manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']);
                        if ($manifestAttributes->{'full-path'} == '/') {
                            $mimeType = (string) $manifestAttributes->{'media-type'};

                            break;
                        }
                    }
                }
            }

            $zip->close();

            return $mimeType === 'application/vnd.oasis.opendocument.spreadsheet';
        }

        return false;
    }
public function canRead ( $ pFilename ) { File :: assertFile ( $ pFilename ) ; $ mimeType = 'UNKNOWN' ; // Load file $ zip = new ZipArchive ( ) ; if ( $ zip -> open ( $ pFilename ) === true ) { // check if it is an OOXML archive $ stat = $ zip -> statName ( 'mimetype' ) ; if ( $ stat && ( $ stat [ 'size' ] <= 255 ) ) { $ mimeType = $ zip -> getFromName ( $ stat [ 'name' ] ) ; } elseif ( $ stat = $ zip -> statName ( 'META-INF/manifest.xml' ) ) { $ xml = simplexml_load_string ( $ this -> securityScan ( $ zip -> getFromName ( 'META-INF/manifest.xml' ) ) , 'SimpleXMLElement' , Settings :: getLibXmlLoaderOptions ( ) ) ; $ namespacesContent = $ xml -> getNamespaces ( true ) ; if ( isset ( $ namespacesContent [ 'manifest' ] ) ) { $ manifest = $ xml -> children ( $ namespacesContent [ 'manifest' ] ) ; foreach ( $ manifest as $ manifestDataSet ) { $ manifestAttributes = $ manifestDataSet -> attributes ( $ namespacesContent [ 'manifest' ] ) ; if ( $ manifestAttributes -> { 'full-path' } == '/' ) { $ mimeType = ( string ) $ manifestAttributes -> { 'media-type' } ; break ; } } } } $ zip -> close ( ) ; return $ mimeType === 'application/vnd.oasis.opendocument.spreadsheet' ; } return false ; }
Can the current IReader read the file?

@param string $pFilename

@throws Exception

@return bool
Can the current IReader read the file?