The class LtiProviderPlugin has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13. Open
class LtiProviderPlugin extends Plugin
{
public const TABLE_PLATFORM = 'plugin_lti_provider_platform';
public const LAUNCH_PATH = 'lti_provider/tool/start.php';
public const LOGIN_PATH = 'lti_provider/tool/login.php';
- 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
Missing class import via use statement (line '479', column '36'). Open
->setStartDate(new DateTime())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '543', column '20'). Open
return new SimpleXMLElement($request);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '167', column '25'). Open
$list = new LearnpathList(
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method performActionsAfterConfigure uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($platformKey) {
$em->remove($platformKey);
}
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method saveResult uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$objResult = new Result();
$objResult
->setIssuer($values['issuer'])
->setUserId($values['user_id'])
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pkHtml = $this->get_lang('GenerateKeyPairInfo');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused local variables such as '$key'. Open
foreach ($exerciseList as $key => $exercise) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused private methods such as 'getRequestXmlElement'. Open
private function getRequestXmlElement(): ?SimpleXMLElement
{
$request = file_get_contents("php://input");
if (empty($request)) {
- Read upRead up
- Exclude checks
UnusedPrivateMethod
Since: 0.2
Unused Private Method detects when a private method is declared but is unused.
Example
class Something
{
private function foo() {} // unused
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod
Missing parameter name Open
* @param $courseCode
- Exclude checks
Missing parameter name Open
* @param $label
- Exclude checks
Missing function doc comment Open
public function getToolProviderVars($clientId): array
- Exclude checks
Missing function doc comment Open
public function trimParams(array &$params)
- Exclude checks
Missing parameter name Open
* @param $toolId
- Exclude checks
Missing parameter name Open
* @param $userId
- Exclude checks
Method name "LtiProviderPlugin::get_name" is not in camel caps format Open
public function get_name(): string
- Exclude checks
Missing parameter name Open
* @param $id
- Exclude checks
Missing parameter name Open
* @param $value
- Exclude checks
Missing parameter name Open
* @param $startDate
- Exclude checks
Missing parameter name Open
* @param $endDate
- Exclude checks
Missing function doc comment Open
public function saveResult($values, $ltiLaunchId = null)
- Exclude checks
The method get_name is not named in camelCase. Open
public function get_name(): string
{
return 'lti_provider';
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}