-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
input-output.phpakefile
41 lines (36 loc) · 1.04 KB
/
input-output.phpakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Input_Output;
/**
* Show today's date.
*
* Uses a Symphony Console Output to display output. $output is treated as any
* other optional argument. It is a built-in parameter that is automatically
* injected. Preferably, it should be kept towards the end, after all required
* parameters.
*/
function show_date($output) {
$datetime = new DateTime();
$output->writeln($datetime->format('M j, Y'));
}
/**
* Say hello to a human.
*
* Uses a required parameter, and an optional parameter. "param" annotations
* are used to describe the parameters. These descriptions are displayed with
* command-specific help.
*
* Notice how the built-in parameter $output was kept towards the end.
*
* @usage Niki
* @usage Niki Martin
*
* @param string $fname First name.
* @param string|null $lname Last name.
* @param object $output
*/
function hello_human(string $fname, string $lname = NULL, $output = NULL) {
$name = $lname ? "$fname $lname" : "$fname";
$output->writeln("Hello <info>$name</info>!");
}
function _do_nothing() {
}