for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Workana\AsyncJobs\Normalizer;
use ReflectionClass;
use ReflectionProperty;
/**
* Property accesor
*
* @author Carlos Frutos <[email protected]>
*/
abstract class Accesor
{
* Set protected/private property
* @param object $target
* @param string $propertyName
* @param mixed $value
* @return void
public static function set($target, $propertyName, $value)
$property = new ReflectionProperty($target, $propertyName);
$property->setAccessible(true);
$property->setValue($target, $value);
}
* Get protected/private property
* @return mixed
public static function get($target, $propertyName)
return $property->getValue($target);
* Creates a new instance without using constructor
* @param string $class
public static function newInstanceWithoutConstructor($class)
$reflection = new ReflectionClass($class);
return $reflection->newInstanceWithoutConstructor();