bubbstore/dooki-php-sdk

View on GitHub

Showing 6 of 6 total issues

The class DookiRequest has 16 public methods. Consider refactoring DookiRequest to keep number of public methods under 10.
Open

class DookiRequest extends DookiAuth
{
    private $api;

    private $method;
Severity: Minor
Found in src/Dooki/DookiRequest.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

DookiRequest has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class DookiRequest extends DookiAuth
{
    private $api;

    private $method;
Severity: Minor
Found in src/Dooki/DookiRequest.php - About 3 hrs to fix

    Function search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function search($search)
        {
            $searchString = '';
    
            foreach ($search as $field => $value) {
    Severity: Minor
    Found in src/Dooki/DookiRequest.php - About 25 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

    Line exceeds 120 characters; contains 130 characters
    Open

                throw new DookiRequestException($property . ' is not a valid property for DookiRequest. Use headers, query or json.');
    Severity: Minor
    Found in src/Dooki/DookiRequest.php by phpcodesniffer

    Line exceeds 120 characters; contains 142 characters
    Open

         * @param DookiRequest $environment {@link DookiRequest::production()} or {@link DookiRequest::sandbox()} or {@link DookiRequest::local()}
    Severity: Minor
    Found in src/Dooki/Dooki.php by phpcodesniffer

    Line exceeds 120 characters; contains 131 characters
    Open

                throw new DookiRequestException($method . ' is not a valid HTTP method. Use GET, POST, PUT, PATCH or DELETE instead.');
    Severity: Minor
    Found in src/Dooki/DookiRequest.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language