for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace kalanis\kw_mapper\Storage\Storage;
use kalanis\kw_mapper\MapperException;
use kalanis\kw_storage\Interfaces\IStorage;
use kalanis\kw_storage\StorageException;
/**
* Trait TStorage
* @package kalanis\kw_mapper\Storage\Storage
*/
trait TStorage
{
* Set another storage than usually called local volume
* @param object|array<string, string|object>|string $storageParams
* @throws MapperException
protected function setStorage($storageParams = 'volume'): void
try {
$instance = StorageSingleton::getInstance();
$instance->clearStorage();
$instance->getStorage($storageParams);
} catch (StorageException $ex) {
throw new MapperException($ex->getMessage(), $ex->getCode(), $ex);
}
* @return IStorage
protected function getStorage(): IStorage
return StorageSingleton::getInstance()->getStorage('volume');
// @codeCoverageIgnoreStart
// means you have failed storage - larger problem than "only" unknown storage
// @codeCoverageIgnoreEnd
protected function clearStorage(): void
StorageSingleton::getInstance()->clearStorage();