Showing 14 of 33 total issues
Function withoutUnnamedGroups
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Confirmed
private function withoutUnnamedGroups(array $groupKeys): array
{
$names = [];
$lastWasString = false;
foreach ($groupKeys as $groupKey) {
- 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 consumeGroup
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Confirmed
private function consumeGroup(EntitySequence $entities): Entity
{
$groupDetails = new MatchedString($this->feed, $this->openGroupRegex, 6);
if (!$groupDetails->matched()) {
if ($this->imposedNonCapture($entities)) {
- 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 consumeGroup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private function consumeGroup(EntitySequence $entities): Entity
{
$groupDetails = new MatchedString($this->feed, $this->openGroupRegex, 6);
if (!$groupDetails->matched()) {
if ($this->imposedNonCapture($entities)) {
Method groupOpenRegex
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private function groupOpenRegex(): string
{
$namedGroup = "(?:<|P<|') [a-zA-Z0-9_\x80-\xFF@]* [>']?";
if (Pcre::pcre2()) {
$flags = '\^?[ismxnUJ]*(?:-[ismxnUJ]*)?';
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Subject $subject,
int $index,
GroupAware $groupAware,
Entry $matchEntry,
UsedForGroup $usedForGroup,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
public function __construct(Subject $subject, Signatures $signatures, int $index, MatchAllFactory $allFactory, GroupKeys $groupKeys, Prime $prime)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
public function __construct(Flags $flags, string $keyword, string $pattern, AutoCapture $autoCapture, SubpatternFlags $subpatternFlags)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
public function __construct(string $methodName, $pattern, string $message, PhpError $error, string $errorName)
Method create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
public static function create(Subject $subject,
int $index,
IRawMatchOffset $match,
MatchAllFactory $allFactory,
Prime $prime): MatchDetail
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
public function __construct(string $message, $pattern, string $methodName, int $errorCode, string $errorName)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
GroupAware $groupAware,
UsedForGroup $usedForGroup,
Signatures $signatures,
MatchAllFactory $allFactory,
Subject $subject)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
public function __construct(Feed $feed,
SubpatternFlags $flags,
GroupAutoCapture $autoCapture,
PlaceholderConsumer $placeholderConsumer,
Convention $convention)
Function cleanMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Confirmed
private function cleanMessage(string $message): string
{
if ($message === 'Null byte in regex') {
return 'Pattern may not contain null-byte';
}
- 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 matchedGroups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Confirmed
private function matchedGroups(): array
{
$result = \array_fill(0, $this->groups, null);
foreach ($this->matches as $index => [$text, $offset]) {
if ($index === 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"