YetiForceCompany/YetiForceCRM

View on GitHub
app/Integrations/SMSProvider/Provider.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\Settings_Vtiger_Module_Model' in method 'getEditViewUrl'.
Open

        $model = \Settings_Vtiger_Module_Model::getInstance('Settings:SMSNotifier');

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 unused parameters such as '$phoneNumber'.
Open

    public function setPhone(string $phoneNumber): self

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Call to method getInstance from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
Open

        return \App\Encryption::getInstance()->decrypt($this->get('api_key'));
Severity: Critical
Found in app/Integrations/SMSProvider/Provider.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     * Authorization.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        return [];

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return \Vtiger_Field_Model[]

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     * Send by record.

Spaces must be used to indent lines; tabs are not allowed
Open

        ];

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $phoneNumber

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    abstract public function send(): bool;

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string Url

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    abstract public function sendByRecord(\Vtiger_Record_Model $recordModel): bool;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getName(): string

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param \Vtiger_Record_Model $recordModel

Spaces must be used to indent lines; tabs are not allowed
Open

        return 'index.php?module=' . $model->getName() . '&parent=' . $model->getParentName() . "&view=Edit&provider={$this->name}";

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $url;

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string provider name

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getHeaders(): array

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    abstract public function getEditFields(): array;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * Set phone number.

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $name;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string[]

Spaces must be used to indent lines; tabs are not allowed
Open

        return \App\Encryption::getInstance()->decrypt($this->get('api_key'));

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Line exceeds 120 characters; contains 132 characters
Open

        return 'index.php?module=' . $model->getName() . '&parent=' . $model->getParentName() . "&view=Edit&provider={$this->name}";

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get Edit view url.

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Provider name | File name.

Spaces must be used to indent lines; tabs are not allowed
Open

     * Required fields.

Spaces must be used to indent lines; tabs are not allowed
Open

        $model = \Settings_Vtiger_Module_Model::getInstance('Settings:SMSNotifier');

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get provider name.

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     * Headers.

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        return [

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;

Spaces must be used to indent lines; tabs are not allowed
Open

            'Authorization' => 'Bearer ' . $this->getAuthorization(),

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getRequiredParams(): array

Spaces must be used to indent lines; tabs are not allowed
Open

    public function setPhone(string $phoneNumber): self

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string

Spaces must be used to indent lines; tabs are not allowed
Open

     * Address URL.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->name;

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Fields for edit view in settings.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getEditViewUrl(): string

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getAuthorization(): string

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string[]

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to handle SMS Send operation.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

            'Content-Type' => 'application/json',

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

There are no issues that match your filters.

Category
Status