Showing 7,873 of 7,873 total issues
Avoid deeply nested control flow statements. Open
if ($this->getDebug() === true) {
$this->log(xPDO::LOG_LEVEL_DEBUG, "Removing all cache objects of class {$gClass}: " . ($removed ? 'successful' : 'failed'));
}
Avoid deeply nested control flow statements. Open
if (isset ($v['index']) && isset ($v['phptype']) && $v['index'] == 'pk') {
$pk[$k]= $k;
}
Avoid deeply nested control flow statements. Open
if (empty($sigClass) || $sigClass !== $class) {
$sigClass= $class;
}
Method generateObject
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function generateObject($obj, $objName, $generateObjVars= false, $generateRelated= false, $objRef= 'this->xpdo', $format= xPDOCacheManager::CACHE_PHP) {
Avoid deeply nested control flow statements. Open
if ($payload !== false) {
$payload = $this->xpdo->fromJSON($payload);
if (is_array($payload) && isset($payload['expires']) && (empty($payload['expires']) || time() < $payload['expires'])) {
if (array_key_exists('content', $payload)) {
$value= $payload['content'];
Avoid deeply nested control flow statements. Open
if (!filesize($cacheKey)) {
$value= false;
break;
}
Avoid deeply nested control flow statements. Open
while (!is_callable($loader) && $loaderClass = next($callbacks)) {
$loader = array($loaderClass, $method);
}
Avoid deeply nested control flow statements. Open
if (isset ($this->map[$ancestorClassName]['fieldMeta'][$k]['phptype'])) {
if (isset ($v['primary']) && $v['primary'] == true) {
$pk[$k]= $k;
}
}
Function __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(& $xpdo, $options = array()) {
parent :: __construct($xpdo, $options);
if (class_exists('Memcached', true)) {
$this->memcached = new Memcached();
if ($this->memcached) {
- 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
Avoid deeply nested control flow statements. Open
if ($ts !== false && !empty($value)) {
if (is_string($format) && !empty ($format)) {
if (strpos($format, 're:') === 0) {
$value= date('Y-m-d H:i:s', $ts);
if (!empty ($formatTemplate) && is_string($formatTemplate)) {
Avoid deeply nested control flow statements. Open
if (is_string($value) && strlen($value) > 1) {
$value= $this->xpdo->fromJSON($value, true);
}
Function getTransport
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getTransport() {
if ($this->transport === null || !$this->transport instanceof xPDOTransport) {
if (!isset($this->xpdo->config['xPDOTransport.class']) || !$transportClass= $this->xpdo->loadClass($this->xpdo->config['xPDOTransport.class'], '', false, true)) {
$transportClass= $this->xpdo->loadClass('transport.xPDOTransport', XPDO_CORE_PATH, true, true);
}
- 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
Avoid deeply nested control flow statements. Open
if (is_string($format) && !empty ($format)) {
if (strpos($format, 're:') === 0) {
if (!empty ($formatTemplate) && is_string($formatTemplate)) {
$value= preg_replace(substr($format, 3), $formatTemplate, $value);
}
Function createSourceContainer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function createSourceContainer($dsnArray = null, $username= null, $password= null, $containerOptions= array ()) {
$created = false;
if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
$this->xpdo->log(xPDO::LOG_LEVEL_WARN, 'SQLite does not support source container creation');
if ($dsnArray === null) $dsnArray = xPDO::parseDSN($this->xpdo->getOption('dsn'));
- 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
Avoid deeply nested control flow statements. Open
if ($cardinality == 'many') {
$newPk= $obj->getPrimaryKey();
if (is_array($newPk)) $newPk= implode('-', $newPk);
if ($pk != $newPk) {
$this->_relatedObjects[$alias][$newPk]= $obj;
Method leftJoin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function leftJoin($class, $alias= '', $conditions= array (), $conjunction= xPDOQuery::SQL_AND, $binding= null, $condGroup= 0) {
Avoid deeply nested control flow statements. Open
if (!empty($localCriteria)) {
$conditions = array($localCriteria, $conditions);
}
Method innerJoin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function innerJoin($class, $alias= '', $conditions= array (), $conjunction= xPDOQuery::SQL_AND, $binding= null, $condGroup= 0) {
Method rightJoin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function rightJoin($class, $alias= '', $conditions= array (), $conjunction= xPDOQuery::SQL_AND, $binding= null, $condGroup= 0) {
Avoid deeply nested control flow statements. Open
if (is_array($fkMeta['criteria']['local'])) {
foreach ($fkMeta['criteria']['local'] as $critKey => $critVal) {
if (is_numeric($critKey)) {
$localCriteria[] = $critVal;
} else {