Method sendSms
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendSms($data)
{
// Mobile number
$receiver = array_key_exists('receiver', $data) ? $data['receiver'] : null;
if (! $receiver) {
Missing class import via use statement (line '81', column '23'). Open
throw new Notifier_Exception_NotificationSend($response->getBody()->getContents());
- 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 '73', column '23'). Open
$client = new GuzzleHttp\Client();
- 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 '121', column '23'). Open
$client = new GuzzleHttp\Client();
- 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 '93', column '23'). Open
throw new Notifier_Exception_NotificationSend('Phone is not determined to send notification SMS.');
- 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 '127', column '23'). Open
throw new \Pluf\Exception($response->getBody()->getContents());
- 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
Avoid using static access to class 'Tenant_Service' in method 'getToken'. Open
$secKey = Tenant_Service::setting(self::ENGINE_PARAMETER_SECRET_KEY, '');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method sendSms uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$param['MobileNumber'] = $receiver;
$param['Code'] = $code;
}
- 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 using static access to class 'Tenant_Service' in method 'sendSms'. Open
$templateId = (int) Tenant_Service::setting(self::ENGINE_PARAMETER_TEMPLATE_ID, 0);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Tenant_Service' in method 'getToken'. Open
$apiKey = Tenant_Service::setting(self::ENGINE_PARAMETER_API_KEY, '');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Notifier_Engine_SmsIr extends Notifier_Engine
- Exclude checks
The class Notifier_Engine_SmsIr is not named in CamelCase. Open
class Notifier_Engine_SmsIr extends Notifier_Engine
{
const ENGINE_PARAMETER_API_KEY = 'notifier.engine.SmsIr.ApiKey';
const ENGINE_PARAMETER_SECRET_KEY = 'notifier.engine.SmsIr.SecretKey';
const ENGINE_PARAMETER_TEMPLATE_ID = 'notifier.engine.SmsIr.TemplateId';
- 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
Whitespace found at end of line Open
*
- Exclude checks
Class name "Notifier_Engine_SmsIr" is not in camel caps format Open
class Notifier_Engine_SmsIr extends Notifier_Engine
- Exclude checks