Showing 864 of 1,073 total issues
Function addCastAttributesToArray
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes)
{
foreach ($this->getCasts() as $key => $value) {
if (! array_key_exists($key, $attributes) ||
in_array($key, $mutatedAttributes)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function resolveDumpSource
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function resolveDumpSource()
{
if (static::$dumpSourceResolver === false) {
return null;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File Mailer.php
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Illuminate\Mail;
use Closure;
Method handle
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
if (! is_dir($stubsPath = $this->laravel->basePath('stubs'))) {
(new Filesystem)->makeDirectory($stubsPath);
}
File FormatsMessages.php
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Illuminate\Validation\Concerns;
use Closure;
Method paginateUsingCursor
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function paginateUsingCursor($perPage, $columns = ['*'], $cursorName = 'cursor', $cursor = null)
{
if (! $cursor instanceof Cursor) {
$cursor = is_string($cursor)
? Cursor::fromEncoded($cursor)
File InteractsWithInput.php
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Illuminate\Http\Concerns;
use Illuminate\Http\UploadedFile;
Component
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Component
{
/**
* The properties / methods that should not be exposed to the component.
*
DatabaseManager
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class DatabaseManager implements ConnectionResolverInterface
{
use Macroable {
__call as macroCall;
}
BelongsTo
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class BelongsTo extends Relation
{
use ComparesRelatedModels,
InteractsWithDictionary,
SupportsDefaultModels;
Consider simplifying this complex logical expression. Open
if (($this->option('name') && ! Str::contains((string) $route['name'], $this->option('name'))) ||
($this->option('path') && ! Str::contains($route['uri'], $this->option('path'))) ||
($this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) ||
($this->option('domain') && ! Str::contains((string) $route['domain'], $this->option('domain'))) ||
($this->option('except-vendor') && $route['vendor']) ||
FilesystemManager
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class FilesystemManager implements FactoryContract
{
/**
* The application instance.
*
Function handle
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function handle($request, Closure $next)
{
if ($this->inExceptArray($request)) {
return $next($request);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method displayForCli
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function displayForCli(array $data)
{
$platform = $data['platform'];
$tables = $data['tables'];
$views = $data['views'] ?? null;
Method causedByLostConnection
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function causedByLostConnection(Throwable $e)
{
$message = $e->getMessage();
return Str::contains($message, [
Method withoutVite
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function withoutVite()
{
if ($this->originalVite == null) {
$this->originalVite = app(Vite::class);
}
File DocsCommand.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Illuminate\Foundation\Console;
use Carbon\CarbonInterval;
File MailFake.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Illuminate\Support\Testing\Fakes;
use Closure;
MorphTo
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class MorphTo extends BelongsTo
{
use InteractsWithDictionary;
/**
Grammar
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Grammar extends BaseGrammar
{
use CompilesJsonPaths;
/**