GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

functions.php ➔ pool()   A
last analyzed

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 FunctionalPHP\Trampoline;
4
5
/**
6
 * This method should be used inside your recursive functions
7
 * when you need to make a tail recursive call.
8
 *
9
 * Instead of calling the function directly it will give back
10
 * the control to the trampoline which will in turn call your
11
 * function again in order to avoid a stack overflow.
12
 *
13
 * @param callable $f a tail recursive function
14
 * @param array ...$args arguments for the function
15
 * @return callable a callable for the Trampoline
16
 */
17
function bounce(callable $f, ...$args)
18
{
19
    return Trampoline::bounce($f, ...$args);
20
}
21
22
/**
23
 * Launch a trampoline. The given callable should be a tail
24
 * recursive function.
25
 *
26
 * All recursive calls inside the function should be made
27
 * using the bounce function so that the trampoline can
28
 * correctly avoid stack overflows.
29
 *
30
 * @param callable $f a tail recursive function
31
 * @param array ...$args arguments for the function
32
 * @return mixed The final result of your function
33
 */
34
function trampoline(callable $f, ...$args)
35
{
36
    return Trampoline::run($f, ...$args);
37
}
38
39
function trampoline_wrapper(callable $f)
40
{
41
    return function(...$args) use($f) {
42
        return Trampoline::run($f, ...$args);
43
    };
44
}
45
46
/**
47
 * Alternative method to get a tail recursive function
48
 * without risk of stack overflows.
49
 *
50
 * All recursive calls inside the function should be made
51
 * by using the `$this` directly as a function.
52
 *
53
 * @param callable $f a tail recursive function
54
 * @return callable equivalent function without stack overflow risk
55
 */
56
function pool(callable $f)
57
{
58
    return Pool::get($f);
59
}
60