artur-graniszewski/ZEUS-for-PHP

View on GitHub

Showing 95 of 95 total issues

Function getProcessesToTerminate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getProcessesToTerminate(ProcessCollection $processes, Config $config, array $statusSummary)
    {
        $expireTime = microtime(true) - $config->getProcessIdleTimeout();

        $processesToTerminate = [];

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 sendBody has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sendBody(ConnectionInterface $connection, $buffer)
    {
        if ($this->isBodyAllowedInResponse($this->request)) {
            $isChunkedResponse = $this->response->getMetadata('isChunkedResponse');

Severity: Minor
Found in src/Zeus/ServerService/Http/Message/Message.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

Method getCommandRules has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getCommandRules()
    {
        $eol = "[\\t\\s]*\r\n~S";
        return [
            'fetch' => [
Severity: Minor
Found in src/Zeus/ServerService/Memcache/Message/Message.php - About 1 hr to fix

    Method start has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function start($launchAsDaemon)
        {
            $this->startTime = microtime(true);
            $plugins = $this->getPluginRegistry()->count();
            $this->log(Logger::INFO, sprintf("Starting Scheduler with %d plugin%s", $plugins, $plugins !== 1 ? 's' : ''));
    Severity: Minor
    Found in src/Zeus/Kernel/ProcessManager/Scheduler.php - About 1 hr to fix

      Method __invoke has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
          {
              $config = $container->get('configuration');
              $mainLogger = $container->build(LoggerInterface::class, ['service_name' => 'main']);
      
      
      Severity: Minor
      Found in src/Zeus/ServerService/Factory/ManagerFactory.php - About 1 hr to fix

        Method setHost has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function setHost(Request $request, $serverAddress)
            {
                $host = $serverAddress;
                $port = null;
                $fullHost = $request->getHeaderOverview('Host', false);
        Severity: Minor
        Found in src/Zeus/ServerService/Http/Message/Helper/Header.php - About 1 hr to fix

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

              public function decodeChunkedRequestBody(Request $request, & $message)
              {
                  $this->buffer .= $message;
          
                  while (true) {
          Severity: Minor
          Found in src/Zeus/ServerService/Http/Message/Helper/ChunkedEncoding.php - About 1 hr to fix

            Method onProcessLoop has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function onProcessLoop(SchedulerEvent $event)
                {
                    $exception = null;
            
                    try {
            Severity: Minor
            Found in src/Zeus/ServerService/Shared/Networking/SocketEventSubscriber.php - About 1 hr to fix

              Function getApplicationConfig has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getApplicationConfig()
                  {
                      $appConfig = static::$applicationConfig;
              
                      if (!$appConfig) {
              Severity: Minor
              Found in src/Zeus/ServerService/Http/Dispatcher/ZendFrameworkDispatcher.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

              Method math has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function math($command, $key, $amount)
                  {
                      $key = sha1($key);
                      $this->markCommandUsage('set');
                      $success = false;
              Severity: Minor
              Found in src/Zeus/ServerService/Memcache/Message/Message.php - About 1 hr to fix

                Method checkBodyHeaders has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function checkBodyHeaders(Request $request, $boundaryLine, $pos)
                    {
                        // initialize data block
                        if (!isset($this->currentFormDataInfo['tmp_name'])) {
                            // file not opened yet, check the boundary
                Severity: Minor
                Found in src/Zeus/ServerService/Http/Message/Helper/FileUpload.php - About 1 hr to fix

                  Method fromStringOfHeaders has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function fromStringOfHeaders($buffer, $allowCustomMethods)
                      {
                          if ("\r\n\r\n" !== substr($buffer, -4)) {
                              throw new \InvalidArgumentException(
                                  'An EOM was not found at the end of request buffer'
                  Severity: Minor
                  Found in src/Zeus/ServerService/Http/Message/Request.php - About 1 hr to fix

                    Method dispatch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function dispatch(RequestInterface $request, ResponseInterface $response = null)
                        {
                            if (!$request instanceof ConsoleRequest) {
                                throw new \InvalidArgumentException(sprintf(
                                    '%s can only dispatch requests in a console environment',
                    Severity: Minor
                    Found in src/Zeus/Controller/ConsoleController.php - About 1 hr to fix

                      Function onMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function onMessage(ConnectionInterface $connection, $message)
                          {
                              $this->requestPhase = static::REQUEST_PHASE_READING;
                      
                              if (!$this->headersReceived) {
                      Severity: Minor
                      Found in src/Zeus/ServerService/Http/Message/Message.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 setHost has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function setHost(Request $request, $serverAddress)
                          {
                              $host = $serverAddress;
                              $port = null;
                              $fullHost = $request->getHeaderOverview('Host', false);
                      Severity: Minor
                      Found in src/Zeus/ServerService/Http/Message/Helper/Header.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

                      Method join has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function join($callId)
                          {
                              $callIds = is_array($callId) ? $callId : [$callId];
                      
                              $results = [];
                      Severity: Minor
                      Found in src/Zeus/ServerService/Async/AsyncPlugin.php - About 1 hr to fix

                        Method startPlugins has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function startPlugins(ContainerInterface $container, $service, array $config)
                            {
                                foreach ($config as $index => $value) {
                                    if (is_int($index)) {
                                        if (is_object($value) && $value instanceof ListenerAggregateInterface) {
                        Severity: Minor
                        Found in src/Zeus/Kernel/ProcessManager/Helper/PluginFactory.php - About 1 hr to fix

                          Method modify has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function modify($command, $key, $flags, $expTime, $bytes, $requestedCas)
                              {
                                  $cas = null;
                                  $key = sha1($key);
                                  $exists = false;
                          Severity: Minor
                          Found in src/Zeus/ServerService/Memcache/Message/Message.php - About 1 hr to fix

                            Method dispatch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function dispatch(Request $request, Response $response)
                                {
                                    /** @var Application $app */
                                    static $app;
                                    // Run the application!
                            Severity: Minor
                            Found in src/Zeus/ServerService/Http/Dispatcher/ZendFrameworkDispatcher.php - About 1 hr to fix

                              Method doJoin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function doJoin(ConnectionInterface $socket)
                                  {
                                      $result = $socket->read();
                                      if ($result === false) {
                                          throw new \RuntimeException("Async call failed: server connection lost", 1);
                              Severity: Minor
                              Found in src/Zeus/ServerService/Async/AsyncPlugin.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language