modules/Settings/CurrencyUpdate/models/AbstractBank.php
The method getRates has a boolean flag argument $cron, which is a certain sign of a Single Responsibility Principle violation. Open
Open
abstract public function getRates($currencies, $date, $cron = false);
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Saw unextractable annotation for comment '* @param <date> $date - date for which exchange is fetched'</date>
Open
Open
* @param <Date> $date - date for which exchange is fetched
- Exclude checks
Saw unextractable annotation for comment '* @param <array> $currencies - list of systems active currencies'</array>
Open
Open
* @param <Array> $currencies - list of systems active currencies
- Exclude checks
Avoid excessively long class names like Settings_CurrencyUpdate_AbstractBank_Model. Keep class name length under 40. Open
Open
abstract class Settings_CurrencyUpdate_AbstractBank_Model
{
// Returns bank name
abstract public function getName();
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
abstract class Settings_CurrencyUpdate_AbstractBank_Model
- Exclude checks
The class Settings_CurrencyUpdate_AbstractBank_Model is not named in CamelCase. Open
Open
abstract class Settings_CurrencyUpdate_AbstractBank_Model
{
// Returns bank name
abstract public function getName();
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
Open
// Returns bank name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
abstract public function getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
abstract public function getSupportedCurrencies();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
// Returns url sources from where exchange rates are taken from
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
// Returns list of currencies supported by this bank
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
abstract public function getMainCurrencyCode();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
abstract public function getSource();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
// Returns banks main currency
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Fetch exchange rates.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param <Date> $date - date for which exchange is fetched
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
abstract public function getRates($currencies, $date, $cron = false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param <Array> $currencies - list of systems active currencies
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param bool $cron - if true then it is fired by server and crms currency conversion rates are updated
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Class name "Settings_CurrencyUpdate_AbstractBank_Model" is not in camel caps format Open
Open
abstract class Settings_CurrencyUpdate_AbstractBank_Model
- Exclude checks