Showing 1,011 of 9,214 total issues
Function makePermaLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function makePermaLink($entity = false) {
if (!$entity) {
return false;
}
- 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 fetch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function fetch() {
if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
throw new Exception("Cannot load loco object - loco ID not provided");
return false;
}
- 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 getRedis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getRedis($reload = false) {
if (!extension_loaded("redis") || (defined("NOREDIS") && NOREDIS == true)) {
return new NullCacheDriver;
}
- 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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function validate() {
if (empty($this->name)) {
throw new Exception("Locomotive class name cannot be empty");
}
- 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 getLogger
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getLogger() {
$Registry = Registry::getInstance();
$Config = self::getConfig();
- 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 getEventsForDates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getEventsForDates($dateFrom = null, $dateTo = null) {
$events = array();
$Railcams = new Module_Railcams;
- 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 getAllowedForumsIDsForUser
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getAllowedForumsIDsForUser(User $User, $permission = self::AUTH_ALL) {
$acl = $this->setUser($User)->getACL();
$ids = array();
$allforums = $this->getAllForums();
- 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 tagLoco
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function tagLoco(Locomotive $Loco) {
if (!filter_var($Loco->id, FILTER_VALIDATE_INT)) {
throw new Exception("An invalid instance of Railpage\\Locos\\Locomotive was supplied");
}
- 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 addDividers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function addDividers() {
$links = $this->getParam("links");
end($links);
- 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 updateUserThreadView
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function updateUserThreadView(Thread $Thread, $User = false) {
// Prevent browser prefetch/preview from creating a timestamp
if (
(isset($_SERVER["HTTP_X_PURPOSE"]) && (strtolower($_SERVER["HTTP_X_PURPOSE"]) == "preview")) ||
- 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 formatDepartures
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function formatDepartures($departures) {
$return = array();
if (isset($departures['values'])) {
foreach ($departures['values'] as $row) {
- 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
The method NominateImage() has an NPath complexity of 1040. The configured NPath complexity threshold is 200. Open
public function NominateImage(Image $imageObject, DateTime $dateWeek, User $userObject) {
$query = "SELECT id FROM image_weekly WHERE datefrom = ?";
if ($this->db->fetchOne($query, $dateWeek->format("Y-m-d"))) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method generate() has an NPath complexity of 6147. The configured NPath complexity threshold is 200. Open
public function generate() {
$string = '';
global $handheld;
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method process() has an NPath complexity of 2304. The configured NPath complexity threshold is 200. Open
private function process(array $item) {
/**
* Process the description field
*/
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method addTiming() has an NPath complexity of 576. The configured NPath complexity threshold is 200. Open
public function addTiming($day = false, $time = false, $going = "arr", $commencing = false, $expiring = false) {
if (!$this->Point instanceof Point) {
throw new Exception("Cannot add a timing because no valid timetable point has been set");
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method load() has an NPath complexity of 720. The configured NPath complexity threshold is 200. Open
private function load() {
$this->mckey = sprintf("railpage:locations.location=%d", $this->id);
if (!$row = $this->Memcached->fetch($this->mckey)) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method geocode() has 104 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private function geocode() {
if (!empty($this->region) && !empty($this->country) && !empty($this->locality)) {
#return;
}
- Exclude checks
The method fetch() has an NPath complexity of 3456. The configured NPath complexity threshold is 200. Open
public function fetch() {
if (empty($this->id)) {
throw new Exception("Cannot fetch download object - no download ID given");
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getPhotosForSite() has 105 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function getPhotosForSite($num = 10, $start = 0) {
$Place = new Place($this->lat, $this->lon);
return $Place->getPhotosFromSphinx($num);
- Exclude checks
The method find() has 114 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function find() {
$args = func_get_args();
$Loco = false;
$LocoClass = false;
- Exclude checks