mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 11:11:31 +00:00
Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to address issues observed during initial testing. These files have been updated in order to generate a new set of app images.
This commit is contained in:
-82
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* A dummy file represents a chunk of text that does not have a file system location.
|
||||
*
|
||||
* Dummy files can also represent a changed (but not saved) version of a file
|
||||
* and so can have a file path either set manually, or set by putting
|
||||
* phpcs_input_file: /path/to/file
|
||||
* as the first line of the file contents.
|
||||
*
|
||||
* @author Greg Sherwood <gsherwood@squiz.net>
|
||||
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
||||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
||||
*/
|
||||
|
||||
namespace PHP_CodeSniffer\Files;
|
||||
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Config;
|
||||
|
||||
class DummyFile extends File
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Creates a DummyFile object and sets the content.
|
||||
*
|
||||
* @param string $content The content of the file.
|
||||
* @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
|
||||
* @param \PHP_CodeSniffer\Config $config The config data for the run.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($content, Ruleset $ruleset, Config $config)
|
||||
{
|
||||
$this->setContent($content);
|
||||
|
||||
// See if a filename was defined in the content.
|
||||
// This is done by including: phpcs_input_file: [file path]
|
||||
// as the first line of content.
|
||||
$path = 'STDIN';
|
||||
if ($content !== '') {
|
||||
if (substr($content, 0, 17) === 'phpcs_input_file:') {
|
||||
$eolPos = strpos($content, $this->eolChar);
|
||||
$filename = trim(substr($content, 17, ($eolPos - 17)));
|
||||
$content = substr($content, ($eolPos + strlen($this->eolChar)));
|
||||
$path = $filename;
|
||||
|
||||
$this->setContent($content);
|
||||
}
|
||||
}
|
||||
|
||||
// The CLI arg overrides anything passed in the content.
|
||||
if ($config->stdinPath !== null) {
|
||||
$path = $config->stdinPath;
|
||||
}
|
||||
|
||||
parent::__construct($path, $ruleset, $config);
|
||||
|
||||
}//end __construct()
|
||||
|
||||
|
||||
/**
|
||||
* Set the error, warning, and fixable counts for the file.
|
||||
*
|
||||
* @param int $errorCount The number of errors found.
|
||||
* @param int $warningCount The number of warnings found.
|
||||
* @param int $fixableCount The number of fixable errors found.
|
||||
* @param int $fixedCount The number of errors that were fixed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setErrorCounts($errorCount, $warningCount, $fixableCount, $fixedCount)
|
||||
{
|
||||
$this->errorCount = $errorCount;
|
||||
$this->warningCount = $warningCount;
|
||||
$this->fixableCount = $fixableCount;
|
||||
$this->fixedCount = $fixedCount;
|
||||
|
||||
}//end setErrorCounts()
|
||||
|
||||
|
||||
}//end class
|
||||
File diff suppressed because it is too large
Load Diff
-255
@@ -1,255 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Represents a list of files on the file system that are to be checked during the run.
|
||||
*
|
||||
* File objects are created as needed rather than all at once.
|
||||
*
|
||||
* @author Greg Sherwood <gsherwood@squiz.net>
|
||||
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
||||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
||||
*/
|
||||
|
||||
namespace PHP_CodeSniffer\Files;
|
||||
|
||||
use PHP_CodeSniffer\Autoload;
|
||||
use PHP_CodeSniffer\Util;
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Config;
|
||||
use PHP_CodeSniffer\Exceptions\DeepExitException;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
class FileList implements \Iterator, \Countable
|
||||
{
|
||||
|
||||
/**
|
||||
* A list of file paths that are included in the list.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $files = [];
|
||||
|
||||
/**
|
||||
* The number of files in the list.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $numFiles = 0;
|
||||
|
||||
/**
|
||||
* The config data for the run.
|
||||
*
|
||||
* @var \PHP_CodeSniffer\Config
|
||||
*/
|
||||
public $config = null;
|
||||
|
||||
/**
|
||||
* The ruleset used for the run.
|
||||
*
|
||||
* @var \PHP_CodeSniffer\Ruleset
|
||||
*/
|
||||
public $ruleset = null;
|
||||
|
||||
/**
|
||||
* An array of patterns to use for skipping files.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $ignorePatterns = [];
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a file list and loads in an array of file paths to process.
|
||||
*
|
||||
* @param \PHP_CodeSniffer\Config $config The config data for the run.
|
||||
* @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Config $config, Ruleset $ruleset)
|
||||
{
|
||||
$this->ruleset = $ruleset;
|
||||
$this->config = $config;
|
||||
|
||||
$paths = $config->files;
|
||||
foreach ($paths as $path) {
|
||||
$isPharFile = Util\Common::isPharFile($path);
|
||||
if (is_dir($path) === true || $isPharFile === true) {
|
||||
if ($isPharFile === true) {
|
||||
$path = 'phar://'.$path;
|
||||
}
|
||||
|
||||
$filterClass = $this->getFilterClass();
|
||||
|
||||
$di = new \RecursiveDirectoryIterator($path, (\RecursiveDirectoryIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS));
|
||||
$filter = new $filterClass($di, $path, $config, $ruleset);
|
||||
$iterator = new \RecursiveIteratorIterator($filter);
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
$this->files[$file->getPathname()] = null;
|
||||
$this->numFiles++;
|
||||
}
|
||||
} else {
|
||||
$this->addFile($path);
|
||||
}//end if
|
||||
}//end foreach
|
||||
|
||||
reset($this->files);
|
||||
|
||||
}//end __construct()
|
||||
|
||||
|
||||
/**
|
||||
* Add a file to the list.
|
||||
*
|
||||
* If a file object has already been created, it can be passed here.
|
||||
* If it is left NULL, it will be created when accessed.
|
||||
*
|
||||
* @param string $path The path to the file being added.
|
||||
* @param \PHP_CodeSniffer\Files\File $file The file being added.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addFile($path, $file=null)
|
||||
{
|
||||
// No filtering is done for STDIN when the filename
|
||||
// has not been specified.
|
||||
if ($path === 'STDIN') {
|
||||
$this->files[$path] = $file;
|
||||
$this->numFiles++;
|
||||
return;
|
||||
}
|
||||
|
||||
$filterClass = $this->getFilterClass();
|
||||
|
||||
$di = new \RecursiveArrayIterator([$path]);
|
||||
$filter = new $filterClass($di, $path, $this->config, $this->ruleset);
|
||||
$iterator = new \RecursiveIteratorIterator($filter);
|
||||
|
||||
foreach ($iterator as $path) {
|
||||
$this->files[$path] = $file;
|
||||
$this->numFiles++;
|
||||
}
|
||||
|
||||
}//end addFile()
|
||||
|
||||
|
||||
/**
|
||||
* Get the class name of the filter being used for the run.
|
||||
*
|
||||
* @return string
|
||||
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the specified filter could not be found.
|
||||
*/
|
||||
private function getFilterClass()
|
||||
{
|
||||
$filterType = $this->config->filter;
|
||||
|
||||
if ($filterType === null) {
|
||||
$filterClass = '\PHP_CodeSniffer\Filters\Filter';
|
||||
} else {
|
||||
if (strpos($filterType, '.') !== false) {
|
||||
// This is a path to a custom filter class.
|
||||
$filename = realpath($filterType);
|
||||
if ($filename === false) {
|
||||
$error = "ERROR: Custom filter \"$filterType\" not found".PHP_EOL;
|
||||
throw new DeepExitException($error, 3);
|
||||
}
|
||||
|
||||
$filterClass = Autoload::loadFile($filename);
|
||||
} else {
|
||||
$filterClass = '\PHP_CodeSniffer\Filters\\'.$filterType;
|
||||
}
|
||||
}
|
||||
|
||||
return $filterClass;
|
||||
|
||||
}//end getFilterClass()
|
||||
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the first file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
reset($this->files);
|
||||
|
||||
}//end rewind()
|
||||
|
||||
|
||||
/**
|
||||
* Get the file that is currently being processed.
|
||||
*
|
||||
* @return \PHP_CodeSniffer\Files\File
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
$path = key($this->files);
|
||||
if (isset($this->files[$path]) === false) {
|
||||
$this->files[$path] = new LocalFile($path, $this->ruleset, $this->config);
|
||||
}
|
||||
|
||||
return $this->files[$path];
|
||||
|
||||
}//end current()
|
||||
|
||||
|
||||
/**
|
||||
* Return the file path of the current file being processed.
|
||||
*
|
||||
* @return string|null Path name or `null` when the end of the iterator has been reached.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return key($this->files);
|
||||
|
||||
}//end key()
|
||||
|
||||
|
||||
/**
|
||||
* Move forward to the next file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
next($this->files);
|
||||
|
||||
}//end next()
|
||||
|
||||
|
||||
/**
|
||||
* Checks if current position is valid.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
if (current($this->files) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}//end valid()
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of files in the list.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return $this->numFiles;
|
||||
|
||||
}//end count()
|
||||
|
||||
|
||||
}//end class
|
||||
-219
@@ -1,219 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* A local file represents a chunk of text has a file system location.
|
||||
*
|
||||
* @author Greg Sherwood <gsherwood@squiz.net>
|
||||
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
||||
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
||||
*/
|
||||
|
||||
namespace PHP_CodeSniffer\Files;
|
||||
|
||||
use PHP_CodeSniffer\Ruleset;
|
||||
use PHP_CodeSniffer\Config;
|
||||
use PHP_CodeSniffer\Util\Cache;
|
||||
use PHP_CodeSniffer\Util\Common;
|
||||
|
||||
class LocalFile extends File
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Creates a LocalFile object and sets the content.
|
||||
*
|
||||
* @param string $path The absolute path to the file.
|
||||
* @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
|
||||
* @param \PHP_CodeSniffer\Config $config The config data for the run.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($path, Ruleset $ruleset, Config $config)
|
||||
{
|
||||
$this->path = trim($path);
|
||||
if (Common::isReadable($this->path) === false) {
|
||||
parent::__construct($this->path, $ruleset, $config);
|
||||
$error = 'Error opening file; file no longer exists or you do not have access to read the file';
|
||||
$this->addMessage(true, $error, 1, 1, 'Internal.LocalFile', [], 5, false);
|
||||
$this->ignored = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Before we go and spend time tokenizing this file, just check
|
||||
// to see if there is a tag up top to indicate that the whole
|
||||
// file should be ignored. It must be on one of the first two lines.
|
||||
if ($config->annotations === true) {
|
||||
$handle = fopen($this->path, 'r');
|
||||
if ($handle !== false) {
|
||||
$firstContent = fgets($handle);
|
||||
$firstContent .= fgets($handle);
|
||||
fclose($handle);
|
||||
|
||||
if (strpos($firstContent, '@codingStandardsIgnoreFile') !== false
|
||||
|| stripos($firstContent, 'phpcs:ignorefile') !== false
|
||||
) {
|
||||
// We are ignoring the whole file.
|
||||
$this->ignored = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->reloadContent();
|
||||
|
||||
parent::__construct($this->path, $ruleset, $config);
|
||||
|
||||
}//end __construct()
|
||||
|
||||
|
||||
/**
|
||||
* Loads the latest version of the file's content from the file system.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reloadContent()
|
||||
{
|
||||
$this->setContent(file_get_contents($this->path));
|
||||
|
||||
}//end reloadContent()
|
||||
|
||||
|
||||
/**
|
||||
* Processes the file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
if ($this->ignored === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->configCache['cache'] === false) {
|
||||
parent::process();
|
||||
return;
|
||||
}
|
||||
|
||||
$hash = md5_file($this->path);
|
||||
$hash .= fileperms($this->path);
|
||||
$cache = Cache::get($this->path);
|
||||
if ($cache !== false && $cache['hash'] === $hash) {
|
||||
// We can't filter metrics, so just load all of them.
|
||||
$this->metrics = $cache['metrics'];
|
||||
|
||||
if ($this->configCache['recordErrors'] === true) {
|
||||
// Replay the cached errors and warnings to filter out the ones
|
||||
// we don't need for this specific run.
|
||||
$this->configCache['cache'] = false;
|
||||
$this->replayErrors($cache['errors'], $cache['warnings']);
|
||||
$this->configCache['cache'] = true;
|
||||
} else {
|
||||
$this->errorCount = $cache['errorCount'];
|
||||
$this->warningCount = $cache['warningCount'];
|
||||
$this->fixableCount = $cache['fixableCount'];
|
||||
}
|
||||
|
||||
if (PHP_CODESNIFFER_VERBOSITY > 0
|
||||
|| (PHP_CODESNIFFER_CBF === true && empty($this->config->files) === false)
|
||||
) {
|
||||
echo "[loaded from cache]... ";
|
||||
}
|
||||
|
||||
$this->numTokens = $cache['numTokens'];
|
||||
$this->fromCache = true;
|
||||
return;
|
||||
}//end if
|
||||
|
||||
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
parent::process();
|
||||
|
||||
$cache = [
|
||||
'hash' => $hash,
|
||||
'errors' => $this->errors,
|
||||
'warnings' => $this->warnings,
|
||||
'metrics' => $this->metrics,
|
||||
'errorCount' => $this->errorCount,
|
||||
'warningCount' => $this->warningCount,
|
||||
'fixableCount' => $this->fixableCount,
|
||||
'numTokens' => $this->numTokens,
|
||||
];
|
||||
|
||||
Cache::set($this->path, $cache);
|
||||
|
||||
// During caching, we don't filter out errors in any way, so
|
||||
// we need to do that manually now by replaying them.
|
||||
if ($this->configCache['recordErrors'] === true) {
|
||||
$this->configCache['cache'] = false;
|
||||
$this->replayErrors($this->errors, $this->warnings);
|
||||
$this->configCache['cache'] = true;
|
||||
}
|
||||
|
||||
}//end process()
|
||||
|
||||
|
||||
/**
|
||||
* Clears and replays error and warnings for the file.
|
||||
*
|
||||
* Replaying errors and warnings allows for filtering rules to be changed
|
||||
* and then errors and warnings to be reapplied with the new rules. This is
|
||||
* particularly useful while caching.
|
||||
*
|
||||
* @param array $errors The list of errors to replay.
|
||||
* @param array $warnings The list of warnings to replay.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function replayErrors($errors, $warnings)
|
||||
{
|
||||
$this->errors = [];
|
||||
$this->warnings = [];
|
||||
$this->errorCount = 0;
|
||||
$this->warningCount = 0;
|
||||
$this->fixableCount = 0;
|
||||
|
||||
$this->replayingErrors = true;
|
||||
|
||||
foreach ($errors as $line => $lineErrors) {
|
||||
foreach ($lineErrors as $column => $colErrors) {
|
||||
foreach ($colErrors as $error) {
|
||||
$this->activeListener = $error['listener'];
|
||||
$this->addMessage(
|
||||
true,
|
||||
$error['message'],
|
||||
$line,
|
||||
$column,
|
||||
$error['source'],
|
||||
[],
|
||||
$error['severity'],
|
||||
$error['fixable']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($warnings as $line => $lineErrors) {
|
||||
foreach ($lineErrors as $column => $colErrors) {
|
||||
foreach ($colErrors as $error) {
|
||||
$this->activeListener = $error['listener'];
|
||||
$this->addMessage(
|
||||
false,
|
||||
$error['message'],
|
||||
$line,
|
||||
$column,
|
||||
$error['source'],
|
||||
[],
|
||||
$error['severity'],
|
||||
$error['fixable']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->replayingErrors = false;
|
||||
|
||||
}//end replayErrors()
|
||||
|
||||
|
||||
}//end class
|
||||
Reference in New Issue
Block a user