Mercurial > hg > isophonics-drupal-site
annotate vendor/consolidation/annotated-command/src/Input/StdinAwareInterface.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@17 | 1 <?php |
Chris@17 | 2 |
Chris@17 | 3 namespace Consolidation\AnnotatedCommand\Input; |
Chris@17 | 4 |
Chris@17 | 5 /** |
Chris@17 | 6 * StdinAwareInterface should be implemented by classes that read from |
Chris@17 | 7 * standard input. This class contains facilities to redirect stdin to |
Chris@17 | 8 * instead read from a file, e.g. in response to an option or argument |
Chris@17 | 9 * value. |
Chris@17 | 10 * |
Chris@17 | 11 * Using StdinAwareInterface is preferable to reading from php://stdin |
Chris@17 | 12 * directly, as it provides a mechanism to instead inject an instance |
Chris@17 | 13 * of StdinHandler that reads from a file, e.g. in tests. |
Chris@17 | 14 * |
Chris@17 | 15 * n.b. If the standard input handler is fetched prior to any code |
Chris@17 | 16 * injecting an stdin handler, you will get an object that is configured |
Chris@17 | 17 * to read from php://stdin. |
Chris@17 | 18 */ |
Chris@17 | 19 interface StdinAwareInterface |
Chris@17 | 20 { |
Chris@17 | 21 /** |
Chris@17 | 22 * Sets the standard input handler. |
Chris@17 | 23 * |
Chris@17 | 24 * @param StdinHandler |
Chris@17 | 25 */ |
Chris@17 | 26 public function setStdinHandler(StdinHandler $stdin); |
Chris@17 | 27 |
Chris@17 | 28 /** |
Chris@17 | 29 * Returns the standard input handler. |
Chris@17 | 30 * |
Chris@17 | 31 * @return StdinHandler |
Chris@17 | 32 */ |
Chris@17 | 33 public function stdin(); |
Chris@17 | 34 } |