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.
Completed
Pull Request — master (#62)
by Jelte
04:52
created

Alias::operationByPsp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
    public function __construct($alias, $aliasOperation = self::OPERATION_BY_MERCHANT, $aliasUsage = null)
22
    {
23
        if (strlen($alias) > 50) {
24
            throw new InvalidArgumentException("Alias is too long");
25
        }
26
27
        if (preg_match('/[^a-zA-Z0-9_-]/', $alias)) {
28
            throw new InvalidArgumentException("Alias cannot contain special characters");
29
        }
30
31
        $this->aliasOperation = $aliasOperation;
32
        $this->aliasUsage = $aliasUsage;
33
        $this->alias = $alias;
34
    }
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
    public function getAliasOperation()
47
    {
48
        return $this->aliasOperation;
49
    }
50
51
    public function getAliasUsage()
52
    {
53
        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
    public function __toString()
72
    {
73
        return $this->alias;
74
    }
75
}
76