Showing 10 of 286 total issues
Client
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class Client
{
use ConfigTrait;
use LogTrait;
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
$isBot,
array $channels,
array $users,
array $patterns,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
LoggerInterface $logger,
LoopInterface $eventLoop,
Client $slackClient,
MessageFactory $messageFactory,
PluginManager $pluginManager,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
RealTimeClient $realTimeClient,
Users $users,
Bots $bots,
Channels $channels,
array $config = [],
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $pluginId,
bool $isBot = null,
array $channels,
array $users,
LoggerInterface $logger = null)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Client $slackClient,
array $data,
string $formattedText,
User $user = null,
Channel $channel)
Avoid too many return
statements within this method. Open
return $this->matchPatterns($message);
Function updatePrefixes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function updatePrefixes($authedUsername)
{
$updatedPriorityMap = [];
foreach ($this->getPriorityMap() as $priority => $prefixMap) {
$updatedPrefixMap = [];
- 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 dispatchToPrefixes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function dispatchToPrefixes(array $prefixMap, Message $message, string $text)
{
foreach ($prefixMap as $prefix => $plugins) {
if ($matches = $this->matchesPrefix($prefix, $text)) {
$this->debug("Dispatching prefix '$prefix'");
- 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 methodMatch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function methodMatch(Message $message)
{
foreach ($this->getMethodMatchers() as $methodMatcher) {
/** @var MethodMatcher $methodMatcher */
if ($matches = $methodMatcher->matches($message)) {
- 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"