k911/swoole-bundle

View on GitHub

Showing 6 of 80 total issues

HttpServerConfiguration has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class HttpServerConfiguration
{
    private const SWOOLE_HTTP_SERVER_CONFIG_DAEMONIZE = 'daemonize';
    private const SWOOLE_HTTP_SERVER_CONFIG_SERVE_STATIC = 'serve_static';
    private const SWOOLE_HTTP_SERVER_CONFIG_REACTOR_COUNT = 'reactor_count';
Severity: Minor
Found in src/Server/HttpServerConfiguration.php - About 4 hrs to fix

    File HttpServerConfiguration.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    namespace K911\Swoole\Server;
    Severity: Minor
    Found in src/Server/HttpServerConfiguration.php - About 2 hrs to fix

      Method validateSetting has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function validateSetting(string $key, $value): void
          {
              Assertion::keyExists(self::SWOOLE_HTTP_SERVER_CONFIGURATION, $key, 'There is no configuration mapping for setting "%s".');
      
              switch ($key) {
      Severity: Minor
      Found in src/Server/HttpServerConfiguration.php - About 1 hr to fix

        Function validateSetting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            private function validateSetting(string $key, $value): void
            {
                Assertion::keyExists(self::SWOOLE_HTTP_SERVER_CONFIGURATION, $key, 'There is no configuration mapping for setting "%s".');
        
                switch ($key) {
        Severity: Minor
        Found in src/Server/HttpServerConfiguration.php - About 1 hr 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

        Function onKernelResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Confirmed

            public function onKernelResponse(ResponseEvent $event): void
            {
                if (!$event->isMasterRequest() || !$this->isSessionRelated($event)) {
                    return;
                }

        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

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

            private function parsePhpIniContent(iterable $iniFiles): string
            {
                $content = '';
                $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
        
        
        Severity: Minor
        Found in src/Common/XdebugHandler/XdebugHandler.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

        Severity
        Category
        Status
        Source
        Language