timegridio/timegrid

View on GitHub
app/Http/Controllers/Manager/BusinessVacancyController.php

Summary

Maintainability
B
4 hrs
Test Coverage
A
97%

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

    public function create(Business $business)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s', $business->id));

Severity: Minor
Found in app/Http/Controllers/Manager/BusinessVacancyController.php - About 1 hr to fix

Method store has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function store(Business $business, Request $request)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s', $business->id));

Severity: Minor
Found in app/Http/Controllers/Manager/BusinessVacancyController.php - About 1 hr to fix

Method buildStatements has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function buildStatements(Service $service, HumanResource $humanResource, $weekdays, $startAt, $finishAt, $timezone)
Severity: Minor
Found in app/Http/Controllers/Manager/BusinessVacancyController.php - About 45 mins to fix

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

    public function store(Business $business, Request $request)
    {
        logger()->info(__METHOD__);
        logger()->info(sprintf('businessId:%s', $business->id));

Severity: Minor
Found in app/Http/Controllers/Manager/BusinessVacancyController.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

Avoid using static access to class '\Carbon\Carbon' in method 'store'.
Open

                $startAt = Carbon::parse($date.' '.$business->pref('start_at').' '.$business->timezone);

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 '\Illuminate\Support\Facades\Storage' in method 'recallStatements'.
Open

        if (!Storage::exists($this->getStatementsFile($businessId))) {

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 '\Illuminate\Support\Facades\Storage' in method 'recallStatements'.
Open

        return Storage::get(
            $this->getStatementsFile($businessId)
        );

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 '\JavaScript' in method 'create'.
Open

        JavaScript::put([
            'services'       => $business->services->pluck('slug')->all(),
            'humanresources' => $business->humanresources->pluck('slug')->all(),
            'lang'           => $this->getActiveLanguage($business->locale),
        ]);

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 '\Illuminate\Support\Facades\Storage' in method 'rememberStatements'.
Open

        return Storage::put(
            $this->getStatementsFile($businessId),
            $statements
        );

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 '\Carbon\Carbon' in method 'store'.
Open

                $finishAt = Carbon::parse($date.' '.$business->pref('finish_at').' '.$business->timezone);

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

Line exceeds 120 characters; contains 152 characters
Open

        $viewParams = compact('business', 'dates', 'advanced', 'template', 'servicesList', 'humanresourcesList', 'weekdaysList', 'startAt', 'finishAt');

Line exceeds 120 characters; contains 124 characters
Open

        $statements = $this->buildStatements($service, $humanResource, $weekdays, $startAt, $finishAt, $business->timezone);

Line exceeds 120 characters; contains 129 characters
Open

    protected function buildStatements(Service $service, HumanResource $humanResource, $weekdays, $startAt, $finishAt, $timezone)

There are no issues that match your filters.

Category
Status