NFarrington/vatsim-url-shortener

View on GitHub
app/Http/Controllers/Platform/UrlController.php

Summary

Maintainability
C
7 hrs
Test Coverage
A
98%

Method store has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

    public function store(Request $request)
    {
        $user = $request->user();
        $attributes = $this->getValidationFactory()->make(
            $request->all(),
Severity: Major
Found in app/Http/Controllers/Platform/UrlController.php - About 4 hrs to fix

File UrlController.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Http\Controllers\Platform;

use App\Entities\Domain;
Severity: Minor
Found in app/Http/Controllers/Platform/UrlController.php - About 3 hrs to fix

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

    public function store(Request $request)
    {
        $user = $request->user();
        $attributes = $this->getValidationFactory()->make(
            $request->all(),
Severity: Minor
Found in app/Http/Controllers/Platform/UrlController.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 update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update(Request $request, Url $url)
    {
        $this->authorize('update', $url);

        $attributes = $this->validate(
Severity: Minor
Found in app/Http/Controllers/Platform/UrlController.php - About 1 hr to fix

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

        SimpleDbClient $simpleDbClient,
        EntityManagerInterface $entityManager,
        UrlRepository $urlRepository,
        DomainRepository $domainRepository,
        OrganizationRepository $organizationRepository,
Severity: Minor
Found in app/Http/Controllers/Platform/UrlController.php - About 45 mins to fix

Avoid too many return statements within this method.
Open

        return redirect()->route('platform.urls.index')
            ->with('success', 'URL created.');
Severity: Major
Found in app/Http/Controllers/Platform/UrlController.php - About 30 mins to fix

There are no issues that match your filters.

Category
Status