Showing 13 of 228 total issues
Function parseMethodDoc
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
private function parseMethodDoc(
string $name,
int $length,
string $className,
string $defaultClass,
- 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 getScheduleDoc
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getScheduleDoc($defaultClass, $source, $boot)
{
$methods = [];
$source = str_replace('\\', '/', realpath($source));
$sourceLength = strlen($source);
Function getScheduleDoc
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getScheduleDoc($defaultClass, $source, $boot)
{
$methods = [];
$source = str_replace('\\', '/', realpath($source));
$sourceLength = strlen($source);
- 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 parseMethodDoc
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseMethodDoc(
string $name,
int $length,
string $className,
string $defaultClass,
Method enable
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function enable($carbonClass = null, $defaultOpeningHours = null)
{
if ($carbonClass === null) {
return static function () {
return true;
Method create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create(array $openingHours): self
{
$businessTime = new self();
$parser = new DefinitionParser($businessTime, $openingHours, function ($date) use ($businessTime) {
if ($date instanceof CarbonInterface) {
Consider simplifying this complex logical expression. Open
if ((
(!$mode || $mode === $mixin::LOCAL_MODE) &&
($date = end(static::$macroContextStack)) &&
($hours = $mixin->getOpeningHours($mixin::LOCAL_MODE, $date))
) ||
Function create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function create(array $openingHours): self
{
$businessTime = new self();
$parser = new DefinitionParser($businessTime, $openingHours, function ($date) use ($businessTime) {
if ($date instanceof CarbonInterface) {
- 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 enable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function enable($carbonClass = null, $defaultOpeningHours = null)
{
if ($carbonClass === null) {
return static function () {
return true;
- 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 deeply nested control flow statements. Open
if (preg_match('/^(public|protected)\s+function\s+(\S+)\(.*\)(\s*\{)?$/', trim($code[$i]), $match)) {
break;
}
Avoid deeply nested control flow statements. Open
for ($i = $length - 2; $i >= max(0, $length - 42); $i--) {
$doc = $lines[$i].$doc;
if (preg_match('/\s*\/\*{2,}\s*/', $lines[$i])) {
$methodDocBlock = trim($doc) ?: $methodDocBlock;
Method parseMethodDoc
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
int $length,
string $className,
string $defaultClass,
array $code,
Function getOpeningHours
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getOpeningHours($mode = null, $context = null)
{
switch ($mode) {
case static::GLOBAL_MODE:
return $this->openingHours;
- 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"