register()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Jaxon\Attributes;
4
5
use Jaxon\Attributes\AttributeReader;
6
7
use function Jaxon\jaxon;
8
use function php_sapi_name;
9
10
/**
11
 * Register the attribute reader into the Jaxon Inject container
12
 *
13
 * @return void
14
 */
15
function _register(): void
16
{
17
    $di = jaxon()->di();
18
19
    // Attribute reader
20
    $di->set(AttributeReader::class, fn() => new AttributeReader());
21
22
    $di->alias('metadata_reader_attributes', AttributeReader::class);
23
}
24
25
function register(): void
26
{
27
    // Do nothing if running in cli.
28
    if(php_sapi_name() !== 'cli')
29
    {
30
        _register();
31
    };
32
}
33
34
register();
35