railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Function __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        public function __construct($category_id = false, $recurse = true) {
            parent::__construct(); 
            
            if (filter_var($category_id, FILTER_VALIDATE_INT)) {
                $this->id = $category_id;
Severity: Minor
Found in lib/Links/Category.php - About 1 hr to fix

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 fetchOld has a Cognitive Complexity of 11 (exceeds 5 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");
        }
Severity: Minor
Found in lib/Jobs/Scraper.php - About 1 hr to fix

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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function fetch() {
        if (empty($this->id)) {
            throw new Exception("Cannot fetch download object - no download ID given"); 
        }
        
Severity: Minor
Found in lib/Downloads/Download.php - About 1 hr to fix

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 unBanUser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function unBanUser($banId, $userId = null) {
        $success = false;
        
        /**
         * Empty the cache
Severity: Minor
Found in lib/BanControl/BanControl.php - About 1 hr to fix

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 available_themes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function available_themes() {
        $theme_dir = dirname(__DIR__) . DS . "themes";
        
        $themes = array(); 
        
Severity: Minor
Found in lib/Template.php - About 1 hr to fix

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 CreateCamera has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function CreateCamera($id) {
        
        $Database = AppCore::GetDatabase(); 
        $Memcached = AppCore::GetMemcached(); 
        $Redis = AppCore::getRedis();
Severity: Minor
Found in lib/Images/ImageFactory.php - About 1 hr to fix

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

    private function validate() {
        
        if (!$this->Date instanceof DateTime && empty($this->Date)) {
            $this->Date = new DateTime;
        }
Severity: Minor
Found in lib/Feedback/FeedbackItem.php - About 1 hr to fix

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 generateSrcSet has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function generateSrcSet(Image $imageObject) {
        
        $sources = array(); 
        $widths = array(); 
        
Severity: Minor
Found in lib/Images/Utility/ImageUtility.php - About 1 hr to fix

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

        private function validate() {
            
            if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
                throw new Exception("Cannot validate location - no latitude value"); 
            }
Severity: Minor
Found in lib/Locations/Location.php - About 1 hr to fix

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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        public function __construct($code) {

            parent::__construct();

            $this->code = $code;
Severity: Minor
Found in lib/Locations/Country.php - About 1 hr to fix

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 getUnread has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        public function getUnread() {
            if (!$this->User->id) {
                throw new Exception("Cannot fetch unread PMs - not a registered user");
                return false;
            }
Severity: Minor
Found in lib/PrivateMessages/PrivateMessages.php - About 1 hr to fix

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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($postid = false) {
        $post_timer_start = Debug::GetTimer(); 
        
        parent::__construct();
        
Severity: Minor
Found in lib/Forums/Post.php - About 1 hr to fix

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

    private function validate() {
        if (empty($this->name)) {
            throw new Exception("Name cannot be empty");
        }
        
Severity: Minor
Found in lib/Locos/Gauge.php - About 1 hr to fix

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 get_permission has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_permission($permission_name = false, $permissions_object = false) {
        if ($permissions_object) {
            $this->permissions = $permissions_object;
        }
        
Severity: Minor
Found in lib/Forums/Forum.php - About 1 hr to fix

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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct() {
        parent::__construct();
        
        foreach (func_get_args() as $arg) {
            if (filter_var($arg, FILTER_VALIDATE_INT) || is_array($arg)) {
Severity: Minor
Found in lib/Forums/Stats.php - About 1 hr to fix

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 getPhoto has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getPhoto($image) {
        
        if (is_array($image) && !isset($image['status'])) {
            $query = "SELECT * FROM image_competition_submissions WHERE competition_id = ? AND image_id = ? ORDER BY date_added DESC";
            $params = array(
Severity: Minor
Found in lib/Images/Competition.php - About 1 hr to fix

    Method getFilteredForums has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getFilteredForums() {
            
            $timer = Debug::GetTimer(); 
            
            if (!isset($this->User->Guest) || !$this->User->Guest instanceof User) {
    Severity: Minor
    Found in lib/Users/Timeline.php - About 1 hr to fix

      Method setUserFavourite has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setUserFavourite() {
              
              /**
               * Because I'll no doubt get confused - frequently - at the order of parameters, 
               * let's just be a sneaky bastard and check each parameter
      Severity: Minor
      Found in lib/Images/Favourites.php - About 1 hr to fix

        Method sendNotification has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function sendNotification(Competition $photoComp, $notificationOptions) {
                
                if (count((new Competitions)->getPreviousContestants()) == 0) {
                    return false;
                }
        Severity: Minor
        Found in lib/Images/Utility/CompetitionUtility.php - About 1 hr to fix

          Method getLeagueTable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getLeagueTable() {
                  /**
                   SELECT 
                      s.user_id, u.username, c.title AS comp_title, c.id AS comp_id, c.slug AS comp_slug, 
                      s.image_id, i.meta AS image_meta,
          Severity: Minor
          Found in lib/Images/Competitions.php - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language