Showing 708 of 9,214 total issues
Function fetch
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function fetch($id = false) {
if ($id) {
$this->id = $id;
}
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
private function fetch($recurse) {
if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
$this->id = Utility\LocomotiveUtility::getClassId($this->id);
}
- 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 send
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function send($markAsSent = false) {
$this->validate();
$Smarty = AppCore::getSmarty();
- 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 getReadItemsForUser
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function getReadItemsForUser(User $User, $type = "t") {
/**
* Not logged in - no threads/forums
*/
- 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 makeJSON
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeJSON() {
if ($this->date instanceof DateTime) {
$timezone = $this->date->getTimezone();
} else {
Image
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Image extends AppCore {
/**
* Max age of data before it requires refreshing
*/
Method getPhotos
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPhotos($num = 10) {
$lat = $this->lat;
$lon = $this->lon;
$query = "SELECT flickr_geodata.*, 3956 * 2 * ASIN(SQRT(POWER(SIN((" . $lat . " - flickr_geodata.lat) * pi() / 180 / 2), 2) + COS(" . $lat . " * pi() / 180) * COS(" . $lat . " * pi() / 180) * POWER(SIN((" . $lon . " - flickr_geodata.lon) * pi() / 180 / 2), 2))) AS distance
File Idea.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Suggestions for side ideas and improvements, ala Wordpress.org/ideas
* @since Version 3.8.7
Method banUser
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function banUser($userId = null, $reason = null, $expiry = "0", $adminUserId = null) {
if (!filter_var($userId, FILTER_VALIDATE_INT)) {
throw new InvalidArgumentException("No user ID supplied");
}
Method latest
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function latest($number = 5, $offset = 0) {
$return = false;
$mckey = "railpage:news.latest.count=" . $number .".offset=" . $offset;
$mcexp = strtotime("+5 minutes"); // Store for five minutes
Method latestPosts
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function latestPosts($is_auth_ary, $since, $limit = 10) {
if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
return false;
}
Function getWeatherForecast
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getWeatherForecast($days = 14) {
return false;
$weather = 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 NominateImage
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. 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
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 recent
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function recent($activeOnly = null) {
$Database = (new AppCore)->getDatabaseConnection();
$query = "SELECT b.id, b.user_id, un.username AS username, b.ban_active, b.ban_time, b.ban_expire, b.ban_reason, b.banned_by, u.username AS banned_by_username
- 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 getPhotoContext
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
$Database = (new AppCore)->getDatabaseConnection();
if ($unapprovedOnly == false || $unapprovedOnly == 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
Function updateAuthors
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function updateAuthors() {
$userlookup = array();
$Database = (new AppCore)->getDatabaseConnection();
- 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 getDeleted
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getDeleted($user_id = false) {
if (!$user_id) {
throw new Exception("Cannot fetch deleted message IDs - no user ID given");
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 findArticles
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function findArticles($offset = 0, $limit = 25, $orderby = "story_time_unix") {
if (empty($this->filter_topics) || empty($this->filter_words)) {
$this->getFilters();
}
- 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 Add
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function Add($title = null, $url = null, $grouping = null, $meta = null) {
if (empty(filter_var($title, FILTER_SANITIZE_STRING))) {
throw new InvalidArgumentException("Cannot add item to menu - no title 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
Function setPushSubscription
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function setPushSubscription(User $User, $subscription, $enabled = null) {
$endpoint = false;
$registration_id = false;
$provider = 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"