Showing 106 of 106 total issues
Function parse
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function parse(string $report)
{
$lines = explode($this->line_delimiter, $report);
foreach ($lines as $line)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid excessively long variable names like $extension_class_instance. Keep variable name length under 20. Open
$extension_class_instance = new $extension_class;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $extension_class_instance. Keep variable name length under 20. Open
$extension_class_instance = new $extension_class;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Function boot
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function boot()
{
// If we are in debug mode, listen to database events
// and log queries to the log file.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getPackageLatestVersion
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function getPackageLatestVersion(string $vendor, string $package): string
{
// construct the packagist uri to its API
$packagist_url = sprintf('https://packagist.org/packages/%s/%s.json',
$vendor, $package);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function validate()
{
if ($this->isEmpty())
throw new EmptyReportException();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method evemail_threads
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function evemail_threads($message)
{
// Explode the messages based on the delimiter added
// by the EVE Online Client.
Method __construct
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(string $type, string $variation, ?int $id, int $size, array $attr = [], bool $lazy = true)
{
// Validate the arguments
if (! in_array($type, $this->known_types))
throw new EveImageException($type . ' is not a valid image type.');
Consider simplifying this complex logical expression. Open
if ($id > 90000000 && $id < 98000000)
return 'characters';
elseif (($id > 98000000 && $id < 99000000) || ($id > 1000000 && $id < 2000000))
return 'corporations';
Avoid using short method names like ConvertValueFromStringToText::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::table('global_settings', function (Blueprint $table) {
- 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 ConvertChineseLanguageValue::up(). The configured minimum method name length is 3. Open
public function up()
{
UserSetting::where([
['name', 'language'],
['value', '"cn"'],
- 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 CreateGlobalSettingsTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('global_settings', function (Blueprint $table) {
- 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 AlterHistoricalPricesColumns::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::table('historical_prices', function (Blueprint $table) {
- 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 CreateNotesTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('notes', function (Blueprint $table) {
- 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 CreateEveNotificationTypesTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('eve_notification_types', function (Blueprint $table) {
- 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 DropHistoricalPrices::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::dropIfExists('historical_prices');
}
- 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 MoveSettingsToGroups::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::table('user_settings', function (Blueprint $table) {
- 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 CreateHistoricalPricesTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('historical_prices', function (Blueprint $table) {
- 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 CreateUserSettingsTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('user_settings', function (Blueprint $table) {
- 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 CreateSchedulesTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('schedules', function (Blueprint $table) {
- 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
}
}