Issues (55)

Model/Adapter/B2BinpayAdapterFactory.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace B2Binpay\Payment\Model\Adapter;
4
5
use Magento\Framework\ObjectManagerInterface;
0 ignored issues
show
The type Magento\Framework\ObjectManagerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use B2Binpay\Payment\Gateway\Config\Config;
7
use B2Binpay\Provider as B2BinpayAdapter;
0 ignored issues
show
The type B2Binpay\Provider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class B2BinpayAdapterFactory
10
{
11
    /**
12
     * @var ObjectManagerInterface
13
     */
14
    private $objectManager;
15
16
    /**
17
     * @var Config
18
     */
19
    private $config;
20
21
    /**
22
     * @param ObjectManagerInterface $objectManager
23
     * @param Config $config
24
     */
25
    public function __construct(ObjectManagerInterface $objectManager, Config $config)
26
    {
27
        $this->config = $config;
28
        $this->objectManager = $objectManager;
29
    }
30
31
    /**
32
     * Creates instance of B2Binpay Provider.
33
     *
34
     * @param int|null $storeId if null is provided as an argument, then current scope will be resolved
35
     * by \Magento\Framework\App\Config\ScopeCodeResolver (useful for most cases) but for adminhtml area the store
36
     * should be provided as the argument for correct config settings loading.
37
     * @param string|null $authKey
38
     * @param string|null $authSecret
39
     * @param bool|null $testing
40
     * @return B2BinpayAdapter
41
     */
42
    public function create(int $storeId = null, string $authKey = null, string $authSecret = null, bool $testing = null)
43
    {
44
        return $this->objectManager->create(
45
            B2BinpayAdapter::class,
46
            [
47
                'authKey' => $authKey ?? $this->config->getValue('auth_key', $storeId),
48
                'authSecret' => $authSecret ?? $this->config->getValue('auth_secret', $storeId),
49
                'testing' => $testing ?? ('1' === $this->config->getValue('debug', $storeId))
50
            ]
51
        );
52
    }
53
}
54