This commit is contained in:
Dennis Eichhorn 2018-02-03 13:15:46 +01:00
parent 4fc4f3f7c8
commit 23bc8b732f
49 changed files with 97 additions and 94 deletions

View File

@ -38,7 +38,7 @@ interface CacheInterface
*
* @since 1.0.0
*/
public function set($key, $value, int $expire = -1) /* : void */;
public function set($key, $value, int $expire = -1); /* : void */
/**
* Adding new data if it doesn't exist.
@ -108,7 +108,7 @@ interface CacheInterface
*
* @since 1.0.0
*/
public function setStatus(int $status) /* : void */;
public function setStatus(int $status); /* : void */
/**
* Updating existing value/key.

View File

@ -39,7 +39,7 @@ interface ConnectionInterface
*
* @since 1.0.0
*/
public function connect(array $dbdata) /* : void */;
public function connect(array $dbdata); /* : void */
/**
* Get the database type.
@ -66,7 +66,7 @@ interface ConnectionInterface
*
* @since 1.0.0
*/
public function close() /* : void */;
public function close(); /* : void */
/**
* Return grammar for this connection.

View File

@ -254,7 +254,7 @@ class Grammar extends GrammarAbstract
foreach ($wheres as $key => $where) {
foreach ($where as $key2 => $element) {
$expression .= $this->compileWhereElement($element, $query, $first);
$first = false;
$first = false;
}
}
@ -299,7 +299,7 @@ class Grammar extends GrammarAbstract
if (isset($element['value'])) {
$expression .= ' ' . strtoupper($element['operator']) . ' ' . $this->compileValue($element['value'], $query->getPrefix());
} else {
$operator = strtoupper($element['operator']) === '=' ? 'IS' : 'IS NOT';
$operator = strtoupper($element['operator']) === '=' ? 'IS' : 'IS NOT';
$expression .= ' ' . $operator . ' ' . $this->compileValue($element['value'], $query->getPrefix());
}
@ -434,7 +434,7 @@ class Grammar extends GrammarAbstract
$expression .= $this->compileSystem($column, $query->getPrefix()) . ', ';
}
$expression = rtrim($expression, ', ');
$expression = rtrim($expression, ', ');
$expression .= ' ' . $key . ', ';
}

View File

@ -71,7 +71,7 @@ interface SessionInterface
*
* @since 1.0.0
*/
public function save() /* : void */;
public function save(); /* : void */
/**
* @return int|string
@ -87,7 +87,7 @@ interface SessionInterface
*
* @since 1.0.0
*/
public function setSID($sid) /* : void */;
public function setSID($sid); /* : void */
/**
* Lock session from further adjustments.
@ -96,5 +96,5 @@ interface SessionInterface
*
* @since 1.0.0
*/
public function lock() /* : void */;
public function lock(); /* : void */
}

View File

@ -33,7 +33,7 @@ interface LoggerInterface
*
* @return null
*/
public function emergency(string $message, array $context = []) /* : void */;
public function emergency(string $message, array $context = []); /* : void */
/**
* Action must be taken immediately.
@ -46,7 +46,7 @@ interface LoggerInterface
*
* @return null
*/
public function alert(string $message, array $context = []) /* : void */;
public function alert(string $message, array $context = []); /* : void */
/**
* Critical conditions.
@ -58,7 +58,7 @@ interface LoggerInterface
*
* @return null
*/
public function critical(string $message, array $context = []) /* : void */;
public function critical(string $message, array $context = []); /* : void */
/**
* Runtime errors that do not require immediate action but should typically
@ -69,7 +69,7 @@ interface LoggerInterface
*
* @return null
*/
public function error(string $message, array $context = []) /* : void */;
public function error(string $message, array $context = []); /* : void */
/**
* Exceptional occurrences that are not errors.
@ -82,7 +82,7 @@ interface LoggerInterface
*
* @return null
*/
public function warning(string $message, array $context = []) /* : void */;
public function warning(string $message, array $context = []); /* : void */
/**
* Normal but significant events.
@ -92,7 +92,7 @@ interface LoggerInterface
*
* @return null
*/
public function notice(string $message, array $context = []) /* : void */;
public function notice(string $message, array $context = []); /* : void */
/**
* Interesting events.
@ -104,7 +104,7 @@ interface LoggerInterface
*
* @return null
*/
public function info(string $message, array $context = []) /* : void */;
public function info(string $message, array $context = []); /* : void */
/**
* Detailed debug information.
@ -114,7 +114,7 @@ interface LoggerInterface
*
* @return null
*/
public function debug(string $message, array $context = []) /* : void */;
public function debug(string $message, array $context = []); /* : void */
/**
* Logs with an arbitrary level.
@ -125,5 +125,5 @@ interface LoggerInterface
*
* @return null
*/
public function log(string $level, string $message, array $context = []) /* : void */;
public function log(string $level, string $message, array $context = []); /* : void */
}

