FakeMerchant::getWorker()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * Yii2 extension for payment processing with Omnipay, Payum and more later.
4
 *
5
 * @link      https://github.com/hiqdev/yii2-merchant
6
 * @package   yii2-merchant
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\yii2\merchant\tests\unit;
12
13
use Yii;
14
15
class FakeMerchant extends \hiqdev\php\merchant\AbstractMerchant
16
{
17
    public $requestClass = 'hiqdev\yii2\merchant\tests\unit\FakeRequest';
18
19
    public $responseClass = 'hiqdev\yii2\merchant\tests\unit\FakeResponse';
20
21
    /**
22
     * Fake Gateway object.
23
     */
24
    protected $_worker;
25
26
    public function getWorker()
27
    {
28
        if ($this->_worker === null) {
29
            $this->_worker = Yii::createObject([
30
                'class'   => FakeGateway::class,
31
                'gateway' => $this->gateway,
32
                'data'    => $this->data,
33
            ]);
34
        }
35
36
        return $this->_worker;
37
    }
38
}
39