Function latest
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function latest($identifier, $constraint = '*', array $args = array()) {
$latest = array();
if (strpos($identifier, '-') === false) {
/** @var modRestResponse $response */
$response = $this->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
File modtransportprovider.class.php
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of MODX Revolution.
*
* Copyright (c) MODX, LLC. All Rights Reserved.
Method find
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find(array $search = array(), array $args = array()) {
$results = array();
$where = array_merge(
array(
Method latest
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function latest($identifier, $constraint = '*', array $args = array()) {
$latest = array();
if (strpos($identifier, '-') === false) {
/** @var modRestResponse $response */
$response = $this->request(
Function transfer
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function transfer($signature, $target = null, array $args = array()) {
$result = false;
$metadata = $this->info($signature);
if (!empty($metadata)) {
/** @var modTransportPackage $package */
- 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 stats
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stats(array $args = array()) {
$stats = array(
'packages' => 0,
'downloads' => 0,
'topdownloaded' => array(),
Method transfer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transfer($signature, $target = null, array $args = array()) {
$result = false;
$metadata = $this->info($signature);
if (!empty($metadata)) {
/** @var modTransportPackage $package */
Function stats
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function stats(array $args = array()) {
$stats = array(
'packages' => 0,
'downloads' => 0,
'topdownloaded' => array(),
- 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 info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function info($identifier, array $args = array()) {
$info = array();
if (strpos($identifier, '-') > 0) {
$response = $this->request('package', 'GET', array('signature' => $identifier));
if ($response) {
- 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 downloadUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function downloadUrl($signature, $location, array $args = array()) {
$url = false;
/** @var modRestClient $rest */
$rest = $this->xpdo->getService('rest','rest.modRestClient');
if ($rest) {
- 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"