Passed
Push — master ( a30cf1...9051a7 )
by Gabriel
14:38
created

Gateway   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setSandbox() 0 3 1
A getSandbox() 0 3 2
A isActive() 0 7 2
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\Stripe;
4
5
use Omnipay\Stripe\PaymentIntentsGateway as AbstractGateway;
0 ignored issues
show
Bug introduced by
The type Omnipay\Stripe\PaymentIntentsGateway 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 ByTIC\Payments\Gateways\Providers\AbstractGateway\Traits\GatewayTrait;
7
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Traits\OverwriteServerCompletePurchaseTrait;
8
9
/**
10
 * Class Gateway
11
 * @package ByTIC\Payments\Gateways\Providers\Stripe
12
 */
13
class Gateway extends AbstractGateway
14
{
15
    use GatewayTrait;
16
    use OverwriteServerCompletePurchaseTrait;
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function setSandbox($value): self
22
    {
23
        return $this->setTestMode($value == 'yes');
24
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29
    public function getSandbox(): string
30
    {
31
        return $this->getTestMode() === true ? 'yes' : 'no';
32
    }
33
34
    /**
35
     * @return bool
36
     */
37
    public function isActive(): bool
38
    {
39
        if (strlen($this->getApiKey()) >= 5) {
40
            return true;
41
        }
42
43
        return false;
44
    }
45
}
46