for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace NilPortugues\Foundation\Infrastructure\Model\Repository\InMemory;
class InMemoryValue
{
/**
* @param $object
* @param string $property
*
* @return mixed
* @throws \Exception
*/
public static function get($object, $property)
if (array_key_exists($property, get_object_vars($object))) {
return $object->{$property};
}
if (method_exists(get_class($object), $property)) {
return $object->{$property}();
if (method_exists(get_class($object), 'get'.$property)) {
$property = 'get'.$property;
throw new \Exception(
sprintf(
'Could not filter by property \'%s\' as it does not exist in object %s.',
$property,
get_class($object)
)
);