YetiForceCompany/YetiForceCRM

View on GitHub
app/Integrations/Magento/Controller.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '45', column '15').
Open

                throw new \App\Exceptions\AppException('ERR_CLASS_NOT_FOUND');

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 'App\Integrations\Magento\Config' in method 'updateStock'.
Open

        foreach (Config::getAllServers() as $serverId => $config) {

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 '\App\Integrations\Magento\Config' in method '__construct'.
Open

        $this->config = \App\Integrations\Magento\Config::getInstance($serverId);

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

Expected an object instance or the name of a class but saw expression with type 'Token'|string
Open

            $this->connector = new $className($this->config);

Reference to undeclared class \Token
Open

            $this->connector = new $className($this->config);
Severity: Critical
Found in app/Integrations/Magento/Controller.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

     * Connector with magento.

Line exceeds 120 characters; contains 182 characters
Open

 * The file is part of the paid functionality. Using the file is allowed only after purchasing a subscription. File modification allowed only with the consent of the system producer.

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

     * @var \App\Integrations\Magento\Config

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

     * Config.

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

    public $config;

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

     * Synchronize products.

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

        $orderSynchronizer = new Synchronizer\Order($this);

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

        foreach (Config::getAllServers() as $serverId => $config) {

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

        if (empty($this->connector)) {

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

            }

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

     * Synchronize categories for products.

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

    {

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

        $productSynchronizer = new Synchronizer\Product($this);

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

     * @throws AppException

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 synchronizeCurrencies(): void

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

        $invoiceSynchronizer->process();

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

    {

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

            $className = '\\App\\Integrations\\Magento\\Connector\\' . $this->config->get('connector') ?? 'Token';

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

     */

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

        $orderSynchronizer->process();

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

     */

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

        $customerSynchronizer = new Synchronizer\Customer($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

                throw new \App\Exceptions\AppException('ERR_CLASS_NOT_FOUND');

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

    public function __construct(int $serverId)

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 synchronizeCustomers(): void

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

        $customerSynchronizer->process();

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

     */

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

            $this->connector = new $className($this->config);

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

     * @param int $serverId

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

        $this->getConnector()->authorize();

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

        $productSynchronizer->process();

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

    }

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

            $customerSynchronizer = new Synchronizer\InventoryStock(new self($serverId));

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 void

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

     * Synchronize products.

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

    public function synchronizeInvoices(): void

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

    public function synchronizeOrders(): void

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

     * Synchronize currencies for products.

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

        $currencySynchronizer->process();

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

     * Synchronize orders.

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

     * @param int $product

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

                throw new AppException('ERR_CLASS_MUST_BE||\App\Integrations\Magento\Connector\Base');

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

    public function synchronizeCategories(): void

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 void

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

     */

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

            if (!class_exists($className)) {

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->connector;

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

    public function synchronizeProducts(): void

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

     * Constructor. Connect with magento and authorize.

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 void

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

            if (0 === (int) $config['status'] || 'None' === $config['storage_quantity_location']) {

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

     * @return void

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

    /**

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

     * Update inventory stock in all magento.

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

     * @param int $storageId

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

            $customerSynchronizer->product = $product;

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

            $customerSynchronizer->process();

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 static function updateStock(int $storageId, int $product): void

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 $connector;

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

    public function getConnector()

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

        }

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

        $categorySynchronizer = new Synchronizer\Category($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

     * Returns connector.

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

     * @return object

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

    /**

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

        $categorySynchronizer->process();

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

     * Synchronize orders.

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

     * @throws AppException

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

    {

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

                continue;

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

        $this->config = \App\Integrations\Magento\Config::getInstance($serverId);

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

        $currencySynchronizer = new Synchronizer\Currency($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

     * @throws AppException

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

    }

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

            if (!$this->connector instanceof \App\Integrations\Magento\Connector\Base) {

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

        $invoiceSynchronizer = new Synchronizer\Invoice($this);

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

            $customerSynchronizer->storageId = $storageId;

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

    }

There are no issues that match your filters.

Category
Status