Set property value.

@param $reflection
@param $classInstance
@param $classProperty
@param $object
6293
protected function setPropertyValue($reflection, $classInstance, $classProperty, $object)
    {
        /*
         | We will make property accessible and set the value into it
         */
        $reflection->makePropertyAccessible($classProperty);
        $reflectionProperty = $reflection->getReflectionProperty();
        $reflectionProperty->setValue($classInstance, $object);
    }
480904
public function setInstance($object, $abstract = null)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('$object must be an object');
        }
        if ($abstract === null) {
            //If $abstract is not specified, use $objects class
            $abstract = get_class($object);
        } elseif ($abstract[0] === '\\') {
            //Strip all leading backslashes
            $abstract = substr($abstract, 1);
        }
        $concrete = $this->findMostConcreteDefinition($abstract);
        if (isset($this->objects[$concrete])) {
            //If this class already has an instance, we'll return the old object
            $old = $this->objects[$concrete];
        } else {
            $old = false;
        }
        //Store the object
        $this->objects[$concrete] = $object;

        return $old;
    }
868763
protected function invokeSetter(ReflectionProperty $property, $value) : void
    {
        $methodName = $this->generateSetterName($property->getName());
        if ($this->hasInternalMethod($methodName)) {
            $this->$methodName($value);
            return;
        }

        throw new UndefinedPropertyException(sprintf(
            'No "%s"() method available for property "%s"', $methodName,
            $property->getName()
        ));
    }
36411
public function propertyInjection($classInstance, $controller)
    {
        $dependencies = $this->getPropertyDefinitionConfig($controller);
        $controller = "\\\\";

        if (array_key_exists($controller, $this->definitions)) {
            list($reflection, $reflectionClass) = $this->setReflectionClassAttributes($controller);
            
            foreach ($dependencies as $classProperty => $class) {
                $reflectionArray = [$reflectionClass, $classProperty];
                list($object, $controllerProp) = $this->checkPropertyAndMakeObject($controller, $class, $reflectionArray);
                
                /*
                 | We will check is set{PropertyName}() method exists in class.
                 | If exists we will call the method to set object into it
                 */
                if (method_exists($classInstance, 'set'.$controllerProp)) {
                    $classInstance->{'set'.$controllerProp}($object);
                } else {
                    $prop = $reflectionClass->getProperty($classProperty);
                    /*
                     | Check if property defined as static.
                     | we will throw exception is property defined as static
                     */
                    if ($prop->isStatic()) {
                        throw new DependencyException(
                            sprintf("Static Property '%s' is not injectable in $controller controller", $classProperty)
                        );
                    }

                    $this->setPropertyValue($reflection, $classInstance, $classProperty, $object);
                }
            }

            return true;
        }

        return false;
    }
17417
private function setValue($object, string $attributeName, $value)
    {
        try {
            $this->propertyAccessor->setValue($object, $attributeName, $value);
        } catch (NoSuchPropertyException $exception) {
            // Properties not found are ignored
        }
    }
963374
protected function setPropertyValue($object, \ReflectionProperty $property, $value)
    {
        if ($value !== null) {
            // If the property is public accessible, set the value directly
            if ($property->isPublic()) {
                $object->{$property->name} = $value;
            } else {
                // If not, use the setter / adder
                $ucw = ucwords($property->name);
                if ($property->getDeclaringClass()->hasMethod($method = 'set' . $ucw)) {
                    $object->$method($value);
                } elseif ($property->getDeclaringClass()->hasMethod($method = 'add' . $ucw)) {
                    $object->$method($value);
                }
            }
        }
    }
835089
@Override
	public final void setObjectProperty(String name, Object value) throws JMSException
    {
        if (value == null)
            throw new MessageFormatException("A property value cannot be null");
            
        // Check type
        if (!(value instanceof Boolean ||
              value instanceof Byte ||
              value instanceof Short ||
              value instanceof Integer ||
              value instanceof Long ||
              value instanceof Float ||
              value instanceof Double ||
              value instanceof String))
            throw new MessageFormatException("Unsupported property value type : "+value.getClass().getName());
        
        setProperty(name,value);
    }
325501
public function apply(object $object, ReflectionProperty $reflectionProperty, callable $objectCopier): void
    {
        $reflectionProperty->setAccessible(true);
        /** @var Collection $oldCollection */
        $oldCollection = $reflectionProperty->getValue($object);

        $newCollection = $oldCollection->map(
            function ($item) use ($objectCopier) {
                return $objectCopier($item);
            }
        );

        $reflectionProperty->setValue($object, $newCollection);
    }
725613
private function handleProperties($data, $object, \ReflectionClass $reflection, $fields)
    {
        foreach ($fields as $field) {
            $property = $reflection->getProperty($field);
            $name     = $property->getName();

            if (property_exists($data, $name) === false ) {
                continue;
            }
            $property->setAccessible(true);
            $type  = $this->propertyHandler->propertyTypeOverride(null, $property);
            $value = $this->propertyHandler->handleTypeConversion($type, $data->$name);

            $property->setValue($object, $value);
        }
    }
457765
public static function setPropertyValue($object, string $property, $value, $scope = 'static')
    {
        $setPropertyValue = function ($value) use ($object, $property) {
            if (is_object($object)) {
                $object->$property = $value;
            } else {
                $object::$$property = $value;
            }
        };
        $setPropertyValue = $setPropertyValue->bindTo(is_object($object) ? $object : null, $scope);
        $setPropertyValue($value);
    }
666365
protected function _methodInjection(
        $instance, MethodInjection $method, ReflectionClass $classReflection)
    {

        $methodReflection = $classReflection->getMethod($method->getMethodName());
        $args = $this->_getMethodParameters($method, $methodReflection);
        $methodReflection->invokeArgs($instance, $args);
    }
837781
protected function getPropertyValueFromObject(ClassMetadata $meta, $propertyName, $object)
    {
        $refl = $meta->getReflectionClass();
        $prop = $refl->getProperty($propertyName);
        $prop->setAccessible(true);
        $value = $prop->getValue($object);
        return $value;
    }
518368
public static function set($className, $instance)
    {
        $key = self::getStorageKey($className);

        if (is_null($instance)) {
            unset(self::$instances[$key]);

            return;
        }

        self::$instances[$key] = $instance;

        return;
    }
933183
protected function setProperty($object, $name = null)
    {
        if ($name === null) {
            $this->params[] = $object;
        } else {
            $this->params[$name] = $object;
        }
        return $this->make();
    }
286700
protected function setInstance(string $name, $object):bool
    {
        if (!isset(self::$instances[$name])) {
            self::$instances[$name] = $object;
            return (true);
        }
        throw new Server500(new \ArrayObject(array("explain" => "Cannot redeclare instance name $name as new instance",
            "solution" => "Please use SingletonMulPattern correctly")));
    }
247190
public static function setProperty(string $property, ?object $object, $value, ?string $classOverride = null): bool
    {
        $reflectionClass = self::getReflectionClass($object, $classOverride);
        try {
            $property = $reflectionClass->getProperty($property);
            $property->setAccessible(true);
            $property->setValue($object, $value);
        } catch (Exception $e) {
            return false;
        }
        return true;
    }
143315
private function setPropertyValue($entity, $propertyPath, $value)
    {
        if (!$this->propertyAccessor->isWritable($entity, $propertyPath)) {
            throw new CustomObjectException(
                sprintf('Property "%s::$%s" is not writable.', ClassUtils::getClass($entity), $propertyPath)
            );
        }

        $this->propertyAccessor->setValue($entity, $propertyPath, $value);
    }