artur-graniszewski/ZEUS-for-PHP

View on GitHub

Showing 95 of 95 total issues

Function stopServices has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function stopServices($services, $mustBeRunning)
    {
        $servicesAmount = 0;
        foreach ($services as $service) {
            try {
Severity: Minor
Found in src/Zeus/ServerService/Manager.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 parseCommand has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseCommand()
    {
        $command = explode(" ", ltrim($this->buffer), 2);
        $command = $command[0];
        $commandRules = $this->getCommandRules();
Severity: Minor
Found in src/Zeus/ServerService/Memcache/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 parseCommand has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function parseCommand()
    {
        $command = explode(" ", ltrim($this->buffer), 2);
        $command = $command[0];
        $commandRules = $this->getCommandRules();
Severity: Minor
Found in src/Zeus/ServerService/Memcache/Message/Message.php - About 1 hr to fix

    Method doWrite has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function doWrite($writeMethod)
        {
            if (!$this->isWritable()) {
                $this->data = '';
    
    
    Severity: Minor
    Found in src/Zeus/Kernel/Networking/FileStream.php - About 1 hr to fix

      Method enableCompressionIfSupported has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function enableCompressionIfSupported(& $buffer)
          {
              $this->compressionHandler = null;
      
              if (!function_exists('deflate_init') || !$this->isBodyAllowedInResponse($this->request)) {
      Severity: Minor
      Found in src/Zeus/ServerService/Http/Message/Message.php - About 1 hr to fix

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

            public function dispatch(Request $request, Response $response)
            {
                $path = $request->getUri()->getPath();
        
                $code = Response::STATUS_CODE_200;
        Severity: Minor
        Found in src/Zeus/ServerService/Http/Dispatcher/StaticFileDispatcher.php - About 1 hr to fix

          Method isSupported has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function isSupported()
              {
                  $className = basename(str_replace('\\', '/', static::class));
          
                  if (!$this->isPcntlExtensionLoaded()) {

            Method handleMessages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function handleMessages()
                {
                    $this->schedulerStatus->updateStatus();
            
                    /** @var Message[] $messages */
            Severity: Minor
            Found in src/Zeus/Kernel/ProcessManager/Scheduler.php - About 1 hr to fix

              Method onMessage has 28 lines of code (exceeds 25 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

                Method startServices has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function startServices($serviceNames)
                    {
                        $plugins = $this->getPluginRegistry()->count();
                        $this->logger->info(sprintf("Starting Server Service Manager with %d plugin%s", $plugins, $plugins !== 1 ? 's' : ''));
                
                Severity: Minor
                Found in src/Zeus/ServerService/Manager.php - About 1 hr to fix

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

                      protected static function detectNumberOfCores()
                      {
                          if (is_file('/proc/cpuInfo') && is_readable('/proc/cpuInfo')) {
                              $cpuInfo = file_get_contents('/proc/cpuInfo');
                              if (preg_match_all('/^processor/m', $cpuInfo, $matches)) {
                  Severity: Minor
                  Found in src/Zeus/Kernel/ProcessManager/System/CpuDetector.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 getQueueInfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getQueueInfo()
                      {
                          if (!$this->queueInfo) {
                              $queueId = null;
                              $queue = $this->ipc[0] ? $this->ipc[0] : ($this->ipc[1] ? $this->ipc[1] : null);
                  Severity: Minor
                  Found in src/Zeus/Kernel/IpcServer/Adapter/MsgAdapter.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 doWrite has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function doWrite($writeMethod)
                      {
                          if (!$this->isWritable()) {
                              $this->data = '';
                  
                  
                  Severity: Minor
                  Found in src/Zeus/Kernel/Networking/FileStream.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 __invoke has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
                      {
                          $channelName = $options['service_name'];
                  
                          $logger = $options['logger_adapter'];
                  Severity: Minor
                  Found in src/Zeus/Kernel/IpcServer/Factory/IpcServerFactory.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 __invoke has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
                      {
                          $config = $container->get('configuration');
                          $loggerConfig = isset($config['zeus_process_manager']['logger']) ? $config['zeus_process_manager']['logger'] : [];
                  
                  
                  Severity: Minor
                  Found in src/Zeus/ServerService/Shared/Logger/LoggerFactory.php - About 1 hr to fix

                    Method getStatus has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getStatus()
                        {
                            $payload = [
                                'isEvent' => false,
                                'type' => Message::IS_STATUS_REQUEST,
                    Severity: Minor
                    Found in src/Zeus/Kernel/ProcessManager/Scheduler.php - About 1 hr to fix

                      Method store has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method send has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function send($message)
                            {
                                $channelNumber = $this->channelNumber;
                        
                                $channelNumber == 0 ?
                        Severity: Minor
                        Found in src/Zeus/Kernel/IpcServer/Adapter/SharedMemoryAdapter.php - About 1 hr to fix

                          Method doStartService has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function doStartService($serviceName)
                              {
                                  $service = $this->getService($serviceName);
                          
                                  $event = $this->getEvent();
                          Severity: Minor
                          Found in src/Zeus/ServerService/Manager.php - About 1 hr to fix

                            Method decodeRegularRequestBody has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function decodeRegularRequestBody(Request $request, & $message)
                                {
                                    $expectedBodyLength = $request->getHeaderOverview('Content-Length', false);
                            
                                    if (false === $expectedBodyLength) {
                            Severity: Minor
                            Found in src/Zeus/ServerService/Http/Message/Helper/RegularEncoding.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language