Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/inventory.corals.io/vendor/maatwebsite/excel/src/Helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/inventory.corals.io/vendor/maatwebsite/excel/src/Helpers/FileTypeDetector.php
<?php

namespace Maatwebsite\Excel\Helpers;

use Maatwebsite\Excel\Exceptions\NoTypeDetectedException;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class FileTypeDetector
{
    /**
     * @param  $filePath
     * @param  string|null  $type
     * @return string|null
     *
     * @throws NoTypeDetectedException
     */
    public static function detect($filePath, string $type = null)
    {
        if (null !== $type) {
            return $type;
        }

        if (!$filePath instanceof UploadedFile) {
            $pathInfo  = pathinfo($filePath);
            $extension = $pathInfo['extension'] ?? '';
        } else {
            $extension = $filePath->getClientOriginalExtension();
        }

        if (null === $type && trim($extension) === '') {
            throw new NoTypeDetectedException();
        }

        return config('excel.extension_detector.' . strtolower($extension));
    }

    /**
     * @param  string  $filePath
     * @param  string|null  $type
     * @return string
     *
     * @throws NoTypeDetectedException
     */
    public static function detectStrict(string $filePath, string $type = null): string
    {
        $type = static::detect($filePath, $type);

        if (!$type) {
            throw new NoTypeDetectedException();
        }

        return $type;
    }
}

Spamworldpro Mini