protected function setValue($object, $property, $value)
    {
        $reflectionClass = new ReflectionClass($object);

        if (!$reflectionClass->hasProperty($property)) {
            $object->{$property} = $value;

            return;
        }

        $reflectionProperty = $reflectionClass->getProperty($property);
        $reflectionProperty->setAccessible(true);

        $reflectionProperty->setValue($object, $value);
    }
protected function setValue($object, $property, $value)
    {
        $reflectionClass = new ReflectionClass($object);

        if (!$reflectionClass->hasProperty($property)) {
            $object->{$property} = $value;

            return;
        }

        $reflectionProperty = $reflectionClass->getProperty($property);
        $reflectionProperty->setAccessible(true);

        $reflectionProperty->setValue($object, $value);
    }
protected function setValue ( $ object , $ property , $ value ) { $ reflectionClass = new ReflectionClass ( $ object ) ; if ( ! $ reflectionClass -> hasProperty ( $ property ) ) { $ object -> { $ property } = $ value ; return ; } $ reflectionProperty = $ reflectionClass -> getProperty ( $ property ) ; $ reflectionProperty -> setAccessible ( true ) ; $ reflectionProperty -> setValue ( $ object , $ value ) ; }
Sets the value in an object

@param   object $object   The object
@param   string $property The property
@param   mixed  $value    The value

@return  void
Sets the value in an object