Completed
Push — master ( aa5c9c...a87303 )
by Johnny
02:10
created

actions_functions.php ➔ helloWorld()   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
namespace Sandbox\Demos;
3
4
require 'autoload.php';
5
6
use Redbox\Hooks\Actions;
7
8
function helloWorld($text)
9
{
10
    echo $text . "\n";
11
}
12
13
/**
14
 * If you are using your own custom namespace it is highly important
15
 * to prefix your functions with a the correct namespace.
16
 */
17
Actions::AddAction('hello_world', 'Sandbox\Demos\helloWorld');
18
Actions::doAction('hello_world', 'Hello World');
19
20
/**
21
 * The result should be:
22
 *
23
 * Result: Hello World
24
 *
25
 */
26
27
/**
28
 * This is not required in your code. I have to add this to reset my unit tests.
29
 */
30
Actions::removeAllActions('hello_world');