mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
php cs and stan fixes
This commit is contained in:
parent
188a993d84
commit
39db344ebd
|
|
@ -66,7 +66,7 @@ trait OptionsTrait
|
|||
/**
|
||||
* Get options by keys.
|
||||
*
|
||||
* @param mixed $key Unique option key
|
||||
* @param array $key Unique option key
|
||||
*
|
||||
* @return array Option values
|
||||
*
|
||||
|
|
|
|||
291
Contract/StreamInterface.php
Normal file
291
Contract/StreamInterface.php
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package phpOMS\Contract
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Contract;
|
||||
|
||||
/**
|
||||
* Make a class streamable.
|
||||
*
|
||||
* @package phpOMS\Contract
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface StreamInterface
|
||||
{
|
||||
/**
|
||||
* Convert the stream to a string if the stream is readable and the stream is seekable.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* Close the underlying stream
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function close() : void;
|
||||
|
||||
/**
|
||||
* Get stream metadata
|
||||
*
|
||||
* @param string $key Specific metadata to retrieve
|
||||
*
|
||||
* @return array|mixed|null
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getMetaData(string $key = null);
|
||||
|
||||
/**
|
||||
* Get the stream resource
|
||||
*
|
||||
* @return resource
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStream();
|
||||
|
||||
/**
|
||||
* Set the stream that is wrapped by the object
|
||||
*
|
||||
* @param resource $stream Stream resource to wrap
|
||||
* @param null|int $size Size of the stream in bytes. Only pass if the size cannot be obtained from the stream.
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStream($stream, int $size = null) : self;
|
||||
|
||||
/**
|
||||
* Detach the current stream resource
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function detachStream() : self;
|
||||
|
||||
/**
|
||||
* Get the stream wrapper type
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getWrapper() : string;
|
||||
|
||||
/**
|
||||
* Wrapper specific data attached to this stream.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getWrapperData() : array;
|
||||
|
||||
/**
|
||||
* Get a label describing the underlying implementation of the stream
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStreamType() : string;
|
||||
|
||||
/**
|
||||
* Get the URI/filename associated with this stream
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getUri() : string;
|
||||
|
||||
/**
|
||||
* Get the size of the stream if able
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSize() : int;
|
||||
|
||||
/**
|
||||
* Check if the stream is readable
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isReadable() : bool;
|
||||
|
||||
/**
|
||||
* Check if the stream is repeatable
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isRepeatable() : bool;
|
||||
|
||||
/**
|
||||
* Check if the stream is writable
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isWritable() : bool;
|
||||
|
||||
/**
|
||||
* Check if the stream has been consumed
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isConsumed() : bool;
|
||||
|
||||
/**
|
||||
* Alias of isConsumed
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function feof() : bool;
|
||||
|
||||
/**
|
||||
* Check if the stream is a local stream vs a remote stream
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isLocal() : bool;
|
||||
|
||||
/**
|
||||
* Check if the string is repeatable
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isSeekable() : bool;
|
||||
|
||||
/**
|
||||
* Specify the size of the stream in bytes
|
||||
*
|
||||
* @param int $size Size of the stream contents in bytes
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setSize(int $size) : self;
|
||||
|
||||
/**
|
||||
* Seek to a position in the stream
|
||||
*
|
||||
* @param int $offset Stream offset
|
||||
* @param int $whence Where the offset is applied
|
||||
*
|
||||
* @return bool Returns TRUE on success or FALSE on failure
|
||||
* @link http://www.php.net/manual/en/function.fseek.php
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function seek(int $offset, int $whence = \SEEK_SET) : bool;
|
||||
|
||||
/**
|
||||
* Read data from the stream
|
||||
*
|
||||
* @param int $length Up to length number of bytes read.
|
||||
*
|
||||
* @return string Returns the data read from the stream or FALSE on failure or EOF
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function read(int $length) : ?string;
|
||||
|
||||
/**
|
||||
* Write data to the stream
|
||||
*
|
||||
* @param string $string The string that is to be written.
|
||||
*
|
||||
* @return int Returns the number of bytes written to the stream on success or FALSE on failure.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function write(string $string) : int;
|
||||
|
||||
/**
|
||||
* Returns the current position of the file read/write pointer
|
||||
*
|
||||
* @return int Returns the position of the file pointer or false on error
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function ftell() : int;
|
||||
|
||||
/**
|
||||
* Rewind to the beginning of the stream
|
||||
*
|
||||
* @return bool Returns true on success or false on failure
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function rewind() : bool;
|
||||
|
||||
/**
|
||||
* Read a line from the stream up to the maximum allowed buffer length
|
||||
*
|
||||
* @param int $maxLength Maximum buffer length
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function readLine(int $maxLength = null) : ?string;
|
||||
|
||||
/**
|
||||
* Set custom data on the stream
|
||||
*
|
||||
* @param string $key Key to set
|
||||
* @param mixed $value Value to set
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCustomData(string $key, $value) : self;
|
||||
|
||||
/**
|
||||
* Get custom data from the stream
|
||||
*
|
||||
* @param string $key Key to retrieve
|
||||
*
|
||||
* @return null|mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCustomData(string $key);
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ final class CookieJar
|
|||
|
||||
// @codeCoverageIgnoreStart
|
||||
foreach ($this->cookies as $key => $cookie) {
|
||||
\setcookie($key, $cookie['value'], $cookie['expiry'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'], ['samesite' => 'Strict']);
|
||||
\setcookie($key, $cookie['value'], $cookie['expiry'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'], 'Strict');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -907,7 +907,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*/
|
||||
private static function createOwnsOneArray(string $propertyName, array &$obj)
|
||||
{
|
||||
if (\is_array($obj)) {
|
||||
$mapper = static::$ownsOne[$propertyName]['mapper'];
|
||||
$primaryKey = $obj[static::$columns[static::$primaryField]['internal']];
|
||||
|
||||
|
|
@ -918,9 +917,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
return $primaryKey;
|
||||
}
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create owns one
|
||||
*
|
||||
|
|
@ -964,7 +960,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*/
|
||||
private static function createBelongsToArray(string $propertyName, array $obj)
|
||||
{
|
||||
if (\is_array($obj)) {
|
||||
/** @var string $mapper */
|
||||
$mapper = static::$belongsTo[$propertyName]['mapper'];
|
||||
$primaryKey = $obj[static::$columns[static::$primaryField]['internal']];
|
||||
|
|
@ -976,9 +971,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
return $primaryKey;
|
||||
}
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create relation table entry
|
||||
*
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ class Builder extends BuilderAbstract
|
|||
*/
|
||||
public function newQuery() : self
|
||||
{
|
||||
return new static($this->connection, $this->isReadOnly);
|
||||
return new self($this->connection, $this->isReadOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1274,6 +1274,11 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* On.
|
||||
*
|
||||
* @param string|array $columns Columns to join on
|
||||
* @param null|string|array $operator Comparison operator
|
||||
* @param null|string|array $values Values to compare with
|
||||
* @param string|array $boolean Concatonator
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -1317,6 +1322,10 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* On.
|
||||
*
|
||||
* @param string|array $columns Columns to join on
|
||||
* @param null|string|array $operator Comparison operator
|
||||
* @param null|string|array $values Values to compare with
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -1329,6 +1338,10 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* On.
|
||||
*
|
||||
* @param string|array $columns Columns to join on
|
||||
* @param null|string|array $operator Comparison operator
|
||||
* @param null|string|array $values Values to compare with
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -123,6 +123,9 @@ final class CholeskyDecomposition
|
|||
*
|
||||
* @return Matrix
|
||||
*
|
||||
* @throws InvalidDimensionException
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function solve(Matrix $B) : Matrix
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* Get matrix array.
|
||||
*
|
||||
* @return array<int, array<int, mixed>>
|
||||
* @return array<int, array<int, int|float>>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ final class NaiveBayesClassifier
|
|||
|
||||
if (\is_array($value)) {
|
||||
/**
|
||||
* @var string[] $value
|
||||
* @var string $word
|
||||
*/
|
||||
foreach ($value as $word) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Message;
|
||||
|
||||
use phpOMS\Contract\StreamInterface;
|
||||
|
||||
/**
|
||||
* Upload interface.
|
||||
*
|
||||
|
|
@ -30,7 +32,7 @@ interface UploadedFileInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStream();
|
||||
public function getStream() : StreamInterface;
|
||||
|
||||
/**
|
||||
* Move the uploaded file to a new location.
|
||||
|
|
|
|||
|
|
@ -261,8 +261,12 @@ final class ModuleManager
|
|||
if (empty($this->all)) {
|
||||
\chdir($this->modulePath);
|
||||
$files = \glob('*', \GLOB_ONLYDIR);
|
||||
$c = $files === false ? 0 : \count($files);
|
||||
|
||||
if ($files === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$c = $files === false ? 0 : \count($files);
|
||||
for ($i = 0; $i < $c; ++$i) {
|
||||
$path = $this->modulePath . '/' . $files[$i] . '/info.json';
|
||||
|
||||
|
|
@ -670,6 +674,11 @@ final class ModuleManager
|
|||
}
|
||||
|
||||
$dirs = \scandir($this->modulePath . '/' . $from . '/Application');
|
||||
|
||||
if ($dirs === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if ($dir === '.' || $dir === '..') {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ interface CsvInterface
|
|||
*
|
||||
* @param string $path Path to export
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function exportCsv($path);
|
||||
public function exportCsv($path) : void;
|
||||
|
||||
/**
|
||||
* Import Csv.
|
||||
|
|
@ -42,7 +43,6 @@ interface CsvInterface
|
|||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function importCsv($path) : void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
"phpunit/phpunit": "^8.5",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"phpmd/phpmd": "^2.6",
|
||||
"phpstan/phpstan": "^0.12.11",
|
||||
"phpstan/phpstan": "^0.12.13",
|
||||
"phan/phan": "^1.1.5",
|
||||
"codeclimate/php-test-reporter": "^0.4.4",
|
||||
"facebook/webdriver": "^1.7",
|
||||
|
|
|
|||
2
composer.lock
generated
2
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "043f0c2fa2b3b436d06695f23a7ff67c",
|
||||
"content-hash": "fd398b982f231bd108d7943e3a14dbf1",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user