Missing class import via use statement (line '114', column '23'). Open
$compilatio = new Compilatio();
- 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 sendDocument uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$filename = $documentUrl;
}
- 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 sendDocument uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo Display::return_message(get_lang('Error'), 'error');
}
- 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 sendDocument uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pieces = explode('/', $doc->url);
$nbPieces = count($pieces);
$filename = $pieces[$nbPieces - 1];
$compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, file_get_contents($filePath));
- 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
Multi-line function call not indented correctly; expected 28 spaces but found 32 Open
$compilatio->getWgetUri()
- Exclude checks
Consider putting global function "getFilename" in a static class Open
function getFilename($txt)
- Exclude checks
Variable "LocalWrkUrl" is not in valid camel caps format Open
file_get_contents($LocalWrkUrl)
- Exclude checks
Missing function doc comment Open
function sendDocument($documentId, $courseInfo)
- Exclude checks
Variable "WrkUrl" is not in valid camel caps format Open
$WrkUrl = $currentCourseRepositoryWeb.$doc->url;
- Exclude checks
Multi-line function call not indented correctly; expected 28 spaces but found 32 Open
'',
- Exclude checks
Multi-line function call not indented correctly; expected 24 spaces but found 28 Open
).'/'.$courseInfo['path'].'/'.$doc->url;
- Exclude checks
Missing parameter name Open
* @param $courseId
- Exclude checks
Missing function doc comment Open
function getFileExtension($filename)
- Exclude checks
Variable "LocalWrkUrl" is not in valid camel caps format Open
$LocalWrkUrl = $courseInfo['course_sys_path'].$doc->url;
- Exclude checks
Consider putting global function "sendDocument" in a static class Open
function sendDocument($documentId, $courseInfo)
- Exclude checks
Consider putting global function "getFileExtension" in a static class Open
function getFileExtension($filename)
- Exclude checks
Variable "WrkUrl" is not in valid camel caps format Open
$filename = $WrkUrl;
- Exclude checks
Missing function doc comment Open
function getWorkTitle($docId, $courseId)
- Exclude checks
Multi-line function call not indented correctly; expected 28 spaces but found 32 Open
'/$',
- Exclude checks
Missing parameter name Open
* @param $docId
- Exclude checks
Consider putting global function "workDocExtension" in a static class Open
function workDocExtension($docId, $courseId)
- Exclude checks
Consider putting global function "getWorkTitle" in a static class Open
function getWorkTitle($docId, $courseId)
- Exclude checks
Variable "work_folder" is not in valid camel caps format Open
$work_folder = getWorkFolder($urlFile);
- Exclude checks
Missing function doc comment Open
function compilatioUpdateWorkDocument($docId, $courseId)
- Exclude checks
Missing function doc comment Open
function getFilename($txt)
- Exclude checks
Consider putting global function "getWorkFolder" in a static class Open
function getWorkFolder($txt)
- Exclude checks
Consider putting global function "getShortFilename" in a static class Open
function getShortFilename($txt)
- Exclude checks
Variable "work_folder" is not in valid camel caps format Open
$sql = "UPDATE $workTable SET url='".$work_folder.$newestFilename."'
- Exclude checks
Consider putting global function "compilatioUpdateWorkDocument" in a static class Open
function compilatioUpdateWorkDocument($docId, $courseId)
- Exclude checks
Variable "_course" is not in valid camel caps format Open
$_course = api_get_course_info();
- Exclude checks
Variable "_course" is not in valid camel caps format Open
$coursePath = $_course['course_sys_path'];
- Exclude checks
Variable "urlFile_ext" is not in valid camel caps format Open
if ('' != $extensionFile && '' == $urlFile_ext) {
- Exclude checks
Missing function doc comment Open
function getShortFilename($txt)
- Exclude checks
Variable "work_folder" is not in valid camel caps format Open
rename($coursePath.$urlFile, $coursePath.$work_folder.$newestFilename);
- Exclude checks
Missing function doc comment Open
function getWorkFolder($txt)
- Exclude checks
Variable "urlFile_ext" is not in valid camel caps format Open
$urlFile_ext = getFileExtension($urlFile);
- Exclude checks
Multi-line function call not indented correctly; expected 28 spaces but found 32 Open
'',
- Exclude checks
Multi-line function call not indented correctly; expected 28 spaces but found 32 Open
'/$',
- Exclude checks
Multi-line function call not indented correctly; expected 28 spaces but found 32 Open
$compilatio->getWgetUri()
- Exclude checks
Multi-line function call not indented correctly; expected 24 spaces but found 28 Open
).'/'.$courseInfo['path'].'/'.$doc->url;
- Exclude checks
The variable $_course is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_course is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $work_folder is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $urlFile_ext is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $work_folder is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $urlFile_ext is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $work_folder is not named in camelCase. Open
function compilatioUpdateWorkDocument($docId, $courseId)
{
$_course = api_get_course_info();
$docId = (int) $docId;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}