Passed
Push — master ( ae9f09...aff02c )
by Dedipyaman
01:51
created

getOptionalValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 3
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Phypes <https://github.com/2DSharp/Phypes>.
4
 *
5
 * (c) Dedipyaman Das <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Phypes;
11
12
/**
13
 * Get optional values from arrays
14
 * @param int $key
15
 * @param array $arr
16
 * @param $default
17
 * @return mixed
18
 */
19
function getOptionalValue(int $key, array $arr, $default) {
20
    return isset($arr[$key]) ? $arr[$key]: $default;
21
}