fixes, spline interpolation added

This commit is contained in:
Dennis Eichhorn 2019-10-16 17:35:10 +02:00
parent 479facee52
commit 7c71b023c7
421 changed files with 1157 additions and 591 deletions

View File

@ -268,7 +268,7 @@ class Builder extends BuilderAbstract
$this->type = QueryType::SELECT;
foreach ($columns as $key => $column) {
if (\is_string($column) || $column instanceof \Closure) {
if (\is_string($column) || $column instanceof self || $column instanceof \Closure) {
$this->selects[] = $column;
} else {
throw new \InvalidArgumentException();
@ -395,12 +395,14 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
private function isValidReadOnly($raw) : bool
private function isValidReadOnly(string $raw) : bool
{
if (!$this->isReadOnly) {
return true;
}
$raw = \strtolower($raw);
if (\stripos($raw, 'insert') !== false
|| \stripos($raw, 'update') !== false
|| \stripos($raw, 'drop') !== false
@ -414,22 +416,6 @@ class Builder extends BuilderAbstract
return true;
}
/**
* Make raw column selection.
*
* @param \Closure|string $expression Raw expression
*
* @return Builder
*
* @since 1.0.0
*/
public function selectRaw($expression) : self
{
$this->selects[null][] = $expression;
return $this;
}
/**
* Is distinct.
*
@ -456,7 +442,7 @@ class Builder extends BuilderAbstract
public function from(...$tables) : self
{
foreach ($tables as $key => $table) {
if (\is_string($table) || $table instanceof \Closure) {
if (\is_string($table) || $table instanceof self || $table instanceof \Closure) {
$this->from[] = $table;
} else {
throw new \InvalidArgumentException();
@ -483,22 +469,6 @@ class Builder extends BuilderAbstract
return $this;
}
/**
* Make raw from.
*
* @param array|\Closure|string $expression Expression
*
* @return Builder
*
* @since 1.0.0
*/
public function fromRaw($expression) : self
{
$this->from[null][] = $expression;
return $this;
}
/**
* Where.
*
@ -654,7 +624,7 @@ class Builder extends BuilderAbstract
public function groupBy(...$columns) : self
{
foreach ($columns as $key => $column) {
if (\is_string($column) || $column instanceof \Closure) {
if (\is_string($column) || $column instanceof self || $column instanceof \Closure) {
$this->groups[] = $column;
} else {
throw new \InvalidArgumentException();
@ -1032,7 +1002,7 @@ class Builder extends BuilderAbstract
$this->type = QueryType::UPDATE;
foreach ($tables as $key => $table) {
if (\is_string($table) || $table instanceof \Closure) {
if (\is_string($table) || $table instanceof self || $table instanceof \Closure) {
$this->updates[] = $table;
} else {
throw new \InvalidArgumentException();

View File

@ -260,7 +260,7 @@ class Grammar extends GrammarAbstract
if (isset($element['value'])) {
$expression .= ' ' . \strtoupper($element['operator']) . ' ' . $this->compileValue($query, $element['value'], $query->getPrefix());
} else {
$operator = \strtoupper($element['operator']) === '=' ? 'IS' : 'IS NOT';
$operator = $element['operator'] === '=' ? 'IS' : 'IS NOT';
$expression .= ' ' . $operator . ' ' . $this->compileValue($query, $element['value'], $query->getPrefix());
}

View File

@ -112,6 +112,10 @@ class MysqlGrammar extends Grammar
$keys .= ' PRIMARY KEY (' . $this->expressionizeTableColumn([$name], '') . '),';
}
if (isset($field['unique']) && $field['unique']) {
$keys .= ' UNIQUE KEY (' . $this->expressionizeTableColumn([$name], '') . '),';
}
if (isset($field['foreignTable'], $field['foreignKey'])
&& !empty($field['foreignTable']) && !empty($field['foreignKey'])
) {

View File

@ -278,7 +278,7 @@ final class Polygon implements D2ShapeInterface
*/
public static function getRegularAreaByLength(float $length, int $sides) : float
{
return $length ** 2 * $sides / (4 * \tan(180 / $sides));
return $length ** 2 * $sides / (4 * \tan(\M_PI / $sides));
}
/**
@ -293,6 +293,6 @@ final class Polygon implements D2ShapeInterface
*/
public static function getRegularAreaByRadius(float $r, int $sides) : float
{
return $r ** 2 * $sides * \sin(360 / $sides) / 2;
return $r ** 2 * $sides * \tan(\M_PI / $sides);
}
}

View File

@ -26,10 +26,10 @@ final class Quadrilateral implements D2ShapeInterface
/**
* Calculate the surface area from the length of all sides and the angle between a and b
*
* @param float $a Side a length
* @param float $b Side b length
* @param float $c Side c length
* @param float $d Side d length
* @param float $a Side a length (DA)
* @param float $b Side b length (AB)
* @param float $c Side c length (BC)
* @param float $d Side d length (CD)
* @param float $alpha Angle between side a and b
*
* @return float
@ -38,7 +38,9 @@ final class Quadrilateral implements D2ShapeInterface
*/
public static function getSurfaceFromSidesAndAngle(float $a, float $b, float $c, float $d, float $alpha) : float
{
return 1 / 2 * $a * $b * \sin($alpha) + 1 / 4
* \sqrt(4 * $c ** 2 * $d ** 2 - ($c ** 2 + $d ** 2 - $a ** 2 - $b ** 2 + 2 * $a * $b * \cos($alpha)) ** 2);
$s = ($a + $b + $c + $d) / 2;
$gamma = \acos(($c ** 2 + $d ** 2 - $a ** 2 - $b ** 2 + 2 * $a * $b * \cos(\deg2rad($alpha))) / (2 * $c * $d));
return \sqrt(($s - $a) * ($s - $b) * ($s - $c) * ($s - $d) - $a * $b * $c * $d * \cos((\deg2rad($alpha) + $gamma) / 2) ** 2);
}
}

View File

@ -13,6 +13,8 @@
declare(strict_types=1);
namespace phpOMS\Math\Geometry\Shape\D3;
use phpOMS\Math\Geometry\Shape\D2\Polygon;
/**
* Prism shape.
*

View File

@ -110,7 +110,7 @@ class Matrix implements \ArrayAccess, \Iterator
*
* @since 1.0.0
*/
public function get(int $m, int $n)
public function get(int $m, int $n = 0)
{
if (!isset($this->matrix[$m], $this->matrix[$m][$n])) {
throw new InvalidDimensionException($m . 'x' . $n);
@ -301,11 +301,10 @@ class Matrix implements \ArrayAccess, \Iterator
$mDim = $this->m;
$nDim = $this->n;
$rank = \max($mDim, $nDim);
$rank = 0;
$selected = \array_fill(0, $mDim, false);
for ($i = 0; $i < $nDim; ++$i) {
$j;
for ($j = 0; $j < $mDim; ++$j) {
if (!$selected[$j] && \abs($matrix[$j][$i]) > 0.0001) {
break;
@ -313,18 +312,19 @@ class Matrix implements \ArrayAccess, \Iterator
}
if ($j === $mDim) {
--$rank;
} else {
$selected[$j] = true;
for ($p = $i + 1; $p < $nDim; ++$p) {
$matrix[$j][$p] /= $matrix[$j][$i];
}
continue;
}
for ($k = 0; $k < $mDim; ++$k) {
if ($k !== $j && \abs($matrix[$k][$i]) > 0.0001) {
for ($p = $i + 1; $p < $nDim; ++$p) {
$matrix[$k][$p] -= $matrix[$j][$p] * $matrix[$k][$i];
}
++$rank;
$selected[$j] = true;
for ($p = $i + 1; $p < $nDim; ++$p) {
$matrix[$j][$p] /= $matrix[$j][$i];
}
for ($k = 0; $k < $mDim; ++$k) {
if ($k !== $j && \abs($matrix[$k][$i]) > 0.0001) {
for ($p = $i + 1; $p < $nDim; ++$p) {
$matrix[$k][$p] -= $matrix[$j][$p] * $matrix[$k][$i];
}
}
}
@ -674,7 +674,7 @@ class Matrix implements \ArrayAccess, \Iterator
*
* @param Matrix $B Matrix/Vector b
*
* @return Matrix
* @return Matrix|Vector
*
* @since 1.0.0
*/

View File

@ -89,7 +89,7 @@ final class SingularValueDecomposition
for ($k = 0; $k < $maxNctNrt; ++$k) {
if ($k < $nct) {
$this->S[$k] = 0;
$this->S[$k] = 0.0;
for ($i = $k; $i < $this->m; ++$i) {
$this->S[$k] = Triangle::getHypot($this->S[$k], $A[$i][$k]);
}
@ -273,7 +273,7 @@ final class SingularValueDecomposition
break;
}
$t = ($ks !== $p ? \abs($e[$ks]) : 0) + ($ks !== $k + 1 ? \abs($e[$ks - 1]) : 0);
$t = ($ks !== $p ? \abs($e[$ks]) : 0.0) + ($ks !== $k + 1 ? \abs($e[$ks - 1]) : 0.0);
if (\abs($this->S[$ks]) <= $eps * $t) {
$this->S[$ks] = 0.0;
@ -304,8 +304,8 @@ final class SingularValueDecomposition
$this->S[$j] = $t;
if ($j !== $k) {
$f = -$sn * $e[$j - 1];
$e[$j - 1] = $cs * $e[$j - 1];
$f = -$sn * $e[$j - 1];
$e[$j - 1] *= $cs;
}
for ($i = 0; $i < $this->n; ++$i) {
@ -325,7 +325,7 @@ final class SingularValueDecomposition
$sn = $f / $t;
$this->S[$j] = $t;
$f = -$sn * $e[$j];
$e[$j] = $cs * $e[$j];
$e[$j] *= $cs;
for ($i = 0; $i < $this->m; ++$i) {
$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k - 1];
@ -397,7 +397,7 @@ final class SingularValueDecomposition
$f = $cs * $e[$j] + $sn * $this->S[$j + 1];
$this->S[$j + 1] = -$sn * $e[$j] + $cs * $this->S[$j + 1];
$g = $sn * $e[$j + 1];
$e[$j + 1] = $cs * $e[$j + 1];
$e[$j + 1] *= $cs;
if ($j < $this->m - 1) {
for ($i = 0; $i < $this->m; ++$i) {
@ -413,7 +413,7 @@ final class SingularValueDecomposition
break;
case 4:
if ($this->S[$k] <= 0.0) {
$this->S[$k] = ($this->S[$k] < 0.0 ? -$this->S[$k] : 0.0);
$this->S[$k] = $this->S[$k] < 0.0 ? -$this->S[$k] : 0.0;
for ($i = 0; $i <= $pp; ++$i) {
$this->V[$i][$k] = -$this->V[$i][$k];

View File

@ -24,4 +24,62 @@ namespace phpOMS\Math\Matrix;
*/
final class Vector extends Matrix
{
/**
* Create vector
*
* @param int $m Vector length
*
* @since 1.0.0
*/
public function __cosntruct(int $m = 1)
{
parent::__construct($m, 1);
}
/**
* Set vector value
*
* @param int $m Position to set
* @param mixed $value Value to set
*
* @return void
*
* @since 1.0.0
*/
public function setV(int $m, $value) : void
{
parent::set($m , 0, $value);
}
/**
* Get vector value
*
* @param int $m Position to get
*
* @return mixed
*
* @since 1.0.0
*/
public function getV(int $m)
{
return parent::get($m, 0);
}
/**
* Set matrix
*
* @param array $vector 1-Dimensional array
*
* @return Vector
*
* @since 1.0.0
*/
public function setMatrixV(array $vector) : self
{
foreach ($vector as $key => $value) {
$this->setV($key, $value);
}
return $this;
}
}

View File

@ -14,6 +14,9 @@ declare(strict_types=1);
namespace phpOMS\Math\Numerics\Interpolation;
use phpOMS\Math\Matrix\Matrix;
use phpOMS\Math\Matrix\Vector;
/**
* Cubic spline interpolation.
*
@ -22,6 +25,156 @@ namespace phpOMS\Math\Numerics\Interpolation;
* @link https://orange-management.org
* @since 1.0.0
*/
class CubicSplineInterpolation
class CubicSplineInterpolation implements InterpolationInterface
{
/**
* Points for spline interpolation
*
* @var array
* @since 1.0.0
*/
private array $points = [];
/**
* Parameter a of cubic spline
*
* @var Vector
* @since 1.0.0
*/
private Vector $solveA;
/**
* Parameter b of cubic spline
*
* @var Matrix
* @since 1.0.0
*/
private Matrix $solveB;
/**
* Parameter c of cubic spline
*
* @var Vector
* @since 1.0.0
*/
private Vector $solveC;
/**
* Constructor.
*
* @param array $points Points to create the interpolation with
* @param float $leftCurvature Left point curvature
* @param float $leftDerivativeType Derivative type for the left point
* @param float $rightCurvature Right point curvature
* @param float $rightDerivativeType Derivative type for the right point
*
* @since 1.0.0
*/
public function __construct(
array $points,
float $leftCurvature = 0.0,
int $leftDerivativeType = DerivativeType::FIRST,
float $rightCurvature = 0.0,
int $rightDerivativeType = DerivativeType::FIRST
) {
$this->points = $points;
$n = \count($this->points);
$b = [];
$matrix = new Matrix($n, $n);
for($i = 1; $i < $n - 1; ++$i) {
$matrix->set($i, $i - 1, 1.0 / 3.0 * ($this->points[$i]['x'] - $this->points[$i - 1]['x']));
$matrix->set($i, $i, 2.0 / 3.0 * ($this->points[$i + 1]['x'] - $this->points[$i - 1]['x']));
$matrix->set($i, $i + 1, 1.0 / 3.0 * ($this->points[$i + 1]['x'] - $this->points[$i]['x']));
$b[$i] = ($this->points[$i + 1]['y'] - $this->points[$i]['y']) / ($this->points[$i + 1]['x'] - $this->points[$i]['x'])
- ($this->points[$i]['y'] - $this->points[$i - 1]['y']) / ($this->points[$i]['x'] - $this->points[$i - 1]['x']);
}
if ($leftDerivativeType === DerivativeType::FIRST) {
$matrix->set(0, 0, 2.0 * ($this->points[1]['x'] - $this->points[0]['x']));
$matrix->set(0, 1, 1.0 * ($this->points[1]['x'] - $this->points[0]['x']));
$b[0] = 3.0 * (($this->points[1]['y'] - $this->points[0]['y']) / ($this->points[1]['x'] - $this->points[0]['x']) - $rightCurvature);
} else {
$matrix->set(0, 0, 2.0);
$matrix->set(0, 1, 0.0);
$b[0] = $leftCurvature;
}
if ($rightDerivativeType === DerivativeType::FIRST) {
$matrix->set($n - 1, $n - 1, 2.0 * ($this->points[$n - 1]['x'] - $this->points[$n - 2]['x']));
$matrix->set($n - 1, $n - 2, 1.0 * ($this->points[$n - 1]['x'] - $this->points[$n - 2]['x']));
$b[$n - 1] = 3.0 * ($rightCurvature - ($this->points[$n - 1]['y'] - $this->points[$n - 2]['y']) / ($this->points[$n - 1]['x'] - $this->points[$n - 2]['x']));
} else {
$matrix->set($n - 1, $n - 1, 2.0);
$matrix->set($n - 1, $n - 2, 0.0);
$b[$n - 1] = $rightCurvature;
}
$bVector = new Vector($n);
$bVector->setMatrixV($b);
$this->solveB = $matrix->solve($bVector);
$this->solveA = new Vector($n);
$this->solveC = new Vector($n);
for ($i = 0; $i < $n - 1; ++$i) {
$this->solveA->setV($i, 1.0 / 3.0 * ($this->solveB->get($i + 1) - $this->solveB->get($i)) / ($this->points[$i + 1]['x'] - $this->points[$i]['x']));
$this->solveC->setV($i,
($this->points[$i + 1]['y'] - $this->points[$i]['y']) / ($this->points[$i + 1]['x'] - $this->points[$i]['x'])
- 1.0 / 3.0 * (2 * $this->solveB->get($i) + $this->solveB->get($i + 1)) * ($this->points[$i + 1]['x'] - $this->points[$i]['x']));
}
$h = $this->points[$n - 1]['x'] - $this->points[$n - 2]['x'];
$this->solveA->setV($n - 1, 0.0);
$this->solveC->setV($n - 1, 3.0 * $this->solveA->getV($n - 2) * $h ** 2 + 2.0 * $this->solveB->get($n - 2) * $h + $this->solveC->getV($n - 2));
$a = 2;
/**
* @todo: consider linear extrapolation at start and end point
*
* $this->solveB->setV($n - 1, 0.0)
*/
}
/**
* {@inheritdoc}
*/
public function interpolate($x) : float
{
$n = \count($this->points);
$xPos = $n - 1;
foreach ($this->points as $key => $point) {
if ($x <= $point['x']) {
$xPos = $key;
break;
}
}
$xPos = \max($xPos - 1, 0);
$h = $x - $this->points[$xPos]['x'];
if ($x < $this->points[0]['x']) {
return ($this->solveB->get(0) * $h + $this->solveC->getV(0)) * $h + $this->points[0]['y'];
/**
* @todo: consider linear extrapolation at start and end point
*
* ($this->solveC->getV(0)) * $h + $this->points[0]['y'];
*/
} elseif ($x > $this->points[$n - 1]['x']) {
return ($this->solveB->get($n - 1) * $h + $this->solveC->getV($n - 1) * $h + $this->points[$n - 1]['y']);
}
return (($this->solveA->getV($xPos) * $h + $this->solveB->get($xPos)) * $h + $this->solveC->getV($xPos)) * $h + $this->points[$xPos]['y'];
}
}

View File

@ -14,14 +14,18 @@ declare(strict_types=1);
namespace phpOMS\Math\Numerics\Interpolation;
use phpOMS\Stdlib\Base\Enum;
/**
* Polynomial spline interpolation.
* Derivative type enum.
*
* @package phpOMS\Math\Numerics\Interpolation
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class PolynomialInterpolation
abstract class DerivativeType extends Enum
{
public const FIRST = 1;
public const SECOND = 2;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package phpOMS\Math\Numerics\Interpolation
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace phpOMS\Math\Numerics\Interpolation;
/**
* Interpolation interface.
*
* @package phpOMS\Math\Numerics\Interpolation
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
interface InterpolationInterface
{
/**
* Interpolation at a given point
*
* @param float|int $x X-Coordinate to interpolate at
*
* @return float
*
* @since 1.0.0
*/
public function interpolate($x) : float;
}

View File

@ -0,0 +1,67 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package phpOMS\Math\Numerics\Interpolation
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace phpOMS\Math\Numerics\Interpolation;
/**
* Lagrange spline interpolation.
*
* @package phpOMS\Math\Numerics\Interpolation
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class LagrangeInterpolation implements InterpolationInterface
{
/**
* Points for spline interpolation
*
* @var array
* @since 1.0.0
*/
private array $points = [];
/**
* Constructor.
*
* @param array $points Points to create the interpolation with
*
* @since 1.0.0
*/
public function __construct(array $points) {
$this->points = $points;
}
/**
* {@inheritdoc}
*/
public function interpolate($x) : float
{
$n = \count($this->points);
$result = 0.0;
for ($i = 0; $i < $n; ++$i) {
$solve = $this->points[$i]['y'];
for ($j = 0; $j < $n; ++$j) {
if ($j !== $i) {
$solve *= ($x - $this->points[$j]['x']) / ($this->points[$i]['x'] - $this->points[$j]['x']);
}
}
$result += $solve;
}
return $result;
}
}

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace phpOMS\Math\Numerics\Interpolation;
use phpOMS\Math\Matrix\Vector;
/**
* Linear spline interpolation.
*
@ -22,6 +24,100 @@ namespace phpOMS\Math\Numerics\Interpolation;
* @link https://orange-management.org
* @since 1.0.0
*/
class LinearInterpolation
class LinearInterpolation implements InterpolationInterface
{
/**
* Points for spline interpolation
*
* @var array
* @since 1.0.0
*/
private array $points = [];
/**
* Parameter a of cubic spline
*
* @var Vector
* @since 1.0.0
*/
private Vector $solveA;
/**
* Parameter b of cubic spline
*
* @var Vector
* @since 1.0.0
*/
private Vector $solveB;
/**
* Parameter c of cubic spline
*
* @var Vector
* @since 1.0.0
*/
private Vector $solveC;
/**
* Constructor.
*
* @param array $points Points to create the interpolation with
*
* @since 1.0.0
*/
public function __construct(array $points) {
$this->points = $points;
$n = \count($this->points);
$this->solveA = new Vector($n);
$this->solveB = new Vector($n);
$this->solveC = new Vector($n);
for ($i = 0; $i < $n - 1; ++$i) {
$this->solveA->setV($i, 0.0);
$this->solveB->setV($i, 0.0);
$this->solveC->setV($i, ($this->points[$i + 1]['y'] - $this->points[$i]['y']) / ($this->points[$i + 1]['x'] - $this->points[$i]['x']));
}
for ($i = 0; $i < $n - 1; ++$i) {
$this->solveA->setV($i, 1.0 / 3.0 * ($this->solveB->getV($i + 1) - $this->solveB->getV($i)) / ($this->points[$i + 1]['x'] - $this->points[$i]['x']));
$this->solveC->setV($i,
($this->points[$i + 1]['y'] - $this->points[$i]['y']) / ($this->points[$i + 1]['x'] - $this->points[$i]['x'])
- 1.0 / 3.0 * (2 * $this->solveB->getV($i) + $this->solveB->getV($i + 1)) * ($this->points[$i + 1]['x'] - $this->points[$i]['x']));
}
$h = $this->points[$n - 1]['x'] - $this->points[$n - 2]['x'];
$this->solveA->setV($n - 1, 0.0);
$this->solveC->setV($n - 1, 3.0 * $this->solveA->getV($n - 2) * $h ** 2 + 2.0 * $this->solveB->getV($n - 2) * $h + $this->solveC->getV($n - 2));
}
/**
* {@inheritdoc}
*/
public function interpolate($x) : float
{
$n = \count($this->points);
$xPos = $n - 1;
foreach ($this->points as $key => $point) {
if ($x <= $point['x']) {
$xPos = $key;
break;
}
}
$xPos = \max($xPos - 1, 0);
$h = $x - $this->points[$xPos]['x'];
if ($x < $this->points[0]['x']) {
return ($this->solveB->getV(0) * $h + $this->solveC->getV(0)) * $h + $this->points[0]['y'];
} elseif ($x > $this->points[$n - 1]['x']) {
return ($this->solveB->getV($n - 1) * $h + $this->solveC->getV($n - 1) * $h + $this->points[$n - 1]['y']);
}
return (($this->solveA->getV($xPos) * $h + $this->solveB->getV($xPos)) * $h + $this->solveC->getV($xPos)) * $h + $this->points[$xPos]['y'];
}
}

View File

@ -117,8 +117,6 @@ class NaiveBayesClassifier
++$this->probabilities['criteria'][$criteria]['count'];
++$this->probabilities['count'];
}
$this->changed = true;
}
/**
@ -134,11 +132,7 @@ class NaiveBayesClassifier
*/
public function match(string $criteria, array $toMatch, int $minimum = 3) : float
{
if ($this->changed) {
$this->cache();
}
$this->changed = false;
$this->preCalculateProbabilities($toMatch);
$n = 0.0;
foreach ($toMatch as $attr => $value) {
@ -161,10 +155,10 @@ class NaiveBayesClassifier
}
} else {
// todo: add probability of criteria / total?
$p = 1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
* \exp(-($value - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance']));
//var_dump($p);
$p = (1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
* \exp(-($value - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2 / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])))
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count'])
/ $this->probabilities['attr'][$attr]['data'];
$n += \log(1 - $p) - \log($p);
}
@ -174,13 +168,15 @@ class NaiveBayesClassifier
}
/**
* Cache probabilities for matching function.
* Pre-calculate some probabilities used for the matching process
*
* @param array $toMatch Data to match. Some probabilities depend on the passed values.
*
* @return void
*
* @since 1.0.0
*/
private function cache() : void
private function preCalculateProbabilities(array $toMatch) : void
{
$this->probabilities['attr'] = [];
@ -188,15 +184,18 @@ class NaiveBayesClassifier
foreach ($subDict as $attr => $valueArray) {
if ($valueArray['type'] === 2) {
$this->probabilities['criteria'][$criteria]['attr'][$attr]['mean'] = Average::arithmeticMean($this->dict[$criteria][$attr]['data']);
$this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'] = MeasureOfDispersion::empiricalVariance($this->dict[$criteria][$attr]['data'], [], $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']);
$this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'] = MeasureOfDispersion::sampleVariance($this->dict[$criteria][$attr]['data'], $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']);
// \var_dump($criteria);
// \var_dump($attr);
// \var_dump($this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']); // good
// \var_dump($this->probabilities['criteria'][$criteria]['attr'][$attr]['variance']); // bad
if (!isset($this->probabilities['attr'][$attr])) {
$this->probabilities['attr'][$attr] = ['data' => 0.0];
}
$this->probabilities['attr'][$attr]['data'] += (1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
* \exp(-($toMatch[$attr] - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2 / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])))
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count']);
} else {
if (!isset( $this->probabilities['attr'][$attr])) {
$this->probabilities['attr'] = [$attr => ['data' => []]];
$this->probabilities['attr'][$attr] = ['data' => []];
}
foreach ($valueArray['data'] as $word => $count) {

View File

@ -134,9 +134,7 @@ final class Router
) {
// if csrf is required but not set
if (isset($d['csrf']) && $d['csrf'] && $csrf === null) {
\array_merge($bound, $this->route('/' . $app . '/e403', $csrf, $verb));
continue;
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403', $csrf, $verb) : $this->route('/e403', $csrf, $verb);
}
// if permission check is invalid
@ -147,9 +145,7 @@ final class Router
)
)
) {
\array_merge($bound, $this->route('/' . $app . '/e403', $csrf, $verb));
continue;
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403', $csrf, $verb) : $this->route('/e403', $csrf, $verb);
}
$bound[] = ['dest' => $d['dest']];

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Account;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\Algorithm\CoinMatching;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\PathFinding;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Asset;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Asset;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Auth;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Auth;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Finance;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Finance;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Finance;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Finance;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Finance;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Marketing;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Marketing;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Programming;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Business\Sales;
use phpOMS\Business\Sales\MarketShareEstimation;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\Config;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;
@ -89,13 +89,19 @@ class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertFalse($cache->delete('keyInvalid'));
self::assertNull($cache->get('key4'));
self::assertArraySubset(
[
'status' => CacheStatus::OK,
'count' => 6,
],
$cache->stats()
);
$arr = [
'status' => CacheStatus::OK,
'count' => 6,
];
$isSubset = true;
$parent = $cache->stats();
foreach ($arr as $key => $value) {
if (!isset($parent[$key]) || $parent[$key] !== $value) {
$isSubset = false;
break;
}
}
self::assertTrue($isSubset);
self::assertTrue($cache->flushAll());
self::assertTrue($cache->flush());
@ -103,13 +109,19 @@ class MemCachedTest extends \PHPUnit\Framework\TestCase
$cache->flushAll();
self::assertArraySubset(
[
'status' => CacheStatus::OK,
'count' => 5, // Carefull memcached is dumb and keeps expired elements which were not acessed after flushing in stats
],
$cache->stats()
);
$arr = [
'status' => CacheStatus::OK,
'count' => 5, // Carefull memcached is dumb and keeps expired elements which were not acessed after flushing in stats
];
$isSubset = true;
$parent = $cache->stats();
foreach ($arr as $key => $value) {
if (!isset($parent[$key]) || $parent[$key] !== $value) {
$isSubset = false;
break;
}
}
self::assertTrue($isSubset);
}
public function testBadCacheStatus() : void

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Connection;
@ -91,13 +91,19 @@ class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertFalse($cache->delete('keyInvalid'));
self::assertNull($cache->get('key4'));
self::assertArraySubset(
[
'status' => CacheStatus::OK,
'count' => 6,
],
$cache->stats()
);
$arr = [
'status' => CacheStatus::OK,
'count' => 6,
];
$isSubset = true;
$parent = $cache->stats();
foreach ($arr as $key => $value) {
if (!isset($parent[$key]) || $parent[$key] !== $value) {
$isSubset = false;
break;
}
}
self::assertTrue($isSubset);
self::assertTrue($cache->flushAll());
self::assertTrue($cache->flush());
@ -105,13 +111,19 @@ class RedisCacheTest extends \PHPUnit\Framework\TestCase
$cache->flushAll();
self::assertArraySubset(
[
'status' => CacheStatus::OK,
'count' => 0,
],
$cache->stats()
);
$arr = [
'status' => CacheStatus::OK,
'count' => 0,
];
$isSubset = true;
$parent = $cache->stats();
foreach ($arr as $key => $value) {
if (!isset($parent[$key]) || $parent[$key] !== $value) {
$isSubset = false;
break;
}
}
self::assertTrue($isSubset);
}
public function testBadCacheStatus() : void

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cache\Exception;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Cookie;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Connection;
use phpOMS\DataStorage\Database\Connection\PostgresConnection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Connection;
use phpOMS\DataStorage\Database\Connection\SQLiteConnection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Connection;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database;
use phpOMS\tests\DataStorage\Database\TestModel\BaseModel;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Exception;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Exception;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Exception;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query;
@ -35,6 +35,10 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
$sql = 'SELECT `a`.`test` FROM `a` WHERE `a`.`test` = 1;';
self::assertEquals($sql, $query->select('a.test')->from('a')->where('a.test', '=', 1)->toSql());
$query = new Builder($this->con);
$sql = 'SELECT `a`.`test` as t FROM `a` as b WHERE `a`.`test` = 1;';
self::assertEquals($sql, $query->selectAs('a.test', 't')->fromAs('a', 'b')->where('a.test', '=', 1)->toSql());
$query = new Builder($this->con);
$sql = 'SELECT DISTINCT `a`.`test` FROM `a` WHERE `a`.`test` = 1;';
self::assertEquals($sql, $query->select('a.test')->distinct()->from('a')->where('a.test', '=', 1)->toSql());
@ -76,6 +80,8 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
->orderBy(['a.test', 'b.test', ], ['ASC', 'DESC', ])
->toSql()
);
self::assertEquals($query->toSql(), $query->__toString());
}
public function testMysqlOrder() : void
@ -340,6 +346,30 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
$query->delete();
}
public function testInvalidSelectParameter() : void
{
self::expectException(\InvalidArgumentException::class);
$query = new Builder($this->con, true);
$query->select(false);
}
public function testInvalidFromParameter() : void
{
self::expectException(\InvalidArgumentException::class);
$query = new Builder($this->con, true);
$query->from(false);
}
public function testInvalidGroupByParameter() : void
{
self::expectException(\InvalidArgumentException::class);
$query = new Builder($this->con, true);
$query->groupBy(false);
}
public function testInvalidWhereOperator() : void
{
self::expectException(\InvalidArgumentException::class);

View File

@ -10,17 +10,19 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query;
use phpOMS\DataStorage\Database\Query\Column;
/**
* @internal
*/
class ColumnTest extends \PHPUnit\Framework\TestCase
{
public function testPlaceholder() : void
public function testDefault() : void
{
self::markTestIncomplete();
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Builder', new Column($GLOBALS['dbpool']->get()));
}
}

View File

@ -10,17 +10,19 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query;
use phpOMS\DataStorage\Database\Query\Count;
/**
* @internal
*/
class CountTest extends \PHPUnit\Framework\TestCase
{
public function testPlaceholder() : void
public function testDefault() : void
{
self::markTestIncomplete();
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Builder', new Count($GLOBALS['dbpool']->get()));
}
}

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query;

View File

@ -10,17 +10,19 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query;
use phpOMS\DataStorage\Database\Query\From;
/**
* @internal
*/
class FromTest extends \PHPUnit\Framework\TestCase
{
public function testPlaceholder() : void
public function testDefault() : void
{
self::markTestIncomplete();
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Builder', new From($GLOBALS['dbpool']->get()));
}
}

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query\Grammar;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query\Grammar;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query\Grammar;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query\Grammar;

View File

@ -10,7 +10,7 @@
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database\Query\Grammar;

Some files were not shown because too many files have changed in this diff Show More