foothing/laravel-simple-pageviews

View on GitHub
src/Parser.php

Summary

Maintainability
B
5 hrs
Test Coverage

Method parse has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parse($startOrShortcut = null, $end = null) {
        if (! $startOrShortcut) {
            $startOrShortcut = 'currentYear';
        }

Severity: Major
Found in src/Parser.php - About 2 hrs to fix

    Avoid too many return statements within this method.
    Open

            return new DateFilter(
                'default',
                new Carbon($startOrShortcut),
                null
            );
    Severity: Major
    Found in src/Parser.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return new DateFilter(
                      $startOrShortcut,
                      Carbon::now()->startOfYear(),
                      Carbon::now()->endOfYear()
                  );
      Severity: Major
      Found in src/Parser.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return new DateFilter(
                        'default',
                        new Carbon($startOrShortcut),
                        new Carbon($end)
                    );
        Severity: Major
        Found in src/Parser.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return [
                          new Carbon($startOrShortcut),
                          new Carbon($end),
                      ];
          Severity: Major
          Found in src/Parser.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return [
                            Carbon::now()->startOfYear(),
                            Carbon::now()->endOfYear()
                        ];
            Severity: Major
            Found in src/Parser.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return [
                          new Carbon($startOrShortcut),
                          null
                      ];
              Severity: Major
              Found in src/Parser.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status