marcelog/PAMI

View on GitHub

Showing 282 of 282 total issues

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class MyPAGIApplication extends PAGIApplication

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class A implements IEventListener

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ListenerTest implements IEventListener

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class A implements IEventListener
Severity: Minor
Found in doc/examples/sms/example.php by phpcodesniffer

Function dispatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function dispatch(IncomingMessage $message)
    {
        foreach ($this->eventListeners as $data) {
            $listener = $data[0];
            $predicate = $data[1];
Severity: Minor
Found in src/PAMI/Client/Impl/ClientImpl.php - About 55 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

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 131 and the first side effect is on line 30.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 57 and the first side effect is on line 30.
Open

<?php

The property $_pamiOptions is not named in camelCase.
Open

class ListenerTest implements IEventListener
{
    private $_client;
    private $_id;
    private $_pamiOptions;
Severity: Minor
Found in doc/examples/asyncagi/example.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 58 and the first side effect is on line 32.
Open

<?php
Severity: Minor
Found in doc/examples/sms/example.php by phpcodesniffer

Avoid variables with short names like $id. Configured minimum length is 3.
Open

        $id = $message->getActionID('ActionID');
Severity: Minor
Found in src/PAMI/Client/Impl/ClientImpl.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid classes with short names like A. Configured minimum length is 3.
Open

class A implements IEventListener
{
    public function handle(EventMessage $event)
    {
        //This Handler will print the incoming message.
Severity: Minor
Found in doc/examples/sms/example.php by phpmd

ShortClassName

Since: 2.9

Detects when classes or interfaces have a very short name.

Example

class Fo {

}

interface Fo {

}

Source https://phpmd.org/rules/naming.html#shortclassname

The property $_client is not named in camelCase.
Open

class ListenerTest implements IEventListener
{
    private $_client;
    private $_id;
    private $_pamiOptions;
Severity: Minor
Found in doc/examples/asyncagi/example.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $_id is not named in camelCase.
Open

class ListenerTest implements IEventListener
{
    private $_client;
    private $_id;
    private $_pamiOptions;
Severity: Minor
Found in doc/examples/asyncagi/example.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid classes with short names like A. Configured minimum length is 3.
Open

class A implements IEventListener
{
    public function handle(EventMessage $event)
    {
        var_dump($event);
Severity: Minor
Found in doc/examples/quickstart/example.php by phpmd

ShortClassName

Since: 2.9

Detects when classes or interfaces have a very short name.

Example

class Fo {

}

interface Fo {

}

Source https://phpmd.org/rules/naming.html#shortclassname

Function serialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function serialize()
    {
        $result = array();
        foreach ($this->getKeys() as $k => $v) {
            $result[] = $k . ': ' . $v;
Severity: Minor
Found in src/PAMI/Message/Message.php - About 45 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
/**
 * ShowDialPlan action message.
 *
 * PHP Version 5
Severity: Minor
Found in src/PAMI/Message/Action/ShowDialPlanAction.php and 1 other location - About 40 mins to fix
src/PAMI/Message/Action/QueueStatusAction.php on lines 1..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
/**
 * QueueStatus action message.
 *
 * PHP Version 5
Severity: Minor
Found in src/PAMI/Message/Action/QueueStatusAction.php and 1 other location - About 40 mins to fix
src/PAMI/Message/Action/ShowDialPlanAction.php on lines 1..64

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
/**
 * QueuePenalty action message.
 *
 * PHP Version 5
Severity: Minor
Found in src/PAMI/Message/Action/QueuePenaltyAction.php and 1 other location - About 35 mins to fix
src/PAMI/Message/Action/AGIAction.php on lines 1..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
/**
 * AGI action message.
 *
 * PHP Version 5
Severity: Minor
Found in src/PAMI/Message/Action/AGIAction.php and 1 other location - About 35 mins to fix
src/PAMI/Message/Action/QueuePenaltyAction.php on lines 1..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function getChannelVariables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChannelVariables($channel = null)
    {
        if (is_null($channel)) {
            if (!isset($this->keys['channel'])) {
                return $this->getChannelVariables('default');
Severity: Minor
Found in src/PAMI/Message/IncomingMessage.php - About 35 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

Severity
Category
Status
Source
Language