Showing 15 of 85 total issues
Appointment
has 55 functions (exceeds 20 allowed). Consider refactoring. Open
class Appointment extends EloquentModel implements HasPresenter
{
/**
* The attributes that are mass assignable.
*
File Appointment.php
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Timegridio\Concierge\Models;
use Carbon\Carbon;
Business
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Business extends EloquentModel implements HasPresenter
{
use SoftDeletes, Preferenceable, IsIntoDomain;
/**
Method takeReservation
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function takeReservation(array $request)
{
$issuer = $request['issuer'];
$service = $request['service'];
$contact = $request['contact'];
Method format
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function format($format = [])
{
$this->tempInterval = $this->interval;
$hours = $this->getHours(PHP_ROUND_HALF_DOWN);
$this->interval = $this->tempInterval % (1000 * 60 * 60);
Method generateAppointment
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$issuerId,
$businessId,
$contactId,
$serviceId,
Carbon $startAt,
Function format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function format($format = [])
{
$this->tempInterval = $this->interval;
$hours = $this->getHours(PHP_ROUND_HALF_DOWN);
$this->interval = $this->tempInterval % (1000 * 60 * 60);
- Read upRead up
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 cast
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function cast($value, $type)
{
switch ($type) {
case 'bool':
return boolval($value);
- Read upRead up
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 publish
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function publish($date, Carbon $startAt, Carbon $finishAt, $serviceId, $capacity = 1)
Avoid too many return
statements within this method. Open
return serialize($value);
Avoid too many return
statements within this method. Open
return $value;
Avoid too many return
statements within this method. Open
return unserialize($value);
Function buildVacancies
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function buildVacancies(array $vacancyParameters)
{
$services = $this->services($vacancyParameters['services']);
$days = $this->dates($vacancyParameters['days']);
$hourRanges = $this->hours($vacancyParameters['hours']);
- Read upRead up
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 init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function init()
{
$this->timetable = [];
$dimensions['service'] = $this->inflateServices();
- Read upRead up
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 processServiceStatements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function processServiceStatements($business, $date, $services)
{
$changed = false;
foreach ($services as $serviceSlug => $statements) {
$service = $business->services()->where('slug', $serviceSlug)->get()->first();
- Read upRead up
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"