Showing 144 of 452 total issues
File Data.php
has 576 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Automatorm\Orm;
use Automatorm\Exception;
use Automatorm\Database\SqlString;
Function generate
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
public function generate()
{
$data = $this->connection->data;
$database = $this->connection->schemaName;
- 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 generate
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
public function generate()
{
$connection = $this->connection;
$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 filter
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function filter($filter, $invertAffix = false)
{
$copy = $this->container;
if (is_array($filter)) {
- 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 generateData
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function generateData($connection)
{
list($schema, $database) = $connection->getSchemaGenerator()->generate();
$currentTable = 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
Function format
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
{
switch (true) {
case $value instanceof Model:
$namespace = explode('\\', get_class($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
Data
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class Data
{
protected $data = []; // Data from columns on this table
protected $external = []; // Links to foreign key objects
Method generate
has 129 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate()
{
$connection = $this->connection;
$model = [];
Method format
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
{
switch (true) {
case $value instanceof Model:
$namespace = explode('\\', get_class($value));
QueryBuilder
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class QueryBuilder
{
const ENGINES = ['mysql', 'postgres', 'mssql'];
public static $engine = "mysql";
public static $requireWhereClause = true;
Function generate
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public static function generate($path, Schema $schema)
{
$namespace = $schema->namespace;
foreach ($schema->model as $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 commit
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function commit($mode, $table, $id, $data, $externalData, $schema) : int
{
if ($mode == 'delete') {
$this->data->delete($table, $id);
return $id;
- 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
Collection
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class Collection implements \ArrayAccess, \Iterator, \Countable, \JsonSerializable
{
// From Hodgepodge
protected $container = [];
Method generate
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate()
{
$data = $this->connection->data;
$database = $this->connection->schemaName;
File QueryBuilder.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Query Builder - build SQL queries programatically
*
* @package Automatorm\Database
Function __construct
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($column)
{
// Cowardly refuse to process SqlStrings
if ($column instanceof SqlString) {
$this->column = (string) $column;
- 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 dumpModel
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public static function dumpModel(Model $model)
{
$data_access = function ($var) {
return $this->$var;
};
- 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 dumpModel
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function dumpModel(Model $model)
{
$data_access = function ($var) {
return $this->$var;
};
Model
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Model implements \JsonSerializable
{
// Flags
const COUNT_ONLY = 1;
Function factoryObjectCache
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
final public static function factoryObjectCache($ids, $classOrTable = null, Schema $schema = null, $forceRefresh = false)
{
$schema = $schema ?: Schema::get(static::getNamespace());
list(,$table) = $schema->guessContext($classOrTable ?: get_called_class());
$namespace = $schema->namespace;
- 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"