mrcnpdlk/xmdb-api

View on GitHub

Showing 23 of 93 total issues

Function searchByTitleNative has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public function searchByTitleNative(string $title): array
    {
        try {
            /**
             * @var Title[] $answer
Severity: Minor
Found in src/Imdb.php - About 6 hrs 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 searchByTitleNative has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function searchByTitleNative(string $title): array
    {
        try {
            /**
             * @var Title[] $answer
Severity: Major
Found in src/Imdb.php - About 4 hrs to fix

    Method getTvShow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getTvShow(int $id): TvShowTitle
        {
            try {
                $tData = $this->oTmdbClient
                    ->getTvApi()
    Severity: Major
    Found in src/Tmdb.php - About 2 hrs to fix

      File Tmdb.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * xMDB-API
       *
       * Copyright © 2017 pudelek.org.pl
      Severity: Minor
      Found in src/Tmdb.php - About 2 hrs to fix

        Method getByImdbId has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getByImdbId(string $imdbId = null)
            {
                try {
                    $this->oLog->info(sprintf('Searching: %s', $imdbId));
                    if ($imdbId === null || $imdbId === '') {
        Severity: Major
        Found in src/Tmdb.php - About 2 hrs to fix

          Method getMovie has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getMovie(int $id): Model\Tmdb\Movie\Title
              {
                  try {
                      $tData                = $this->oTmdbClient->getMoviesApi()->getMovie($id, [
                          'language'      => $this->oClient->getLang(),
          Severity: Major
          Found in src/Tmdb.php - About 2 hrs to fix

            File Imdb.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * xMDB-API
             *
             * Copyright © 2017 pudelek.org.pl
            Severity: Minor
            Found in src/Imdb.php - About 2 hrs to fix

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

                  public function getRating(string $imdbId): Rating
                  {
                      try {
                          $searchUrl = 'http://p.media-imdb.com/static-content/documents/v1/title/'
                              . $imdbId
              Severity: Minor
              Found in src/Imdb.php - About 1 hr to fix

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

                    public function searchByTitle(string $title)
                    {
                        try {
                            /**
                             * @var Title[] $answer
                Severity: Minor
                Found in src/Tmdb.php - About 1 hr to fix

                  Method create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function create(\stdClass $oData)
                      {
                          $oTitle                   = new static();
                          $oTitle->title            = $oData->Title;
                          $oTitle->titleOrg         = $oData->Title;
                  Severity: Minor
                  Found in src/Model/Omdb/Title.php - About 1 hr to fix

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

                        public function searchByTitleApi(string $title): array
                        {
                            try {
                                $answer = [];
                                $tList  = $this->getApiTitleSearch()->search($title, [
                    Severity: Minor
                    Found in src/Imdb.php - About 1 hr to fix

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

                          public function getByImdbId(string $imdbId, Ratio $oRatio = null)
                          {
                              try {
                                  $oResp = $this->oClient->getAdapter()->useCache(
                                      function () use ($imdbId) {
                      Severity: Minor
                      Found in src/Omdb.php - About 1 hr to fix

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

                            public function getTvShow(int $id): TvShowTitle
                            {
                                try {
                                    $tData = $this->oTmdbClient
                                        ->getTvApi()
                        Severity: Minor
                        Found in src/Tmdb.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 getMovie has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getMovie(int $id): Model\Tmdb\Movie\Title
                            {
                                try {
                                    $tData                = $this->oTmdbClient->getMoviesApi()->getMovie($id, [
                                        'language'      => $this->oClient->getLang(),
                        Severity: Minor
                        Found in src/Tmdb.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 getByTitle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getByTitle(string $title)
                            {
                                try {
                                    $oResp = $this->oClient->getAdapter()->useCache(
                                        function () use ($title) {
                        Severity: Minor
                        Found in src/Omdb.php - About 1 hr to fix

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

                              public function searchByTitle(string $title, int $limit = null, Ratio $oRatio = null): array
                              {
                                  /**
                                   * @var Title[] $answer
                                   * @var Title[] $tmpList
                          Severity: Minor
                          Found in src/Imdb.php - About 1 hr to fix

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

                                public function calculateRatio(array $tTitles)
                                {
                                    $this->items = [];
                                    foreach ($tTitles as $item) {
                                        $fTitleRatio    = 0;
                            Severity: Minor
                            Found in src/Model/Ratio.php - About 1 hr to fix

                              Function calculateRatio has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function calculateRatio(array $tTitles)
                                  {
                                      $this->items = [];
                                      foreach ($tTitles as $item) {
                                          $fTitleRatio    = 0;
                              Severity: Minor
                              Found in src/Model/Ratio.php - About 55 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

                              Function searchByTitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function searchByTitle(string $title, int $limit = null, Ratio $oRatio = null): array
                                  {
                                      /**
                                       * @var Title[] $answer
                                       * @var Title[] $tmpList
                              Severity: Minor
                              Found in src/Imdb.php - About 55 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

                              Function getByImdbId has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getByImdbId(string $imdbId = null)
                                  {
                                      try {
                                          $this->oLog->info(sprintf('Searching: %s', $imdbId));
                                          if ($imdbId === null || $imdbId === '') {
                              Severity: Minor
                              Found in src/Tmdb.php - About 55 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