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

RequestNotSupportedException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
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
}