mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 19:21:33 +00:00
updated streamline-setup v2
This commit is contained in:
@@ -22,10 +22,9 @@ class GNUReadline implements Readline
|
||||
{
|
||||
/** @var string|false */
|
||||
protected $historyFile;
|
||||
/** @var int */
|
||||
protected $historySize;
|
||||
/** @var bool */
|
||||
protected $eraseDups;
|
||||
protected int $historySize;
|
||||
// @todo better type for this
|
||||
protected ?bool $eraseDups;
|
||||
|
||||
/**
|
||||
* GNU Readline is supported iff `readline_list_history` is defined. PHP
|
||||
@@ -105,7 +104,7 @@ class GNUReadline implements Readline
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readline(string $prompt = null)
|
||||
public function readline(?string $prompt = null)
|
||||
{
|
||||
return \readline($prompt);
|
||||
}
|
||||
|
||||
+2
-2
@@ -62,8 +62,8 @@ class AutocompleterPath implements Autocompleter
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
string $root = null,
|
||||
\Closure $iteratorFactory = null
|
||||
?string $root = null,
|
||||
?\Closure $iteratorFactory = null
|
||||
) {
|
||||
if (null === $root) {
|
||||
$root = static::PWD;
|
||||
|
||||
@@ -154,7 +154,7 @@ class ConsoleCursor
|
||||
* Move to the line X and the column Y.
|
||||
* If null, use the current coordinate.
|
||||
*/
|
||||
public static function moveTo(int $x = null, int $y = null)
|
||||
public static function moveTo(?int $x = null, ?int $y = null)
|
||||
{
|
||||
if (null === $x || null === $y) {
|
||||
$position = static::getPosition();
|
||||
|
||||
@@ -53,7 +53,7 @@ class ConsoleInput implements StreamIn
|
||||
/**
|
||||
* Wraps an `Hoa\Stream\IStream\In` stream.
|
||||
*/
|
||||
public function __construct(StreamIn $input = null)
|
||||
public function __construct(?StreamIn $input = null)
|
||||
{
|
||||
if (null === $input) {
|
||||
if (\defined('STDIN') &&
|
||||
|
||||
@@ -57,7 +57,7 @@ class ConsoleOutput implements StreamOut
|
||||
/**
|
||||
* Wraps an `Hoa\Stream\IStream\Out` stream.
|
||||
*/
|
||||
public function __construct(StreamOut $output = null)
|
||||
public function __construct(?StreamOut $output = null)
|
||||
{
|
||||
$this->_output = $output;
|
||||
|
||||
|
||||
+6
-6
@@ -245,10 +245,10 @@ class ConsoleProcessus extends Stream implements StreamIn, StreamOut, StreamPath
|
||||
*/
|
||||
public function __construct(
|
||||
string $command,
|
||||
array $options = null,
|
||||
array $descriptors = null,
|
||||
string $cwd = null,
|
||||
array $environment = null,
|
||||
?array $options = null,
|
||||
?array $descriptors = null,
|
||||
?string $cwd = null,
|
||||
?array $environment = null,
|
||||
int $timeout = 30
|
||||
) {
|
||||
$this->setCommand($command);
|
||||
@@ -285,7 +285,7 @@ class ConsoleProcessus extends Stream implements StreamIn, StreamOut, StreamPath
|
||||
/**
|
||||
* Open the stream and return the associated resource.
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
$out = @\proc_open(
|
||||
$streamName,
|
||||
@@ -527,7 +527,7 @@ class ConsoleProcessus extends Stream implements StreamIn, StreamOut, StreamPath
|
||||
* Read an array.
|
||||
* Alias of the $this->scanf() method.
|
||||
*/
|
||||
public function readArray(string $format = null, int $pipe = 1)
|
||||
public function readArray(?string $format = null, int $pipe = 1)
|
||||
{
|
||||
return $this->scanf($format, $pipe);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class Exception extends ExceptionIdle implements EventSource
|
||||
string $message,
|
||||
int $code = 0,
|
||||
$arguments = [],
|
||||
\Throwable $previous = null
|
||||
?\Throwable $previous = null
|
||||
) {
|
||||
parent::__construct($message, $code, $arguments, $previous);
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class ExceptionIdle extends \Exception
|
||||
string $message,
|
||||
int $code = 0,
|
||||
$arguments = [],
|
||||
\Exception $previous = null
|
||||
?\Exception $previous = null
|
||||
) {
|
||||
$this->_tmpArguments = $arguments;
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
@@ -105,7 +105,7 @@ abstract class File extends FileGeneric implements StreamBufferable, StreamLocka
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
$this->setMode($mode);
|
||||
@@ -140,7 +140,7 @@ abstract class File extends FileGeneric implements StreamBufferable, StreamLocka
|
||||
/**
|
||||
* Open the stream and return the associated resource.
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
if (\substr($streamName, 0, 4) === 'file' &&
|
||||
false === \is_dir(\dirname($streamName))) {
|
||||
@@ -181,7 +181,7 @@ abstract class File extends FileGeneric implements StreamBufferable, StreamLocka
|
||||
* Start a new buffer.
|
||||
* The callable acts like a light filter.
|
||||
*/
|
||||
public function newBuffer($callable = null, int $size = null): int
|
||||
public function newBuffer($callable = null, ?int $size = null): int
|
||||
{
|
||||
$this->setStreamBuffer($size);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class FileDirectory extends FileGeneric
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode = self::MODE_READ,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
$this->setMode($mode);
|
||||
@@ -78,7 +78,7 @@ class FileDirectory extends FileGeneric
|
||||
/**
|
||||
* Open the stream and return the associated resource.
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
if (false === \is_dir($streamName)) {
|
||||
if ($this->getMode() === self::MODE_READ) {
|
||||
@@ -185,7 +185,7 @@ class FileDirectory extends FileGeneric
|
||||
public static function create(
|
||||
string $name,
|
||||
string $mode = self::MODE_CREATE_RECURSIVE,
|
||||
string $context = null
|
||||
?string $context = null
|
||||
): bool {
|
||||
if (true === \is_dir($name)) {
|
||||
return true;
|
||||
|
||||
@@ -229,7 +229,7 @@ abstract class FileGeneric extends Stream implements StreamPathable, StreamStata
|
||||
/**
|
||||
* Set access and modification time of file.
|
||||
*/
|
||||
public function touch(int $time = null, int $atime = null): bool
|
||||
public function touch(?int $time = null, ?int $atime = null): bool
|
||||
{
|
||||
if (null === $time) {
|
||||
$time = \time();
|
||||
@@ -333,7 +333,7 @@ abstract class FileGeneric extends Stream implements StreamPathable, StreamStata
|
||||
/**
|
||||
* Change the current umask.
|
||||
*/
|
||||
public static function umask(int $umask = null): int
|
||||
public static function umask(?int $umask = null): int
|
||||
{
|
||||
if (null === $umask) {
|
||||
return \umask();
|
||||
|
||||
@@ -49,7 +49,7 @@ class FileLink extends File
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
if (!\is_link($streamName)) {
|
||||
|
||||
@@ -57,7 +57,7 @@ class FileLinkRead extends FileLink implements StreamIn
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode = parent::MODE_READ,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
parent::__construct($streamName, $mode, $context, $wait);
|
||||
@@ -76,7 +76,7 @@ class FileLinkRead extends FileLink implements StreamIn
|
||||
* @throws \Hoa\File\Exception\FileDoesNotExist
|
||||
* @throws \Hoa\File\Exception
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
static $createModes = [
|
||||
parent::MODE_READ,
|
||||
@@ -190,7 +190,7 @@ class FileLinkRead extends FileLink implements StreamIn
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function readArray(string $format = null)
|
||||
public function readArray(?string $format = null)
|
||||
{
|
||||
return $this->scanf($format);
|
||||
}
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@ class FileLinkReadWrite extends FileLink implements StreamIn, StreamOut
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode = parent::MODE_APPEND_READ_WRITE,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
parent::__construct($streamName, $mode, $context, $wait);
|
||||
@@ -60,7 +60,7 @@ class FileLinkReadWrite extends FileLink implements StreamIn, StreamOut
|
||||
/**
|
||||
* Open the stream and return the associated resource.
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
static $createModes = [
|
||||
parent::MODE_READ_WRITE,
|
||||
@@ -150,7 +150,7 @@ class FileLinkReadWrite extends FileLink implements StreamIn, StreamOut
|
||||
* Read an array.
|
||||
* Alias of the $this->scanf() method.
|
||||
*/
|
||||
public function readArray(string $format = null)
|
||||
public function readArray(?string $format = null)
|
||||
{
|
||||
return $this->scanf($format);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class FileRead extends File implements StreamIn
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode = parent::MODE_READ,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
parent::__construct($streamName, $mode, $context, $wait);
|
||||
@@ -60,7 +60,7 @@ class FileRead extends File implements StreamIn
|
||||
/**
|
||||
* Open the stream and return the associated resource.
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
static $createModes = [
|
||||
parent::MODE_READ,
|
||||
@@ -146,7 +146,7 @@ class FileRead extends File implements StreamIn
|
||||
* Read an array.
|
||||
* Alias of the $this->scanf() method.
|
||||
*/
|
||||
public function readArray(string $format = null)
|
||||
public function readArray(?string $format = null)
|
||||
{
|
||||
return $this->scanf($format);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class FileReadWrite extends File implements StreamIn, StreamOut
|
||||
public function __construct(
|
||||
string $streamName,
|
||||
string $mode = parent::MODE_APPEND_READ_WRITE,
|
||||
string $context = null,
|
||||
?string $context = null,
|
||||
bool $wait = false
|
||||
) {
|
||||
parent::__construct($streamName, $mode, $context, $wait);
|
||||
@@ -60,7 +60,7 @@ class FileReadWrite extends File implements StreamIn, StreamOut
|
||||
/**
|
||||
* Open the stream and return the associated resource.
|
||||
*/
|
||||
protected function &_open(string $streamName, StreamContext $context = null)
|
||||
protected function &_open(string $streamName, ?StreamContext $context = null)
|
||||
{
|
||||
static $createModes = [
|
||||
parent::MODE_READ_WRITE,
|
||||
@@ -150,7 +150,7 @@ class FileReadWrite extends File implements StreamIn, StreamOut
|
||||
* Read an array.
|
||||
* Alias of the $this->scanf() method.
|
||||
*/
|
||||
public function readArray(string $format = null)
|
||||
public function readArray(?string $format = null)
|
||||
{
|
||||
return $this->scanf($format);
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class IteratorFileSystem extends \FilesystemIterator
|
||||
* Please, see \FileSystemIterator::__construct() method.
|
||||
* We add the $splFileInfoClass parameter.
|
||||
*/
|
||||
public function __construct(string $path, int $flags = null, string $splFileInfoClass = null)
|
||||
public function __construct(string $path, ?int $flags = null, ?string $splFileInfoClass = null)
|
||||
{
|
||||
$this->_splFileInfoClass = $splFileInfoClass;
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class IteratorRecursiveDirectory extends \RecursiveDirectoryIterator
|
||||
* Please, see \RecursiveDirectoryIterator::__construct() method.
|
||||
* We add the $splFileInfoClass parameter.
|
||||
*/
|
||||
public function __construct(string $path, int $flags = null, string $splFileInfoClass = null)
|
||||
public function __construct(string $path, ?int $flags = null, ?string $splFileInfoClass = null)
|
||||
{
|
||||
if (null === $flags) {
|
||||
parent::__construct($path);
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ class IteratorSplFileInfo extends \SplFileInfo
|
||||
/**
|
||||
* Construct.
|
||||
*/
|
||||
public function __construct(string $filename, string $relativePath = null)
|
||||
public function __construct(string $filename, ?string $relativePath = null)
|
||||
{
|
||||
parent::__construct($filename);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class ProtocolNode implements \ArrayAccess, \IteratorAggregate
|
||||
* overload the `$_name` attribute), we can set the `$_name` attribute
|
||||
* dynamically. This is useful to create a node on-the-fly.
|
||||
*/
|
||||
public function __construct(string $name = null, string $reach = null, array $children = [])
|
||||
public function __construct(?string $name = null, ?string $reach = null, array $children = [])
|
||||
{
|
||||
if (null !== $name) {
|
||||
$this->_name = $name;
|
||||
@@ -133,7 +133,7 @@ class ProtocolNode implements \ArrayAccess, \IteratorAggregate
|
||||
* Resolve a path, i.e. iterate the nodes tree and reach the queue of
|
||||
* the path.
|
||||
*/
|
||||
protected function _resolve(string $path, &$accumulator, string $id = null)
|
||||
protected function _resolve(string $path, &$accumulator, ?string $id = null)
|
||||
{
|
||||
if (\substr($path, 0, 6) === 'hoa://') {
|
||||
$path = \substr($path, 6);
|
||||
@@ -246,7 +246,7 @@ class ProtocolNode implements \ArrayAccess, \IteratorAggregate
|
||||
* Queue of the node.
|
||||
* Generic one. Must be overrided in children classes.
|
||||
*/
|
||||
public function reach(string $queue = null)
|
||||
public function reach(?string $queue = null)
|
||||
{
|
||||
return empty($queue) ? $this->_reach : $queue;
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class ProtocolNodeLibrary extends ProtocolNode
|
||||
/**
|
||||
* Queue of the component.
|
||||
*/
|
||||
public function reach(string $queue = null)
|
||||
public function reach(?string $queue = null)
|
||||
{
|
||||
$withComposer = \class_exists('Composer\Autoload\ClassLoader', false) ||
|
||||
('cli' === \PHP_SAPI && \file_exists(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'autoload.php'));
|
||||
|
||||
@@ -137,7 +137,7 @@ class Readline
|
||||
/**
|
||||
* Read a line from the input.
|
||||
*/
|
||||
public function readLine(string $prefix = null)
|
||||
public function readLine(?string $prefix = null)
|
||||
{
|
||||
$input = Console::getInput();
|
||||
|
||||
@@ -270,7 +270,7 @@ class Readline
|
||||
/**
|
||||
* Add an entry in the history.
|
||||
*/
|
||||
public function addHistory(string $line = null)
|
||||
public function addHistory(?string $line = null)
|
||||
{
|
||||
if (empty($line)) {
|
||||
return;
|
||||
@@ -294,7 +294,7 @@ class Readline
|
||||
/**
|
||||
* Get an entry in the history.
|
||||
*/
|
||||
public function getHistory(int $i = null)
|
||||
public function getHistory(?int $i = null)
|
||||
{
|
||||
if (null === $i) {
|
||||
$i = $this->_historyCurrent;
|
||||
|
||||
@@ -110,7 +110,7 @@ abstract class Stream implements IStream, EventListenable
|
||||
* If not exists in the register, try to call the
|
||||
* `$this->_open()` method. Please, see the `self::_getStream()` method.
|
||||
*/
|
||||
public function __construct(string $streamName, string $context = null, bool $wait = false)
|
||||
public function __construct(string $streamName, ?string $context = null, bool $wait = false)
|
||||
{
|
||||
$this->_streamName = $streamName;
|
||||
$this->_context = $context;
|
||||
@@ -150,7 +150,7 @@ abstract class Stream implements IStream, EventListenable
|
||||
private static function &_getStream(
|
||||
string $streamName,
|
||||
self $handler,
|
||||
string $context = null
|
||||
?string $context = null
|
||||
): array {
|
||||
$name = \md5($streamName);
|
||||
|
||||
@@ -195,7 +195,7 @@ abstract class Stream implements IStream, EventListenable
|
||||
* Note: This method is protected, but do not forget that it could be
|
||||
* overloaded into a public context.
|
||||
*/
|
||||
abstract protected function &_open(string $streamName, StreamContext $context = null);
|
||||
abstract protected function &_open(string $streamName, ?StreamContext $context = null);
|
||||
|
||||
/**
|
||||
* Close the current stream.
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ interface StreamBufferable extends IStream
|
||||
* Start a new buffer.
|
||||
* The callable acts like a light filter.
|
||||
*/
|
||||
public function newBuffer($callable = null, int $size = null): int;
|
||||
public function newBuffer($callable = null, ?int $size = null): int;
|
||||
|
||||
/**
|
||||
* Flush the buffer.
|
||||
|
||||
+1
-1
@@ -106,5 +106,5 @@ interface StreamTouchable extends IStream
|
||||
/**
|
||||
* Change the current umask.
|
||||
*/
|
||||
public static function umask(int $umask = null): int;
|
||||
public static function umask(?int $umask = null): int;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use Psy\Util\Str;
|
||||
*/
|
||||
class Libedit extends GNUReadline
|
||||
{
|
||||
private $hasWarnedOwnership = false;
|
||||
private bool $hasWarnedOwnership = false;
|
||||
|
||||
/**
|
||||
* Let's emulate GNU Readline by manually reading and parsing the history file!
|
||||
@@ -48,6 +48,10 @@ class Libedit extends GNUReadline
|
||||
*/
|
||||
public function listHistory(): array
|
||||
{
|
||||
if ($this->historyFile === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$history = \file_get_contents($this->historyFile);
|
||||
if (!$history) {
|
||||
return [];
|
||||
@@ -63,6 +67,7 @@ class Libedit extends GNUReadline
|
||||
|
||||
// decode the line
|
||||
$history = \array_map([$this, 'parseHistoryLine'], $history);
|
||||
|
||||
// filter empty lines & comments
|
||||
return \array_values(\array_filter($history));
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ interface Readline
|
||||
*
|
||||
* @return false|string
|
||||
*/
|
||||
public function readline(string $prompt = null);
|
||||
public function readline(?string $prompt = null);
|
||||
|
||||
/**
|
||||
* Redraw readline to redraw the display.
|
||||
|
||||
@@ -18,9 +18,10 @@ use Psy\Exception\BreakException;
|
||||
*/
|
||||
class Transient implements Readline
|
||||
{
|
||||
private $history;
|
||||
private $historySize;
|
||||
private $eraseDups;
|
||||
private array $history;
|
||||
private int $historySize;
|
||||
private bool $eraseDups;
|
||||
/** @var resource */
|
||||
private $stdin;
|
||||
|
||||
/**
|
||||
@@ -49,7 +50,7 @@ class Transient implements Readline
|
||||
// don't do anything with the history file...
|
||||
$this->history = [];
|
||||
$this->historySize = $historySize;
|
||||
$this->eraseDups = $eraseDups;
|
||||
$this->eraseDups = $eraseDups ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +111,7 @@ class Transient implements Readline
|
||||
*
|
||||
* @return false|string
|
||||
*/
|
||||
public function readline(string $prompt = null)
|
||||
public function readline(?string $prompt = null)
|
||||
{
|
||||
echo $prompt;
|
||||
|
||||
|
||||
@@ -25,15 +25,11 @@ use Psy\Readline\Hoa\Ustring as HoaUstring;
|
||||
*/
|
||||
class Userland implements Readline
|
||||
{
|
||||
/** @var HoaReadline */
|
||||
private $hoaReadline;
|
||||
|
||||
/** @var string|null */
|
||||
private $lastPrompt;
|
||||
|
||||
private $tput;
|
||||
private $input;
|
||||
private $output;
|
||||
private HoaReadline $hoaReadline;
|
||||
private ?string $lastPrompt = null;
|
||||
private HoaConsoleTput $tput;
|
||||
private HoaConsoleInput $input;
|
||||
private HoaConsoleOutput $output;
|
||||
|
||||
public static function isSupported(): bool
|
||||
{
|
||||
@@ -138,7 +134,7 @@ class Userland implements Readline
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function readline(string $prompt = null)
|
||||
public function readline(?string $prompt = null)
|
||||
{
|
||||
$this->lastPrompt = $prompt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user