Showing 708 of 9,214 total issues
Function StopsNearLocation
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function StopsNearLocation($latitude = null, $longitude = null) {
if ($latitude == null) {
throw new Exception("Cannot fetch " . __METHOD__ . " - no latitude given");
}
- 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 Template.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Templating engine
* Simple wrapper for Smarty, in this case allowing for subthemes (eg handheld, kiosk, etc)
Method fetchOld
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetchOld() {
if (!is_string($this->feed)) {
throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
}
Method load
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function load($option = null) {
Debug::RecordInstance();
$this->mckey = sprintf("railpage:image=%d", $this->id);
Method getImage
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getImage($id, $force = 0) {
$params = array(
"ImageKey" => $id
);
Method LatLonWoELookup
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function LatLonWoELookup($lat, $lon, $force = false) {
if (is_null($lon) && strpos($lat, ",") !== false) {
$tmp = explode(",", $lat);
$lat = $tmp[0];
Method __construct
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($postid = false) {
$post_timer_start = Debug::GetTimer();
parent::__construct();
Method load
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load() {
$photodata = $this->Provider->getPhoto($this->id);
$this->title = $photodata['title'];
$this->description = $photodata['description'];
File MultimediaUtility.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Multimedia formatter
* @since Version 3.10.0
Method getTimeline
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTimeline() {
$query = "SELECT d.*, lu.loco_num, ld.loco_date_text FROM loco_unit_date AS d INNER JOIN loco_date_type AS ld ON ld.loco_date_id = d.loco_date_id INNER JOIN loco_unit AS lu ON lu.loco_id = d.loco_unit_id WHERE lu.class_id = ? ORDER BY timestamp ASC";
$return = array(
"timeline" => array(
Method tagLoco
has 59 lines of code (exceeds 25 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");
}
Thread
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Thread extends Forums {
/**
* Thread ID
* @since Version 3.0.1
Method createSlug
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSlug($story_id = false) {
if (RP_DEBUG) {
global $site_debug;
$debug_timer_start = microtime(true);
}
Method commit
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function commit() {
$this->validate();
$timer = Debug::getTimer();
Method newPosts
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function newPosts($forums = false, $from_time = false, $items_per_page = 25, $start = 0) {
if (!$forums || !is_array($forums)) {
throw new \Exception("You must provide a list of forums this user has permission to view");
return false;
}
Method validatePassword
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validatePassword($password = false, $username = false) {
Utility\PasswordUtility::validateParameters($password, $username, $this);
/**
Method unBanUser
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function unBanUser($banId, $userId = null) {
$success = false;
/**
* Empty the cache
Function getAddress
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getAddress() {
$mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
if ($address = $this->Memcached->fetch($mckey)) {
- 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 getStylesheets
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getStylesheets() {
$tags = array();
$minify = 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 autoPopulateNextComp
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function autoPopulateNextComp() {
$month = new DateTime("first day of next month");
$title = $month->format("F Y");
- 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"