YetiForceCompany/YetiForceCRM

View on GitHub
include/http/Response.php

Summary

Maintainability
B
4 hrs
Test Coverage
F
18%

Function emit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function emit()
    {
        $contentTypeSent = false;
        foreach ($this->headers as $header) {
            if (!$contentTypeSent && 0 === stripos($header, 'content-type')) {
Severity: Minor
Found in include/http/Response.php - About 2 hrs 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

Method emit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function emit()
    {
        $contentTypeSent = false;
        foreach ($this->headers as $header) {
            if (!$contentTypeSent && 0 === stripos($header, 'content-type')) {
Severity: Minor
Found in include/http/Response.php - About 1 hr to fix

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

        protected function emitText()
        {
            if (null === $this->result) {
                if (\is_string($this->error)) {
                    echo $this->error;
    Severity: Minor
    Found in include/http/Response.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

    The method emit() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
    Open

        public function emit()
        {
            $contentTypeSent = false;
            foreach ($this->headers as $header) {
                if (!$contentTypeSent && 0 === stripos($header, 'content-type')) {
    Severity: Minor
    Found in include/http/Response.php by phpmd

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

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

    Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
    Open

        public function emit()
    Severity: Critical
    Found in include/http/Response.php by sonar-php

    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

    See

    The method setError has a boolean flag argument $trace, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function setError($code = 500, $message = null, $trace = false): void
    Severity: Minor
    Found in include/http/Response.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method emitText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                if (\is_string($this->result)) {
                    echo $this->result;
                } else {
                    echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class '\App\Language' in method 'setException'.
    Open

            $reasonPhrase = $error['message'] = $show ? $message : \App\Language::translate('ERR_OCCURRED_ERROR');
    Severity: Minor
    Found in include/http/Response.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    The method prepareResponse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $response['success'] = true;
                $response['result'] = $this->result;
            }
    Severity: Minor
    Found in include/http/Response.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method emitText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                } else {
                    echo \App\Json::encode($this->prepareResponse());
                }
    Severity: Minor
    Found in include/http/Response.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method emitText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                } else {
                    echo \App\Json::encode($this->prepareResponse());
                }
    Severity: Minor
    Found in include/http/Response.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class '\App\Json' in method 'emitText'.
    Open

                    echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Request' in method 'setException'.
    Open

            $this->setHeader(\App\Request::_getServer('SERVER_PROTOCOL') . ' ' . $statusCode . ' ' . str_ireplace(["\r\n", "\r", "\n"], ' ', $reasonPhrase));
    Severity: Minor
    Found in include/http/Response.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Json' in method 'emitJSON'.
    Open

            echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Json' in method 'emitText'.
    Open

                    echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Define a constant instead of duplicating this literal "message" 3 times.
    Open

            $error = ['code' => $code, 'message' => $message, 'trace' => $trace];
    Severity: Critical
    Found in include/http/Response.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
    Open

                echo $this->emitJSONPFn . '(';
    Severity: Minor
    Found in include/http/Response.php by phan

    array to string conversion
    Open

                    echo $this->error;
    Severity: Info
    Found in include/http/Response.php by phan

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

    class Vtiger_Response
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    The class Vtiger_Response is not named in CamelCase.
    Open

    class Vtiger_Response
    {
        // Constants
    
        /**
    Severity: Minor
    Found in include/http/Response.php by phpmd

    CamelCaseClassName

    Since: 0.2

    It is considered best practice to use the CamelCase notation to name classes.

    Example

    class class_name {
    }

    Source

    The property $EMIT_RAW is not named in camelCase.
    Open

    class Vtiger_Response
    {
        // Constants
    
        /**
    Severity: Minor
    Found in include/http/Response.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 $EMIT_JSONTEXT is not named in camelCase.
    Open

    class Vtiger_Response
    {
        // Constants
    
        /**
    Severity: Minor
    Found in include/http/Response.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 $EMIT_JSON is not named in camelCase.
    Open

    class Vtiger_Response
    {
        // Constants
    
        /**
    Severity: Minor
    Found in include/http/Response.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 variables with short names like $fn. Configured minimum length is 3.
    Open

        public function setEmitJSONP($fn)
    Severity: Minor
    Found in include/http/Response.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

    The property $EMIT_HTML is not named in camelCase.
    Open

    class Vtiger_Response
    {
        // Constants
    
        /**
    Severity: Minor
    Found in include/http/Response.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 $EMIT_JSONP is not named in camelCase.
    Open

    class Vtiger_Response
    {
        // Constants
    
        /**
    Severity: Minor
    Found in include/http/Response.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 variables with short names like $e. Configured minimum length is 3.
    Open

        public function setException(Throwable $e): void
    Severity: Minor
    Found in include/http/Response.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

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private $emitJSONPFn = false; // for EMIT_JSONP
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $message = $e->getMessage();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($show && ($e instanceof \App\Exceptions\AppException)) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed $type
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed      $code
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setError($code = 500, $message = null, $trace = false): void
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $reasonPhrase = $error['message'] = $show ? $message : \App\Language::translate('ERR_OCCURRED_ERROR');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static $EMIT_JSONP = 4;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setHeader($header)
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set headers to send.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param Throwable $e
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $show = \Config\Debug::$EXCEPTION_ERROR_TO_SHOW || 0 === strpos($message, 'ERR_');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set emit type.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setEmitType($type)
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed $result
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static $EMIT_HTML = 2;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as padded-json.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set error data to send.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set exception error to send.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->setHeader(\App\Request::_getServer('SERVER_PROTOCOL') . ' ' . $statusCode . ' ' . str_ireplace(["\r\n", "\r", "\n"], ' ', $reasonPhrase));
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static $EMIT_RAW = 0;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Result data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        // List of response headers
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $error = [
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (\Config\Debug::$DISPLAY_EXCEPTION_BACKTRACE) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $error['message'] = $e->getDisplayMessage();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->error = $error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return null !== $this->error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Update the result data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed $key
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Error data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->headers[] = $header;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed|null $message
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (null === $message) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'code' => $e->getCode(),
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        // Constants
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as json string.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ];
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed      $trace
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (is_numeric($code)) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $statusCode = \is_int($e->getCode()) ? $e->getCode() : 500;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $error['trace'] = str_replace(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR, '', $e->getTraceAsString());
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setResult($result)
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as string/jsonstring.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private $result;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private $headers = [];
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->error = $error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->emitJSONPFn = $fn;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Is emit type configured to JSON?
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set the result data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as html string.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private $error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->emitType = $type;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Line exceeds 120 characters; contains 153 characters
    Open

            $this->setHeader(\App\Request::_getServer('SERVER_PROTOCOL') . ' ' . $statusCode . ' ' . str_ireplace(["\r\n", "\r", "\n"], ' ', $reasonPhrase));
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->result = $result;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static $EMIT_JSONTEXT = 3;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as raw string.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return void
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static $EMIT_JSON = 1;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $error = ['code' => $code, 'message' => $message, 'trace' => $trace];
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private $emitType = 1; // EMIT_JSON
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return void
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed $header
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get the error data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setException(Throwable $e): void
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set padding method name for JSONP emit type.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setEmitJSONP($fn)
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->emitType == self::$EMIT_JSON;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getError()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                http_response_code($code);
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed $fn
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->setEmitType(self::$EMIT_JSONP);
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Check the presence of error data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        // Active emit type
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        // JSONP padding
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $message = $code;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            http_response_code($statusCode);
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function isJSON()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function hasError()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!$contentTypeSent) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->emitText();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ($this->emitType == self::$EMIT_RAW) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!$contentTypeSent) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    header('content-type: application/javascript; charset=UTF-8');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (null === $this->result) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (\is_string($this->error)) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (null === $this->result) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            echo $this->result;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (null !== $this->error) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    header('content-type: text/plain; charset=UTF-8');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Prepare the response wrapper.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $response = [];
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $response['success'] = false;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ($this->emitType == self::$EMIT_HTML) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                echo $this->emitJSONPFn . '(';
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as String/JSONString.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (\is_string($this->result)) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function emitRaw()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!$contentTypeSent && 0 === stripos($header, 'content-type')) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($this->emitType == self::$EMIT_JSON) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    header('content-type: text/json; charset=UTF-8');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } else {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as String.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                header($header);
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->emitRaw();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ($this->emitType == self::$EMIT_JSONP) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function emitText()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed $value
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!$contentTypeSent) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                echo ')';
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    echo $this->result;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function prepareResponse()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $response['success'] = true;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($this->headers as $header) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    header('content-type: text/html; charset=UTF-8');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->emitRaw();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->result[$key] = $value;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Send response to client.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->result;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $contentTypeSent = true;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $response['result'] = $this->result;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->emitJSON();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get the result data.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getResult()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function emit()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    echo $this->error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            // Set right charset (UTF-8) to avoid IE complaining about c00ce56e error
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!$contentTypeSent) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->emitJSON();
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ($this->emitType == self::$EMIT_JSONTEXT) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    header('content-type: text/json; charset=UTF-8');
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $response['error'] = $this->error;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Emit response wrapper as JSONString.
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                echo (\is_string($this->error)) ? $this->error : var_export($this->error, true);
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function updateResult($key, $value)
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $response;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $contentTypeSent = false;
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!$contentTypeSent) {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function emitJSON()
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } else {
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    echo \App\Json::encode($this->prepareResponse());
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    Class name "Vtiger_Response" is not in camel caps format
    Open

    class Vtiger_Response
    Severity: Minor
    Found in include/http/Response.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status