view vendor/consolidation/annotated-command/src/Input/StdinAwareTrait.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
line wrap: on
line source
<?php

namespace Consolidation\AnnotatedCommand\Input;

/**
 * StdinAwareTrait provides the implementation for StdinAwareInterface.
 */
trait StdinAwareTrait
{
    protected $stdinHandler;

    /**
     * @inheritdoc
     */
    public function setStdinHandler(StdinHandler $stdin)
    {
        $this->stdinHandler = $stdin;
    }

    /**
     * @inheritdoc
     */
    public function stdin()
    {
        if (!$this->stdinHandler) {
            $this->stdinHandler = new StdinHandler();
        }
        return $this->stdinHandler;
    }
}