hnhdigital-os/laravel-resources-loader

View on GitHub
src/Assets/TextDiff.php

Summary

Maintainability
A
45 mins
Test Coverage

Showing 3 of 3 total issues

The method __construct has a boolean flag argument $version, which is a certain sign of a Single Responsibility Principle violation.
Open

public function __construct($version = false)
Severity: Minor
Found in src/Assets/TextDiff.php by phpmd

The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

} else {
$version = Resource::version(class_basename(__CLASS__), $version);
Resource::add('https://cdnjs.cloudflare.com/ajax/libs/diff_match_patch/'.$version.'/diff_match_patch.js');
Resource::add('vendor/pretty-text-diff/jquery.pretty-text-diff.min.js');
}
Severity: Minor
Found in src/Assets/TextDiff.php by phpmd

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if (!env('APP_CDN', true)) {
Resource::add('vendor/text-diff-patch.min.js');
Resource::add('vendor/text-diff.min.js');
} else {
$version = Resource::version(class_basename(__CLASS__), $version);
Severity: Major
Found in src/Assets/TextDiff.php and 2 other locations - About 45 mins to fix
src/Assets/Dropzone.php on lines 12..19
src/Assets/Steps.php on lines 14..21
Category
Status