timegridio/concierge

View on GitHub

Showing 15 of 85 total issues

Appointment has 55 functions (exceeds 20 allowed). Consider refactoring.
Open

class Appointment extends EloquentModel implements HasPresenter
{
    /**
     * The attributes that are mass assignable.
     *
Severity: Major
Found in src/Models/Appointment.php - About 7 hrs to fix

    File Appointment.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Timegridio\Concierge\Models;
    
    use Carbon\Carbon;
    Severity: Minor
    Found in src/Models/Appointment.php - About 4 hrs to fix

      Business has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Business extends EloquentModel implements HasPresenter
      {
          use SoftDeletes, Preferenceable, IsIntoDomain;
      
          /**
      Severity: Minor
      Found in src/Models/Business.php - About 2 hrs to fix

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

            public function takeReservation(array $request)
            {
                $issuer = $request['issuer'];
                $service = $request['service'];
                $contact = $request['contact'];
        Severity: Minor
        Found in src/Concierge.php - About 1 hr to fix

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

              public function format($format = [])
              {
                  $this->tempInterval = $this->interval;
                  $hours = $this->getHours(PHP_ROUND_HALF_DOWN);
                  $this->interval = $this->tempInterval % (1000 * 60 * 60);
          Severity: Minor
          Found in src/Duration.php - About 1 hr to fix

            Method generateAppointment has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $issuerId,
                    $businessId,
                    $contactId,
                    $serviceId,
                    Carbon $startAt,
            Severity: Major
            Found in src/Concierge.php - About 1 hr to fix

              Function format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function format($format = [])
                  {
                      $this->tempInterval = $this->interval;
                      $hours = $this->getHours(PHP_ROUND_HALF_DOWN);
                      $this->interval = $this->tempInterval % (1000 * 60 * 60);
              Severity: Minor
              Found in src/Duration.php - About 45 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 cast has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function cast($value, $type)
                  {
                      switch ($type) {
                          case 'bool':
                              return boolval($value);
              Severity: Minor
              Found in src/Traits/Preferenceable.php - About 45 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

              Method publish has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function publish($date, Carbon $startAt, Carbon $finishAt, $serviceId, $capacity = 1)
              Severity: Minor
              Found in src/Vacancy/VacancyManager.php - About 35 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return serialize($value);
                Severity: Major
                Found in src/Traits/Preferenceable.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $value;
                  Severity: Major
                  Found in src/Traits/Preferenceable.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return unserialize($value);
                    Severity: Major
                    Found in src/Traits/Preferenceable.php - About 30 mins to fix

                      Function buildVacancies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function buildVacancies(array $vacancyParameters)
                          {
                              $services = $this->services($vacancyParameters['services']);
                              $days = $this->dates($vacancyParameters['days']);
                              $hourRanges = $this->hours($vacancyParameters['hours']);
                      Severity: Minor
                      Found in src/Vacancy/VacancyParser.php - About 25 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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function init()
                          {
                              $this->timetable = [];
                      
                              $dimensions['service'] = $this->inflateServices();
                      Severity: Minor
                      Found in src/Timetable/Timetable.php - About 25 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 processServiceStatements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function processServiceStatements($business, $date, $services)
                          {
                              $changed = false;
                              foreach ($services as $serviceSlug => $statements) {
                                  $service = $business->services()->where('slug', $serviceSlug)->get()->first();
                      Severity: Minor
                      Found in src/Vacancy/VacancyManager.php - About 25 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