Missing class import via use statement (line '173', column '29'). Open
$eval = new Evaluation();
- 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 get_evaluation uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$eval = new Evaluation();
$eval->set_category_id(-1);
$eval->set_date(api_get_utc_datetime()); // these values will be changed
$eval->set_weight(0); // when the link setter
- 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
Method name "EvalLink::has_results" is not in camel caps format Open
public function has_results()
- Exclude checks
Abstract class name is not prefixed with "Abstract" Open
abstract class EvalLink extends AbstractLink
- Exclude checks
Missing function doc comment Open
public function get_name()
- Exclude checks
Method name "EvalLink::get_description" is not in camel caps format Open
public function get_description()
- Exclude checks
Missing function doc comment Open
public function get_max()
- Exclude checks
Method name "EvalLink::add_linked_data" is not in camel caps format Open
public function add_linked_data()
- Exclude checks
Method name "EvalLink::needs_results" is not in camel caps format Open
public function needs_results()
- Exclude checks
Missing function doc comment Open
public function get_description()
- Exclude checks
Missing function doc comment Open
public function set_weight($weight)
- Exclude checks
Missing function doc comment Open
public function get_link()
- Exclude checks
Method name "EvalLink::get_link" is not in camel caps format Open
public function get_link()
- Exclude checks
Method name "EvalLink::needs_max" is not in camel caps format Open
public function needs_max()
- Exclude checks
Method name "EvalLink::delete_linked_data" is not in camel caps format Open
public function delete_linked_data()
- Exclude checks
Missing function doc comment Open
public function set_name($name)
- Exclude checks
Missing function doc comment Open
public function set_description($description)
- Exclude checks
Method name "EvalLink::get_max" is not in camel caps format Open
public function get_max()
- Exclude checks
Doc comment for parameter $userId does not match actual variable name $studentId Open
* @param int $userId
- Exclude checks
Method name "EvalLink::calc_score" is not in camel caps format Open
public function calc_score($studentId = null, $type = null)
- Exclude checks
Missing function doc comment Open
public function needs_name_and_description()
- Exclude checks
Method name "EvalLink::needs_name_and_description" is not in camel caps format Open
public function needs_name_and_description()
- Exclude checks
Missing function doc comment Open
public function set_visible($visible)
- Exclude checks
Missing function doc comment Open
public function add_linked_data()
- Exclude checks
Missing function doc comment Open
public function set_max($max)
- Exclude checks
You must use "/**" style comments for a function comment Open
public function set_date($date)
- Exclude checks
Method name "EvalLink::set_weight" is not in camel caps format Open
public function set_weight($weight)
- Exclude checks
Method name "EvalLink::get_name" is not in camel caps format Open
public function get_name()
- Exclude checks
Method name "EvalLink::get_evaluation" is not in camel caps format Open
protected function get_evaluation()
- Exclude checks
Variable "ref_id" is not in valid camel caps format Open
if (isset($this->ref_id)) {
- Exclude checks
Method name "EvalLink::set_max" is not in camel caps format Open
public function set_max($max)
- Exclude checks
Missing function doc comment Open
public function save_linked_data()
- Exclude checks
Method name "EvalLink::set_description" is not in camel caps format Open
public function set_description($description)
- Exclude checks
Method name "EvalLink::set_date" is not in camel caps format Open
public function set_date($date)
- Exclude checks
Variable "created_at" is not in valid camel caps format Open
$this->created_at = $date;
- Exclude checks
Method name "EvalLink::is_valid_link" is not in camel caps format Open
public function is_valid_link()
- Exclude checks
Missing function doc comment Open
public function needs_max()
- Exclude checks
Method name "EvalLink::set_name" is not in camel caps format Open
public function set_name($name)
- Exclude checks
Missing function doc comment Open
public function is_valid_link()
- Exclude checks
Missing function doc comment Open
public function needs_results()
- Exclude checks
Method name "EvalLink::save_linked_data" is not in camel caps format Open
public function save_linked_data()
- Exclude checks
Missing function doc comment Open
public function delete_linked_data()
- Exclude checks
Method name "EvalLink::set_visible" is not in camel caps format Open
public function set_visible($visible)
- Exclude checks
The method needs_name_and_description is not named in camelCase. Open
public function needs_name_and_description()
{
return true;
}
- 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 set_date is not named in camelCase. Open
public function set_date($date)
{
$this->created_at = $date;
if ($this->is_valid_link()) {
$this->evaluation->set_date($date);
- 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 set_description is not named in camelCase. Open
public function set_description($description)
{
if ($this->is_valid_link()) {
$this->evaluation->set_description($description);
}
- 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_evaluation is not named in camelCase. Open
protected function get_evaluation()
{
if (!isset($this->evaluation)) {
if (isset($this->ref_id)) {
$evalarray = Evaluation::load($this->get_ref_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 add_linked_data is not named in camelCase. Open
public function add_linked_data()
{
if ($this->is_valid_link()) {
$this->evaluation->add();
$this->set_ref_id($this->evaluation->get_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 needs_max is not named in camelCase. Open
public function needs_max()
{
return true;
}
- 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_link is not named in camelCase. Open
public function get_link()
{
$eval = $this->get_evaluation();
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit()) {
- 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_name is not named in camelCase. Open
public function get_name()
{
$eval = $this->get_evaluation();
return $eval->get_name();
- 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 is_valid_link is not named in camelCase. Open
public function is_valid_link()
{
$eval = $this->get_evaluation();
return isset($eval);
- 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 save_linked_data is not named in camelCase. Open
public function save_linked_data()
{
if ($this->is_valid_link()) {
$this->evaluation->save();
}
- 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 set_name is not named in camelCase. Open
public function set_name($name)
{
if ($this->is_valid_link()) {
$this->evaluation->set_name($name);
}
- 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 set_max is not named in camelCase. Open
public function set_max($max)
{
if ($this->is_valid_link()) {
$this->evaluation->set_max($max);
}
- 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 has_results is not named in camelCase. Open
public function has_results()
{
$eval = $this->get_evaluation();
return $eval->has_results();
- 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_description is not named in camelCase. Open
public function get_description()
{
$eval = $this->get_evaluation();
return $eval->get_description();
- 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 needs_results is not named in camelCase. Open
public function needs_results()
{
return true;
}
- 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 delete_linked_data is not named in camelCase. Open
public function delete_linked_data()
{
if ($this->is_valid_link()) {
$this->evaluation->delete_with_results();
}
- 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_max is not named in camelCase. Open
public function get_max()
{
$eval = $this->get_evaluation();
return $eval->get_max();
- 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 set_weight is not named in camelCase. Open
public function set_weight($weight)
{
$this->weight = $weight;
if ($this->is_valid_link()) {
$this->evaluation->set_weight($weight);
- 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 set_visible is not named in camelCase. Open
public function set_visible($visible)
{
$this->visible = $visible;
if ($this->is_valid_link()) {
$this->evaluation->set_visible($visible);
- 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 calc_score is not named in camelCase. Open
public function calc_score($studentId = null, $type = null)
{
$eval = $this->get_evaluation();
return $eval->calc_score($studentId, $type);
- 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() {
}
}