mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 11:11:31 +00:00
Build modified streamline images
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\VarDumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
/**
|
||||
* A PsySH-specialized VarCloner.
|
||||
*/
|
||||
class Cloner extends VarCloner
|
||||
{
|
||||
private $filter = 0;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cloneVar($var, $filter = 0): Data
|
||||
{
|
||||
$this->filter = $filter;
|
||||
|
||||
return parent::cloneVar($var, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function castResource(Stub $stub, $isNested): array
|
||||
{
|
||||
return Caster::EXCLUDE_VERBOSE & $this->filter ? [] : parent::castResource($stub, $isNested);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\VarDumper;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\VarDumper\Cloner\Cursor;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
|
||||
/**
|
||||
* A PsySH-specialized CliDumper.
|
||||
*/
|
||||
class Dumper extends CliDumper
|
||||
{
|
||||
private $formatter;
|
||||
private $forceArrayIndexes;
|
||||
|
||||
private const ONLY_CONTROL_CHARS = '/^[\x00-\x1F\x7F]+$/';
|
||||
private const CONTROL_CHARS = '/([\x00-\x1F\x7F]+)/';
|
||||
private const CONTROL_CHARS_MAP = [
|
||||
"\0" => '\0',
|
||||
"\t" => '\t',
|
||||
"\n" => '\n',
|
||||
"\v" => '\v',
|
||||
"\f" => '\f',
|
||||
"\r" => '\r',
|
||||
"\033" => '\e',
|
||||
];
|
||||
|
||||
public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
|
||||
{
|
||||
$this->formatter = $formatter;
|
||||
$this->forceArrayIndexes = $forceArrayIndexes;
|
||||
parent::__construct();
|
||||
$this->setColors(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild): void
|
||||
{
|
||||
if (Cursor::HASH_INDEXED === $type || Cursor::HASH_ASSOC === $type) {
|
||||
$class = 0;
|
||||
}
|
||||
parent::enterHash($cursor, $type, $class, $hasChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dumpKey(Cursor $cursor): void
|
||||
{
|
||||
if ($this->forceArrayIndexes || Cursor::HASH_INDEXED !== $cursor->hashType) {
|
||||
parent::dumpKey($cursor);
|
||||
}
|
||||
}
|
||||
|
||||
protected function style($style, $value, $attr = []): string
|
||||
{
|
||||
if ('ref' === $style) {
|
||||
$value = \strtr($value, '@', '#');
|
||||
}
|
||||
|
||||
$styled = '';
|
||||
$cchr = $this->styles['cchr'];
|
||||
|
||||
$chunks = \preg_split(self::CONTROL_CHARS, $value, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
|
||||
foreach ($chunks as $chunk) {
|
||||
if (\preg_match(self::ONLY_CONTROL_CHARS, $chunk)) {
|
||||
$chars = '';
|
||||
$i = 0;
|
||||
do {
|
||||
$chars .= isset(self::CONTROL_CHARS_MAP[$chunk[$i]]) ? self::CONTROL_CHARS_MAP[$chunk[$i]] : \sprintf('\x%02X', \ord($chunk[$i]));
|
||||
} while (isset($chunk[++$i]));
|
||||
|
||||
$chars = $this->formatter->escape($chars);
|
||||
$styled .= "<{$cchr}>{$chars}</{$cchr}>";
|
||||
} else {
|
||||
$styled .= $this->formatter->escape($chunk);
|
||||
}
|
||||
}
|
||||
|
||||
$style = $this->styles[$style];
|
||||
|
||||
return "<{$style}>{$styled}</{$style}>";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dumpLine($depth, $endOfValue = false): void
|
||||
{
|
||||
if ($endOfValue && 0 < $depth) {
|
||||
$this->line .= ',';
|
||||
}
|
||||
$this->line = $this->formatter->format($this->line);
|
||||
parent::dumpLine($depth, $endOfValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\VarDumper;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* A Presenter service.
|
||||
*/
|
||||
class Presenter
|
||||
{
|
||||
const VERBOSE = 1;
|
||||
|
||||
private $cloner;
|
||||
private $dumper;
|
||||
private $exceptionsImportants = [
|
||||
"\0*\0message",
|
||||
"\0*\0code",
|
||||
"\0*\0file",
|
||||
"\0*\0line",
|
||||
"\0Exception\0previous",
|
||||
];
|
||||
private $styles = [
|
||||
'num' => 'number',
|
||||
'integer' => 'integer',
|
||||
'float' => 'float',
|
||||
'const' => 'const',
|
||||
'str' => 'string',
|
||||
'cchr' => 'default',
|
||||
'note' => 'class',
|
||||
'ref' => 'default',
|
||||
'public' => 'public',
|
||||
'protected' => 'protected',
|
||||
'private' => 'private',
|
||||
'meta' => 'comment',
|
||||
'key' => 'comment',
|
||||
'index' => 'number',
|
||||
];
|
||||
|
||||
public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
|
||||
{
|
||||
// Work around https://github.com/symfony/symfony/issues/23572
|
||||
$oldLocale = \setlocale(\LC_NUMERIC, 0);
|
||||
\setlocale(\LC_NUMERIC, 'C');
|
||||
|
||||
$this->dumper = new Dumper($formatter, $forceArrayIndexes);
|
||||
$this->dumper->setStyles($this->styles);
|
||||
|
||||
// Now put the locale back
|
||||
\setlocale(\LC_NUMERIC, $oldLocale);
|
||||
|
||||
$this->cloner = new Cloner();
|
||||
$this->cloner->addCasters(['*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) {
|
||||
if ($filter || $isNested) {
|
||||
if ($obj instanceof \Throwable) {
|
||||
$a = Caster::filter($a, Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, $this->exceptionsImportants);
|
||||
} else {
|
||||
$a = Caster::filter($a, Caster::EXCLUDE_PROTECTED | Caster::EXCLUDE_PRIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register casters.
|
||||
*
|
||||
* @see http://symfony.com/doc/current/components/var_dumper/advanced.html#casters
|
||||
*
|
||||
* @param callable[] $casters A map of casters
|
||||
*/
|
||||
public function addCasters(array $casters)
|
||||
{
|
||||
$this->cloner->addCasters($casters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Present a reference to the value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function presentRef($value): string
|
||||
{
|
||||
return $this->present($value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Present a full representation of the value.
|
||||
*
|
||||
* If $depth is 0, the value will be presented as a ref instead.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param int $depth (default: null)
|
||||
* @param int $options One of Presenter constants
|
||||
*/
|
||||
public function present($value, int $depth = null, int $options = 0): string
|
||||
{
|
||||
$data = $this->cloner->cloneVar($value, !($options & self::VERBOSE) ? Caster::EXCLUDE_VERBOSE : 0);
|
||||
|
||||
if (null !== $depth) {
|
||||
$data = $data->withMaxDepth($depth);
|
||||
}
|
||||
|
||||
// Work around https://github.com/symfony/symfony/issues/23572
|
||||
$oldLocale = \setlocale(\LC_NUMERIC, 0);
|
||||
\setlocale(\LC_NUMERIC, 'C');
|
||||
|
||||
$output = '';
|
||||
$this->dumper->dump($data, function ($line, $depth) use (&$output) {
|
||||
if ($depth >= 0) {
|
||||
if ('' !== $output) {
|
||||
$output .= \PHP_EOL;
|
||||
}
|
||||
$output .= \str_repeat(' ', $depth).$line;
|
||||
}
|
||||
});
|
||||
|
||||
// Now put the locale back
|
||||
\setlocale(\LC_NUMERIC, $oldLocale);
|
||||
|
||||
return OutputFormatter::escape($output);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy\VarDumper;
|
||||
|
||||
/**
|
||||
* Presenter injects itself as a dependency to all objects which
|
||||
* implement PresenterAware.
|
||||
*/
|
||||
interface PresenterAware
|
||||
{
|
||||
/**
|
||||
* Set a reference to the Presenter.
|
||||
*
|
||||
* @param Presenter $presenter
|
||||
*/
|
||||
public function setPresenter(Presenter $presenter);
|
||||
}
|
||||
Reference in New Issue
Block a user