Passed
Push — 0.6.x ( 9a1948...a98caa )
by Shinji
03:23 queued 01:32
created

Cast::castPointerToInt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the reliforp/reli-prof 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 Reli\Lib\FFI;
15
16
use FFI\CData;
17
use FFI\CInteger;
18
use FFI\CPointer;
19
20
class Cast
21
{
22
    /** @param CPointer $cdata */
23
    public static function castPointerToInt(CData &$cdata): int
24
    {
25
        /** @var CInteger $casted */
26
        $casted = \FFI::cast('long', $cdata);
27
        return $casted->cdata;
28
    }
29
}
30