mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
cleanup todos
This commit is contained in:
parent
4414fad940
commit
a75025c1a0
|
|
@ -131,8 +131,6 @@ final class Kmeans
|
|||
for ($i = 0; $i < $coordinates; ++$i) {
|
||||
$center->setCoordinate($i, 0);
|
||||
}
|
||||
|
||||
//$center->setGroup(0); done because of bug below?!
|
||||
}
|
||||
|
||||
foreach ($points as $point) {
|
||||
|
|
@ -149,7 +147,13 @@ final class Kmeans
|
|||
|
||||
foreach ($clusterCenters as $center) {
|
||||
for ($i = 0; $i < $coordinates; ++$i) {
|
||||
// todo: here is a bug sometimes center->getGroup() is 0. this fix below is stupid
|
||||
/**
|
||||
* @todo Orange-Management/phpOMS#229
|
||||
* Invalid center coodinate value
|
||||
* In some cases the center point of a cluster belongs to the group 0 in this case the coordinate value is not working correctly.
|
||||
* As a quick fix the value is set to `1` in such a case but probably has multiple side effects.
|
||||
* Maybe it makes sense to just use `$center->getGroup() + 1` or set the value to `0`.
|
||||
*/
|
||||
$center->setCoordinate($i, $center->getCoordinate($i) / ($center->getGroup() === 0 ? 1 : $center->getGroup()));
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +214,7 @@ final class Kmeans
|
|||
* @param PointInterface[] $points Points to use for the cluster center initialization
|
||||
* @param int $n Amount of clusters to use
|
||||
*
|
||||
* @return array
|
||||
* @return PointInterface[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ class Grid
|
|||
public function getNode(int $x, int $y) : ?Node
|
||||
{
|
||||
if (!isset($this->nodes[$y]) || !isset($this->nodes[$y][$x])) {
|
||||
// todo: add null node to grid because we need to modify some properties later on and remember them!
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class JumpPointSearch implements PathFinderInterface
|
|||
|
||||
while (!$openList->isEmpty()) {
|
||||
$node = $openList->pop();
|
||||
$node->setClosed(true); // todo: do i really want to modify the node? probably not? I should clone the grid and all it's nodes.
|
||||
$node->setClosed(true);
|
||||
|
||||
if ($node->isEqual($endNode)) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ final class HeapSort implements SortInterface
|
|||
$right = ($index + 1) * 2;
|
||||
$pivot = 0;
|
||||
|
||||
// todo: also check $left > $size if test failes for desc!
|
||||
$pivot = $left < $size && $list[$left]->compare($list[$index], $order) ? $left : $index;
|
||||
|
||||
if ($right < $size && $list[$right]->compare($list[$pivot], $order)) {
|
||||
|
|
|
|||
|
|
@ -170,8 +170,6 @@ final class MemCached extends ConnectionAbstract
|
|||
return false;
|
||||
}
|
||||
|
||||
// todo: handle parsing
|
||||
|
||||
return $this->con->replace($key, $value, \max($expire, 0));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2282,7 +2282,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
}
|
||||
|
||||
if (\in_array($columns[$column]['type'], ['string', 'int', 'float', 'bool'])) {
|
||||
// todo: what is this or condition for? seems to be wrong if obj null then it doesn't work anyways
|
||||
if ($value !== null || $refProp->getValue($obj) !== null) {
|
||||
\settype($value, $columns[$column]['type']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ abstract class GrammarAbstract
|
|||
{
|
||||
$identifier = $this->systemIdentifier;
|
||||
|
||||
// todo: this is a bad way to handle select \count(*) which doesn't need a prefix. Maybe remove prefixes in total?
|
||||
// don't prefix special keywords e.g. COUNT(*)
|
||||
foreach ($this->specialKeywords as $keyword) {
|
||||
if (\strrpos($system, $keyword, -\strlen($system)) !== false) {
|
||||
$prefix = '';
|
||||
|
|
|
|||
|
|
@ -530,7 +530,6 @@ class Builder extends BuilderAbstract
|
|||
* Get column of where condition
|
||||
*
|
||||
* One column can have multiple where conditions.
|
||||
* TODO: maybe think about a case where there is a where condition but no column but some other identifier?
|
||||
*
|
||||
* @param mixed $column Column
|
||||
*
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ abstract class RegressionAbstract
|
|||
$sum += $errors[$i] ** 2;
|
||||
}
|
||||
|
||||
// todo: could this be - 1 depending on the different definitions?!
|
||||
return \sqrt($sum / $count);
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +99,6 @@ abstract class RegressionAbstract
|
|||
$sum += $errors[$i] ** 2;
|
||||
}
|
||||
|
||||
// todo: could this be - 1 depending on the different definitions?!
|
||||
return \sqrt($sum / ($count - 2));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,6 @@ final 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 / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])))
|
||||
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count'])
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ final class ModuleManager
|
|||
/**
|
||||
* All modules another module is providing for.
|
||||
*
|
||||
* This is important to inform other moduels what kind of information they can receive from other modules.
|
||||
* This is important to inform other modules what kind of information they can receive from other modules.
|
||||
*
|
||||
* @var array<string, array<int, string>>
|
||||
* @since 1.0.0
|
||||
|
|
@ -487,8 +487,11 @@ final class ModuleManager
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Orange-Management/Modules#193
|
||||
* Implement online database and downloading api for modules and updates
|
||||
*/
|
||||
if (!\file_exists($this->modulePath . '/' . $module . '/Admin/Installer.php')) {
|
||||
// todo download;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,6 @@ final class PackageManager
|
|||
$path = StringUtils::startsWith($component, '/Package/') ? $this->extractPath . '/' . \substr($component, 9) : $this->basePath . '/' . $component;
|
||||
|
||||
if (StringUtils::endsWith($component, '.php')) {
|
||||
// todo: maybe add a guessing method to find php path if it isn't available in the environment see Repository.php for git api
|
||||
$cmd = 'php ' . $path;
|
||||
} elseif (StringUtils::endsWith($component, '.sh') && OperatingSystem::getSystem() === SystemType::LINUX && \is_executable($path)) {
|
||||
$cmd = $path;
|
||||
|
|
|
|||
|
|
@ -53,11 +53,14 @@ abstract class StatusAbstract
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#228
|
||||
* Remove/Add routes on module status change
|
||||
* If the status of a module changes it should also change the routing file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function activateRoutes(string $destRoutePath, string $srcRoutePath) : void
|
||||
{
|
||||
// todo: remove route
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -104,11 +107,14 @@ abstract class StatusAbstract
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#228
|
||||
* Remove/Add routes on module status change
|
||||
* If the status of a module changes it should also change the routing file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function deactivateRoutes(string $destRoutePath, string $srcRoutePath) : void
|
||||
{
|
||||
// todo: remove route
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,11 +36,14 @@ abstract class UninstallerAbstract
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#228
|
||||
* Remove/Add routes on module status change
|
||||
* If the status of a module changes it should also change the routing file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function uninstall(DatabasePool $dbPool, InfoManager $info) : void
|
||||
{
|
||||
// todo: remove routes
|
||||
self::dropTables($dbPool, $info);
|
||||
self::unregisterFromDatabase($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ abstract class SocketAbstract implements SocketInterface
|
|||
{
|
||||
$this->ip = $ip;
|
||||
$this->port = $port;
|
||||
|
||||
// todo: if local network connect use AF_UNIX
|
||||
$this->sock = \socket_create(\AF_INET, \SOCK_STREAM, \SOL_TCP);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,9 +231,8 @@ abstract class ViewAbstract implements RenderableInterface
|
|||
$includeData = include $path;
|
||||
$ob = (string) \ob_get_clean();
|
||||
|
||||
// todo: is this correct? finally is still called.
|
||||
if (\is_array($includeData)) {
|
||||
return (string) \json_encode($includeData);
|
||||
$ob = (string) \json_encode($includeData);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$ob = ''; // @codeCoverageIgnore
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class PostgresConnectionTest extends \PHPUnit\Framework\TestCase
|
|||
public function testInvalidDatabaseName() : void
|
||||
{
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
$db['database'] = 'invalid';
|
||||
$db['database'] = ';`$';
|
||||
|
||||
$mysql = new PostgresConnection($db);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user