diff --git a/Algorithm/Clustering/Kmeans.php b/Algorithm/Clustering/Kmeans.php index 9308a26ad..f9ef03493 100644 --- a/Algorithm/Clustering/Kmeans.php +++ b/Algorithm/Clustering/Kmeans.php @@ -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 */ diff --git a/Algorithm/PathFinding/Grid.php b/Algorithm/PathFinding/Grid.php index b29c41982..ff49c7a2d 100644 --- a/Algorithm/PathFinding/Grid.php +++ b/Algorithm/PathFinding/Grid.php @@ -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; } diff --git a/Algorithm/PathFinding/JumpPointSearch.php b/Algorithm/PathFinding/JumpPointSearch.php index 125d00c6b..c87f0b535 100644 --- a/Algorithm/PathFinding/JumpPointSearch.php +++ b/Algorithm/PathFinding/JumpPointSearch.php @@ -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; diff --git a/Algorithm/Sort/HeapSort.php b/Algorithm/Sort/HeapSort.php index 89128fa70..c4d6fee78 100644 --- a/Algorithm/Sort/HeapSort.php +++ b/Algorithm/Sort/HeapSort.php @@ -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)) { diff --git a/DataStorage/Cache/Connection/MemCached.php b/DataStorage/Cache/Connection/MemCached.php index 5862a983c..5d4dbdab2 100644 --- a/DataStorage/Cache/Connection/MemCached.php +++ b/DataStorage/Cache/Connection/MemCached.php @@ -170,8 +170,6 @@ final class MemCached extends ConnectionAbstract return false; } - // todo: handle parsing - return $this->con->replace($key, $value, \max($expire, 0)); } diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 62024b08b..451592e8b 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -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']); } diff --git a/DataStorage/Database/GrammarAbstract.php b/DataStorage/Database/GrammarAbstract.php index 20c9dd010..ac8bf15fd 100644 --- a/DataStorage/Database/GrammarAbstract.php +++ b/DataStorage/Database/GrammarAbstract.php @@ -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 = ''; diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index edf080cc9..95d316b0f 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -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 * diff --git a/Math/Statistic/Forecast/Regression/RegressionAbstract.php b/Math/Statistic/Forecast/Regression/RegressionAbstract.php index e91b84533..c5961169b 100644 --- a/Math/Statistic/Forecast/Regression/RegressionAbstract.php +++ b/Math/Statistic/Forecast/Regression/RegressionAbstract.php @@ -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)); } diff --git a/Math/Stochastic/NaiveBayesClassifier.php b/Math/Stochastic/NaiveBayesClassifier.php index 6ef420062..99d87d4ba 100644 --- a/Math/Stochastic/NaiveBayesClassifier.php +++ b/Math/Stochastic/NaiveBayesClassifier.php @@ -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']) diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index 879d6b866..2a20a49e3 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -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> * @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; } diff --git a/Module/PackageManager.php b/Module/PackageManager.php index 9c05a322e..983969c7e 100644 --- a/Module/PackageManager.php +++ b/Module/PackageManager.php @@ -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; diff --git a/Module/StatusAbstract.php b/Module/StatusAbstract.php index f593cc429..9bad21bcc 100644 --- a/Module/StatusAbstract.php +++ b/Module/StatusAbstract.php @@ -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 } /** diff --git a/Module/UninstallerAbstract.php b/Module/UninstallerAbstract.php index 24ec3acbc..f46233d0f 100644 --- a/Module/UninstallerAbstract.php +++ b/Module/UninstallerAbstract.php @@ -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); } diff --git a/Socket/SocketAbstract.php b/Socket/SocketAbstract.php index 7b3137786..bb9604407 100644 --- a/Socket/SocketAbstract.php +++ b/Socket/SocketAbstract.php @@ -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); } diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index 6a8dd310d..6861367f2 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -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 diff --git a/tests/DataStorage/Database/Connection/PostgresConnectionTest.php b/tests/DataStorage/Database/Connection/PostgresConnectionTest.php index 0a18ad8f9..e8b036968 100644 --- a/tests/DataStorage/Database/Connection/PostgresConnectionTest.php +++ b/tests/DataStorage/Database/Connection/PostgresConnectionTest.php @@ -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); }