src/Providers/FoundationServiceProvider.php
Method boot
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function boot(): void
{
// Fix the specified key was too long error
Schema::defaultStringLength(191);
- Create a ticketCreate a ticket
Method bindBlueprintMacro
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function bindBlueprintMacro(): void
{
Blueprint::macro('auditable', function () {
$this->integer('created_by_id')->unsigned()->after('created_at')->nullable();
$this->string('created_by_type')->after('created_at')->nullable();
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return false;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return in_array($name, $parameterNames);
- Create a ticketCreate a ticket
The class FoundationServiceProvider has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13. Open
Open
class FoundationServiceProvider extends ServiceProvider
{
use ConsoleTools;
/**
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '98', column '24'). Open
Open
return new \Cortex\Foundation\Overrides\Illuminate\Session\DatabaseSessionHandler(
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid assigning values to variables in if clauses and the like (line '130', column '17'). Open
Open
public function boot(): void
{
// Fix the specified key was too long error
Schema::defaultStringLength(191);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}