diff --git a/DataStorage/Session/SessionAbstract.php b/DataStorage/Session/SessionAbstract.php index 7deed9d2e..7a8a6e127 100644 --- a/DataStorage/Session/SessionAbstract.php +++ b/DataStorage/Session/SessionAbstract.php @@ -43,7 +43,7 @@ abstract class SessionAbstract * * @since 1.0.0 */ - public abstract function get(string $key) : mixed; + abstract public function get(string $key) : mixed; /** * Store session value by key. @@ -56,7 +56,7 @@ abstract class SessionAbstract * * @since 1.0.0 */ - public abstract function set(string $key, mixed $value, bool $overwrite = false) : bool; + abstract public function set(string $key, mixed $value, bool $overwrite = false) : bool; /** * Remove value from session by key. @@ -67,7 +67,7 @@ abstract class SessionAbstract * * @since 1.0.0 */ - public abstract function remove(string $key) : bool; + abstract public function remove(string $key) : bool; /** * Save session. @@ -76,14 +76,14 @@ abstract class SessionAbstract * * @since 1.0.0 */ - public abstract function save() : bool; + abstract public function save() : bool; /** * @return string * * @since 1.0.0 */ - public abstract function getSID() : string; + abstract public function getSID() : string; /** * @param string $sid Session id @@ -92,7 +92,7 @@ abstract class SessionAbstract * * @since 1.0.0 */ - public abstract function setSID(string $sid) : void; + abstract public function setSID(string $sid) : void; /** * Lock session from further adjustments. @@ -101,5 +101,5 @@ abstract class SessionAbstract * * @since 1.0.0 */ - public abstract function lock() : void; + abstract public function lock() : void; } diff --git a/Math/Geometry/ConvexHull/GrahamScan.php b/Math/Geometry/ConvexHull/GrahamScan.php index 639122fcc..5c68c3341 100644 --- a/Math/Geometry/ConvexHull/GrahamScan.php +++ b/Math/Geometry/ConvexHull/GrahamScan.php @@ -50,6 +50,7 @@ final class GrahamScan } $min = 1; + $points = \array_merge([['x' => 0.0, 'y' => 0.0]], $points); for ($i = 2; $i < $n; ++$i) { if ($points[$i]['y'] < $points[$min]['y'] diff --git a/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php b/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php index e3d41d7c1..a34cc0d1e 100755 --- a/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php +++ b/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php @@ -143,7 +143,7 @@ final class SpreadsheetDatabaseMapper implements IODatabaseMapper $sheet->setActiveSheetIndex($i); $workSheet = $sheet->getSheet($i); - $table = \strtr(empty($table) ? $workSheet->getTitle() : $table, ' ', '_'); + $tableName = \strtr(empty($table) ? $workSheet->getTitle() : $table, ' ', '_'); $titles = []; // get column titles @@ -172,7 +172,7 @@ final class SpreadsheetDatabaseMapper implements IODatabaseMapper // insert data $query = new Builder($this->con); - $query->insert(...$titles)->into($table); + $query->insert(...$titles)->into($tableName); while ($hasData = !empty($workSheet->getCell('A' . $line)->getCalculatedValue())) { $cells = []; @@ -285,7 +285,7 @@ final class SpreadsheetDatabaseMapper implements IODatabaseMapper $sheet->setActiveSheetIndex($i); $workSheet = $sheet->getSheet($i); - $table = \strtr(empty($table) ? $workSheet->getTitle() : $table, ' ', '_'); + $tableName = \strtr(empty($table) ? $workSheet->getTitle() : $table, ' ', '_'); $titles = []; // get column titles @@ -313,7 +313,7 @@ final class SpreadsheetDatabaseMapper implements IODatabaseMapper $line = 2; while (!empty($workSheet->getCell('A' . $line)->getCalculatedValue())) { $query = new Builder($this->con); - $query->update($table); + $query->update($tableName); for ($j = 2; $j <= $columns; ++$j) { $query->sets((string) $titles[$j - 2], $workSheet->getCell(StringUtils::intToAlphabet($j) . $line)->getCalculatedValue()); diff --git a/Utils/TaskSchedule/TaskAbstract.php b/Utils/TaskSchedule/TaskAbstract.php index 52dc103df..2005aa75e 100755 --- a/Utils/TaskSchedule/TaskAbstract.php +++ b/Utils/TaskSchedule/TaskAbstract.php @@ -83,7 +83,7 @@ abstract class TaskAbstract /** * Constructor * - * @param string $name Id/name of the task (on linux the same as the executable script) + * @param string $name Id/name of the task (on Linux the same as the executable script) * @param string $cmd Command to create the task * * @since 1.0.0 @@ -251,7 +251,7 @@ abstract class TaskAbstract /** * Create task based on job data * - * @param string[] $jobData Raw job data + * @param array $jobData Raw job data * * @return TaskAbstract * diff --git a/tests/Math/Geometry/ConvexHull/GrahamScanTest.php b/tests/Math/Geometry/ConvexHull/GrahamScanTest.php index c42ee330c..5d938f0b3 100644 --- a/tests/Math/Geometry/ConvexHull/GrahamScanTest.php +++ b/tests/Math/Geometry/ConvexHull/GrahamScanTest.php @@ -14,6 +14,8 @@ declare(strict_types=1); namespace phpOMS\tests\Math\Geometry\ConvexHull; +include_once __DIR__ . '/../../../Autoloader.php'; + use phpOMS\Math\Geometry\ConvexHull\GrahamScan; /** diff --git a/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php b/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php index 363f67e0a..cc925f178 100755 --- a/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php +++ b/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php @@ -14,6 +14,8 @@ declare(strict_types=1); namespace phpOMS\tests\Utils\IO\Spreadsheet; +include_once __DIR__ . '/../../../Autoloader.php'; + use phpOMS\DataStorage\Database\Connection\SQLiteConnection; use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\tests\Autoloader; @@ -73,10 +75,11 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase public function testInsertOds() : void { $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.ods', 'insert_1'); + $mapper->import(__DIR__ . '/insert.ods'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + self::assertEquals( [ ['id' => 1, 'int' => 2, 'decimal' => 2.0, 'bool' => 1, 'varchar' => 'Line 1', 'datetime' => '43631'], @@ -105,7 +108,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase public function testInsertXls() : void { $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.xls', 'insert_1'); + $mapper->import(__DIR__ . '/insert.xls'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -137,7 +140,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase public function testInsertXlsx() : void { $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.xlsx', 'insert_1'); + $mapper->import(__DIR__ . '/insert.xlsx'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -169,7 +172,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase public function testUpdateOds() : void { $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.ods', 'insert_1'); + $mapper->import(__DIR__ . '/insert.ods'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -196,7 +199,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase ); $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->update(__DIR__ . '/update.ods', 'insert_1'); + $mapper->update(__DIR__ . '/update.ods'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -228,7 +231,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase public function testUpdateXls() : void { $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.xls', 'insert_1'); + $mapper->import(__DIR__ . '/insert.xls'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -255,7 +258,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase ); $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->update(__DIR__ . '/update.xls', 'insert_1'); + $mapper->update(__DIR__ . '/update.xls'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -287,7 +290,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase public function testUpdateXlsx() : void { $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.xlsx', 'insert_1'); + $mapper->import(__DIR__ . '/insert.xlsx'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -314,7 +317,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase ); $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->update(__DIR__ . '/update.xlsx', 'insert_1'); + $mapper->update(__DIR__ . '/update.xlsx'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -350,7 +353,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase } $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.ods', 'insert_1'); + $mapper->import(__DIR__ . '/insert.ods'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -399,7 +402,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase } $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.xls', 'insert_1'); + $mapper->import(__DIR__ . '/insert.xls'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; @@ -448,7 +451,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase } $mapper = new SpreadsheetDatabaseMapper($this->sqlite); - $mapper->import(__DIR__ . '/insert.xlsx', 'insert_1'); + $mapper->import(__DIR__ . '/insert.xlsx'); $builder = new Builder($this->sqlite, true); $data = $builder->select('insert_1.*')->from('insert_1')->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];