10000 [Console] Added three state long option by ocke · Pull Request #11883 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Added three state long option #11883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
- renamed to VALUE_TERNARY
- renamed to camelCase setDefault
  • Loading branch information
Olaf Kwant committed Sep 10, 2014
commit cdf48b446a1dce076e93c94e0034c7d6ca927044
16 changes: 8 additions & 8 deletions src/Symfony/Component/Console/Input/InputOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class InputOption
const VALUE_REQUIRED = 2;
const VALUE_OPTIONAL = 4;
const VALUE_IS_ARRAY = 8;
const VALUE_OPTIONULL = 16;
const VALUE_TERNARY = 16;

private $name;
private $shortcut;
private $mode;
private $default;
private $set_default;
private $setDefault;
private $description;

/**
Expand Down Expand Up @@ -154,11 +154,11 @@ public function isArray()
/**
* Returns true if the option takes an optional value with null as default.
*
* @return bool true if mode is self::VALUE_OPTIONULL, false otherwise
* @return bool true if mode is self::VALUE_TERNARY, false otherwise
*/
public function isValueOptionull()
{
return self::VALUE_OPTIONULL === (self::VALUE_OPTIONULL & $this->mode);
return self::VALUE_TERNARY === (self::VALUE_TERNARY & $this->mode);
}

/**
Expand All @@ -182,14 +182,14 @@ public function setDefault($default = null)
}
}

$set_default = false;
$setDefault = false;

if ($this->isValueOptionull()) {
$set_default = $default;
$setDefault = $default;
$default = false;
}

$this->set_default = $set_default;
$this->setDefault = $setDefault;
$this->default = $this->acceptValue() ? $default : false;
}

Expand All @@ -210,7 +210,7 @@ public function getDefault()
*/
public function getSetDefault()
{
return $this->set_default;
return $this->setDefault;
}

/**
Expand Down
0