Passed
Push — master ( 373b55...acaf2a )
by Sebastian
02:48
created

array_key_last()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Mailcode;
4
5
/**
6
 * Translation function used to translate some of the internal
7
 * strings: if the localization is installed, it will use this
8
 * to do the translation.
9
 * 
10
 * @return string
11
 */
12
function t()
13
{
14
    $args = func_get_args();
15
    
16
    return call_user_func_array('\AppLocalize\t', $args);
17
}
18
19
/**
20
 * @param array<mixed,mixed> $array
21
 * @return int|string|null
22
 */
23
function array_key_last(array $array)
24
{
25
    $keys = array_keys($array);
26
    return array_pop($keys);
27
}
28
29
/**
30
 * Initializes the utilities: this is called automatically
31
 * because this file is included in the files list in the
32
 * composer.json, guaranteeing it is always loaded.
33
 */
34
function init() : void
35
{
36
    if(!class_exists('\AppLocalize\Localization')) {
37
        return;
38
    }
39
    
40
    $installFolder = realpath(__DIR__.'/../');
41
    
42
    // Register the classes as a localization source,
43
    // so they can be found, and use the bundled localization
44
    // files.
45
    \AppLocalize\Localization::addSourceFolder(
46
        'mailcode',
47
        'Mailcode Syntax Parser',
48
        'Composer Packages',
49
        $installFolder.'/localization',
50
        $installFolder.'/src'
51
    );
52
}
53
54
init();
55