for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GFG\DTOContext;
use GFG\DTOContext\DataWrapper;
use GFG\DTOContext\Factory;
class Manager
{
/**
* Factory responsible to create the ContextObject
*
* @var Factory\FactoryInterface
*/
private static $factory;
* Get the current factory
* @return void
public function getFactory()
if (!self::$factory) {
throw new \RuntimeException('Factory not set');
}
return self::$factory;
* Sets a new factory class
* @param Factory\FactoryInterface
* @return Manager
public function setFactory(Factory\FactoryInterface $factory)
self::$factory = $factory;
return $this;
* @see Factory\FactoryInterface::build
public function create(
$contextName,
DataWrapper\DataWrapperInterface $dataWrapper
) {
return $this->getFactory()
->build($contextName, $dataWrapper);
* @see Factory\FactoryInterface::rebuild
public function rebuild(
array $rawData,
Factory\HydratorInterface $hydrator
return $this->getFactory()->rebuild($rawData, $hydrator);
* @see Factory\FactoryInterface::getHydrator
public function getHydrator()
return $this->getFactory()->getHydrator();