Completed
Push — master ( 8bb399...6d8696 )
by Randy
03:07
created

functions.php ➔ verify()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dgame\Optional;
4
5
/**
6
 * @param $value
7
 *
8
 * @return Some
9
 */
10
function some($value): Some
11
{
12
    return new Some($value);
13
}
14
15
/**
16
 * @return None
17
 */
18
function none(): None
19
{
20
    return None::instance();
21
}
22
23
/**
24
 * @param $value
25
 *
26
 * @return OptionalInterface
27
 */
28
function maybe($value): OptionalInterface
29
{
30
    return $value !== null ? some($value) : none();
31
}