Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Commit 044e3ef

Browse files
committed
some update ....
1 parent aa98304 commit 044e3ef

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/console/Input.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,23 @@ public function getOption($name=null, $default = null)
8585
* @param bool $default
8686
* @return bool
8787
*/
88-
public function getBool($key, $default = false)
88+
public function getInt($key, $default = 0)
8989
{
9090
$value = $this->get($key);
9191

92-
if ($value === null) {
93-
return $default;
94-
}
92+
return $value === null ? (int)$default : (int)$value;
93+
}
94+
95+
/**
96+
* @param $key
97+
* @param bool $default
98+
* @return bool
99+
*/
100+
public function getBool($key, $default = false)
101+
{
102+
$value = $this->get($key);
95103

96-
return in_array($value, ['0', 0, 'false', false], true) ? false : true;
104+
return $value === null ? (bool)$default : !in_array($value, ['0', 0, 'false', false], true);
97105
}
98106

99107
/**

0 commit comments

Comments
 (0)