Showing 6 of 6 total issues
The class Carton has 12 public methods. Consider refactoring Carton to keep number of public methods under 10. Open
class Carton extends ObjectAbstract implements CartonInterface
{
use SessionAwareTrait;
/**
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Avoid using short method names like FileHandler::gc(). The configured minimum method name length is 3. Open
public function gc(/*# int */ $maxlifetime)/*# : bool */
{
return true;
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like StorageHandler::gc(). The configured minimum method name length is 3. Open
public function gc(/*# int */ $maxlifetime)/*# : bool */
{
return true;
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Missing class import via use statement (line '236', column '43'). Open
$this->data[$namespace] = new \ArrayObject(
- 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
Remove error control operator '@' on line 131. Open
public function read(/*# string */ $session_id)/*# : string */
{
$file = $this->getSessionFile($session_id);
$content = @file_get_contents($file);
if (false === $content) {
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '150', column '20'). Open
return new \ArrayIterator($this->data());
- 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();
}