View File

@ -84,29 +84,29 @@ class CholeskyDecomposition
// Solve L*Y = B;
for ($k = 0; $k < $this->m; $k++) {
for ($j = 0; $j < $n; $j++) {
for ($i = 0; $i < $k ; $i++) {
$X[$k][$j] -= $X[$i][$j] * $this->L[$k][$i];
for ($j = 0; $j < $n; $j++) {
for ($i = 0; $i < $k; $i++) {
$X[$k][$j] -= $X[$i][$j] * $this->L[$k][$i];
}
$X[$k][$j] /= $this->L[$k][$k];
}
}
$X[$k][$j] /= $this->L[$k][$k];
}
}
// Solve L'*X = Y;
for ($k = $this->m - 1; $k >= 0; $k--) {
for ($j = 0; $j < $n; $j++) {
for ($i = $k + 1; $i < $this->m ; $i++) {
$X[$k][$j] -= $X[$i][$j] * $this->L[$i][$k];
for ($k = $this->m - 1; $k >= 0; $k--) {
for ($j = 0; $j < $n; $j++) {
for ($i = $k + 1; $i < $this->m; $i++) {
$X[$k][$j] -= $X[$i][$j] * $this->L[$i][$k];
}
$X[$k][$j] /= $this->L[$k][$k];
}
}
$X[$k][$j] /= $this->L[$k][$k];
}
}
$solution = new Matrix();
$solution->setMatrix($X);
return $solution;
}
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Matrix;
class EigenValueDecomposition
{
}
}

View File

@ -36,7 +36,7 @@ class LUDecomposition
}
$this->pivSign = 1;
$LUrowi = $LUcolj = [];
$LUrowi = $LUcolj = [];
for ($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {
@ -45,8 +45,8 @@ class LUDecomposition
for ($i = 0; $i < $this->m; ++$i) {
$LUrowi = $this->LU[$i];
$kmax = min($i, $j);
$s = 0.0;
$kmax = min($i, $j);
$s = 0.0;
for ($k = 0; $k < $kmax; ++$k) {
$s += $LUrowi[$k] * $LUcolj[$k];
@ -63,12 +63,12 @@ class LUDecomposition
if ($p != $j) {
for ($k = 0; $k < $this->n; ++$k) {
$t = $this->LU[$p][$k];
$t = $this->LU[$p][$k];
$this->LU[$p][$k] = $this->LU[$j][$k];
$this->LU[$j][$k] = $t;
}
$k = $this->piv[$p];
$k = $this->piv[$p];
$this->piv[$p] = $this->piv[$j];
$this->piv[$j] = $k;
$this->pivSign = $this->pivSign * -1;
@ -161,7 +161,7 @@ class LUDecomposition
}
$n = $B->getN();
$X = $B->getMatrix($this->piv, 0, $n - 1);
$X = $B->getMatrix($this->piv, 0, $n - 1);
// todo: fix get extract
// Solve L*Y = B(piv,:)
@ -190,4 +190,4 @@ class LUDecomposition
return $solution;
}
}
}

View File

@ -83,4 +83,4 @@ class Dijkstra
return $path;
}
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Knappsack;
class Backpack
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Knappsack;
class BruteForce
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Knappsack;
class GA
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Knappsack;
class Item
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Knappsack;
class ItemPool
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\Knappsack;
class Population
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\ShiftScheduling;
class BruteForce
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\ShiftScheduling;
class GA
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\ShiftScheduling;
class Population
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\ShiftScheduling;
class Workday
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\ShiftScheduling;
class Worker
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Optimization\ShiftScheduling;
class WorkerPool
{
}
}

View File

@ -39,4 +39,4 @@ class Forecasts
{
return [$forecast - $interval * $standardDeviation, $forecast + $interval * $standardDeviation];
}
}
}

View File

@ -39,4 +39,4 @@ class LevelLevelRegression extends RegressionAbstract
{
return $b1 * $y / $x;
}
}
}

View File

@ -57,4 +57,4 @@ class LevelLogRegression extends RegressionAbstract
{
return $b1 / $x;
}
}
}

View File

@ -57,4 +57,4 @@ class LogLevelRegression extends RegressionAbstract
{
return $b1 * $x;
}
}
}

View File

@ -58,4 +58,4 @@ class LogLogRegression extends RegressionAbstract
{
return $b1;
}
}
}

View File

@ -45,4 +45,4 @@ class MultipleLinearRegression
public static function getPredictionInterval() : array
{
}
}
}

View File

