mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding __get() to access protected properties of ConsoleOptionParser components for upcoming changes.
This commit is contained in:
parent
e63f81c12a
commit
8e1dd9e892
4 changed files with 41 additions and 4 deletions
|
@ -50,6 +50,19 @@ class ConsoleInputArgument {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protected attribute accessor.
|
||||||
|
*
|
||||||
|
* @param string $name Name of attribute to read.
|
||||||
|
* @return mixed.
|
||||||
|
*/
|
||||||
|
public function __get($name) {
|
||||||
|
if (isset($this->{'_' . $name})) {
|
||||||
|
return $this->{'_' . $name};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the argument
|
* Get the name of the argument
|
||||||
*
|
*
|
||||||
|
|
|
@ -55,6 +55,19 @@ class ConsoleInputOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protected attribute accessor.
|
||||||
|
*
|
||||||
|
* @param string $name Name of attribute to read.
|
||||||
|
* @return mixed.
|
||||||
|
*/
|
||||||
|
public function __get($name) {
|
||||||
|
if (isset($this->{'_' . $name})) {
|
||||||
|
return $this->{'_' . $name};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the argument
|
* Get the name of the argument
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,9 +27,7 @@
|
||||||
*/
|
*/
|
||||||
class ConsoleInputSubcommand {
|
class ConsoleInputSubcommand {
|
||||||
|
|
||||||
protected $_name;
|
protected $_name, $_help, $_parser;
|
||||||
protected $_help;
|
|
||||||
protected $_parser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a new Subcommand
|
* Make a new Subcommand
|
||||||
|
@ -55,6 +53,19 @@ class ConsoleInputSubcommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protected attribute accessor.
|
||||||
|
*
|
||||||
|
* @param string $name Name of attribute to read.
|
||||||
|
* @return mixed.
|
||||||
|
*/
|
||||||
|
public function __get($name) {
|
||||||
|
if (isset($this->{'_' . $name})) {
|
||||||
|
return $this->{'_' . $name};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the subcommand
|
* Get the name of the subcommand
|
||||||
*
|
*
|
||||||
|
|
|
@ -141,7 +141,7 @@ class HelpFormatter {
|
||||||
protected function _getMaxLength($collection) {
|
protected function _getMaxLength($collection) {
|
||||||
$max = 0;
|
$max = 0;
|
||||||
foreach ($collection as $item) {
|
foreach ($collection as $item) {
|
||||||
$max = (strlen($item->name()) > $max) ? strlen($item->name()) : $max;
|
$max = (strlen($item->name) > $max) ? strlen($item->name) : $max;
|
||||||
}
|
}
|
||||||
return $max;
|
return $max;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue