forked from inhere/php-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputInterface.php
More file actions
70 lines (60 loc) · 1.41 KB
/
Copy pathInputInterface.php
File metadata and controls
70 lines (60 loc) · 1.41 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Created by PhpStorm.
* User: Inhere
* Date: 2016/4/23 0023
* Time: 10:22
*/
namespace Inhere\Console\IO;
/**
* Class Input
* @package Inhere\Console\IO
*/
interface InputInterface
{
// fixed args and opts for a command/controller-command
const ARG_REQUIRED = 1;
const ARG_OPTIONAL = 2;
const ARG_IS_ARRAY = 4;
const OPT_BOOLEAN = 1;
const OPT_REQUIRED = 2;
const OPT_OPTIONAL = 4;
const OPT_IS_ARRAY = 8;
/**
* 读取输入信息
* @param string $question 若不为空,则先输出文本消息
* @param bool $nl true 会添加换行符 false 原样输出,不添加换行符
* @return string
*/
public function read($question = null, $nl = false): string;
/**
* @return string
*/
public function getScript(): string;
/**
* @param string $default
* @return string
*/
public function getCommand($default = ''): string;
/**
* @return array
*/
public function getArgs(): array;
/**
* get Argument
* @param null|int|string $name
* @param mixed $default
* @return mixed
*/
public function getArg($name, $default = null);
/**
* @return array
*/
public function getOpts(): array;
/**
* @param string $name
* @param null $default
* @return bool|mixed|null
*/
public function getOpt(string $name, $default = null);
}