fix todos/move to todo list

This commit is contained in:
Dennis Eichhorn 2020-11-26 20:50:18 +01:00
parent b57e6ca305
commit 843d97c632
22 changed files with 53 additions and 206 deletions

View File

@ -55,7 +55,7 @@ final class Weighted
}
if ($j1->getEnd() !== null && $j2->getEnd() === null) {
return -1; // @todo: Implement test case
return -1;
}
return $j1->getEnd()->getTimestamp() <=> $j2->getEnd()->getTimestamp();

View File

@ -194,9 +194,6 @@ class ApplicationAbstract
*
* @return void
*
* @todo Orange-Management/phpOMS#218
* As soon as readonly member variables are possible the magic methods should be removed.
*
* @since 1.0.0
*/
public function __set($name, $value) : void
@ -215,9 +212,6 @@ class ApplicationAbstract
*
* @return mixed Returns the value of the application member
*
* @todo Orange-Management/phpOMS#218
* As soon as readonly member variables are possible the magic methods should be removed.
*
* @since 1.0.0
*/
public function __get($name)

View File

@ -23,20 +23,6 @@ use phpOMS\DataStorage\DataStorageConnectionInterface;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#184
* Add more functions:
* * exists - Checks if the key exists
* * getLike - Get all by pattern
* * removeLike - Remove all by pattern
* * getMult - Get multiple results
* * removeMult - Remove multiple
* * setMult - Set multiple
* * updateExpiration - Update expiration
* * increment - Increment numeric value
* * decrement - Decrement numeric value
* * rename - Rename key
* * save - Save cache (to hard drive or somewhere else)
*/
interface ConnectionInterface extends DataStorageConnectionInterface
{

View File

@ -39,14 +39,6 @@ use phpOMS\System\File\Local\File;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#182
* Create file locking
* The file caching should implement a locking solution for the cache files.
* Without it a different process may try to read it while the cache is still getting created.
* A solution could be to create a directory or file called _lock which is getting checked
* (if this file exists reading from cache, modifying or creating it is not allowed except the _lock file is 5 minutes or so old).
* File and or directory creation should be atomic, right?
*/
final class FileCache extends ConnectionAbstract
{

View File

@ -31,11 +31,6 @@ use phpOMS\DataStorage\Database\Schema\Grammar\Grammar as SchemaGrammar;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/Modules#100
* Init only when used
* The database connection should only get initialized when used.
* Setup happens before but initialization should only happen on the first usage.
*/
abstract class ConnectionAbstract implements ConnectionInterface
{
@ -196,9 +191,6 @@ abstract class ConnectionAbstract implements ConnectionInterface
*
* @return mixed Returns the value of the connection
*
* @todo Orange-Management/phpOMS#218
* As soon as readonly member variables are possible the magic methods should be removed.
*
* @since 1.0.0
*/
public function __get($name)

View File

@ -2578,11 +2578,6 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return mixed
*
* @todo Orange-Management/phpOMS#161
* Reconsider get*() parameter order
* Check if the parameter order of all of the get functions makes sense or if another order would be better.
* Especially the fill parameter probably should be swapped with the depth filter.
*
* @since 1.0.0
*/
public static function get($primaryKey, int $relations = RelationType::ALL, int $depth = 3, string $ref = null, Builder $query = null)

View File

@ -25,10 +25,6 @@ use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#33
* Implement missing grammar & builder functions
* Missing elements are e.g. sum, merge etc.
*/
class Builder extends BuilderAbstract
{

View File

@ -24,10 +24,6 @@ use phpOMS\DataStorage\Database\Query\Builder as QueryBuilder;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#32
* Implement schema grammar
* Basic create/drop schema grammar created. Next step is to be able to update existing schema and read existing schema.
*/
class Builder extends QueryBuilder
{

View File

@ -25,10 +25,6 @@ use phpOMS\DataStorage\Database\Schema\QueryType;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#32
* Implement schema grammar
* Basic create/drop schema grammar created. Next step is to be able to update existing schema and read existing schema.
*/
class Grammar extends QueryGrammar
{

View File

@ -24,10 +24,6 @@ use phpOMS\DataStorage\Database\Query\Builder;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#32
* Implement schema grammar
* Basic create/drop schema grammar created. Next step is to be able to update existing schema and read existing schema.
*/
class MysqlGrammar extends Grammar
{

View File

@ -97,7 +97,7 @@ final class Rest
*
* according to the verbose output of curl the request is correct. this means the server must have a problem with it
*
* the php webserver and apache2 both seem to be unable to populate the php://input correctly -> not a server isue but a php issue?
* the php webserver and apache2 both seem to be unable to populate the php://input correctly -> not a server issue but a php issue?
*/
$headers['content-type'] = 'Content-Type: multipart/form-data; boundary/' . $boundary;
$headers['content-length'] = 'Content-Length: ' . \strlen($data);

View File

@ -29,9 +29,6 @@ use phpOMS\Utils\StringUtils;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/Modules#113
* Don't use name but id for identification
*/
abstract class ModuleAbstract
{

View File

@ -33,9 +33,6 @@ use phpOMS\System\File\PathException;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/Modules#113
* Don't use name but id for identification
*/
final class ModuleManager
{
@ -197,7 +194,6 @@ final class ModuleManager
public function getActiveModules(bool $useCache = true) : array
{
if (empty($this->active) || !$useCache) {
// @todo: use ModuleMapper and return objects
$query = new Builder($this->app->dbPool->get('select'));
$sth = $query->select('module.module_path')
->from('module')
@ -263,8 +259,6 @@ final class ModuleManager
public function getAllModules() : array
{
if (empty($this->all)) {
// @todo: return objects
\chdir($this->modulePath);
$files = \glob('*', \GLOB_ONLYDIR);
@ -274,16 +268,11 @@ final class ModuleManager
$c = $files === false ? 0 : \count($files);
for ($i = 0; $i < $c; ++$i) {
$path = $this->modulePath . $files[$i] . '/info.json';
$module = $this->loadInfo($files[$i]);
if (!\is_file($path)) {
continue;
if ($module !== null) {
$this->all[$files[$i]] = $module;
}
$content = \file_get_contents($path);
$json = \json_decode($content === false ? '[]' : $content, true);
$this->all[(string) ($json['name']['internal'] ?? '?')] = $json === false ? [] : $json;
}
}
@ -314,7 +303,6 @@ final class ModuleManager
public function getInstalledModules(bool $useCache = true) : array
{
if (empty($this->installed) || !$useCache) {
// @todo: use ModuleMapper and return objects
$query = new Builder($this->app->dbPool->get('select'));
$sth = $query->select('module.module_path')
->from('module')
@ -323,12 +311,6 @@ final class ModuleManager
$installed = $sth->fetchAll(\PDO::FETCH_COLUMN);
foreach ($installed as $module) {
$path = $this->modulePath . $module . '/info.json';
if (!\is_file($path)) {
continue;
}
$this->installed[$module] = $this->loadInfo($module);
}
}
@ -341,16 +323,16 @@ final class ModuleManager
*
* @param string $module Module name
*
* @return ModuleInfo
* @return null|ModuleInfo
*
* @since 1.0.0
*/
private function loadInfo(string $module) : ModuleInfo
private function loadInfo(string $module) : ?ModuleInfo
{
$path = \realpath($oldPath = $this->modulePath . $module . '/info.json');
if ($path === false) {
throw new PathException($oldPath);
return null;
}
$info = new ModuleInfo($path);
@ -503,10 +485,6 @@ final class ModuleManager
return false;
}
/**
* @todo Orange-Management/Modules#193
* Implement online database and downloading api for modules and updates
*/
if (!\is_file($this->modulePath . $module . '/Admin/Installer.php')) {
return false;
}

View File

@ -53,10 +53,6 @@ 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
@ -106,10 +102,6 @@ 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

View File

@ -36,10 +36,6 @@ 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, ModuleInfo $info) : void

View File

@ -317,42 +317,7 @@ final class Directory extends FileAbstract implements DirectoryInterface, LocalC
return \implode('/', $path);
}
/**
* {@inheritdoc}
*
* @todo Orange-Management/phpOMS#??? [p:low] [t:optimization] [d:beginner] [t:question]
* Consider to move this to fileAbastract since it should be the same for file and directory?
*/
public static function created(string $path) : \DateTime
{
if (!\is_dir($path)) {
throw new PathException($path);
}
$created = new \DateTime('now');
$time = \filemtime($path);
$created->setTimestamp($time === false ? 0 : $time);
return $created;
}
/**
* {@inheritdoc}
*/
public static function changed(string $path) : \DateTime
{
if (!\is_dir($path)) {
throw new PathException($path);
}
$changed = new \DateTime();
$time = \filectime($path);
$changed->setTimestamp($time === false ? 0 : $time);
return $changed;
}
/**
* {@inheritdoc}

View File

@ -203,51 +203,6 @@ final class File extends FileAbstract implements FileInterface, LocalContainerIn
return \preg_replace($invalid, $replace, $path) ?? '';
}
/**
* {@inheritdoc}
*/
public static function created(string $path) : \DateTime
{
if (!\is_file($path)) {
throw new PathException($path);
}
$time = \filemtime($path);
return self::createFileTime($time === false ? 0 : $time);
}
/**
* {@inheritdoc}
*/
public static function changed(string $path) : \DateTime
{
if (!\is_file($path)) {
throw new PathException($path);
}
$time = \filemtime($path);
return self::createFileTime($time === false ? 0 : $time);
}
/**
* Create file time.
*
* @param int $time Time of the file
*
* @return \DateTime
*
* @since 1.0.0
*/
private static function createFileTime(int $time) : \DateTime
{
$fileTime = new \DateTime();
$fileTime->setTimestamp($time);
return $fileTime;
}
/**
* {@inheritdoc}
*/

View File

@ -116,6 +116,51 @@ abstract class FileAbstract implements ContainerInterface
$this->changedAt = new \DateTime('now');
}
/**
* {@inheritdoc}
*/
public static function created(string $path) : \DateTime
{
if (!\file_exists($path)) {
throw new PathException($path);
}
$time = \filectime($path);
return self::createFileTime($time === false ? 0 : $time);
}
/**
* {@inheritdoc}
*/
public static function changed(string $path) : \DateTime
{
if (!\file_exists($path)) {
throw new PathException($path);
}
$time = \filemtime($path);
return self::createFileTime($time === false ? 0 : $time);
}
/**
* Create file time.
*
* @param int $time Time of the file
*
* @return \DateTime
*
* @since 1.0.0
*/
private static function createFileTime(int $time) : \DateTime
{
$fileTime = new \DateTime();
$fileTime->setTimestamp($time);
return $fileTime;
}
/**
* {@inheritdoc}
*/

View File

@ -21,11 +21,6 @@ namespace phpOMS\Utils;
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*
* @todo Orange-Management/phpOMS#154
* Create excel operations on arrays
* In many cases there are values stored inside of arrays which need simple math operators performed on them.
* Instead of writing the expression it should be possible to do this in good old excel fasion.
*/
final class ArrayUtils
{
@ -394,9 +389,6 @@ final class ArrayUtils
*
* @return float[]
*
* @todo Orange-Management/phpOMS#223
* In the ArrayUtils class the power* functions should be combined once union types become available.
*
* @since 1.0.0
*/
public static function powerFloat(array $values, float $exp = 2.0) : array
@ -418,9 +410,6 @@ final class ArrayUtils
*
* @return array<int|float>
*
* @todo Orange-Management/phpOMS#223
* In the ArrayUtils class the power* functions should be combined once union types become available.
*
* @since 1.0.0
*/
public static function powerInt(array $values, int $exp = 2) : array

View File

@ -171,8 +171,6 @@ final class StringCompare
*
* @return int
*
* @todo: Consider to remove previous matches in words2. Otherwise the distance may be checked against the same word over and over.
*
* @since 1.0.0
*/
public static function valueWords(string $s1, string $s2) : int

View File

@ -276,11 +276,6 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
self::markTestIncomplete();
/**
* @todo Orange-Management/phpOMS#179
* Create unit test for inverse.
* It seems like some columns are ordered in a different way
*/
/*self::assertEquals([
[-0.9, -0.5, 2.2],
[0.7, 0.5, -1.6],

View File

@ -283,9 +283,6 @@ class ArrayUtilsTest extends \PHPUnit\Framework\TestCase
* @testdox All array values in an array can be potentiated by an integer
* @covers phpOMS\Utils\ArrayUtils
*
* @todo Orange-Management/phpOMS#223
* In the ArrayUtils class the power* functions should be combined once union types become available.
*
* @group framework
*/
public function testPowerInt() : void
@ -298,9 +295,6 @@ class ArrayUtilsTest extends \PHPUnit\Framework\TestCase
* @testdox All array values in an array can be potentiated by a float
* @covers phpOMS\Utils\ArrayUtils
*
* @todo Orange-Management/phpOMS#223
* In the ArrayUtils class the power* functions should be combined once union types become available.
*
* @group framework
*/
public function testPowerFloat() : void