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
Push — master ( bbf2ff...d7ffda )
by Robert
12:47
created

RetryAcquireTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A retryAcquire() 0 12 3
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\mutex;
9
10
use Closure;
11
12
/**
13
 * Trait RetryAcquireTrait.
14
 *
15
 * @author Robert Korulczyk <[email protected]>
16
 * @internal
17
 */
18
trait RetryAcquireTrait
19
{
20
    /**
21
     * @var int Number of milliseconds between each try in [[acquire()]] until specified timeout times out.
22
     * By default it is 50 milliseconds - it means that [[acquire()]] may try acquire lock up to 20 times per second.
23
     * @since 2.0.16
24
     */
25
    public $retryDelay = 50;
26
27
28 24
    private function retryAcquire($timeout, Closure $callback)
29
    {
30 24
        $start = microtime(true);
31
        do {
32 24
            if ($callback()) {
33 24
                return true;
34
            }
35 9
            usleep($this->retryDelay * 1000);
36 9
        } while (microtime(true) - $start < $timeout);
37
38 9
        return false;
39
    }
40
}
41