visavi/rotor

View on GitHub

Showing 286 of 512 total issues

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

    public function restore(Request $request, Validator $validator)
    {
        if (getUser()) {
            setFlash('danger', __('main.already_authorized'));

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

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

        public function index(Request $request, Validator $validator)
        {
            $advert = AdminAdvert::query()
                ->where('user_id', getUser('id'))
                ->firstOrNew();
    Severity: Minor
    Found in app/Http/Controllers/Admin/AdminAdvertController.php - About 1 hr to fix

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

          public function handle()
          {
              $lang1 = $this->argument('lang1');
              $lang2 = $this->argument('lang2');
      
      
      Severity: Minor
      Found in app/Console/Commands/LangCompare.php - About 1 hr to fix

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

            public function delete(int $id, Request $request, Validator $validator): RedirectResponse
            {
                $del = intar($request->input('del'));
                $page = int($request->input('page'));
        
        
        Severity: Minor
        Found in app/Http/Controllers/Forum/TopicController.php - About 1 hr to fix

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

          function dateFixed(
              DateTimeInterface|int|null $timestamp,
              string $format = 'd.m.Y / H:i',
              bool $original = false,
          ): string {
          Severity: Minor
          Found in app/helpers.php - About 1 hr to fix

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

                public function uploadFile(Request $request, Validator $validator): JsonResponse
                {
                    $imageTypes = [
                        Article::$morphName,
                        Item::$morphName,
            Severity: Minor
            Found in app/Http/Controllers/AjaxController.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 index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function index(Request $request, Validator $validator)
                {
                    if ($request->isMethod('post')) {
                        $page = int($request->input('page', 1));
                        $choice = intar($request->input('choice'));
            Severity: Minor
            Found in app/Http/Controllers/Admin/ReglistController.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function create(int $id, Request $request, Validator $validator, Flood $flood): RedirectResponse
                {
                    $msg = $request->input('msg');
            
                    if (! $user = getUser()) {
            Severity: Minor
            Found in app/Http/Controllers/Forum/TopicController.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 parsePhpModules has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function parsePhpModules(): array
                {
                    ob_start();
                    phpinfo(INFO_MODULES);
                    $s = ob_get_clean();
            Severity: Minor
            Found in app/Http/Controllers/InstallController.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 makeCalendar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function makeCalendar(int $month, int $year): array
                {
                    $date = date('w', mktime(0, 0, 0, $month, 1, $year));
            
                    if ($date === '0') {
            Severity: Minor
            Found in app/Classes/Calendar.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 index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function index(Request $request, Validator $validator)
                {
                    $find = $request->input('find');
                    $type = $request->input('type') === 'title' ? 'title' : 'text';
                    $data = collect();
            Severity: Minor
            Found in app/Http/Controllers/Forum/SearchController.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 edit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
                {
                    if (! $user = getUser()) {
                        abort(403, __('main.not_authorized'));
                    }
            Severity: Minor
            Found in app/Http/Controllers/ArticleController.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 index has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function index(): View
                {
                    $count = statsCounter();
                    $online = statsOnline();
            
            
            Severity: Minor
            Found in app/Http/Controllers/CounterController.php - About 1 hr to fix

              Method index has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function index(Request $request, Validator $validator)
                  {
                      $find = $request->input('find');
                      $type = $request->input('type') === 'title' ? 'title' : 'text';
                      $data = collect();
              Severity: Minor
              Found in app/Http/Controllers/Forum/SearchController.php - About 1 hr to fix

                Method pagination has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function pagination(string $url = '/topics'): ?HtmlString
                    {
                        if (! $this->count_posts) {
                            return null;
                        }
                Severity: Minor
                Found in app/Models/Topic.php - About 1 hr to fix

                  Method users has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function users(string $login): Response
                      {
                          $user = getUserByLogin($login);
                  
                          if (! $user) {
                  Severity: Minor
                  Found in app/Http/Controllers/ApiController.php - About 1 hr to fix

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

                        public function edit(int $id, Request $request, Validator $validator)
                        {
                            if (! isAdmin(User::BOSS)) {
                                abort(403, __('errors.forbidden'));
                            }
                    Severity: Minor
                    Found in app/Http/Controllers/Admin/ArticleController.php - About 1 hr to fix

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

                          public function edit(int $id, Request $request, Validator $validator)
                          {
                              if (! isAdmin(User::BOSS)) {
                                  abort(403, __('errors.forbidden'));
                              }
                      Severity: Minor
                      Found in app/Http/Controllers/Admin/LoadController.php - About 1 hr to fix

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

                            public function zip(int $id): View
                            {
                                /** @var File $file */
                                $file = File::query()->where('relate_type', Down::$morphName)->find($id);
                                $down = $file?->relate;
                        Severity: Minor
                        Found in app/Http/Controllers/Load/DownController.php - About 1 hr to fix

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

                              public function edit(int $id, Request $request, Validator $validator)
                              {
                                  $offer = Offer::query()->where('id', $id)->first();
                          
                                  if (! $offer) {
                          Severity: Minor
                          Found in app/Http/Controllers/Admin/OfferController.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language