efureev/laravel-files

View on GitHub

Showing 9 of 14 total issues

Method up has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function up(): void
{
Schema::create(config('files.table.name'), function (Blueprint $table): void {
$typeId = config('files.table.id');
 
 
Severity: Minor
Found in database/migrations/2018_12_24_1339_create_files_table.php - About 1 hr to fix

    Function beforeUploadFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    private function beforeUploadFile(UploadedFile $file): UploadedFile
    {
    if (!$this->beforeUploadActions || !is_array($this->beforeUploadActions)) {
    return $file;
    }
    Severity: Minor
    Found in src/Services/UploadService.php - About 1 hr to fix

    Function mimeIs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    public static function mimeIs(string $mimeExist, string $mimeAsk): bool
    {
    if (empty($mimeExist) || empty($mimeAsk)) {
    return false;
    }
    Severity: Minor
    Found in src/Support/Types.php - About 1 hr to fix

    Function afterUploadFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    private function afterUploadFile(BaseFile $baseFile)
    {
    if (!$this->afterUploadActions || !is_array($this->afterUploadActions)) {
    return $baseFile;
    }
    Severity: Minor
    Found in src/Services/UploadService.php - About 1 hr to fix

    Function handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    public function handle($model, ... $options)
    {
    if ($this->width !== null && $this->height !== null) {
    if ($this->bestFit) {
    $model->getImageProcessor()->resizeToBestFit($this->width, $this->height, ...$options);
    Severity: Minor
    Found in src/Entities/Modificators/ResizeModificator.php - About 45 mins to fix

    Function up has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    public function up(): void
    {
    Schema::create(config('files.table.name'), function (Blueprint $table): void {
    $typeId = config('files.table.id');
     
     
    Severity: Minor
    Found in database/migrations/2018_12_24_1339_create_files_table.php - About 35 mins to fix

    Avoid too many return statements within this method.
    Open

    return File::class;
    Severity: Major
    Found in src/Traits/FileTypes.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

      return $formatExist === $formatAsk;
      Severity: Major
      Found in src/Support/Types.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

        return true;
        Severity: Major
        Found in src/Support/Types.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language