Skip to content

Commit

Permalink
Merge 29a8c2c into edf663d
Browse files Browse the repository at this point in the history
  • Loading branch information
scil committed Feb 12, 2020
2 parents edf663d + 29a8c2c commit f14dece
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions src/Shell/Shell.php
@@ -0,0 +1,38 @@
<?php

namespace Spatie\WebTinker\Shell;

use Psy\Configuration;
use Psy\Input\SilentInput;
use Psy\Shell as PsyShell;

class Shell extends PsyShell
{
/**
* @var array overwrite parent::$inputBuffer which is private
*/
protected $inputBuffer;

public function __construct(Configuration $config = null)
{
parent::__construct($config);

$this->inputBuffer = [];
}

public function addInput($input, $silent = false)
{
foreach ((array) $input as $line) {
$this->inputBuffer[] = $silent ? new SilentInput($line) : $line;
}
}

protected function readline()
{
if (! empty($this->inputBuffer)) {
return \array_shift($this->inputBuffer);
}

return false;
}
}
2 changes: 1 addition & 1 deletion src/Tinker.php
Expand Up @@ -17,7 +17,7 @@ class Tinker
/** @var \Symfony\Component\Console\Output\BufferedOutput */
protected $output;

/** @var \Psy\Shell */
/** @var Shell */
protected $shell;

/** @var \Spatie\WebTinker\OutputModifiers\OutputModifier */
Expand Down

0 comments on commit f14dece

Please sign in to comment.