Showing 708 of 9,214 total issues
Method getUnreviewedImages
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getUnreviewedImages($page = 1, $itemsPerPage = 25) {
if (!$this->User instanceof User) {
throw new Exception("Cannot find unreviewed images - no user has been set");
}
Method loadFromCache
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function loadFromCache() {
$mckey = sprintf("railpage:locations.country=%s", strtoupper($this->code));
#printArray($mckey);die;
Method mostReadThisWeek
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function mostReadThisWeek($limit = 5) {
$return = false;
$params = array();
Method Add
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
}
Method guessTopic
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static public function guessTopic($topic) {
/**
* Normalise the topic name
*/
Method photos
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function photos($items_per_page, $page, $extras, $sort = true) {
$url = "https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=" . RP_FLICKR_API_KEY . "&user_id=" . $this->nsid . "&extras=" . $extras . "&per_page=" . $items_per_page . "&page=" . $page . "&format=json&nojsoncallback=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
Method populate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function populate() {
$query = "SELECT organisation_id, conversions, job_added, reference_id, job_urls, job_location_id, job_classification_id, job_thread_id, job_title, job_description, job_expiry, DATEDIFF(job_expiry, NOW()) AS job_expiry_until, job_salary, job_special_cond, job_duration FROM jn_jobs WHERE job_id = ?";
if (!$result = $this->Memcached->fetch($this->mckey)) {
$result = $this->db->fetchRow($query, $this->id);
Method getImageFromUrl
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getImageFromUrl($url = null, $option = null) {
/**
* Flickr
*/
Method load
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function load() {
$query = "SELECT * FROM image_competition WHERE id = ?";
$row = $this->db->fetchRow($query, $this->id);
Method commit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function commit() {
$this->validate();
$data = array(
Method banIP
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function banIP($ipAddress = null, $reason = null, $expiry = "0", $adminUserId = null) {
if (is_null($ipAddress)) {
throw new InvalidArgumentException("No IP address supplied");
}
Method validate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function validate() {
if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
throw new Exception("Cannot validate location - no latitude value");
}
Method fetch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function fetch() {
if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
throw new Exception("Cannot fetch PM - no message ID provided");
}
Method fetch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function fetch() {
$user_ids = array_keys($this->users);
// If only one user account found, we must've sent ourselves a PM...
if (count($user_ids) === 1) {
Method getSite
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getSite($id = false, $pending = false) {
if (!$this->db) {
return false;
}
Method getRecipients
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getRecipients() {
$query = "SELECT * FROM notifications_recipients WHERE notification_id = ?";
$recipients = array();
Method validate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function validate() {
if ($this->class instanceof LocoClass && !$this->Class instanceof LocoClass) {
$this->Class = &$this->class;
}
Method fetch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function fetch() {
if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
throw new Exception("Cannot fetch Livery object - no ID given");
return false;
}
Function memberList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function memberList($page = 1, $items_per_page = 25) {
$start = $page > 0 ? ($page - 1) * $items_per_page : 0;
$return = 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 validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function validate() {
if (!is_object($this->Organisation) || empty($this->Organisation->id)) {
throw new Exception("Cannot save job - organisation is empty or invalid");
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"