diff --git a/lib/Alchemy/Phrasea/Core/Provider/RepositoriesServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/RepositoriesServiceProvider.php index dcfa26ce46..d58db4bb8d 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/RepositoriesServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/RepositoriesServiceProvider.php @@ -12,11 +12,11 @@ namespace Alchemy\Phrasea\Core\Provider; use Alchemy\Phrasea\Application as PhraseaApplication; -use Alchemy\Phrasea\Databox\CachedDataboxRepository; +use Alchemy\Phrasea\Databox\CachingDataboxRepositoryDecorator; use Alchemy\Phrasea\Databox\DataboxFactory; -use Alchemy\Phrasea\Databox\DataboxFieldFactory; -use Alchemy\Phrasea\Databox\DbalDataboxFieldRepository; use Alchemy\Phrasea\Databox\DbalDataboxRepository; +use Alchemy\Phrasea\Databox\Field\DataboxFieldFactory; +use Alchemy\Phrasea\Databox\Field\DbalDataboxFieldRepository; use Silex\Application; use Silex\ServiceProviderInterface; @@ -132,7 +132,7 @@ class RepositoriesServiceProvider implements ServiceProviderInterface $appbox = $app->getApplicationBox(); $repository = new DbalDataboxRepository($appbox->get_connection(), $factory); - return new CachedDataboxRepository($repository, $app['cache'], $appbox->get_cache_key($appbox::CACHE_LIST_BASES), $factory); + return new CachingDataboxRepositoryDecorator($repository, $app['cache'], $appbox->get_cache_key($appbox::CACHE_LIST_BASES), $factory); }); $app['repo.fields.factory'] = $app->protect(function (\databox $databox) use ($app) { diff --git a/lib/Alchemy/Phrasea/Databox/CachedDataboxRepository.php b/lib/Alchemy/Phrasea/Databox/CachingDataboxRepositoryDecorator.php similarity index 86% rename from lib/Alchemy/Phrasea/Databox/CachedDataboxRepository.php rename to lib/Alchemy/Phrasea/Databox/CachingDataboxRepositoryDecorator.php index 13461d205c..60f8ad58a3 100644 --- a/lib/Alchemy/Phrasea/Databox/CachedDataboxRepository.php +++ b/lib/Alchemy/Phrasea/Databox/CachingDataboxRepositoryDecorator.php @@ -11,9 +11,9 @@ namespace Alchemy\Phrasea\Databox; use Doctrine\Common\Cache\Cache; -final class CachedDataboxRepository implements DataboxRepositoryInterface +final class CachingDataboxRepositoryDecorator implements DataboxRepository { - /** @var DataboxRepositoryInterface */ + /** @var DataboxRepository */ private $repository; /** @var Cache */ private $cache; @@ -22,7 +22,7 @@ final class CachedDataboxRepository implements DataboxRepositoryInterface /** @var DataboxFactory */ private $factory; - public function __construct(DataboxRepositoryInterface $repository, Cache $cache, $cacheKey, DataboxFactory $factory) + public function __construct(DataboxRepository $repository, Cache $cache, $cacheKey, DataboxFactory $factory) { $this->repository = $repository; $this->cache = $cache; diff --git a/lib/Alchemy/Phrasea/Databox/DataboxRepositoryInterface.php b/lib/Alchemy/Phrasea/Databox/DataboxRepository.php similarity index 91% rename from lib/Alchemy/Phrasea/Databox/DataboxRepositoryInterface.php rename to lib/Alchemy/Phrasea/Databox/DataboxRepository.php index 9d39b4576a..a431aebbce 100644 --- a/lib/Alchemy/Phrasea/Databox/DataboxRepositoryInterface.php +++ b/lib/Alchemy/Phrasea/Databox/DataboxRepository.php @@ -9,7 +9,7 @@ */ namespace Alchemy\Phrasea\Databox; -interface DataboxRepositoryInterface +interface DataboxRepository { /** * @param int $id diff --git a/lib/Alchemy/Phrasea/Databox/DbalDataboxRepository.php b/lib/Alchemy/Phrasea/Databox/DbalDataboxRepository.php index dec73db88b..2c392034ee 100644 --- a/lib/Alchemy/Phrasea/Databox/DbalDataboxRepository.php +++ b/lib/Alchemy/Phrasea/Databox/DbalDataboxRepository.php @@ -11,7 +11,7 @@ namespace Alchemy\Phrasea\Databox; use Doctrine\DBAL\Connection; -final class DbalDataboxRepository implements DataboxRepositoryInterface +final class DbalDataboxRepository implements DataboxRepository { /** @var Connection */ private $connection; diff --git a/lib/Alchemy/Phrasea/Databox/DataboxFieldFactory.php b/lib/Alchemy/Phrasea/Databox/Field/DataboxFieldFactory.php similarity index 96% rename from lib/Alchemy/Phrasea/Databox/DataboxFieldFactory.php rename to lib/Alchemy/Phrasea/Databox/Field/DataboxFieldFactory.php index 368fa04161..ee0adbd8a5 100644 --- a/lib/Alchemy/Phrasea/Databox/DataboxFieldFactory.php +++ b/lib/Alchemy/Phrasea/Databox/Field/DataboxFieldFactory.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Databox; +namespace Alchemy\Phrasea\Databox\Field; use Alchemy\Phrasea\Application; use databox; diff --git a/lib/Alchemy/Phrasea/Databox/DataboxFieldRepositoryInterface.php b/lib/Alchemy/Phrasea/Databox/Field/DataboxFieldRepository.php similarity index 80% rename from lib/Alchemy/Phrasea/Databox/DataboxFieldRepositoryInterface.php rename to lib/Alchemy/Phrasea/Databox/Field/DataboxFieldRepository.php index 23e46df278..823cdc6a36 100644 --- a/lib/Alchemy/Phrasea/Databox/DataboxFieldRepositoryInterface.php +++ b/lib/Alchemy/Phrasea/Databox/Field/DataboxFieldRepository.php @@ -7,9 +7,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Databox; +namespace Alchemy\Phrasea\Databox\Field; -interface DataboxFieldRepositoryInterface +interface DataboxFieldRepository { /** * Find all fields diff --git a/lib/Alchemy/Phrasea/Databox/DbalDataboxFieldRepository.php b/lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php similarity index 98% rename from lib/Alchemy/Phrasea/Databox/DbalDataboxFieldRepository.php rename to lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php index 789ddc6008..da8ef9017e 100644 --- a/lib/Alchemy/Phrasea/Databox/DbalDataboxFieldRepository.php +++ b/lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php @@ -7,11 +7,11 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Databox; +namespace Alchemy\Phrasea\Databox\Field; use Doctrine\DBAL\Connection; -final class DbalDataboxFieldRepository implements DataboxFieldRepositoryInterface +final class DbalDataboxFieldRepository implements DataboxFieldRepository { private static $columnNames = [ 'id', diff --git a/lib/classes/appbox.php b/lib/classes/appbox.php index 842dbb9e30..5934bfab2e 100644 --- a/lib/classes/appbox.php +++ b/lib/classes/appbox.php @@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Configuration\AccessRestriction; use Alchemy\Phrasea\Core\Connection\ConnectionSettings; use Alchemy\Phrasea\Core\Version\AppboxVersionRepository; -use Alchemy\Phrasea\Databox\DataboxRepositoryInterface; +use Alchemy\Phrasea\Databox\DataboxRepository; use Doctrine\ORM\Tools\SchemaTool; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Specification\Image as ImageSpecification; @@ -295,7 +295,7 @@ class appbox extends base } /** - * @return DataboxRepositoryInterface + * @return DataboxRepository */ private function getDataboxRepository() { diff --git a/lib/classes/databox.php b/lib/classes/databox.php index 9c5d4aa137..c8e20e22f0 100644 --- a/lib/classes/databox.php +++ b/lib/classes/databox.php @@ -11,10 +11,11 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Connection\ConnectionSettings; +use Alchemy\Phrasea\Core\PhraseaTokens; use Alchemy\Phrasea\Core\Version\DataboxVersionRepository; -use Alchemy\Phrasea\Databox\DataboxFieldRepositoryInterface; -use Alchemy\Phrasea\Model\Entities\User; +use Alchemy\Phrasea\Databox\Field\DataboxFieldRepository; use Alchemy\Phrasea\Exception\InvalidArgumentException; +use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Status\StatusStructure; use Alchemy\Phrasea\Status\StatusStructureFactory; use Doctrine\DBAL\Connection; @@ -23,7 +24,6 @@ use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Translation\TranslatorInterface; -use Alchemy\Phrasea\Core\PhraseaTokens; class databox extends base implements \Alchemy\Phrasea\Core\Thumbnail\ThumbnailedElement { @@ -646,7 +646,7 @@ class databox extends base implements \Alchemy\Phrasea\Core\Thumbnail\Thumbnaile return $this->meta_struct; } - /** @var DataboxFieldRepositoryInterface $fieldRepository */ + /** @var \Alchemy\Phrasea\Databox\Field\DataboxFieldRepository $fieldRepository */ $fieldRepository = $this->app['repo.fields.factory']($this); $this->meta_struct = new databox_descriptionStructure($fieldRepository->findAll()); diff --git a/tests/Alchemy/Tests/Phrasea/Databox/CachedDataboxRepositoryTest.php b/tests/Alchemy/Tests/Phrasea/Databox/CachedDataboxRepositoryTest.php index 4810c4883a..be3e55f94f 100644 --- a/tests/Alchemy/Tests/Phrasea/Databox/CachedDataboxRepositoryTest.php +++ b/tests/Alchemy/Tests/Phrasea/Databox/CachedDataboxRepositoryTest.php @@ -9,9 +9,9 @@ */ namespace Alchemy\Tests\Phrasea\Databox; -use Alchemy\Phrasea\Databox\CachedDataboxRepository; +use Alchemy\Phrasea\Databox\CachingDataboxRepositoryDecorator; use Alchemy\Phrasea\Databox\DataboxFactory; -use Alchemy\Phrasea\Databox\DataboxRepositoryInterface; +use Alchemy\Phrasea\Databox\DataboxRepository; use Doctrine\Common\Cache\Cache; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; @@ -26,16 +26,16 @@ final class CachedDataboxRepositoryTest extends \PHPUnit_Framework_TestCase /** @var ObjectProphecy */ private $repository; - /** @var CachedDataboxRepository */ + /** @var CachingDataboxRepositoryDecorator */ private $sut; protected function setUp() { $this->cache = $this->prophesize(Cache::class); - $this->repository = $this->prophesize(DataboxRepositoryInterface::class); + $this->repository = $this->prophesize(DataboxRepository::class); $this->factory = $this->prophesize(DataboxFactory::class); - $this->sut = new CachedDataboxRepository( + $this->sut = new CachingDataboxRepositoryDecorator( $this->repository->reveal(), $this->cache->reveal(), $this->cacheKey, @@ -45,7 +45,7 @@ final class CachedDataboxRepositoryTest extends \PHPUnit_Framework_TestCase public function testItImplementsDataboxRepositoryInterface() { - $this->assertInstanceOf(DataboxRepositoryInterface::class, $this->sut); + $this->assertInstanceOf(DataboxRepository::class, $this->sut); } public function testItFindsASpecificDataboxWhenNotInCache() diff --git a/tests/Alchemy/Tests/Phrasea/Databox/DbalDataboxRepositoryTest.php b/tests/Alchemy/Tests/Phrasea/Databox/DbalDataboxRepositoryTest.php index e0465b99f4..41290522ba 100644 --- a/tests/Alchemy/Tests/Phrasea/Databox/DbalDataboxRepositoryTest.php +++ b/tests/Alchemy/Tests/Phrasea/Databox/DbalDataboxRepositoryTest.php @@ -10,7 +10,7 @@ namespace Alchemy\Tests\Phrasea\Databox; use Alchemy\Phrasea\Databox\DataboxFactory; -use Alchemy\Phrasea\Databox\DataboxRepositoryInterface; +use Alchemy\Phrasea\Databox\DataboxRepository; use Alchemy\Phrasea\Databox\DbalDataboxRepository; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\Statement; @@ -36,7 +36,7 @@ final class DbalDataboxRepositoryTest extends \PHPUnit_Framework_TestCase public function testItImplementsDataboxRepositoryInterface() { - $this->assertInstanceOf(DataboxRepositoryInterface::class, $this->sut); + $this->assertInstanceOf(DataboxRepository::class, $this->sut); } public function testItFindsDataboxProperly()