| @@ 11-28 (lines=18) @@ | ||
| 8 | * Uses the EnvironmentVariableStrategy (EDITOR) and CommandLocatorStrategy to |
|
| 9 | * create an Editor. |
|
| 10 | */ |
|
| 11 | class EditorStrategy extends ListStrategy implements StrategyInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * Initialize the editor strategy. |
|
| 15 | * |
|
| 16 | * @param string[] $editors The names to the potential editors. The first |
|
| 17 | * command in the list that can be located will be used. |
|
| 18 | * @param \Nubs\Which\Locator $commandLocator The command locator. This |
|
| 19 | * helps locate commands using PATH. |
|
| 20 | * @param \Habitat\Environment\Environment $environment The environment |
|
| 21 | * variable wrapper. Defaults to null, which just uses the built-in |
|
| 22 | * getenv. |
|
| 23 | */ |
|
| 24 | public function __construct(array $editors, CommandLocator $commandLocator, Environment $environment = null) |
|
| 25 | { |
|
| 26 | parent::__construct([new EnvironmentVariableStrategy('EDITOR', $environment), new CommandLocatorStrategy($editors, $commandLocator)]); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||
| @@ 11-28 (lines=18) @@ | ||
| 8 | * Uses the EnvironmentVariableStrategy (PAGER) and CommandLocatorStrategy to |
|
| 9 | * create a Pager. |
|
| 10 | */ |
|
| 11 | class PagerStrategy extends ListStrategy implements StrategyInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * Initialize the pager strategy. |
|
| 15 | * |
|
| 16 | * @param string[] $pagers The names of the potential pagers. The first |
|
| 17 | * command in the list that can be located will be used. |
|
| 18 | * @param \Nubs\Which\Locator $commandLocator The command locator. This |
|
| 19 | * helps locate commands using PATH. |
|
| 20 | * @param \Habitat\Environment\Environment $environment The environment |
|
| 21 | * variable wrapper. Defaults to null, which just uses the built-in |
|
| 22 | * getenv. |
|
| 23 | */ |
|
| 24 | public function __construct(array $pagers, CommandLocator $commandLocator, Environment $environment = null) |
|
| 25 | { |
|
| 26 | parent::__construct([new EnvironmentVariableStrategy('PAGER', $environment), new CommandLocatorStrategy($pagers, $commandLocator)]); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||