Completed
Push — master ( df8184...e3b994 )
by Aydin
02:31
created

examples/input-text.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use PhpSchool\CliMenu\CliMenu;
4
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
5
6
require_once(__DIR__ . '/../vendor/autoload.php');
7
8
$itemCallable = function (CliMenu $menu) {
9
    $result = $menu->askText()
10
        ->setPlaceholderText('Enter something here')
11
        ->ask();
12
13
    var_dump($result->fetch());
0 ignored issues
show
Security Debugging Code introduced by Aydin Hassan
var_dump($result->fetch()); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
14
};
15
16
$menu = (new CliMenuBuilder)
17
    ->setTitle('Basic CLI Menu')
18
    ->addItem('Enter text', $itemCallable)
19
    ->addItem('Second Item', $itemCallable)
20
    ->addItem('Third Item', $itemCallable)
21
    ->addLineBreak('-')
22
    ->setMarginAuto('-')
23
    ->build();
24
25
$menu->open();
26