Missing class import via use statement (line '283', column '26'). Open
$promotion = new \Chamilo\CoreBundle\Entity\Promotion();
- 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 '235', column '23'). Open
$career = new Career();
- 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 '207', column '21'). Open
$form = new FormValidator('promotion', 'post', $url);
- 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 delete uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return false;
}
- 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 return_form uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$form->addButtonCreate(get_lang('Add'), 'submit');
}
- 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 copy uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pid = $this->save($new);
}
- 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 parameters such as '$showQuery'. Open
public function save($params, $showQuery = false)
- 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
The parameter $career_id is not named in camelCase. Open
public function get_all_promotions_by_career_id($career_id, $order = false)
{
return Database::select(
'*',
$this->table,
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $copy_sessions is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $career_id is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $promotion_id is not named in camelCase. Open
public function update_all_sessions_status_by_promotion_id(
$promotion_id,
$status
) {
$sessionList = SessionManager::get_all_sessions_by_promotion($promotion_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Method name "Promotion::get_all_promotions_by_career_id" is not in camel caps format Open
public function get_all_promotions_by_career_id($career_id, $order = false)
- Exclude checks
Variable "career_list" is not in valid camel caps format Open
$career_list,
- Exclude checks
Variable "status_list" is not in valid camel caps format Open
$form->addSelect('status', get_lang('Status'), $status_list);
- Exclude checks
Variable "career_id" is not in valid camel caps format Open
public function get_all_promotions_by_career_id($career_id, $order = false)
- Exclude checks
Variable "promotion_id" is not in valid camel caps format Open
$promotion_id,
- Exclude checks
Variable "promotion_id" is not in valid camel caps format Open
$sessionList = SessionManager::get_all_sessions_by_promotion($promotion_id);
- Exclude checks
Variable "career_id" is not in valid camel caps format Open
if (!empty($career_id)) {
- Exclude checks
Missing parameter name Open
* @param int career id
- Exclude checks
Variable "session_list" is not in valid camel caps format Open
foreach ($session_list as $item) {
- Exclude checks
Expected 14 spaces after parameter type; 1 found Open
* @param bool $order
- Exclude checks
Variable "career_id" is not in valid camel caps format Open
'where' => ['career_id = ?' => $career_id],
- Exclude checks
Method name "Promotion::return_form" is not in camel caps format Open
public function return_form($url, $action = 'add')
- Exclude checks
Variable "career_list" is not in valid camel caps format Open
$career_list[$item['id']] = $item['name'];
- Exclude checks
Variable "career_id" is not in valid camel caps format Open
$val = (int) $career_id;
- Exclude checks
Method name "Promotion::get_status_list" is not in camel caps format Open
public function get_status_list(): array
- Exclude checks
Method name "Promotion::get_count" is not in camel caps format Open
public function get_count()
- Exclude checks
Missing parameter name Open
* @param int Promotion ID
- Exclude checks
Variable "career_id" is not in valid camel caps format Open
public function copy($id, $career_id = null, $copy_sessions = false)
- Exclude checks
Variable "copy_sessions" is not in valid camel caps format Open
public function copy($id, $career_id = null, $copy_sessions = false)
- Exclude checks
Variable "new_session_list" is not in valid camel caps format Open
$new_session_list = [];
- Exclude checks
Method name "Promotion::update_all_sessions_status_by_promotion_id" is not in camel caps format Open
public function update_all_sessions_status_by_promotion_id(
- Exclude checks
Variable "copy_sessions" is not in valid camel caps format Open
if ($copy_sessions) {
- Exclude checks
Variable "session_list" is not in valid camel caps format Open
$session_list = SessionManager::get_all_sessions_by_promotion($id);
- Exclude checks
Variable "session_list" is not in valid camel caps format Open
if (!empty($session_list)) {
- Exclude checks
Missing parameter name Open
* @param int Career ID, in case we want to change it
- Exclude checks
Variable "new_session_list" is not in valid camel caps format Open
$new_session_list[] = $sid;
- Exclude checks
Variable "new_session_list" is not in valid camel caps format Open
$new_session_list
- Exclude checks
Variable "career_list" is not in valid camel caps format Open
$career_list = [];
- Exclude checks
Missing parameter name Open
* @param bool Whether or not to copy the sessions inside
- Exclude checks
Variable "new_session_list" is not in valid camel caps format Open
if (!empty($new_session_list)) {
- Exclude checks
Missing function doc comment Open
public function get_status_list(): array
- Exclude checks
Variable "status_list" is not in valid camel caps format Open
$status_list = $this->get_status_list();
- Exclude checks
The variable $promotion_id is not named in camelCase. Open
public function update_all_sessions_status_by_promotion_id(
$promotion_id,
$status
) {
$sessionList = SessionManager::get_all_sessions_by_promotion($promotion_id);
- 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 $career_list is not named in camelCase. Open
public function return_form($url, $action = 'add')
{
$form = new FormValidator('promotion', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
- 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 $career_list is not named in camelCase. Open
public function return_form($url, $action = 'add')
{
$form = new FormValidator('promotion', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
- 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 $session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $career_list is not named in camelCase. Open
public function return_form($url, $action = 'add')
{
$form = new FormValidator('promotion', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
- 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 $new_session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $career_id is not named in camelCase. Open
public function get_all_promotions_by_career_id($career_id, $order = false)
{
return Database::select(
'*',
$this->table,
- 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 $new_session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $status_list is not named in camelCase. Open
public function return_form($url, $action = 'add')
{
$form = new FormValidator('promotion', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
- 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 $new_session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $copy_sessions is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $new_session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $status_list is not named in camelCase. Open
public function return_form($url, $action = 'add')
{
$form = new FormValidator('promotion', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
- 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 $career_id is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $session_list is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 $career_id is not named in camelCase. Open
public function copy($id, $career_id = null, $copy_sessions = false)
{
$pid = false;
$promotion = $this->get($id);
if (!empty($promotion)) {
- 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 method get_all_promotions_by_career_id is not named in camelCase. Open
public function get_all_promotions_by_career_id($career_id, $order = false)
{
return Database::select(
'*',
$this->table,
- 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() {
}
}
Source
The method update_all_sessions_status_by_promotion_id is not named in camelCase. Open
public function update_all_sessions_status_by_promotion_id(
$promotion_id,
$status
) {
$sessionList = SessionManager::get_all_sessions_by_promotion($promotion_id);
- 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() {
}
}
Source
The method return_form is not named in camelCase. Open
public function return_form($url, $action = 'add')
{
$form = new FormValidator('promotion', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
- 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() {
}
}
Source
The method get_count is not named in camelCase. Open
public function get_count()
{
$row = Database::select(
'count(*) as count',
$this->table,
- 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() {
}
}
Source
The method get_status_list is not named in camelCase. Open
public function get_status_list(): array
{
return [
PromotionEntity::PROMOTION_STATUS_ACTIVE => get_lang('active'),
PromotionEntity::PROMOTION_STATUS_INACTIVE => get_lang('inactive'),
- 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() {
}
}