gjerokrsteski/reactphp-pimf

View on GitHub

Showing 24 of 24 total issues

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

    public function __invoke($requestBody = '')
    {
        $this->response->writeHead(200, ['Content-Type' => 'application/json; charset=utf-8']);

        return $this->response->end(Json::encode([
Severity: Minor
Found in app/Articles/Service/ListApiUsageOptions.php - About 1 hr to fix

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

        public function __invoke($requestBody = '')
        {
            $this->request->on('data', function ($requestBody) {
    
                $route = new Route('/articles/:id');
    Severity: Minor
    Found in app/Articles/Service/UpdateExistingArticle.php - About 1 hr to fix

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

          public function __invoke(ReactiveRequest $request, ReactiveResponse $response)
          {
              $this->request = $request;
              $this->response = $response;
      
      
      Severity: Minor
      Found in app/Articles/Application/Dispatcher.php - About 1 hr to fix

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

            public function __invoke($requestBody = '')
            {
                $this->request->on('data', function ($requestBody) {
        
                    $route = new Route('/articles/:id');
        Severity: Minor
        Found in app/Articles/Service/CreateNewArticle.php - About 1 hr to fix

          Avoid variables with short names like $id. Configured minimum length is 3.
          Open

                  $id = $requestData->get('id');

          Since: PHPMD 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: http://phpmd.org/rules/naming.txt

          Avoid variables with short names like $id. Configured minimum length is 3.
          Open

                  $id = (int)$this->pdo->lastInsertId();
          Severity: Minor
          Found in app/Articles/DataMapper/Article.php by phpmd

          Since: PHPMD 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: http://phpmd.org/rules/naming.txt

          Avoid variables with short names like $id. Configured minimum length is 3.
          Open

              protected $id;
          Severity: Minor
          Found in app/Articles/Model/Article.php by phpmd

          Since: PHPMD 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: http://phpmd.org/rules/naming.txt

          Avoid variables with short names like $id. Configured minimum length is 3.
          Open

                  $id = $query->get('id');

          Since: PHPMD 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: http://phpmd.org/rules/naming.txt

          Avoid too many return statements within this method.
          Open

                      return $this->response->end();
          Severity: Major
          Found in app/Articles/Service/UpdateExistingArticle.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $routeTo(new WriteAllowedRequestMethods($this->response));
            Severity: Major
            Found in app/Articles/Application/Dispatcher.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return $routeTo(new DeleteExistingArticle($this->entityManager, $this->request, $this->response));
              Severity: Major
              Found in app/Articles/Application/Dispatcher.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $this->response->end();
                Severity: Major
                Found in app/Articles/Service/DeleteExistingArticle.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $routeTo(new ListApiUsageOptions($this->response));
                  Severity: Major
                  Found in app/Articles/Application/Dispatcher.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $this->response->end();
                    Severity: Major
                    Found in app/Articles/Service/CreateNewArticle.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return $this->response->end(Json::encode($article->toArray()));
                      Severity: Major
                      Found in app/Articles/Service/FindExistingArticle.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $routeTo(new UpdateExistingArticle($this->entityManager, $this->request, $this->response));
                        Severity: Major
                        Found in app/Articles/Application/Dispatcher.php - About 30 mins to fix

                          Avoid using static access to class '\Pimf\Uri' in method '__invoke'.
                          Open

                                  Uri::setup($this->request->getPath(), $this->request->getPath());

                          Since: PHPMD 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: http://phpmd.org/rules/cleancode.txt

                          Avoid unused parameters such as '$requestBody'.
                          Open

                              public function __invoke($requestBody = '')

                          Since: PHPMD 0.2

                          Avoid passing parameters to methods or constructors and then not using those parameters.

                          Example:

                          class Foo
                            {
                                private function bar($howdy)
                                {
                                    // $howdy is not used
                                }
                            }

                          Source: http://phpmd.org/rules/unusedcode.txt

                          Avoid using static access to class '\Pimf\Util\Json' in method '__invoke'.
                          Open

                                  return $this->response->end(Json::encode([
                          
                                      'create new article' => [
                                          'url' => '/articles',
                                          'method' => 'POST',

                          Since: PHPMD 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: http://phpmd.org/rules/cleancode.txt

                          Avoid using static access to class '\Pimf\Util\Json' in method '__invoke'.
                          Open

                                  return $this->response->end(Json::encode($article->toArray()));

                          Since: PHPMD 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: http://phpmd.org/rules/cleancode.txt

                          Severity
                          Category
                          Status
                          Source
                          Language