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 (#51)
by
unknown
03:30
created

TestCaseSnapshot::getSnapshotId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Spatie\Snapshots;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Class TestCaseSnapshot.
9
 *
10
 * Special test case, supported Windows OS.
11
 *
12
 * @see {https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file}
13
 */
14
abstract class TestCaseSnapshot extends TestCase
15
{
16
    const WINDOWS_FILE_NAME_LENGTH_LIMIT = 255;
17
18
    use MatchesSnapshots;
19
20
    /**
21
     * @throws \ReflectionException
22
     * @throws \Exception
23
     *
24
     * @return string
25
     */
26
    protected function getSnapshotId(): string
27
    {
28
        $name = (new \ReflectionClass($this))->getShortName() . '_' .
29
            $this->getName() . '_' .
30
            $this->snapshotIncrementor;
31
32
        $replaced = \preg_replace('/(\s+|\W+)/ui', '_', $name);
33
34
        if (\mb_strlen($replaced) >= self::WINDOWS_FILE_NAME_LENGTH_LIMIT) {
35
            throw new \Exception('Very long filename, please rename test or test case name!');
36
        }
37
38
        return $replaced;
39
    }
40
}
41