Showing 8 of 8 total issues
File Plugin.php
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Method compareKarma
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function compareKarma($term0, $term1, $method, UserEvent $event, Queue $queue)
{
$nick = $event->getNick();
$canonicalTerm0 = $this->getCanonicalTerm($term0, $nick);
$canonicalTerm1 = $this->getCanonicalTerm($term1, $nick);
Method handleKarmaCommand
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleKarmaCommand(CommandEvent $event, Queue $queue)
{
$params = $event->getCustomParams();
if (count($params) < 1) {
$this->handleKarmaHelp($event, $queue);
Method handleIrcReceived
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleIrcReceived(UserEvent $event, Queue $queue)
{
$params = $event->getParams();
$message = $params['text'];
$termPattern = '\S+?|\([^<>]+?\)+';
Method modifyKarma
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function modifyKarma($term, $action, UserEvent $event, Queue $queue)
{
$nick = $event->getNick();
$canonicalTerm = $this->getCanonicalTerm($term, $nick);
if ($canonicalTerm == strtolower($nick)) {
Method setLoop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function setLoop(LoopInterface $loop)
{
parent::setLoop($loop);
\React\Promise\Timer\timeout(
Method compareKarma
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
protected function compareKarma($term0, $term1, $method, UserEvent $event, Queue $queue)
Function setAdapter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function setAdapter($adapter)
{
if (is_string($adapter)) {
if (class_exists($adapter)) {
$class = $adapter;
- 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"