Showing 20 of 29 total issues
File Bread.php
has 504 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace BoldBrush\Bread;
Bread
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class Bread
{
/** @var string|Model $model */
protected $model = null;
Field
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class Field implements FieldInterface
{
protected $name;
protected $editable = true;
Method search
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function search(?array $sortBy)
{
$fields = $this->getFields()
->for(FieldContainer::BROWSE)
->toArray();
Function search
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function search(?array $sortBy)
{
$fields = $this->getFields()
->for(FieldContainer::BROWSE)
->toArray();
- 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 boot
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot()
{
$this->loadViewsFrom(
realpath(dirname(dirname(__DIR__))) . '/resources/views',
'bread'
Method toDBAL
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function toDBAL(array $config): array
{
switch (true) {
case $config['driver'] === 'sqlite':
return [
Method save
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save(?int $id = null, ?array $data = [])
{
$this->checkIfModelHasBeenSetup();
$model = $this->model;
Method browse
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function browse(): string
{
$this->checkIfModelHasBeenSetup();
$model = $this->model;
Function browse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function browse(): string
{
$this->checkIfModelHasBeenSetup();
$model = $this->model;
- 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 save
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function save(?int $id = null, ?array $data = [])
{
$this->checkIfModelHasBeenSetup();
$model = $this->model;
- 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 create
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(?array $data = [])
{
$this->checkIfModelHasBeenSetup();
$model = $this->model;
Function init
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function init(): void
{
if (is_array($this->config)) {
foreach ($this->config as $method => $value) {
try {
- 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 setupFields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setupFields(string $for = FieldContainer::GENERAL): self
{
$sm = $this->getConnectionConfigForModel()
->createSchemaManager();
Function setupFields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function setupFields(string $for = FieldContainer::GENERAL): self
{
$sm = $this->getConnectionConfigForModel()
->createSchemaManager();
- 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 getColumns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getColumns()
{
if ($this->count() === 0) {
return [];
}
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
array $general = [],
array $browse = [],
array $read = [],
array $edit = [],
array $add = []
Function create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function create(?array $data = [])
{
$this->checkIfModelHasBeenSetup();
$model = $this->model;
- 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 resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function resolve(): bool
{
foreach ($this->data as $name => $data) {
$field = $this->bread->configureFields()->field($name);
foreach ($data as $method => $value) {
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(?array $routes = null, ?string $pkColumn = null)
{
if (isset($routes['browse'])) {
$this->setBrowseRoute($routes['browse']);
}
- 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"