@ -184,4 +184,4 @@ abstract class RegressionAbstract
{
return 0.0;
}
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class BetaDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class FDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class GammaDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class HypergeometricDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class LogDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class LogNormalDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class LogisticDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class ParetoDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class TDistribution
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Math\Stochastic\Distribution;
class WeibullDistribution
{
}
}

View File

@ -12,6 +12,7 @@
*/
declare(strict_types = 1);
namespace phpOMS\Math\Stochastic;
/**
* Bernulli distribution.
*

View File

@ -165,7 +165,7 @@ abstract class HeaderAbstract
*
* @since 1.0.0
*/
abstract public function generate(int $statusCode) /* : void */;
abstract public function generate(int $statusCode); /* : void */
/**
* Get status code

View File

@ -16,4 +16,4 @@ namespace phpOMS\Message\Socket;
class Request
{
}
}

View File

@ -16,4 +16,4 @@ namespace phpOMS\Message\Socket;
class Response
{
}
}

View File

@ -75,7 +75,7 @@ class PackageManager
*/
public function __construct(string $path, string $basePath)
{
$this->path = $path;
$this->path = $path;
$this->basePath = $basePath;
}
@ -279,4 +279,4 @@ class PackageManager
return $unsignedHash === $rawHash;
}
}
}

View File

@ -24,10 +24,10 @@ namespace phpOMS\Socket\Client;
*/
class ClientConnection
{
private $id = 0;
private $socket = null;
private $id = 0;
private $socket = null;
private $handshake = false;
private $pid = null;
private $pid = null;
private $connected = true;
public function __construct($id, $socket)

View File

@ -224,7 +224,7 @@ class Server extends SocketAbstract
{
$this->app->logger->debug('Connecting client...');
$this->clientManager->add($client = new ClientConnection(uniqid(), $socket));
$this->conn[$client->getId()] = $socket;
$this->conn[$client->getId()] = $socket;
$this->app->logger->debug('Connected client.');
}

View File

@ -148,8 +148,8 @@ class BinaryTree extends Tree
}
$order[$horizontalDistance][] = $node;
$left = $this->getLeft($node);
$right = $this->getRight($node);
$left = $this->getLeft($node);
$right = $this->getRight($node);
if (isset($left)) {
$this->getVerticalOrder($left, $horizontalDistance - 1, $order);
@ -196,10 +196,10 @@ class BinaryTree extends Tree
return true;
}
$left1 = $this->getLeft($node1);
$left1 = $this->getLeft($node1);
$right1 = $this->getRight($node1);
$left2 = isset($node2) ? $this->getLeft($node1) : $this->getLeft($node2);
$left2 = isset($node2) ? $this->getLeft($node1) : $this->getLeft($node2);
$right2 = isset($node2) ? $this->getRight($node1) : $this->getRight($node2);
// todo: compare values? true symmetry requires the values to be the same
@ -209,4 +209,4 @@ class BinaryTree extends Tree
return false;
}
}
}

View File

@ -78,7 +78,7 @@ class Tree extends Graph
return 0;
}
$depth = 1;
$depth = 1;
$neighbors = $this->getNeighbors($currentNode);
foreach ($neighbors as $neighbor) {
@ -105,7 +105,7 @@ class Tree extends Graph
return 0;
}
$depth = [];
$depth = [];
$neighbors = $this->getNeighbors($currentNode);
foreach ($neighbors as $neighbor) {
@ -165,7 +165,7 @@ class Tree extends Graph
{
--$level;
$neighbors = $this->getNeighbors($node);
$nodes = [];
$nodes = [];
if ($level === 1) {
return $neighbors;
@ -212,7 +212,8 @@ class Tree extends Graph
*
* @since 1.0.0
*/
public function preOrder(Node $node, \Closure $callback) {
public function preOrder(Node $node, \Closure $callback)
{
if (count($this->nodes) === 0) {
return;
}
@ -234,7 +235,8 @@ class Tree extends Graph
*
* @since 1.0.0
*/
public function postOrder(Node $node, \Closure $callback) {
public function postOrder(Node $node, \Closure $callback)
{
if (count($this->nodes) === 0) {
return;
}
@ -248,4 +250,4 @@ class Tree extends Graph
$callback($node);
}
}
}

View File

@ -126,7 +126,7 @@ interface UriInterface
*
* @since 1.0.0
*/
public function setRootPath(string $root) /* : void */;
public function setRootPath(string $root); /* : void */
/**
* Get path element.
@ -213,5 +213,5 @@ interface UriInterface
*
* @since 1.0.0
*/
public function set(string $uri) /* : void */;
public function set(string $uri); /* : void */
}

View File

@ -62,5 +62,5 @@ interface ValidatorInterface
*
* @since 1.0.0
*/
public static function resetError() /* : void */;
public static function resetError(); /* : void */
}