The method sendPendingMessages() has an NPath complexity of 933192. The configured NPath complexity threshold is 200. Open
public function sendPendingMessages(int $urlId, bool $debug = false): int
{
if (!$this->allowed()) {
if ($debug) {
error_log('Announcements not allowed.');
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
Avoid using undefined variables such as '$tags' which will lead to PHP notices. Open
$tags['(('.strtolower($extraField['variable']).'))'] = $valueExtra['value'] ?? '';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$tags' which will lead to PHP notices. Open
$message = str_replace(array_keys($tags), $tags, $message);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$tags' which will lead to PHP notices. Open
$message = str_replace(array_keys($tags), $tags, $message);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class ScheduledAnnouncementService has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class ScheduledAnnouncementService
{
public function __construct(
private readonly ScheduledAnnouncementRepository $announcementRepository,
private readonly AccessUrlRepository $accessUrlRepository,
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Avoid unused parameters such as '$announcement'. Open
private function buildCoachMessage($announcement, $generalCoaches, $message): string
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$courseInfo'. Open
private function buildMessage($announcement, Session $session, User $user, $courseInfo, $attachments, $progress): string
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Add a single space around assignment operators Open
declare(strict_types=1);
- Exclude checks
Missing class doc comment Open
class ScheduledAnnouncementService
- Exclude checks
Closing brace must be on a line by itself Open
) {}
- Exclude checks
Missing function doc comment Open
public function __construct(
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly EntityManager $em,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly AccessUrlRepository $accessUrlRepository,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly TranslatorInterface $translator
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly SettingsManager $settingsManager,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly SessionRepository $sessionRepository,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly MessageHelper $messageHelper,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly ScheduledAnnouncementRepository $announcementRepository,
- Exclude checks
Closing brace must be on a line by itself Open
) {}
- Exclude checks