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.

ApcLock   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A lock() 0 9 2
A unlock() 0 7 2
1
<?php
2
namespace PhpBoot\Lock;
3
4
class ApcLock implements LockInterface
5
{
6
7
    public function lock($key, $ttl)
8
    {
9
        if(apc_add($key, 1, $ttl)){
10
            $this->locked = true;
11
            return true;
12
        }else{
13
            return false;
14
        }
15
    }
16
17
    public function unlock($key)
18
    {
19
        $this->locked or \PhpBoot\abort("unlock unlocked $key");
20
        $res = apc_delete($key);
21
        $this->locked = false;
22
        return $res;
23
    }
24
    private $locked=false;
25
}