private function getBackupFileDate($file, $ext = 'php')
    {
        $matches = [];

        if (preg_match('@^(.*)([0-9]{8}_[0-9]{6})\\.'.$ext.'$@', $file, $matches) === 1) {
            return \DateTime::createFromFormat(self::BACKUP_DATE_FORMAT, $matches[2]);
        }
        // @codeCoverageIgnoreStart
        // Cannot happen because of glob but safer
        else {
            return null;
        }
        // @codeCoverageIgnoreEnd
    }
private function getBackupFileDate($file, $ext = 'php')
    {
        $matches = [];

        if (preg_match('@^(.*)([0-9]{8}_[0-9]{6})\\.'.$ext.'$@', $file, $matches) === 1) {
            return \DateTime::createFromFormat(self::BACKUP_DATE_FORMAT, $matches[2]);
        }
        // @codeCoverageIgnoreStart
        // Cannot happen because of glob but safer
        else {
            return null;
        }
        // @codeCoverageIgnoreEnd
    }
private function getBackupFileDate ( $ file , $ ext = 'php' ) { $ matches = [ ] ; if ( preg_match ( '@^(.*)([0-9]{8}_[0-9]{6})\\.' . $ ext . '$@' , $ file , $ matches ) === 1 ) { return \ DateTime :: createFromFormat ( self :: BACKUP_DATE_FORMAT , $ matches [ 2 ] ) ; } // @codeCoverageIgnoreStart // Cannot happen because of glob but safer else { return null ; } // @codeCoverageIgnoreEnd }
Return the date of a backup file

@param string $file a backup file path
@param string $ext

@return \DateTime|null
Return the date of a backup file