GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Alias::operationByMerchant()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace Ogone\Ecommerce;
3
4
use InvalidArgumentException;
5
6
class Alias
7
{
8
9
    const OPERATION_BY_MERCHANT = 'BYMERCHANT';
10
    const OPERATION_BY_PSP = 'BYPSP';
11
12
    /** @var string */
13
    private $aliasOperation;
14
15
    /** @var string */
16
    private $aliasUsage;
17
18
    /** @var string */
19
    private $alias;
20
21 6
    public function __construct($alias, $aliasOperation = self::OPERATION_BY_MERCHANT, $aliasUsage = null)
22
    {
23 6
        if (strlen($alias) > 50) {
24 1
            throw new InvalidArgumentException("Alias is too long");
25
        }
26
27 5
        if (preg_match('/[^a-zA-Z0-9_-]/', $alias)) {
28 1
            throw new InvalidArgumentException("Alias cannot contain special characters");
29
        }
30
31 4
        $this->aliasOperation = $aliasOperation;
32 4
        $this->aliasUsage = $aliasUsage;
33 4
        $this->alias = $alias;
34 4
    }
35
36
    public function operationByMerchant()
37
    {
38
        $this->aliasOperation = self::OPERATION_BY_MERCHANT;
39
    }
40
41
    public function operationByPsp()
42
    {
43
        $this->aliasOperation = self::OPERATION_BY_PSP;
44
    }
45
46 2
    public function getAliasOperation()
47
    {
48 2
        return $this->aliasOperation;
49
    }
50
51 1
    public function getAliasUsage()
52
    {
53 1
        return $this->aliasUsage;
54
    }
55
56
    public function setAliasUsage($aliasUsage)
57
    {
58
        $this->aliasUsage = $aliasUsage;
59
    }
60
61
    public function getAlias()
62
    {
63
        return $this->alias;
64
    }
65
66
    public function setAlias($alias)
67
    {
68
        $this->alias = $alias;
69
    }
70
71 1
    public function __toString()
72
    {
73 1
        return $this->alias;
74
    }
75
}
76