for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Pcelta\Doctrine\Cache;
use Pcelta\Doctrine\Cache\Entity\Config;
use Doctrine\Common\Cache\CacheProvider;
use Pcelta\Doctrine\Cache\Exception\InvalidCacheConfig;
class Factory
{
/**
* @param Proxy $proxy
*/
public function setProxy(Proxy $proxy)
$this->proxy = $proxy;
proxy
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* @param array $cacheSettings
*
* @return CacheProvider
* @throws InvalidCacheConfig
public function create(array $cacheSettings)
$config = new Config($cacheSettings);
$class = sprintf('\Pcelta\Doctrine\Cache\Factory\%sFactory', $config->getAdapterName());
if (!class_exists($class)) {
throw new InvalidCacheConfig('Adapter not found');
/* @var Factory\AbstractFactory $factory */
$this->factory = new $class();
factory
return $this->factory->create($config);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: