spotweb/spotweb

View on GitHub
lib/SpotNotifications.php

Summary

Maintainability
C
1 day
Test Coverage

Function sendMessages has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendMessages($userId)
    {
        $userDao = $this->_daoFactory->getUserDao();
        $notificationDao = $this->_daoFactory->getNotificationDao();

Severity: Minor
Found in lib/SpotNotifications.php - About 3 hrs 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 sendMessages has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sendMessages($userId)
    {
        $userDao = $this->_daoFactory->getUserDao();
        $notificationDao = $this->_daoFactory->getNotificationDao();

Severity: Minor
Found in lib/SpotNotifications.php - About 1 hr to fix

    Function newSingleMessage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function newSingleMessage($user, $objectId, $type, $notification)
        {
            // Because it's not certain which user we are at this point.
            // we once again request the user records.
            $userDao = $this->_daoFactory->getUserDao();
    Severity: Minor
    Found in lib/SpotNotifications.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 register has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function register()
        {
            if ($this->_spotSec->allowed(SpotSecurity::spotsec_send_notifications_services, '')) {
                $notifProviders = Notifications_Factory::getActiveServices();
                foreach ($notifProviders as $notifProvider) {
    Severity: Minor
    Found in lib/SpotNotifications.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 newSingleMessage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function newSingleMessage($user, $objectId, $type, $notification)
        {
            // Because it's not certain which user we are at this point.
            // we once again request the user records.
            $userDao = $this->_daoFactory->getUserDao();
    Severity: Minor
    Found in lib/SpotNotifications.php - About 1 hr to fix

      Function sendNzbHandled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function sendNzbHandled($action, $spot)
          {
              switch ($action) {
                  case 'save': $notification = $this->_notificationTemplate->template('nzb_save', ['spot' => $spot, 'nzbhandling' => $this->_currentSession['user']['prefs']['nzbhandling']]);
                      break;
      Severity: Minor
      Found in lib/SpotNotifications.php - About 25 mins 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

      There are no issues that match your filters.

      Category
      Status