Showing 21 of 106 total issues
File SQL.php
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This is Spoof.
* Copyright (C) 2011-2017 Spoof project.
Method __construct
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($value, $type = null)
{
// validate type and value
if (is_null($type)) {
$type = $this->determineType($value);
Function __construct
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($value, $type = null)
{
// validate type and value
if (is_null($type)) {
$type = $this->determineType($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 getConditionOperator
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getConditionOperator(IDriver $driver, ICondition $condition)
{
switch ($condition->operator) {
case Condition::OPERATOR_EQUALS:
if ($condition->value2->getType() == Value::TYPE_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
Method getConditionOperator
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConditionOperator(IDriver $driver, ICondition $condition)
{
switch ($condition->operator) {
case Condition::OPERATOR_EQUALS:
if ($condition->value2->getType() == Value::TYPE_NULL) {
Method getValue
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getValue(IDriver $driver, IValue $value)
{
$query = new Query();
switch ($value->getType()) {
case Value::TYPE_PREPARED:
Method handleRequest
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleRequest(api\Request $request)
{
$response = new api\Response();
try {
// map request to class and method
Method getJoin
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getJoin(IDriver $driver, IJoin $join)
{
$query = new Query();
$query->setString($driver->tableQuoteStart . $join->tableBase . $driver->tableQuoteEnd);
foreach ($join->tableJoin as $i => $table) {
Function bindValues
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function bindValues(\PDOStatement $sth, array $values = null)
{
if (!is_null($values)) {
foreach ($values as $key => $value) {
$type = \PDO::PARAM_STR;
- 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 getCondition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getCondition(array $conditions) {
$conditionGroup = null;
if (count($conditions) == 1) {
foreach ($conditions as $column => $value) {
$conditionGroup = new Condition(
- 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 sendResponse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendResponse(api\Response $response)
{
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ?
$_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
$body = null;
Function get
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function get($type, $name)
{
if (isset(self::$objects[$type]) && isset(self::$objects[$type][$name])) {
$object = self::$objects[$type][$name];
} else {
- 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 getValue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getValue(IDriver $driver, IValue $value)
{
$query = new Query();
switch ($value->getType()) {
case Value::TYPE_PREPARED:
- 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 getSelectFromView
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getSelectFromView(IDriver $driver, IView $storage)
{
$query = new Query();
$i = 0;
foreach ($storage->joins as $key => $join) {
- 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
$dsn,
$username = null,
$password = null,
array $options = null,
$driver = null
Function __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function __construct()
{
if (!isset(static::$table)) {
// Set table instance to class
$this->setTable();
- 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 getJoin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getJoin(IDriver $driver, IJoin $join)
{
$query = new Query();
$query->setString($driver->tableQuoteStart . $join->tableBase . $driver->tableQuoteEnd);
foreach ($join->tableJoin as $i => $table) {
- 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 determineType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function determineType($value) {
$type = null;
if (is_array($value)) {
$type = self::TYPE_ARRAY;
} elseif (is_bool($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 handleRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function handleRequest(api\Request $request)
{
$response = new api\Response();
try {
// map request to class and method
- 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 getRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getRequest()
{
$request = new api\Request();
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
$request->parts = explode('/', $_SERVER['REQUEST_URI']);
- 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"