Passed
Pull Request — master (#96)
by Shinji
01:40
created

Errno   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A set() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Lib\Libc\Errno;
15
16
class Errno
17
{
18
    /** @var \FFI\Libc\errno_ffi  */
19
    private \FFI $ffi;
20
21
    public function __construct()
22
    {
23
        /** @var \FFI\Libc\errno_ffi  */
24
        $this->ffi = \FFI::cdef('
0 ignored issues
show
Bug introduced by
The property ffi does not seem to exist on FFI\Libc\errno_ffi.
Loading history...
25
           int errno;
26
       ', 'libc.so.6');
27
    }
28
29
    public function get(): int
30
    {
31
        return (int)$this->ffi->errno;
32
    }
33
34
    public function set(int $value): void
35
    {
36
        $this->ffi->errno = $value;
37
    }
38
}
39