YetiForceCompany/YetiForceCRM

View on GitHub
modules/Calendar/models/ExportToIcal.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\App\Integrations\Dav\Calendar' in method 'output'.
Open

        $calendar = \App\Integrations\Dav\Calendar::createEmptyInstance();

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

Declaration of function sanitizeValues($arr) : array should be compatible with function sanitizeValues(array $recordValues) : array (parameter #1 with no type cannot replace original parameter with type 'array') defined in /code/app/Export/Records.php:300
Open

    public function sanitizeValues($arr): array

Call to method serialize from undeclared class \Sabre\VObject\Component\VCalendar
Open

        echo $calendar->getVCalendar()->serialize();
Severity: Critical
Found in modules/Calendar/models/ExportToIcal.php by phan

Call to undeclared method \App\Db\Query::all
Open

        $this->output([], $this->getExportQuery()->all());
Severity: Critical
Found in modules/Calendar/models/ExportToIcal.php by phan

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Calendar_ExportToIcal_Model extends \App\Export\Records

The class Calendar_ExportToIcal_Model is not named in CamelCase.
Open

class Calendar_ExportToIcal_Model extends \App\Export\Records
{
    /** {@inheritdoc} */
    protected $fileExtension = 'ics';

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

    protected $fileExtension = 'ics';

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

    public function exportData()

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

    /** {@inheritdoc} */

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

            $calendar->loadFromArray($row);

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

    {

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

    /** {@inheritdoc} */

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

            $calendar->createComponent();

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

    public function output($headers, $entries)

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 getExportContentType(): string

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

        $this->output([], $this->getExportQuery()->all());

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

        return 'text/calendar';

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

    /** {@inheritdoc} */

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

    /** {@inheritdoc} */

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

        echo $calendar->getVCalendar()->serialize();

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

    /** {@inheritdoc} */

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

    public function sanitizeValues($arr): array

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

        return $arr;

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

        $calendar = \App\Integrations\Dav\Calendar::createEmptyInstance();

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

        foreach ($entries as $row) {

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

    }

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

    {

Class name "Calendar_ExportToIcal_Model" is not in camel caps format
Open

class Calendar_ExportToIcal_Model extends \App\Export\Records

There are no issues that match your filters.

Category
Status