Composer update
* updated Laravel to v5.6.38 * Added laravel tinker in dev dependencies
This commit is contained in:
committed by
Manish Verma
parent
be4b1231b6
commit
6742e13d81
26
vendor/psy/psysh/src/Output/OutputPager.php
vendored
Normal file
26
vendor/psy/psysh/src/Output/OutputPager.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Output;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* An output pager is much the same as a regular OutputInterface, but allows
|
||||
* the stream to be flushed to a pager periodically.
|
||||
*/
|
||||
interface OutputPager extends OutputInterface
|
||||
{
|
||||
/**
|
||||
* Close the current pager process.
|
||||
*/
|
||||
public function close();
|
||||
}
|
||||
39
vendor/psy/psysh/src/Output/PassthruPager.php
vendored
Normal file
39
vendor/psy/psysh/src/Output/PassthruPager.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Output;
|
||||
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
|
||||
/**
|
||||
* A passthrough pager is a no-op. It simply wraps a StreamOutput's stream and
|
||||
* does nothing when the pager is closed.
|
||||
*/
|
||||
class PassthruPager extends StreamOutput implements OutputPager
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param StreamOutput $output
|
||||
*/
|
||||
public function __construct(StreamOutput $output)
|
||||
{
|
||||
parent::__construct($output->getStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the current pager process.
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
}
|
||||
103
vendor/psy/psysh/src/Output/ProcOutputPager.php
vendored
Normal file
103
vendor/psy/psysh/src/Output/ProcOutputPager.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Output;
|
||||
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
|
||||
/**
|
||||
* ProcOutputPager class.
|
||||
*
|
||||
* A ProcOutputPager instance wraps a regular StreamOutput's stream. Rather
|
||||
* than writing directly to the stream, it shells out to a pager process and
|
||||
* gives that process the stream as stdout. This means regular *nix commands
|
||||
* like `less` and `more` can be used to page large amounts of output.
|
||||
*/
|
||||
class ProcOutputPager extends StreamOutput implements OutputPager
|
||||
{
|
||||
private $proc;
|
||||
private $pipe;
|
||||
private $stream;
|
||||
private $cmd;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param StreamOutput $output
|
||||
* @param string $cmd Pager process command (default: 'less -R -S -F -X')
|
||||
*/
|
||||
public function __construct(StreamOutput $output, $cmd = 'less -R -S -F -X')
|
||||
{
|
||||
$this->stream = $output->getStream();
|
||||
$this->cmd = $cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a message to the output.
|
||||
*
|
||||
* @param string $message A message to write to the output
|
||||
* @param bool $newline Whether to add a newline or not
|
||||
*
|
||||
* @throws \RuntimeException When unable to write output (should never happen)
|
||||
*/
|
||||
public function doWrite($message, $newline)
|
||||
{
|
||||
$pipe = $this->getPipe();
|
||||
if (false === @\fwrite($pipe, $message . ($newline ? PHP_EOL : ''))) {
|
||||
// @codeCoverageIgnoreStart
|
||||
// should never happen
|
||||
throw new \RuntimeException('Unable to write output');
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
\fflush($pipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the current pager process.
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
if (isset($this->pipe)) {
|
||||
\fclose($this->pipe);
|
||||
}
|
||||
|
||||
if (isset($this->proc)) {
|
||||
$exit = \proc_close($this->proc);
|
||||
if ($exit !== 0) {
|
||||
throw new \RuntimeException('Error closing output stream');
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->pipe, $this->proc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pipe for paging output.
|
||||
*
|
||||
* If no active pager process exists, fork one and return its input pipe.
|
||||
*/
|
||||
private function getPipe()
|
||||
{
|
||||
if (!isset($this->pipe) || !isset($this->proc)) {
|
||||
$desc = [['pipe', 'r'], $this->stream, \fopen('php://stderr', 'w')];
|
||||
$this->proc = \proc_open($this->cmd, $desc, $pipes);
|
||||
|
||||
if (!\is_resource($this->proc)) {
|
||||
throw new \RuntimeException('Error opening output stream');
|
||||
}
|
||||
|
||||
$this->pipe = $pipes[0];
|
||||
}
|
||||
|
||||
return $this->pipe;
|
||||
}
|
||||
}
|
||||
204
vendor/psy/psysh/src/Output/ShellOutput.php
vendored
Normal file
204
vendor/psy/psysh/src/Output/ShellOutput.php
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\Output;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
/**
|
||||
* A ConsoleOutput subclass specifically for Psy Shell output.
|
||||
*/
|
||||
class ShellOutput extends ConsoleOutput
|
||||
{
|
||||
const NUMBER_LINES = 128;
|
||||
|
||||
private $paging = 0;
|
||||
private $pager;
|
||||
|
||||
/**
|
||||
* Construct a ShellOutput instance.
|
||||
*
|
||||
* @param mixed $verbosity (default: self::VERBOSITY_NORMAL)
|
||||
* @param bool $decorated (default: null)
|
||||
* @param OutputFormatterInterface $formatter (default: null)
|
||||
* @param null|string|OutputPager $pager (default: null)
|
||||
*/
|
||||
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null, $pager = null)
|
||||
{
|
||||
parent::__construct($verbosity, $decorated, $formatter);
|
||||
|
||||
$this->initFormatters();
|
||||
|
||||
if ($pager === null) {
|
||||
$this->pager = new PassthruPager($this);
|
||||
} elseif (\is_string($pager)) {
|
||||
$this->pager = new ProcOutputPager($this, $pager);
|
||||
} elseif ($pager instanceof OutputPager) {
|
||||
$this->pager = $pager;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Unexpected pager parameter: ' . $pager);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Page multiple lines of output.
|
||||
*
|
||||
* The output pager is started
|
||||
*
|
||||
* If $messages is callable, it will be called, passing this output instance
|
||||
* for rendering. Otherwise, all passed $messages are paged to output.
|
||||
*
|
||||
* Upon completion, the output pager is flushed.
|
||||
*
|
||||
* @param string|array|\Closure $messages A string, array of strings or a callback
|
||||
* @param int $type (default: 0)
|
||||
*/
|
||||
public function page($messages, $type = 0)
|
||||
{
|
||||
if (\is_string($messages)) {
|
||||
$messages = (array) $messages;
|
||||
}
|
||||
|
||||
if (!\is_array($messages) && !\is_callable($messages)) {
|
||||
throw new \InvalidArgumentException('Paged output requires a string, array or callback');
|
||||
}
|
||||
|
||||
$this->startPaging();
|
||||
|
||||
if (\is_callable($messages)) {
|
||||
$messages($this);
|
||||
} else {
|
||||
$this->write($messages, true, $type);
|
||||
}
|
||||
|
||||
$this->stopPaging();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start sending output to the output pager.
|
||||
*/
|
||||
public function startPaging()
|
||||
{
|
||||
$this->paging++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop paging output and flush the output pager.
|
||||
*/
|
||||
public function stopPaging()
|
||||
{
|
||||
$this->paging--;
|
||||
$this->closePager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a message to the output.
|
||||
*
|
||||
* Optionally, pass `$type | self::NUMBER_LINES` as the $type parameter to
|
||||
* number the lines of output.
|
||||
*
|
||||
* @throws \InvalidArgumentException When unknown output type is given
|
||||
*
|
||||
* @param string|array $messages The message as an array of lines or a single string
|
||||
* @param bool $newline Whether to add a newline or not
|
||||
* @param int $type The type of output
|
||||
*/
|
||||
public function write($messages, $newline = false, $type = 0)
|
||||
{
|
||||
if ($this->getVerbosity() === self::VERBOSITY_QUIET) {
|
||||
return;
|
||||
}
|
||||
|
||||
$messages = (array) $messages;
|
||||
|
||||
if ($type & self::NUMBER_LINES) {
|
||||
$pad = \strlen((string) \count($messages));
|
||||
$template = $this->isDecorated() ? "<aside>%{$pad}s</aside>: %s" : "%{$pad}s: %s";
|
||||
|
||||
if ($type & self::OUTPUT_RAW) {
|
||||
$messages = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $messages);
|
||||
}
|
||||
|
||||
foreach ($messages as $i => $line) {
|
||||
$messages[$i] = \sprintf($template, $i, $line);
|
||||
}
|
||||
|
||||
// clean this up for super.
|
||||
$type = $type & ~self::NUMBER_LINES & ~self::OUTPUT_RAW;
|
||||
}
|
||||
|
||||
parent::write($messages, $newline, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a message to the output.
|
||||
*
|
||||
* Handles paged output, or writes directly to the output stream.
|
||||
*
|
||||
* @param string $message A message to write to the output
|
||||
* @param bool $newline Whether to add a newline or not
|
||||
*/
|
||||
public function doWrite($message, $newline)
|
||||
{
|
||||
if ($this->paging > 0) {
|
||||
$this->pager->doWrite($message, $newline);
|
||||
} else {
|
||||
parent::doWrite($message, $newline);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush and close the output pager.
|
||||
*/
|
||||
private function closePager()
|
||||
{
|
||||
if ($this->paging <= 0) {
|
||||
$this->pager->close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize output formatter styles.
|
||||
*/
|
||||
private function initFormatters()
|
||||
{
|
||||
$formatter = $this->getFormatter();
|
||||
|
||||
$formatter->setStyle('warning', new OutputFormatterStyle('black', 'yellow'));
|
||||
$formatter->setStyle('error', new OutputFormatterStyle('black', 'red', ['bold']));
|
||||
$formatter->setStyle('aside', new OutputFormatterStyle('blue'));
|
||||
$formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold']));
|
||||
$formatter->setStyle('return', new OutputFormatterStyle('cyan'));
|
||||
$formatter->setStyle('urgent', new OutputFormatterStyle('red'));
|
||||
$formatter->setStyle('hidden', new OutputFormatterStyle('black'));
|
||||
|
||||
// Visibility
|
||||
$formatter->setStyle('public', new OutputFormatterStyle(null, null, ['bold']));
|
||||
$formatter->setStyle('protected', new OutputFormatterStyle('yellow'));
|
||||
$formatter->setStyle('private', new OutputFormatterStyle('red'));
|
||||
$formatter->setStyle('global', new OutputFormatterStyle('cyan', null, ['bold']));
|
||||
$formatter->setStyle('const', new OutputFormatterStyle('cyan'));
|
||||
$formatter->setStyle('class', new OutputFormatterStyle('blue', null, ['underscore']));
|
||||
$formatter->setStyle('function', new OutputFormatterStyle(null));
|
||||
$formatter->setStyle('default', new OutputFormatterStyle(null));
|
||||
|
||||
// Types
|
||||
$formatter->setStyle('number', new OutputFormatterStyle('magenta'));
|
||||
$formatter->setStyle('string', new OutputFormatterStyle('green'));
|
||||
$formatter->setStyle('bool', new OutputFormatterStyle('cyan'));
|
||||
$formatter->setStyle('keyword', new OutputFormatterStyle('yellow'));
|
||||
$formatter->setStyle('comment', new OutputFormatterStyle('blue'));
|
||||
$formatter->setStyle('object', new OutputFormatterStyle('blue'));
|
||||
$formatter->setStyle('resource', new OutputFormatterStyle('yellow'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user