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.

FileNameBuilder::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Dami\Migration;
4
5
use Stringy\StaticStringy as S;
6
7
class FileNameBuilder
8
{
9
    private $migrationName;
10
11
    /**
12
     * Constructor.
13
     *
14
     * @param string $migrationName Migration name.
15
     *
16
     * @throws InvalidArgumentException If the $migrationName is missing or null.
17
     */
18
    public function __construct($migrationName = null)
19
    {
20
        if (null === $migrationName) {
21
            throw new \InvalidArgumentException('Migration name is required.');
22
        }
23
        $this->migrationName = $migrationName;
24
    }
25
26
    /**
27
     * Build migration file name.
28
     *
29
     * @param datatype $timestamp Timestamp of migration.
30
     *
31
     * @return string
32
     */
33
    public function build($timestamp = null)
34
    {
35
        if (null === $timestamp) {
36
            $timestamp = new \DateTime();
37
            $timestamp = $timestamp->format('YmdHis');
38
        }
39
        $fileName = sprintf('%s_%s.php', $timestamp, S::underscored($this->migrationName));
40
41
        return $fileName;
42
    }
43
}
44