maestroprog/saw-php

View on GitHub

Showing 48 of 48 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
 
namespace Maestroprog\Saw\Command;
 
use Esockets\Client;
Severity: Major
Found in src/Command/ThreadRun.php and 1 other location - About 1 day to fix
src/Command/ThreadBroadcast.php on lines 1..81

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
 
namespace Maestroprog\Saw\Command;
 
use Esockets\Client;
Severity: Major
Found in src/Command/ThreadBroadcast.php and 1 other location - About 1 day to fix
src/Command/ThreadRun.php on lines 1..80

SawContainer has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class SawContainer extends AbstractBasicContainer
{
private $config;
private $daemonConfig;
private $socketConfigurator;
Severity: Minor
Found in src/Di/SawContainer.php - About 3 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php
     
    namespace Maestroprog\Saw\Command;
     
    use Esockets\Client;
    Severity: Major
    Found in src/Command/VariableLock.php and 1 other location - About 3 hrs to fix
    src/Command/ThreadKnow.php on lines 1..58

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php
     
    namespace Maestroprog\Saw\Command;
     
    use Esockets\Client;
    Severity: Major
    Found in src/Command/ThreadKnow.php and 1 other location - About 3 hrs to fix
    src/Command/VariableLock.php on lines 1..40

    File SawContainer.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
     
    namespace Maestroprog\Saw\Di;
     
    use Esockets\base\Configurator;
    Severity: Minor
    Found in src/Di/SawContainer.php - About 2 hrs to fix

      Method init has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function init(string $configPath): self
      {
      defined('INTERVAL') or define('INTERVAL', 10000);
      defined('SAW_DIR') or define('SAW_DIR', __DIR__);
      $config = array_merge(
      Severity: Major
      Found in src/Saw.php - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public function lock(string $varName)
        {
        $message = null;
        $lockCommand = (new VariableLock($this->client, $varName, true))
        ->onError(function (VariableLock $context) use (&$message) {
        Severity: Major
        Found in src/Memory/SharedMemoryOnSocket.php and 1 other location - About 2 hrs to fix
        src/Memory/SharedMemoryOnSocket.php on lines 80..92

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public function unlock(string $varName)
        {
        //todo async! thinking -- really?
        $message = null;
        $unlockCommand = (new VariableLock($this->client, $varName, false))
        Severity: Major
        Found in src/Memory/SharedMemoryOnSocket.php and 1 other location - About 2 hrs to fix
        src/Memory/SharedMemoryOnSocket.php on lines 67..78

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

        public function start()
        {
        $this->connector->getClient()->onReceive(function ($data) {
        if ($data === 'ACCEPT') {
        return;
        Severity: Minor
        Found in src/Standalone/Debugger.php - About 1 hr to fix

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

          public function __construct(
          CommandDispatcher $commandDispatcher,
          Commander $commander,
          WorkerPool $workerPool,
          WorkerBalance $workerBalance
          Severity: Minor
          Found in src/Standalone/Controller/ThreadDistributor.php - About 1 hr to fix

            Method __construct has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            public function __construct(MemoryInterface $memory, CommandDispatcher $dispatcher, Commander $commander)
            {
            $this->memory = $memory;
            $this->dispatcher = $dispatcher;
            $this->commander = $commander;
            Severity: Minor
            Found in src/Standalone/Controller/SharedMemoryServer.php - About 1 hr to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              <?php
               
              namespace Maestroprog\Saw\Command;
               
              use Esockets\Client;
              Severity: Major
              Found in src/Command/VariableLink.php and 2 other locations - About 1 hr to fix
              src/Command/VariableUnlink.php on lines 1..33
              src/Command/WorkerAdd.php on lines 1..45

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              <?php
               
              namespace Maestroprog\Saw\Command;
               
              use Esockets\Client;
              Severity: Major
              Found in src/Command/VariableUnlink.php and 2 other locations - About 1 hr to fix
              src/Command/VariableLink.php on lines 1..33
              src/Command/WorkerAdd.php on lines 1..45

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              <?php
               
              namespace Maestroprog\Saw\Command;
               
              use Esockets\Client;
              Severity: Major
              Found in src/Command/WorkerAdd.php and 2 other locations - About 1 hr to fix
              src/Command/VariableLink.php on lines 1..33
              src/Command/VariableUnlink.php on lines 1..33

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

              public function start()
              {
              $beforeRun = microtime(true);
              $pid = $this->runner->start();
              $afterRun = microtime(true);
              Severity: Minor
              Found in src/Service/ControllerStarter.php - About 1 hr to fix

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

              public function dispatch($data, Client $peer)
              {
              if ($data['state'] === self::STATE_RES) {
              $this->runCommands->get($data['id'])->dispatchResult($data['data'], $data['code']);
              } else {
              Severity: Minor
              Found in src/Service/CommandDispatcher.php - About 1 hr to fix

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

              public function start()
              {
              if (extension_loaded('pcntl')) {
              pcntl_signal(SIGINT, function ($sig) {
              // пофиксил бСсконСчноС ΠΎΠΆΠΈΠ΄Π°Π½ΠΈΠ΅ Π·Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΠ΅ Ρ€Π°Π±ΠΎΡ‚Ρ‹ Π²ΠΎΡ€ΠΊΠ΅Ρ€Π°
              Severity: Minor
              Found in src/Standalone/Worker.php - About 1 hr to fix

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

                protected function main($prepared)
                {
                $header = microtime(true);
                $this->header = $this->thread('FOR1', function () {
                for ($i = 0; $i < 1000; $i++) {
                Severity: Minor
                Found in sample/MyApplication.php - About 1 hr to fix

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

                  public function query(DebugCommand $query): array
                  {
                  $result = ['type' => DebugData::TYPE_VALUE];
                  switch ($query->getQuery()) {
                  case 'killall':
                  Severity: Minor
                  Found in src/Standalone/Controller/ControllerDebugger.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language