Showing 14 of 118 total issues
File HolidaysList.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Cmixin\BusinessDay;
use Cmixin\BusinessDay\Util\Context;
File HolidayCalculator.php
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Cmixin\BusinessDay\Calculator;
use Cmixin\BusinessDay;
Function setHolidaysRegion
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function setHolidaysRegion()
{
$mixin = $this;
/**
- 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 matchYearCondition
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function matchYearCondition($dateTime, ?string &$condition): bool
{
if (!$condition || !preg_match(
'/^\s*year(?:\s*%\s*(?<modulo>\d+))?\s*(?<operator>>=?|<=?|={1,3}|!={1,2}|<>)\s*(?<expected>\d+)/',
$condition,
Method setHolidaysRegion
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setHolidaysRegion()
{
$mixin = $this;
/**
Function getHolidayDate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function getHolidayDate($key, $holiday)
{
$year = $this->year;
if ($key === null) {
- 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 handleModifiers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function handleModifiers($dateTime, $condition, $substitute, $after, $before)
Function isIgnoredYear
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function isIgnoredYear(&$holiday)
{
$mode = 'since';
$cap = 0;
$every = 0;
- 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 handleModifiers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function handleModifiers($dateTime, $condition, $substitute, $after, $before)
{
if ($condition && ($action = $this->getConditionalModifier(explode(' and ', $condition), $dateTime))) {
$dateTime = $dateTime->modify($action);
}
- 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
Avoid too many return
statements within this method. Open
return $value !== $expected;
Avoid too many return
statements within this method. Open
return $value === $expected;
Avoid too many return
statements within this method. Open
return $value <= $expected;
Function boot
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function boot()
{
$config = $this->app->get('config')->get('carbon.holidays');
if ($config instanceof Closure) {
- 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 initializeHolidaysRegion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function initializeHolidaysRegion($region = null)
{
if ($region) {
$region = call_user_func($this->standardizeHolidaysRegion(), $region);
- 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"