view vendor/consolidation/annotated-command/src/Input/StdinAwareInterface.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents
children
line wrap: on
line source
<?php

namespace Consolidation\AnnotatedCommand\Input;

/**
 * StdinAwareInterface should be implemented by classes that read from
 * standard input. This class contains facilities to redirect stdin to
 * instead read from a file, e.g. in response to an option or argument
 * value.
 *
 * Using StdinAwareInterface is preferable to reading from php://stdin
 * directly, as it provides a mechanism to instead inject an instance
 * of StdinHandler that reads from a file, e.g. in tests.
 *
 * n.b. If the standard input handler is fetched prior to any code
 * injecting an stdin handler, you will get an object that is configured
 * to read from php://stdin.
 */
interface StdinAwareInterface
{
    /**
     * Sets the standard input handler.
     *
     * @param StdinHandler
     */
    public function setStdinHandler(StdinHandler $stdin);

    /**
     * Returns the standard input handler.
     *
     * @return StdinHandler
     */
    public function stdin();
}