antonmarin/amocrm

View on GitHub

Showing 75 of 75 total issues

Method sendRequest has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sendRequest($method, $url, $params = null)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_USERAGENT, 'amoCRM-API-client/1.0');
Severity: Minor
Found in src/Connection/CurlHttpClientAdapter.php - About 1 hr to fix

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

        private $id;
    Severity: Minor
    Found in src/Account/Account.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

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

        public function sendRequest($method, $url, $params = null)
        {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_USERAGENT, 'amoCRM-API-client/1.0');
    Severity: Minor
    Found in src/Connection/CurlHttpClientAdapter.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

    Missing class import via use statement (line '29', column '27').
    Open

                    throw new \LogicException('Unexpected method');

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '27', column '27').
    Open

                    throw new \InvalidArgumentException('Type '.$params['type']. ' is not implemented');
    Severity: Minor
    Found in src/Contact/ContactFactory.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '54', column '23').
    Open

                throw new \RuntimeException($curlError, $code);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '17', column '23').
    Open

                throw new \BadMethodCallException('Type is not set');
    Severity: Minor
    Found in src/Contact/ContactFactory.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '21', column '23').
    Open

            $object = new \ReflectionObject($entity);
    Severity: Minor
    Found in src/ArrayMapper.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid unused parameters such as '$params'.
    Open

        public function getLinks($params = [])
    Severity: Minor
    Found in src/Contact/ContactsRepository.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid unused parameters such as '$contacts'.
    Open

        public function set($contacts)
    Severity: Minor
    Found in src/Contact/ContactsRepository.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Lead/LeadRepository.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Note/NoteRepository.php by phpcodesniffer

    Expected 0 spaces after opening bracket; 1 found
    Open

                if ( ! $object->hasProperty($propertyName)) {
    Severity: Minor
    Found in src/ArrayMapper.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }

    Expected 1 newline at end of file; 0 found
    Open

    }

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Contact/Company.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Task/TaskRepository.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity: Minor
    Found in src/Contact/Contact.php by phpcodesniffer

    Expected 1 newline at end of file; 0 found
    Open

    }
    Severity
    Category
    Status
    Source
    Language