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.

RandomSeed   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 35
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A draw() 12 12 1
A registerListeners() 19 19 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Spatie\PhpUnitWatcher\Screens;
4
5 View Code Duplication
class RandomSeed extends Screen
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    public function draw()
8
    {
9
        $this->terminal
10
            ->comment('Random seed usage')
11
            ->write('Type a seed and press Enter to run tests in random order but with a specific seed.')
12
            ->write('Press Enter with an empty pattern to execute all tests in random order.')
13
            ->emptyLine()
14
            ->comment('Start typing to add a random seed')
15
            ->prompt('seed > ');
16
17
        return $this;
18
    }
19
20
    public function registerListeners()
21
    {
22
        $this->terminal->on('data', function ($line) {
23
            $phpunitArguments = '--order-by=random';
24
            if ($line !== '') {
25
                $phpunitArguments .= " --random-order-seed={$line}";
26
            }
27
28
            $phpunitScreen = $this->terminal->getPreviousScreen();
29
30
            $options = $phpunitScreen->options;
0 ignored issues
show
Bug introduced by
The property options does not seem to exist in Spatie\PhpUnitWatcher\Screens\Screen.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
31
32
            $options['phpunit']['arguments'] = $phpunitArguments;
33
34
            $this->terminal->displayScreen(new Phpunit($options));
35
        });
36
37
        return $this;
38
    }
39
}
40