mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 01:38:41 +00:00
template fixes + bug fixes + style fixes
This commit is contained in:
parent
61f44bc044
commit
ab3e8e0939
|
|
@ -226,37 +226,22 @@ class TrueSkill
|
||||||
/ (NormalDistribution::getCdf($epsilon - $tAbs, 0.0, 1.0) - NormalDistribution::getCdf(-$epsilon - $tAbs, 0.0, 1.0));
|
/ (NormalDistribution::getCdf($epsilon - $tAbs, 0.0, 1.0) - NormalDistribution::getCdf(-$epsilon - $tAbs, 0.0, 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function buildRatingLayer() : void
|
private function buildRatingLayer() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function buildPerformanceLayer() : void
|
private function buildPerformanceLayer() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function buildTeamPerformanceLayer() : void
|
private function buildTeamPerformanceLayer() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function buildTruncLayer() : void
|
private function buildTruncLayer() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function factorGraphBuilders()
|
private function factorGraphBuilders()
|
||||||
{
|
{
|
||||||
// Rating layer
|
// Rating layer
|
||||||
|
|
@ -275,9 +260,6 @@ class TrueSkill
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function rating() : void
|
public function rating() : void
|
||||||
{
|
{
|
||||||
// Start values
|
// Start values
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ final class BayesianPersonalizedRanking
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param int $numFactors Determines the dimensionality of the latent factor space.
|
* @param int $numFactors determines the dimensionality of the latent factor space
|
||||||
* @param float $learningRate Controls the step size for updating the latent factors during optimization.
|
* @param float $learningRate controls the step size for updating the latent factors during optimization
|
||||||
* @param float $regularization Prevents over-fitting by adding a penalty for large parameter values.
|
* @param float $regularization prevents over-fitting by adding a penalty for large parameter values
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function __construct(int $numFactors, float $learningRate, float $regularization)
|
public function __construct(int $numFactors, float $learningRate, float $regularization)
|
||||||
{
|
{
|
||||||
$this->numFactors = $numFactors;
|
$this->numFactors = $numFactors;
|
||||||
|
|
|
||||||
|
|
@ -1336,4 +1336,17 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paginate(string $member, string $ptype, mixed $offset) : self
|
||||||
|
{
|
||||||
|
if ($ptype === 'p') {
|
||||||
|
$this->where($member, $offset ?? 0, '<');
|
||||||
|
} elseif ($ptype === 'n') {
|
||||||
|
$this->where($member, $offset ?? 0, '>');
|
||||||
|
} else {
|
||||||
|
$this->where($member, 0, '>');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -852,8 +852,8 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
}
|
}
|
||||||
|
|
||||||
$eig = new EigenvalueDecomposition($this);
|
$eig = new EigenvalueDecomposition($this);
|
||||||
$v = $eig->getV();
|
$v = $eig->getV();
|
||||||
$d = $eig->getD();
|
$d = $eig->getD();
|
||||||
|
|
||||||
$vInv = $v->inverse();
|
$vInv = $v->inverse();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,12 @@ final class UriFactory
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @feature Implement whitelisting/blacklisting for {?}
|
||||||
|
// Currently it copies all parameters
|
||||||
|
// Ideally you could use
|
||||||
|
// {?+para1,para2} for whitelisting
|
||||||
|
// {?-para1,para2} for blacklisting
|
||||||
|
|
||||||
if (\stripos($url, '?') === false && ($pos = \stripos($url, '&')) !== false) {
|
if (\stripos($url, '?') === false && ($pos = \stripos($url, '&')) !== false) {
|
||||||
$url = \substr_replace($url, '?', $pos, 1);
|
$url = \substr_replace($url, '?', $pos, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,10 @@ abstract class TwoDAbstract extends CodeAbstract
|
||||||
*/
|
*/
|
||||||
protected function createImage(array $codeArray) : mixed
|
protected function createImage(array $codeArray) : mixed
|
||||||
{
|
{
|
||||||
|
if (empty($codeArray)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$dimensions = $this->calculateDimensions($codeArray);
|
$dimensions = $this->calculateDimensions($codeArray);
|
||||||
$image = \imagecreate($dimensions['width'], $dimensions['height']);
|
$image = \imagecreate($dimensions['width'], $dimensions['height']);
|
||||||
|
|
||||||
|
|
@ -115,6 +119,13 @@ abstract class TwoDAbstract extends CodeAbstract
|
||||||
*/
|
*/
|
||||||
private function calculateDimensions(array $codeArray) : array
|
private function calculateDimensions(array $codeArray) : array
|
||||||
{
|
{
|
||||||
|
if (empty($codeArray)) {
|
||||||
|
return [
|
||||||
|
'width' => 0,
|
||||||
|
'height' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$matrixDimension = \max(\count($codeArray), \count(\reset($codeArray)));
|
$matrixDimension = \max(\count($codeArray), \count(\reset($codeArray)));
|
||||||
$imageDimension = \max($this->dimension['width'], $this->dimension['width']);
|
$imageDimension = \max($this->dimension['width'], $this->dimension['width']);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,9 @@ final class ColorUtils
|
||||||
public static function approximateColorDistance(array $rgb1, array $rgb2) : float
|
public static function approximateColorDistance(array $rgb1, array $rgb2) : float
|
||||||
{
|
{
|
||||||
$rMean = (int) (($rgb1['r'] + $rgb2['r']) / 2);
|
$rMean = (int) (($rgb1['r'] + $rgb2['r']) / 2);
|
||||||
$r = ($rgb2['r'] - $rgb1['r']);
|
$r = ($rgb2['r'] - $rgb1['r']);
|
||||||
$g = ($rgb2['g'] - $rgb1['g']);
|
$g = ($rgb2['g'] - $rgb1['g']);
|
||||||
$b = ($rgb2['b'] - $rgb1['b']);
|
$b = ($rgb2['b'] - $rgb1['b']);
|
||||||
|
|
||||||
return \sqrt(
|
return \sqrt(
|
||||||
(((512 + $rMean) * $r * $r) >> 8)
|
(((512 + $rMean) * $r * $r) >> 8)
|
||||||
|
|
|
||||||
|
|
@ -4576,7 +4576,7 @@ class Markdown
|
||||||
}
|
}
|
||||||
|
|
||||||
$permitRawHtml = false;
|
$permitRawHtml = false;
|
||||||
$text = null;
|
$text = null;
|
||||||
|
|
||||||
if (isset($element['text'])) {
|
if (isset($element['text'])) {
|
||||||
$text = $element['text'];
|
$text = $element['text'];
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testGetAll() : void
|
public function testGetAll() : void
|
||||||
{
|
{
|
||||||
BaseModelMapper::create()->execute($this->model);
|
BaseModelMapper::create()->execute($this->model);
|
||||||
self::assertCount(1, BaseModelMapper::getAll()->execute());
|
self::assertCount(1, BaseModelMapper::getAll()->executeGetArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetYield() : void
|
public function testGetYield() : void
|
||||||
|
|
@ -303,7 +303,7 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testGetFor() : void
|
public function testGetFor() : void
|
||||||
{
|
{
|
||||||
$id = BaseModelMapper::create()->execute($this->model);
|
$id = BaseModelMapper::create()->execute($this->model);
|
||||||
$for = ManyToManyDirectModelMapper::getAll()->where('to', $id)->execute();
|
$for = ManyToManyDirectModelMapper::getAll()->where('to', $id)->executeGetArray();
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
\reset($this->model->hasManyDirect)->string,
|
\reset($this->model->hasManyDirect)->string,
|
||||||
|
|
@ -337,7 +337,7 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
$model2->datetime = new \DateTime('now');
|
$model2->datetime = new \DateTime('now');
|
||||||
$id2 = BaseModelMapper::create()->execute($model2);
|
$id2 = BaseModelMapper::create()->execute($model2);
|
||||||
|
|
||||||
$newest = BaseModelMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->execute();
|
$newest = BaseModelMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->executeGetArray();
|
||||||
self::assertEquals($id2, \reset($newest)->id);
|
self::assertEquals($id2, \reset($newest)->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,7 +393,7 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
BaseModelMapper::create()->execute($model2);
|
BaseModelMapper::create()->execute($model2);
|
||||||
BaseModelMapper::create()->execute($model3);
|
BaseModelMapper::create()->execute($model3);
|
||||||
|
|
||||||
$found = BaseModelMapper::getAll()->where('string', '%sir%' , 'LIKE')->execute();
|
$found = BaseModelMapper::getAll()->where('string', '%sir%' , 'LIKE')->executeGetArray();
|
||||||
self::assertCount(2, $found);
|
self::assertCount(2, $found);
|
||||||
self::assertEquals($model2->string, \reset($found)->string);
|
self::assertEquals($model2->string, \reset($found)->string);
|
||||||
self::assertEquals($model3->string, \end($found)->string);
|
self::assertEquals($model3->string, \end($found)->string);
|
||||||
|
|
@ -455,7 +455,7 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
$cond3->base = $id2;
|
$cond3->base = $id2;
|
||||||
ConditionalMapper::create()->execute($cond3);
|
ConditionalMapper::create()->execute($cond3);
|
||||||
|
|
||||||
$found = BaseModelMapper::getAll()->with('conditional')->where('conditional/language', 'de')->execute();
|
$found = BaseModelMapper::getAll()->with('conditional')->where('conditional/language', 'de')->executeGetArray();
|
||||||
self::assertCount(2, $found);
|
self::assertCount(2, $found);
|
||||||
self::assertEquals($model1->string, \reset($found)->string);
|
self::assertEquals($model1->string, \reset($found)->string);
|
||||||
self::assertEquals($model2->string, \end($found)->string);
|
self::assertEquals($model2->string, \end($found)->string);
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,7 @@ final class ModuleAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->dbSetup();
|
$this->dbSetup();
|
||||||
|
|
||||||
$this->module->create();
|
$this->module->create();
|
||||||
self::assertCount(1, BaseModelMapper::getAll()->execute());
|
self::assertCount(1, BaseModelMapper::getAll()->executeGetArray());
|
||||||
|
|
||||||
$this->dbTeardown();
|
$this->dbTeardown();
|
||||||
}
|
}
|
||||||
|
|
@ -419,7 +419,7 @@ final class ModuleAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->dbSetup();
|
$this->dbSetup();
|
||||||
|
|
||||||
$this->module->createMultiple();
|
$this->module->createMultiple();
|
||||||
self::assertCount(2, BaseModelMapper::getAll()->execute());
|
self::assertCount(2, BaseModelMapper::getAll()->executeGetArray());
|
||||||
|
|
||||||
$this->dbTeardown();
|
$this->dbTeardown();
|
||||||
}
|
}
|
||||||
|
|
@ -447,7 +447,7 @@ final class ModuleAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->create();
|
$this->module->create();
|
||||||
self::assertCount(1, BaseModelMapper::getAll()->execute());
|
self::assertCount(1, BaseModelMapper::getAll()->execute());
|
||||||
$this->module->delete();
|
$this->module->delete();
|
||||||
self::assertCount(0, BaseModelMapper::getAll()->execute());
|
self::assertCount(0, BaseModelMapper::getAll()->executeGetArray());
|
||||||
|
|
||||||
$this->dbTeardown();
|
$this->dbTeardown();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\tests\Stdlib\Base;
|
namespace phpOMS\tests\Stdlib\Base;
|
||||||
|
|
||||||
use phpOMS\Stdlib\Base\Address;
|
use phpOMS\Stdlib\Base\Address;
|
||||||
use phpOMS\Stdlib\Base\Location;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
|
@ -39,8 +38,8 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testDefault() : void
|
public function testDefault() : void
|
||||||
{
|
{
|
||||||
$expected = [
|
$expected = [
|
||||||
'fao' => '',
|
'fao' => '',
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'postal' => '',
|
'postal' => '',
|
||||||
'city' => '',
|
'city' => '',
|
||||||
'country' => 'XX',
|
'country' => 'XX',
|
||||||
|
|
@ -69,8 +68,8 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testArray() : void
|
public function testArray() : void
|
||||||
{
|
{
|
||||||
$expected = [
|
$expected = [
|
||||||
'fao' => 'fao',
|
'fao' => 'fao',
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'postal' => '',
|
'postal' => '',
|
||||||
'city' => '',
|
'city' => '',
|
||||||
'country' => 'XX',
|
'country' => 'XX',
|
||||||
|
|
@ -80,7 +79,7 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
||||||
'lon' => 0.0,
|
'lon' => 0.0,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->address->fao = 'fao';
|
$this->address->fao = 'fao';
|
||||||
|
|
||||||
self::assertEquals($expected, $this->address->toArray());
|
self::assertEquals($expected, $this->address->toArray());
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +89,8 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testJsonSerialize() : void
|
public function testJsonSerialize() : void
|
||||||
{
|
{
|
||||||
$expected = [
|
$expected = [
|
||||||
'fao' => 'fao',
|
'fao' => 'fao',
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'postal' => '',
|
'postal' => '',
|
||||||
'city' => '',
|
'city' => '',
|
||||||
'country' => 'XX',
|
'country' => 'XX',
|
||||||
|
|
@ -101,7 +100,7 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
||||||
'lon' => 0.0,
|
'lon' => 0.0,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->address->fao = 'fao';
|
$this->address->fao = 'fao';
|
||||||
|
|
||||||
self::assertEquals($expected, $this->address->jsonSerialize());
|
self::assertEquals($expected, $this->address->jsonSerialize());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ final class NodeTest extends \PHPUnit\Framework\TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @bug Directed graphs may return invalid neighbors
|
* @bug Directed graphs may return invalid neighbors
|
||||||
* https://github.com/Karaka-Management/phpOMS/issues/366
|
* https://github.com/Karaka-Management/phpOMS/issues/366
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,6 @@ final class ArrayUtilsTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertNull(ArrayUtils::getArg('--testNull', $_SERVER['argv'] ?? []));
|
self::assertNull(ArrayUtils::getArg('--testNull', $_SERVER['argv'] ?? []));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('framework')]
|
#[\PHPUnit\Framework\Attributes\Group('framework')]
|
||||||
#[\PHPUnit\Framework\Attributes\TestDox('All array values in an array can be potentiated by a numeric value')]
|
#[\PHPUnit\Framework\Attributes\TestDox('All array values in an array can be potentiated by a numeric value')]
|
||||||
public function test() : void
|
public function test() : void
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ final class ScheduleTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertInstanceOf('\phpOMS\Utils\TaskSchedule\TaskAbstract', $job);
|
self::assertInstanceOf('\phpOMS\Utils\TaskSchedule\TaskAbstract', $job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[\PHPUnit\Framework\Attributes\Group('framework')]
|
#[\PHPUnit\Framework\Attributes\Group('framework')]
|
||||||
#[\PHPUnit\Framework\Attributes\TestDox('A task can be created from an array and rendered')]
|
#[\PHPUnit\Framework\Attributes\TestDox('A task can be created from an array and rendered')]
|
||||||
public function testCreateJobWithData() : void
|
public function testCreateJobWithData() : void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user