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::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * This file is part of the Marlon Ogone package.
4
 *
5
 * (c) Marlon BVBA <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Ogone\DirectLink;
12
13
use InvalidArgumentException;
14
15
class Alias
16
{
17
18
    /** @var string */
19
    private $alias;
20
21
    /** @var string */
22
    private $cardName;
23
24
    /** @var string */
25
    private $cardNumber;
26
27
    /** @var string */
28
    private $expiryDate;
29
30
    /**
31
     * @param $alias
32
     * @param string|null $cardName
33
     * @param string|null $cardNumber
34
     * @param string|null $expiryDate
35
     */
36 11
    public function __construct($alias, $cardName = null, $cardNumber = null, $expiryDate = null)
37
    {
38 11
        if (empty($alias)) {
39 2
            throw new InvalidArgumentException("Alias cannot be empty");
40
        }
41
42 9
        if (strlen($alias) > 50) {
43 3
            throw new InvalidArgumentException("Alias is too long");
44
        }
45
46 6
        if (preg_match('/[^a-zA-Z0-9_-]/', $alias)) {
47 2
            throw new InvalidArgumentException("Alias cannot contain special characters");
48
        }
49
50 4
        $this->alias = $alias;
51 4
        $this->cardName = $cardName;
52 4
        $this->cardNumber = $cardNumber;
53 4
        $this->expiryDate = $expiryDate;
54 4
    }
55
56 1
    public function getAlias()
57
    {
58 1
        return $this->alias;
59
    }
60
61 1
    public function getCardName()
62
    {
63 1
        return $this->cardName;
64
    }
65
66 1
    public function getCardNumber()
67
    {
68 1
        return $this->cardNumber;
69
    }
70
71 1
    public function getExpiryDate()
72
    {
73 1
        return $this->expiryDate;
74
    }
75
76 4
    public function __toString()
77
    {
78 4
        return (string) $this->alias;
79
    }
80
}
81