-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from valantic-CEC-Deutschland-GmbH/feature/SPRY…
…-3032 SPRY-3032 Rename CacheManagerGui namespace to CacheManager in CacheMa…
- Loading branch information
Showing
11 changed files
with
187 additions
and
74 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/ValanticSpryker/Zed/CacheManager/Business/CacheManagerBusinessFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace ValanticSpryker\Zed\CacheManager\Business; | ||
|
||
use Spryker\Client\Storage\StorageClientInterface; | ||
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory; | ||
use ValanticSpryker\Zed\CacheManager\Business\Model\CacheManager; | ||
use ValanticSpryker\Zed\CacheManager\CacheManagerDependencyProvider; | ||
use ValanticSpryker\Zed\CacheManager\Communication\Plugin\CacheManagerPluginCollection; | ||
|
||
class CacheManagerBusinessFactory extends AbstractBusinessFactory | ||
{ | ||
/** | ||
* @return \ValanticSpryker\Zed\CacheManager\Business\Model\CacheManager | ||
*/ | ||
public function createCacheManager(): CacheManager | ||
{ | ||
return new CacheManager( | ||
$this->createCacheManagerPluginCollection(), | ||
$this->getStorageClient(), | ||
); | ||
} | ||
|
||
/** | ||
* @return \ValanticSpryker\Zed\CacheManager\Communication\Plugin\CacheManagerPluginCollection | ||
*/ | ||
protected function createCacheManagerPluginCollection(): CacheManagerPluginCollection | ||
{ | ||
return new CacheManagerPluginCollection($this->getCacheManagerPlugins()); | ||
} | ||
|
||
/** | ||
* @return array<\ValanticSpryker\Zed\CacheManager\Communication\Plugin\CacheManagerPluginInterface> | ||
*/ | ||
protected function getCacheManagerPlugins(): array | ||
{ | ||
return $this->getProvidedDependency(CacheManagerDependencyProvider::CACHE_MANAGER_PLUGINS); | ||
} | ||
|
||
/** | ||
* @return \Spryker\Client\Storage\StorageClientInterface | ||
*/ | ||
protected function getStorageClient(): StorageClientInterface | ||
{ | ||
return $this->getProvidedDependency(CacheManagerDependencyProvider::CLIENT_STORAGE); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/ValanticSpryker/Zed/CacheManager/Business/CacheManagerFacade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace ValanticSpryker\Zed\CacheManager\Business; | ||
|
||
use Generated\Shared\Transfer\CacheManagerDeleteTransfer; | ||
use Spryker\Zed\Kernel\Business\AbstractFacade; | ||
|
||
/** | ||
* @method \ValanticSpryker\Zed\CacheManager\Business\CacheManagerBusinessFactory getFactory() | ||
*/ | ||
class CacheManagerFacade extends AbstractFacade implements CacheManagerFacadeInterface | ||
{ | ||
/** | ||
* @return array<\Generated\Shared\Transfer\CacheManagerPluginTransfer> | ||
*/ | ||
public function getCacheManagerPluginsData(): array | ||
{ | ||
return $this->getFactory()->createCacheManager()->getPlugins(); | ||
} | ||
|
||
/** | ||
* @param \Generated\Shared\Transfer\CacheManagerDeleteTransfer $cacheManagerDeleteTransfer | ||
* | ||
* @return \Generated\Shared\Transfer\CacheManagerDeleteTransfer | ||
*/ | ||
public function deleteCache(CacheManagerDeleteTransfer $cacheManagerDeleteTransfer): CacheManagerDeleteTransfer | ||
{ | ||
return $this->getFactory()->createCacheManager()->deleteCache($cacheManagerDeleteTransfer); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/ValanticSpryker/Zed/CacheManager/Business/CacheManagerFacadeInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace ValanticSpryker\Zed\CacheManager\Business; | ||
|
||
use Generated\Shared\Transfer\CacheManagerDeleteTransfer; | ||
|
||
interface CacheManagerFacadeInterface | ||
{ | ||
/** | ||
* @return array<\Generated\Shared\Transfer\CacheManagerPluginTransfer> | ||
*/ | ||
public function getCacheManagerPluginsData(): array; | ||
|
||
/** | ||
* @param \Generated\Shared\Transfer\CacheManagerDeleteTransfer $cacheManagerDeleteTransfer | ||
* | ||
* @return \Generated\Shared\Transfer\CacheManagerDeleteTransfer | ||
*/ | ||
public function deleteCache(CacheManagerDeleteTransfer $cacheManagerDeleteTransfer): CacheManagerDeleteTransfer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/ValanticSpryker/Zed/CacheManager/CacheManagerDependencyProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace ValanticSpryker\Zed\CacheManager; | ||
|
||
use Spryker\Client\Storage\StorageClientInterface; | ||
use Spryker\Zed\Kernel\AbstractBundleDependencyProvider; | ||
use Spryker\Zed\Kernel\Container; | ||
|
||
class CacheManagerDependencyProvider extends AbstractBundleDependencyProvider | ||
{ | ||
public const CACHE_MANAGER_PLUGINS = 'CACHE_MANAGER_PLUGINS'; | ||
public const CLIENT_STORAGE = 'CLIENT_STORAGE'; | ||
|
||
/** | ||
* @param \Spryker\Zed\Kernel\Container $container | ||
* | ||
* @return \Spryker\Zed\Kernel\Container | ||
*/ | ||
public function provideBusinessLayerDependencies(Container $container): Container | ||
{ | ||
$container = parent::provideBusinessLayerDependencies($container); | ||
|
||
$this->addCacheManagerPlugins($container); | ||
$this->addStorageClient($container); | ||
|
||
return $container; | ||
} | ||
|
||
/** | ||
* @param \Spryker\Zed\Kernel\Container $container | ||
* | ||
* @return void | ||
*/ | ||
protected function addCacheManagerPlugins(Container $container): void | ||
{ | ||
$container->set(self::CACHE_MANAGER_PLUGINS, function () { | ||
return $this->getCacheManagerPlugins(); | ||
}); | ||
} | ||
|
||
/** | ||
* @return array<\ValanticSpryker\Zed\CacheManager\Communication\Plugin\CacheManagerPluginInterface> | ||
*/ | ||
protected function getCacheManagerPlugins(): array | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* @param \Spryker\Zed\Kernel\Container $container | ||
* | ||
* @return void | ||
*/ | ||
protected function addStorageClient(Container $container): void | ||
{ | ||
$container->set( | ||
self::CLIENT_STORAGE, | ||
fn (): StorageClientInterface => $container->getLocator()->storage()->client(), // @phpstan-ignore method.notFound | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters