Showing 33 of 33 total issues
Function addButtonRow
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function addButtonRow(...$buttons): self
{
foreach ($buttons as $button) {
if ($button->callback_data === null || !str_contains($button->callback_data, '@')) {
continue;
- 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 resolveNestedGroups
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveNestedGroups(
array $groups,
array $currentMiddlewares = [],
array $currentScopes = [],
array $currentTags = [],
Method parseHeaders
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseHeaders(string $headerContent): array
{
$headers = [];
$headerParts = preg_split('/\\R/s', $headerContent, -1, PREG_SPLIT_NO_EMPTY);
foreach ($headerParts as $headerPart) {
Function closeMenu
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function closeMenu(?string $finalText = null, array $opt = [], bool $reopen = false): bool|Message
{
if ($reopen) {
$this->chatId = $this->messageId = 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 wallpaperFreeformGradientPattern
has 7 arguments (exceeds 5 allowed). Consider refactoring. Open
string $slug,
int $intensity,
string $hexColor1,
string $hexColor2,
string $hexColor3,
Consider simplifying this complex logical expression. Open
if (
($subType !== null && $handler->getPattern() === $subType) ||
($value === null && $handler->getPattern() === null) ||
($value !== null && $handler->matching($value))
) {
Method publicMessage
has 6 arguments (exceeds 5 allowed). Consider refactoring. Open
string $username,
int $messageId,
?int $threadId = null,
bool $single = false,
?int $comment = null,
Method wallpaperGradientPattern
has 6 arguments (exceeds 5 allowed). Consider refactoring. Open
string $slug,
int $intensity,
string $topColor,
string $bottomColor,
int $rotation = 0,
Method privateMessage
has 6 arguments (exceeds 5 allowed). Consider refactoring. Open
int $chatId,
int $messageId,
?int $threadId = null,
bool $single = false,
?int $comment = null,
Function processUpdates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function processUpdates(Nutgram $bot): void
{
$config = $bot->getConfig();
$offset = 1;
- 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 hearUpdate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function hearUpdate(Update $update): self
{
if ($this->commonUser !== null) {
$update->setUser($this->commonUser);
}
- 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 applyGlobalMiddlewareTo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function applyGlobalMiddlewareTo(Handler $handler): void
{
$skippedGlobalMiddlewares = $handler->getSkippedGlobalMiddlewares();
if ($handler->isSkippingGlobalMiddlewares() && empty($skippedGlobalMiddlewares)) {
- 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 getReflectionClass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getReflectionClass(string $class, array $context = []): ReflectionClass
{
$reflectionClass = new ReflectionClass($class);
if ($reflectionClass->isAbstract()) {
- 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"