Refactoring
This commit is contained in:
1 parent
af40881847
commit
a7274d3cfd
5075 files changed
+238202
-16291
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Common;
|
||||
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
||||
trait InputAwareTrait
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\Console\Input\InputInterface
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see \Symfony\Component\Console\Input\InputAwareInterface::setInput()
|
||||
*/
|
||||
public function setInput(InputInterface $input)
|
||||
{
|
||||
$this->input = $input;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\Console\Input\InputInterface
|
||||
*/
|
||||
protected function input()
|
||||
{
|
||||
if (!isset($this->input)) {
|
||||
$this->setInput(new ArgvInput());
|
||||
}
|
||||
return $this->input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backwards compatibility.
|
||||
*
|
||||
* @return \Symfony\Component\Console\Input\InputInterface
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
return $this->input();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user