PSchwisow/phergie-irc-plugin-react-karma

View on GitHub
src/Plugin.php

Summary

Maintainability
C
1 day
Test Coverage

File Plugin.php has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Phergie plugin for handling requests to increment or decrement counters on specified terms (https://github.com/PSchwisow/phergie-irc-plugin-react-karma)
 *
 * @link https://github.com/PSchwisow/phergie-irc-plugin-react-karma for the canonical source repository
Severity: Minor
Found in src/Plugin.php - About 3 hrs to fix

    Method compareKarma has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function compareKarma($term0, $term1, $method, UserEvent $event, Queue $queue)
        {
            $nick = $event->getNick();
            $canonicalTerm0 = $this->getCanonicalTerm($term0, $nick);
            $canonicalTerm1 = $this->getCanonicalTerm($term1, $nick);
    Severity: Minor
    Found in src/Plugin.php - About 1 hr to fix

      Method handleKarmaCommand has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handleKarmaCommand(CommandEvent $event, Queue $queue)
          {
              $params = $event->getCustomParams();
              if (count($params) < 1) {
                  $this->handleKarmaHelp($event, $queue);
      Severity: Minor
      Found in src/Plugin.php - About 1 hr to fix

        Method handleIrcReceived has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handleIrcReceived(UserEvent $event, Queue $queue)
            {
                $params = $event->getParams();
                $message = $params['text'];
                $termPattern = '\S+?|\([^<>]+?\)+';
        Severity: Minor
        Found in src/Plugin.php - About 1 hr to fix

          Method modifyKarma has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function modifyKarma($term, $action, UserEvent $event, Queue $queue)
              {
                  $nick = $event->getNick();
                  $canonicalTerm = $this->getCanonicalTerm($term, $nick);
                  if ($canonicalTerm == strtolower($nick)) {
          Severity: Minor
          Found in src/Plugin.php - About 1 hr to fix

            Method setLoop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function setLoop(LoopInterface $loop)
                {
                    parent::setLoop($loop);
            
                    \React\Promise\Timer\timeout(
            Severity: Minor
            Found in src/Plugin.php - About 1 hr to fix

              Method compareKarma has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  protected function compareKarma($term0, $term1, $method, UserEvent $event, Queue $queue)
              Severity: Minor
              Found in src/Plugin.php - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status