Showing 21 of 37 total issues
Method up
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
if (DB::connection()->getName() == 'mysql') {
DB::statement('ALTER TABLE news CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
DB::statement('ALTER TABLE url_analytics DROP FOREIGN KEY url_analytics_url_id_foreign');
- Create a ticketCreate a ticket
Method down
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function down()
{
if (DB::connection()->getName() == 'mysql') {
DB::statement('ALTER TABLE domain_organization DROP FOREIGN KEY FK_58E115F1115F0EE5');
DB::statement('ALTER TABLE domain_organization DROP FOREIGN KEY FK_58E115F132C8A3DE');
- Create a ticketCreate a ticket
User
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class User extends Entity implements Authenticatable
{
use RecordsCreatedAt, RecordsUpdatedAt, RoutesNotifications;
protected array $trackedProperties = [
- Create a ticketCreate a ticket
File UrlController.php
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers\Platform;
use App\Entities\Domain;
- Create a ticketCreate a ticket
Method verifyLogin
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function verifyLogin(Request $request)
{
try {
$accessToken = $this->provider->getAccessToken(
'authorization_code',
- Create a ticketCreate a ticket
Method handle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$this->simpleDbClient = app(SimpleDbClient::class);
$this->urlRepository = app(UrlRepository::class);
- Create a ticketCreate a ticket
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(),
- Read upRead up
- Create a ticketCreate a ticket
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(
- Create a ticketCreate a ticket
Method onFlush
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onFlush(OnFlushEventArgs $eventArgs)
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
- Create a ticketCreate a ticket
Function onFlush
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function onFlush(OnFlushEventArgs $eventArgs)
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
- Read upRead up
- Create a ticketCreate a ticket
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 findByUserOrTheirOrganizations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findByUserOrTheirOrganizations(
User $user,
string $orderBy = 'id',
string $order = 'ASC',
int $perPage = null,
- Create a ticketCreate a ticket
Function verifyLogin
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function verifyLogin(Request $request)
{
try {
$accessToken = $this->provider->getAccessToken(
'authorization_code',
- Read upRead up
- Create a ticketCreate a ticket
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 format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function format(array $record): string
{
if (empty($record['datetime'])) {
$record['datetime'] = gmdate('c');
}
- Read upRead up
- Create a ticketCreate a ticket
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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
SimpleDbClient $simpleDbClient,
EntityManagerInterface $entityManager,
UrlRepository $urlRepository,
DomainRepository $domainRepository,
OrganizationRepository $organizationRepository,
- Create a ticketCreate a ticket
Method findByUserOrTheirOrganizations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
User $user,
string $orderBy = 'id',
string $order = 'ASC',
int $perPage = null,
int $page = null
- Create a ticketCreate a ticket
Method findPublicOrOwnedByUser
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
User $user,
string $orderBy = 'id',
string $order = 'ASC',
int $perPage = null,
int $page = null
- Create a ticketCreate a ticket
Method findByUser
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
User $user,
string $orderBy = 'id',
string $order = 'ASC',
int $perPage = null,
int $page = null
- Create a ticketCreate a ticket
Function createUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function createUrl(User $user, Domain $domain)
{
if ($domain->isPublic()) {
return true;
}
- Read upRead up
- Create a ticketCreate a ticket
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 too many return
statements within this method. Open
return redirect()->route('platform.urls.index')
->with('success', 'URL created.');
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return redirect()->intended($this->redirectPath());
- Create a ticketCreate a ticket