annotate vendor/consolidation/annotated-command/src/Input/StdinAwareInterface.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents
children
rev   line source
Chris@4 1 <?php
Chris@4 2
Chris@4 3 namespace Consolidation\AnnotatedCommand\Input;
Chris@4 4
Chris@4 5 /**
Chris@4 6 * StdinAwareInterface should be implemented by classes that read from
Chris@4 7 * standard input. This class contains facilities to redirect stdin to
Chris@4 8 * instead read from a file, e.g. in response to an option or argument
Chris@4 9 * value.
Chris@4 10 *
Chris@4 11 * Using StdinAwareInterface is preferable to reading from php://stdin
Chris@4 12 * directly, as it provides a mechanism to instead inject an instance
Chris@4 13 * of StdinHandler that reads from a file, e.g. in tests.
Chris@4 14 *
Chris@4 15 * n.b. If the standard input handler is fetched prior to any code
Chris@4 16 * injecting an stdin handler, you will get an object that is configured
Chris@4 17 * to read from php://stdin.
Chris@4 18 */
Chris@4 19 interface StdinAwareInterface
Chris@4 20 {
Chris@4 21 /**
Chris@4 22 * Sets the standard input handler.
Chris@4 23 *
Chris@4 24 * @param StdinHandler
Chris@4 25 */
Chris@4 26 public function setStdinHandler(StdinHandler $stdin);
Chris@4 27
Chris@4 28 /**
Chris@4 29 * Returns the standard input handler.
Chris@4 30 *
Chris@4 31 * @return StdinHandler
Chris@4 32 */
Chris@4 33 public function stdin();
Chris@4 34 }