PosShortcut   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPlugins() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Shortcut\Alipay;
6
7
use Yansongda\Artful\Contract\ShortcutInterface;
8
use Yansongda\Artful\Plugin\ParserPlugin;
9
use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin;
10
use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin;
11
use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin;
12
use Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos\PayPlugin;
13
use Yansongda\Pay\Plugin\Alipay\V2\ResponsePlugin;
14
use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin;
15
use Yansongda\Pay\Plugin\Alipay\V2\VerifySignaturePlugin;
16
17
class PosShortcut implements ShortcutInterface
18
{
19
    public function getPlugins(array $params): array
20
    {
21
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(Yansongda\P...in\ParserPlugin::class) returns the type array<integer,string> which is incompatible with the return type mandated by Yansongda\Artful\Contrac...Interface::getPlugins() of Yansongda\Artful\Contract\PluginInterface[].

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
22
            StartPlugin::class,
23
            PayPlugin::class,
24
            FormatPayloadBizContentPlugin::class,
25
            AddPayloadSignaturePlugin::class,
26
            AddRadarPlugin::class,
27
            VerifySignaturePlugin::class,
28
            ResponsePlugin::class,
29
            ParserPlugin::class,
30
        ];
31
    }
32
}
33