Showing 708 of 9,214 total issues
Method makePermalink
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makePermalink($id = false) {
$mckey = $id ? "railpage:locations.permalink.id=" . $id : "railpage:locations.permalink.id=" . $this->id;
$timer = Debug::GetTimer();
Method getArray
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getArray() {
$array = array(
"id" => $this->id,
"lat" => $this->lat,
Method getPending
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPending() {
#$query = "SELECT s.*, t.topicname, t.topicimage, t.topictext, u.username FROM nuke_stories AS s, nuke_topics AS t, nuke_users AS u WHERE s.user_id = u.user_id AND s.topic = t.topicid";
$query = "SELECT s.*, t.topicname, t.topictext, u.username, 'newqueue' AS queue
FROM nuke_stories AS s
Method CreateLocation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function CreateLocation($id) {
$Memcached = AppCore::getMemcached();
$Redis = AppCore::getRedis();
$Registry = Registry::getInstance();
Method setRating
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setRating($userId = false, $rating = false) {
if (!$userId instanceof User && !filter_var($userId, FILTER_VALIDATE_INT)) {
throw new Exception("Cannot set user rating for this loco - no user given");
}
Method commit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function commit() {
$this->validate();
$data = array(
"forum_id" => $this->forum->id,
Method populate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function populate($id) {
$row = $this->load($id);
if (!isset($row) || !is_array($row)) {
Method fetch
has 26 lines of code (exceeds 25 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;
}
Method validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function validate() {
if (empty($this->name)) {
throw new Exception("Name cannot be empty");
}
Method CreateEvent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function CreateEvent($id = null) {
$CacheDriver = AppCore::getRedis();
$Registry = Registry::getInstance();
Method reloadOrganisations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function reloadOrganisations($type) {
if (substr($type, -1) !== "s") {
$type .= "s";
}
Method getCenterFromDegrees
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getCenterFromDegrees($data) {
if (!is_array($data)) return FALSE;
$num_coords = count($data);
Method send
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send($action= "message", $data = null, $address = "socket.io/?EIO=2", $transport = 'websocket') {
$fd = fsockopen($this->hostname, $this->port, $errno, $errstr);
if (!$fd) {
Function makePermaLink
has a Cognitive Complexity of 9 (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 onlineUsers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function onlineUsers() {
$mckey = "railpage:onlineusers";
if ($return = $this->Memcached->fetch($mckey)) {
foreach ($return as $id => $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
Function findWithAttribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function findWithAttribute($attribute = null, $value = null) {
if ($attribute == null) {
throw new Exception("Cannot filter groups by attribute - no attribute 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 generateTitle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function generateTitle($row) {
self::$row = $row;
switch (self::$row['key']) {
- 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 canUserVote
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function canUserVote(User $userObject, $imageObject = null) {
if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
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 banUser
has a Cognitive Complexity of 9 (exceeds 5 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");
}
- 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 addTiming
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. 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
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"