The class ImsLtiPlugin has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13. Open
class ImsLtiPlugin extends Plugin
{
const TABLE_TOOL = 'plugin_ims_lti_tool';
const TABLE_PLATFORM = 'plugin_ims_lti_platform';
- 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 '489', column '20'). Open
$xml = new SimpleXMLElement($content);
- 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 '486', column '23'). Open
throw new Exception($this->get_lang('NoAccessToUrl'));
- 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 '493', column '23'). Open
throw new Exception($this->get_lang('LaunchUrlNotFound'));
- 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 '721', 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
The method getToolPublicKey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$publicKey = $tool->publicKey;
};
- 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 updateCourseTool uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$courseTool->setTarget('_self');
}
- 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 performActionsAfterConfigure uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($platform) {
$em->remove($platform);
}
}
- 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 getRoleScopeMentorAsArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$scope[] = (string) $userInfo['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
Missing function doc comment Open
public function trimParams(array &$params)
- Exclude checks
Doc comment for parameter $isVisible does not match actual variable name $course Open
* @param bool $isVisible
- Exclude checks
Doc comment for parameter $isVisible does not match actual variable name $course Open
* @param bool $isVisible
- Exclude checks
Method name "ImsLtiPlugin::get_name" is not in camel caps format Open
public function get_name()
- Exclude checks
Doc comment for parameter $generateIdForTool. does not match actual variable name $user Open
* @param bool $generateIdForTool. Optional. Set TRUE for LTI 1.x.
- Exclude checks
Missing function doc comment Open
public static function isInstructor()
- Exclude checks
Variable "course_settings" is not in valid camel caps format Open
$this->course_settings = [
- Exclude checks
Missing function doc comment Open
public static function getCoursesForParentTool(ImsLtiTool $tool, Session $session = null)
- Exclude checks
The method get_name is not named in camelCase. Open
public function get_name()
{
return 'ims_lti';
}
- 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() {
}
}