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   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 51.72%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 0
dl 0
loc 70
ccs 15
cts 29
cp 0.5172
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
A operationByMerchant() 0 4 1
A operationByPsp() 0 4 1
A getAliasOperation() 0 4 1
A getAliasUsage() 0 4 1
A setAliasUsage() 0 4 1
A getAlias() 0 4 1
A setAlias() 0 4 1
A __toString() 0 4 1
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