Passed
Push — master ( 19a915...d9efc8 )
by Gabriel
14:56
created

RequestNotSupportedException::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Exception;
4
5
use Omnipay\Common\AbstractGateway;
6
7
/**
8
 * Class RequestNotSupportedException
9
 * @package ByTIC\Payments\Exception
10
 */
11
class RequestNotSupportedException extends InvalidArgumentException
12
{
13
14
    /**
15
     * @param string $request
16
     * @param AbstractGateway|null $gateway
17
     * @return self
18
     */
19
    public static function create(string $request, AbstractGateway $gateway = null): self
20
    {
21
        return new self(
22
            sprintf(
23
                'Request %s is not supported for %s',
24
                $request, $gateway->getName()
0 ignored issues
show
Bug introduced by
The method getName() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
                $request, $gateway->/** @scrutinizer ignore-call */ getName()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
            ));
26
    }
27
}