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

Errno::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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