EscolaLMS/Webinar

View on GitHub
src/Repositories/Criteria/WebinarIncomingCriterion.php

Summary

Maintainability
A
1 hr
Test Coverage

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

    public function apply(Builder $query): Builder
    {
        if ($this->withDuration) {
            return $query
                ->where(function (Builder $query) {
Severity: Minor
Found in src/Repositories/Criteria/WebinarIncomingCriterion.php - About 1 hr to fix

    syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST)
    Open

        private ?bool $withDuration;

    Line exceeds 120 characters; contains 204 characters
    Open

                               WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'seconds' or SUBSTRING_INDEX(duration, ' ', -1) = 'second' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) SECOND )

    Line exceeds 120 characters; contains 172 characters
    Open

                               ->whereRaw("active_to + CASE WHEN (duration ~ '^\\d+$') THEN (duration || ' hours')::interval ELSE (duration)::interval END > ?", [$this->value])

    Line exceeds 120 characters; contains 204 characters
    Open

                               WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'minutes' or SUBSTRING_INDEX(duration, ' ', -1) = 'minute' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) MINUTE )

    Line exceeds 120 characters; contains 133 characters
    Open

                           ->where(fn (Builder $query) => $query->whereNull('duration')->where('webinars.active_to', '>', $this->value));

    Line exceeds 120 characters; contains 198 characters
    Open

                               WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'week' or SUBSTRING_INDEX(duration, ' ', -1) = 'weeks' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) WEEK )

    Line exceeds 120 characters; contains 201 characters
    Open

                               WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'month' or SUBSTRING_INDEX(duration, ' ', -1) = 'months' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) MONTH )

    Line exceeds 120 characters; contains 198 characters
    Open

                               WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'year' or SUBSTRING_INDEX(duration, ' ', -1) = 'years' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) YEAR )

    Line exceeds 120 characters; contains 195 characters
    Open

                               WHEN SUBSTRING_INDEX(duration, ' ', -1) = 'days' or SUBSTRING_INDEX(duration, ' ', -1) = 'day' THEN DATE_ADD(active_to, INTERVAL SUBSTRING_INDEX(duration, ' ', 1) DAY )

    Space before opening parenthesis of function call prohibited
    Open

                           ->where(fn (Builder $query) => $query->whereNull('duration')->where('webinars.active_to', '>', $this->value));

    Line indented incorrectly; expected at least 20 spaces, found 19
    Open

                       $query = $query

    Line indented incorrectly; expected at least 24 spaces, found 23
    Open

                           return $query->orWhere(fn (Builder $query) => $query

    Space before opening parenthesis of function call prohibited
    Open

                           return $query->orWhere(fn (Builder $query) => $query

    Line indented incorrectly; expected at least 20 spaces, found 19
    Open

                       return $query->orWhere(fn (Builder $query) => $query

    Line indented incorrectly; expected 20 spaces, found 19
    Open

                       }

    Space before opening parenthesis of function call prohibited
    Open

                       return $query->orWhere(fn (Builder $query) => $query

    Line indented incorrectly; expected 20 spaces, found 19
    Open

                       if (DB::connection()->getPdo()->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'pgsql') {

    Line indented incorrectly; expected at least 25 spaces, found 23
    Open

                           );

    Line indented incorrectly; expected at least 20 spaces, found 19
    Open

                       );

    Expected 0 spaces before closing bracket; newline found
    Open

                           return $query->orWhere(fn (Builder $query) => $query

    Expected 0 spaces before closing bracket; newline found
    Open

                       return $query->orWhere(fn (Builder $query) => $query

    There are no issues that match your filters.

    Category
    Status