Showing 15 of 394 total issues
Function getStatusMessages
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
private function getStatusMessages($instances)
{
$collection = new InstanceStatusCollection();
foreach ($instances as $instance)
- 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
Configuration
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Configuration
{
/**
* @var string the database path
Method onSubscriptionSeen
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function onSubscriptionSeen(SubscriptionSeenEvent $event)
{
$instanceName = $event->getInstance();
$status = $event->getSubscription();
Method getStatusMessages
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getStatusMessages($instances)
{
$collection = new InstanceStatusCollection();
foreach ($instances as $instance)
Function Connection
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Connection = (function() {
var websocket = null;
var accessToken = null;
var handlers = [];
Method onMessage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function onMessage(ConnectionInterface $from, $msg)
{
try
{
$message = MessageFactory::factory($msg);
Method execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function execute(InputInterface $input, OutputInterface $output)
{
// Parse the configuration
$configFile = $input->getArgument('configFile');
$configuration = ConfigurationParser::parseConfiguration(new YamlReader($configFile));
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
options: {
Function validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function validate()
{
// Check that all mandatory values are defined
foreach (self::$mandatoryValues as $mandatoryValue)
if (!isset($this->_configuration[$mandatoryValue]) || ($this->_configuration[$mandatoryValue] != '0' && empty($this->_configuration[$mandatoryValue])))
- 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
Method onSubscriptionStateChange
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function onSubscriptionStateChange(SubscriptionStateChangeEvent $event)
{
$instanceName = $event->getInstance();
$stateChange = $event->getStateChange();
Method testEventHandling
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testEventHandling()
{
/* @var EventSubscriberInterface|\PHPUnit_Framework_MockObject_MockObject|InstanceStateManager $instanceStateManager */
$instanceStateManager = $this->getMockBuilder('\Jalle19\StatusManager\Manager\InstanceStateManager')
->setConstructorArgs([$this->configuration, $this->logger, $this->eventDispatcher])
Method handleMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleMessage(AbstractMessage $message, ConnectionInterface $sender)
{
// Wrap database exceptions in the more generic RequestFailedException
try
{
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$instanceName,
array $availableNetworks,
array $availableMuxes,
array $inputs,
array $subscriptions,
Avoid too many return
statements within this method. Open
Open
return new UsersRequest($payload);
Avoid too many return
statements within this method. Open
Open
return false;