diff --git a/.idea/.name b/.idea/.name index bed0165dda2ac0d1eb2ee33dda14f648801256e9..b7796e073cee5d3b231d67a4953fd55b129577ef 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -mappi/store \ No newline at end of file +cursor \ No newline at end of file diff --git a/.idea/store.iml b/.idea/cursor.iml similarity index 100% rename from .idea/store.iml rename to .idea/cursor.iml diff --git a/.idea/modules.xml b/.idea/modules.xml index bfe35da760532706ba14dc694b9071f6b31b58af..5b8593b5db5e5594f7121bb88628ce64c5136c9a 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/store.iml" filepath="$PROJECT_DIR$/.idea/store.iml" /> + <module fileurl="file://$PROJECT_DIR$/../cursor/.idea/cursor.iml" filepath="$PROJECT_DIR$/../cursor/.idea/cursor.iml" /> </modules> </component> </project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4cb416c083d265558da75d457237d671..0000000000000000000000000000000000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$" vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/composer.json b/composer.json index c23206a3d5b5dd27b1c161f6546e1fc2476e4e35..7f302cd520cbecd10124748ec66d740d7a040a7e 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "mappi/store", + "name": "mappi/cursor", "require": { "php": ">=7.0.0", "dibi/dibi": "^3.0", @@ -18,13 +18,13 @@ ], "autoload": { "psr-4": { - "Grifart\\Mappi\\Store\\": "src/" + "Grifart\\Mappi\\Cursor\\": "src/" } }, "autoload-dev": { "psr-4": { - "Grifart\\Mappi\\Tests\\Store\\": "tests/Store/" + "Grifart\\Mappi\\Tests\\Cursor\\": "tests/Cursor/" } } } diff --git a/src/PostgresDriver/ArrayCursorDriver.php b/src/ArrayCursorDriver.php similarity index 96% rename from src/PostgresDriver/ArrayCursorDriver.php rename to src/ArrayCursorDriver.php index b2760515b562cf5c73cba0a779befdf1ef2ef57a..f982f03fe8d35aed221dc2c92424f6cddbbce378 100644 --- a/src/PostgresDriver/ArrayCursorDriver.php +++ b/src/ArrayCursorDriver.php @@ -1,16 +1,16 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Array Cursor simulates scrolling cursor as implemented in PostgreSQL 9.5. * * For more information see ICursor. * @see ICursor - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ class ArrayCursorDriver implements ICursorDriver { diff --git a/src/PostgresDriver/Cursor.php b/src/Cursor.php similarity index 94% rename from src/PostgresDriver/Cursor.php rename to src/Cursor.php index 5d849c83e22fed2aeda7eebb2bcadd7c2e5e9b85..70b1bbc8372b956fc893b5040fdec747d53251ba 100644 --- a/src/PostgresDriver/Cursor.php +++ b/src/Cursor.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * PostgreSQL cursor driver @@ -13,7 +13,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * simply get no more values. You can check if you reached the end by * `isHeadOnRecord()`. * - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ final class Cursor implements ICursor { diff --git a/src/PostgresDriver/CursorException.php b/src/CursorException.php similarity index 97% rename from src/PostgresDriver/CursorException.php rename to src/CursorException.php index dfd0ec1d218928bb6acc12242b39f342d0df2d19..05bccc553a5a62f28e7ebb0590005491f8f858a7 100644 --- a/src/PostgresDriver/CursorException.php +++ b/src/CursorException.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use Exception; diff --git a/src/PostgresDriver/CursorPosition.php b/src/CursorPosition.php similarity index 94% rename from src/PostgresDriver/CursorPosition.php rename to src/CursorPosition.php index f682c483a38dfa77b0bc7abaf9c2f2eced0a20fe..19383d6f5f3328c01fbc1db361e43fee502e0e22 100644 --- a/src/PostgresDriver/CursorPosition.php +++ b/src/CursorPosition.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; // todo: make this immutable as VOs should be @@ -11,7 +11,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * Value object for TrackedCursor position * * @link https://github.com/nicolopignatelli/valueobjects (inspiration) - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ final class CursorPosition { diff --git a/src/PostgresDriver/CursorPositionOrigin.php b/src/CursorPositionOrigin.php similarity index 64% rename from src/PostgresDriver/CursorPositionOrigin.php rename to src/CursorPositionOrigin.php index 01447b8bcd4052bc30c4a7acea4242930b756a37..41dabea689623fabd2cc317b486c10212afbfd26 100644 --- a/src/PostgresDriver/CursorPositionOrigin.php +++ b/src/CursorPositionOrigin.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use MabeEnum\Enum; diff --git a/src/PostgresDriver/ICursor.php b/src/ICursor.php similarity index 94% rename from src/PostgresDriver/ICursor.php rename to src/ICursor.php index 6c11a89518c5b24033cc5f615f51bb695e023d92..67ae8f55b8d35686df7404ab3e97e06c238454a6 100644 --- a/src/PostgresDriver/ICursor.php +++ b/src/ICursor.php @@ -1,8 +1,8 @@ <?php /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Represents cursor @@ -23,7 +23,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * @link http://www.postgresql.org/docs/9.5/static/plpgsql-cursors.html * @link http://www.postgresql.org/docs/8.1/static/sql-fetch.html * @link http://www.postgresql.org/docs/8.1/static/sql-move.html - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ interface ICursor { diff --git a/src/PostgresDriver/ICursorDriver.php b/src/ICursorDriver.php similarity index 94% rename from src/PostgresDriver/ICursorDriver.php rename to src/ICursorDriver.php index 6e645a9dcb9da6b38057fc8322805623a800167f..e4b0d97b44e7c2b31a33276595579ba9b7e67113 100644 --- a/src/PostgresDriver/ICursorDriver.php +++ b/src/ICursorDriver.php @@ -1,8 +1,8 @@ <?php /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Represents cursor @@ -20,7 +20,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * - Cursor starts at BEGINNING * - When you move too far HEAD will be parked in BEGINNING position or in the END position * - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ interface ICursorDriver { diff --git a/src/IDataStore.php b/src/IDataStore.php deleted file mode 100644 index 7b9fe9994e98ff3fca1af602bd9e12a030cce3df..0000000000000000000000000000000000000000 --- a/src/IDataStore.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php declare(strict_types = 1); - -namespace Grifart\Mappi\Store; - -/** - * Data source - */ -interface IDataStore extends \ArrayAccess, \Countable, \Traversable -{ - public function getAt(int $index) : IRecord; - public function getRange(int $firstIndex, int $numberOfRows); - - -} \ No newline at end of file diff --git a/src/IRecord.php b/src/IRecord.php deleted file mode 100644 index 72bf684dc06b2650ddec21b7f745021257f3db40..0000000000000000000000000000000000000000 --- a/src/IRecord.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php declare(strict_types = 1); - -namespace Grifart\Mappi\Store; - -/** - * Read only record of data source - */ -interface IRecord -{ - - public function get($name); - -} \ No newline at end of file diff --git a/src/PostgresDriver/PostgresCursorDriver.php b/src/PostgresCursorDriver.php similarity index 96% rename from src/PostgresDriver/PostgresCursorDriver.php rename to src/PostgresCursorDriver.php index 5413c4867b5e6685aef928bdeac4cc3e73098de7..6d58bdfcfdb73a63c40b2860d3b9e282d886ffce 100644 --- a/src/PostgresDriver/PostgresCursorDriver.php +++ b/src/PostgresCursorDriver.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use Dibi\Connection; use Dibi\Row; diff --git a/src/PostgresDriver/PostgresCursorFactory.php b/src/PostgresCursorFactory.php similarity index 92% rename from src/PostgresDriver/PostgresCursorFactory.php rename to src/PostgresCursorFactory.php index b7a1c7c32cc65b587df8c647abb314e9e260137c..67b08d88127262dff22f74fabe39e99059543f9b 100644 --- a/src/PostgresDriver/PostgresCursorFactory.php +++ b/src/PostgresCursorFactory.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use Dibi\Connection; diff --git a/src/PostgresDriver/SemanticCursor.php b/src/SemanticCursor.php similarity index 97% rename from src/PostgresDriver/SemanticCursor.php rename to src/SemanticCursor.php index 9fafb781536a48444f8ce6f42d21126984bb6c27..2c618e1f5ed97802709f8ebf9641ea9577804dfd 100644 --- a/src/PostgresDriver/SemanticCursor.php +++ b/src/SemanticCursor.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Adds semantic API into ICursor. @@ -14,7 +14,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * - LAST: the last row position * - END: the position after last row (end position) * - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ class SemanticCursor implements ICursor { diff --git a/src/PostgresDriver/TrackedCursor.php b/src/TrackedCursor.php similarity index 97% rename from src/PostgresDriver/TrackedCursor.php rename to src/TrackedCursor.php index d086671b95aacd944825c4286d35e1d422578d2f..b4ddd27feac99a5004cc39a76c6913247d4bafc7 100644 --- a/src/PostgresDriver/TrackedCursor.php +++ b/src/TrackedCursor.php @@ -1,11 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; - -use Dibi\Connection; +namespace Grifart\Mappi\Cursor; class TrackedCursor implements ICursor { diff --git a/tests/Store/PostgresDriver/CursorTest.phpt b/tests/Cursor/CursorTest.phpt similarity index 68% rename from tests/Store/PostgresDriver/CursorTest.phpt rename to tests/Cursor/CursorTest.phpt index 2a1b9f1304d8cf4f7360554d100a47b2a3c24c44..2473cb48f3325b949d10139679e6ff9d9bc5eaaa 100644 --- a/tests/Store/PostgresDriver/CursorTest.phpt +++ b/tests/Cursor/CursorTest.phpt @@ -3,14 +3,13 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver; -use Grifart\Mappi\Store\PostgresDriver\Cursor; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\ICursor; +use Grifart\Mappi\Cursor\ArrayCursorDriver; +use Grifart\Mappi\Cursor\Cursor; +use Grifart\Mappi\Cursor\ICursor; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; class CursorTest extends ICursorTest diff --git a/tests/Store/PostgresDriver/ICursorTest.php b/tests/Cursor/ICursorTest.php similarity index 98% rename from tests/Store/PostgresDriver/ICursorTest.php rename to tests/Cursor/ICursorTest.php index 7c4923e59e2650f6ae37fc83348046d2dc26b97e..5c45a8213c1a744fe27bb95391e0f0ad965cb0ca 100644 --- a/tests/Store/PostgresDriver/ICursorTest.php +++ b/tests/Cursor/ICursorTest.php @@ -3,9 +3,9 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\ICursor; +use Grifart\Mappi\Cursor\ICursor; use Grifart\Mappi\Tests\Store\BaseTest; use Tester\Assert; @@ -15,7 +15,7 @@ use Tester\Assert; * This file is using Given-When-Then naming convention. * @link http://martinfowler.com/bliki/GivenWhenThen.html * - * @package Grifart\Mappi\Tests\Store\Store\PostgresDriver + * @package Grifart\Mappi\Tests\Store\Cursor */ abstract class ICursorTest extends BaseTest { diff --git a/tests/Store/PostgresDriver/PostgresCursorTest.phpt b/tests/Cursor/PostgresCursorTest.phpt similarity index 78% rename from tests/Store/PostgresDriver/PostgresCursorTest.phpt rename to tests/Cursor/PostgresCursorTest.phpt index 851939f4aad19b12661b7b2f59e61c01ce919442..716babdf4e5b08fc114b0b526c76856c189fdb9a 100644 --- a/tests/Store/PostgresDriver/PostgresCursorTest.phpt +++ b/tests/Cursor/PostgresCursorTest.phpt @@ -3,14 +3,14 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; use Dibi\DriverException; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\ICursor; +use Grifart\Mappi\Cursor\ICursor; +use Grifart\Mappi\Cursor\PostgresCursorFactory; use Tester\Environment; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; class PostgresCursorTest extends ICursorTest diff --git a/tests/Store/PostgresDriver/SemanticCursorIntegration.phpt b/tests/Cursor/SemanticCursorIntegration.phpt similarity index 66% rename from tests/Store/PostgresDriver/SemanticCursorIntegration.phpt rename to tests/Cursor/SemanticCursorIntegration.phpt index 690877e80f6bf20606535eab1fba38a1113d5572..5cef2c7d38778b9b5f46f377606268bcc5bc6cc1 100644 --- a/tests/Store/PostgresDriver/SemanticCursorIntegration.phpt +++ b/tests/Cursor/SemanticCursorIntegration.phpt @@ -3,22 +3,21 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver; -use Grifart\Mappi\Store\PostgresDriver\Cursor; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\SemanticCursor; +use Grifart\Mappi\Cursor\ArrayCursorDriver; +use Grifart\Mappi\Cursor\Cursor; +use Grifart\Mappi\Cursor\SemanticCursor; use Mockery; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; /** * Behavioral test for SemanticCursor using mocking. * @link http://docs.mockery.io/en/latest/ * - * @package Grifart\Mappi\Tests\Store\Store\PostgresDriver + * @package Grifart\Mappi\Tests\Store\Cursor */ class SemanticCursorIntegrationTest extends ICursorTest { diff --git a/tests/Store/PostgresDriver/SemanticCursorTest.phpt b/tests/Cursor/SemanticCursorTest.phpt similarity index 93% rename from tests/Store/PostgresDriver/SemanticCursorTest.phpt rename to tests/Cursor/SemanticCursorTest.phpt index 087ec1e9838a32f009c5e07be41545c325ac8299..329f7edbc7574f5751f924f7acbdb2efe3dac227 100644 --- a/tests/Store/PostgresDriver/SemanticCursorTest.phpt +++ b/tests/Cursor/SemanticCursorTest.phpt @@ -3,23 +3,23 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\CursorException; -use Grifart\Mappi\Store\PostgresDriver\ICursor; -use Grifart\Mappi\Store\PostgresDriver\SemanticCursor; +use Grifart\Mappi\Cursor\CursorException; +use Grifart\Mappi\Cursor\ICursor; +use Grifart\Mappi\Cursor\SemanticCursor; use Grifart\Mappi\Tests\Store\BaseTest; use Mockery; use Tester\Assert; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; /** * Behavioral test for SemanticCursor using mocking. * @link http://docs.mockery.io/en/latest/ * - * @package Grifart\Mappi\Tests\Store\Store\PostgresDriver + * @package Grifart\Mappi\Tests\Store\Cursor */ class SemanticCursorTest extends BaseTest { diff --git a/tests/Store/PostgresDriver/TrackedCursorTest.phpt b/tests/Cursor/TrackedCursorTest.phpt similarity index 94% rename from tests/Store/PostgresDriver/TrackedCursorTest.phpt rename to tests/Cursor/TrackedCursorTest.phpt index d9b8d04280ef1bd4ea468557c28fa29872ac1677..0511173a71b4903bc7b204e7cacebf8b60e990b7 100644 --- a/tests/Store/PostgresDriver/TrackedCursorTest.phpt +++ b/tests/Cursor/TrackedCursorTest.phpt @@ -6,18 +6,15 @@ // TODO: moveBy() ->isOnRecord() ->moveBy() ->isOnRecord() (now I see state before and after command) // TODO: Maybe construct Cursor class in TrackedCursor constructor? -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; - -use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver; -use Grifart\Mappi\Store\PostgresDriver\Cursor; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\CursorPosition; -use Grifart\Mappi\Store\PostgresDriver\ICursor; -use Grifart\Mappi\Store\PostgresDriver\TrackedCursor; -use Grifart\Mappi\Tests\Store\BaseTest; +namespace Grifart\Mappi\Tests\Store\Cursor; + +use Grifart\Mappi\Cursor\ArrayCursorDriver; +use Grifart\Mappi\Cursor\Cursor; +use Grifart\Mappi\Cursor\CursorPosition; +use Grifart\Mappi\Cursor\TrackedCursor; use Tester\Assert; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; class TrackedCursorTest extends ICursorTest