Skip to content

Commit 3763ffd

Browse files
committed
some up
1 parent 52af57e commit 3763ffd

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

src/Base/AbstractApplication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,9 @@ public function setLogoStyle(string $style)
650650
/**
651651
* @return string
652652
*/
653-
public function getRootPath()
653+
public function getRootPath(): string
654654
{
655-
return $this->getMeta('rootPath');
655+
return $this->getMeta('rootPath', '');
656656
}
657657

658658
/**

src/Base/ApplicationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ public function controller(string $name, string $class = null, $option = null);
7575
public function command(string $name, $handler = null, $option = null);
7676

7777
public function showCommandList($quit = true);
78+
79+
public function getRootPath(): string;
7880
}

src/IO/Input/InputItem.php

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace Inhere\Console\IO\Input;
1010

11+
use Inhere\Console\IO\Input;
12+
1113
/**
1214
* Class InputItem
1315
* - definition a input item(option|argument)
@@ -52,5 +54,39 @@ class InputItem
5254
* allow multi value
5355
* @var bool
5456
*/
55-
public $multi;
57+
private $isArray;
58+
59+
/**
60+
* @param string $name
61+
* @param int|null $mode
62+
* @param string $description
63+
* @param null $default
64+
* @return static
65+
*/
66+
public static function make(string $name, int $mode = null, string $description = '', $default = null)
67+
{
68+
return new static($name, $mode, $description, $default);
69+
}
70+
71+
/**
72+
* class constructor.
73+
* @param string $name
74+
* @param int|null $mode
75+
* @param string $description
76+
* @param mixed $default The default value
77+
* - for InputArgument::OPTIONAL mode only
78+
* - must be null for InputOption::OPT_BOOL
79+
*/
80+
public function __construct(string $name, int $mode = null, string $description = '', $default = null)
81+
{
82+
$this->isArray = $mode === Input::ARG_IS_ARRAY;
83+
}
84+
85+
/**
86+
* @return bool
87+
*/
88+
public function isArray(): bool
89+
{
90+
return $this->isArray;
91+
}
5692
}

src/IO/Input/InputOption.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@
1515
*/
1616
class InputOption extends InputItem
1717
{
18+
/**
19+
* @var string|array
20+
*/
21+
public $shortcut;
22+
1823
}

0 commit comments

Comments
 (0)