Get a property value

@param mixed  $object       The object to read
@param string $propertyName The name of the property to read

@return mixed
@throws \InvalidArgumentException if the property doesn't exist or can not be read
178817
public static function getValue($object, $propertyName)
    {
        /**
         * The error container
         *
         * @var \InvalidArgumentException|null $error
         */
        $error = null;

        foreach (self::$providers as $provider) {
            $error = null;
            $value = self::tryGetValue($provider, $object, $propertyName, $error);
            if (is_null($error)) {
                return $value;
            }
        }

        throw $error;
    }
1150600
public function getProperty($name)
    {
        if (!$this->properties->has($name)) {
            throw InvalidPropertyException::propertyDoesNotExist($name);
        }

        return $this->properties->get($name);
    }
481403
private function getPropertyValue(ReflectionClass $reflection, $property, $object)
    {
        $propertyReflection = $this->accessProperty($reflection, $property);
        $value = $propertyReflection->getValue($object);
        $propertyReflection->setAccessible(false);

        return $value;
    }
104794
public static function isPropertyGettable($object, string $propertyName): bool
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('$object must be an object, ' . gettype($object) . ' given.', 1259828921);
        }
        if (($object instanceof \ArrayAccess && $object->offsetExists($propertyName)) || ($object instanceof \stdClass && array_key_exists($propertyName, get_object_vars($object)))) {
            return true;
        }
        $uppercasePropertyName = ucfirst($propertyName);
        if (is_callable([$object, 'get' . $uppercasePropertyName]) || is_callable([$object, 'is' . $uppercasePropertyName]) || is_callable([$object, 'has' . $uppercasePropertyName])) {
            return true;
        }
        $className = TypeHandling::getTypeForValue($object);
        return array_key_exists($propertyName, get_class_vars($className));
    }
797254
public static function fromObject( $object, $rootName = null, $nodeName = null, $addHeader = true )
    {
        if ( !is_object( $object ) )
        {
            throw new \InvalidArgumentException( 'The value of "$object" is not an object.' );
        }

        return static::fromArray( get_object_vars( $object ), $rootName, $nodeName, $addHeader );
    }
328599
public static function getProperty($object, string $property)
    {
        $getter = \Closure::bind(
            function ($object) use ($property) {
                return $object->{$property};
            },
            null,
            get_class($object)
        );

        return $getter($object);
    }
1271047
public function getValue($object)
    {
        $this->reflectionProperty->setAccessible(true);

        return $this->reflectionProperty->getValue($object);
    }
907007
private function getValue($object, \ReflectionProperty $property)
    {
        $value = null;

        if ($property->isPublic()) {
            $value = $property->getValue($object);
        } else {
            // Try to use accessor if property is not public
            $accessorName = $this->formatter->getPhpAccessor($property->getName(), false);
            $reflectedObject = new \ReflectionObject($object);
            $reflectedMethod = $reflectedObject->getMethod($accessorName);

            if (null !== $reflectedMethod) {
                $value = $reflectedMethod->invoke($object);
            }
        }

        return $value;
    }
958518
protected function getPropertyValue($propertyName)
    {
        $desiredKey = $this->trimPrefixKey($propertyName);

        $getter = 'get' . ucfirst($this->getPropertyName($desiredKey));
        if (method_exists($this, $getter)) {
            return $this->$getter();
        }

        // Otherwise, try to get sub object to get data
        $subKey = strtolower(strstr($desiredKey, '_', true));
        $getterMethodName = 'get' . ucfirst($subKey);

        $subObject = $this->$getterMethodName();
        if ($subObject instanceof EntityAbstract) {
            return $subObject->getPropertyValue($desiredKey);
        }

        throw new \InvalidArgumentException(
            sprintf(
                'No getter set for %s (getter was %s:%s)',
                $propertyName,
                get_called_class(),
                $getter
            )
        );
    }
372385
public static function getConverter($name, $propertyName)
    {
        $objectK = $name.$propertyName;
        if ( ! isset(self::$converterObjects[$objectK])) {
            if ( ! isset(self::$converterMap[$name])) {
                throw new \InvalidArgumentException(sprintf('No converter named "%s" found', $name));
            }

            self::$converterObjects[$objectK] = new self::$converterMap[$name]($propertyName);
        }

        return self::$converterObjects[$objectK];
    }
129978
private function set($object, $propertyName, $propertyValue)
    {
        $reflectionUser = new \ReflectionClass($object);

        $reflectionProperty = $reflectionUser->getProperty($propertyName);
        $reflectionProperty->setAccessible(true);
        $reflectionProperty->setValue($object, $propertyValue);

        return $object;
    }
1322024
public static function isPropertySettable($object, string $propertyName): bool
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('$object must be an object, ' . gettype($object) . ' given.', 1259828920);
        }

        $className = TypeHandling::getTypeForValue($object);
        if (($object instanceof \stdClass && array_key_exists($propertyName, get_object_vars($object))) || array_key_exists($propertyName, get_class_vars($className))) {
            return true;
        }
        return is_callable([$object, self::buildSetterMethodName($propertyName)]);
    }
305621
public function get($property)
    {
        if (!array_key_exists($property, $this->data)) {
            throw new InvalidArgumentException(sprintf('Property %s does not exist', $property));
        }

        return $this->data[$property];
    }
1232308
public function __getSerialisablePropertyValue($propertyName) {
        $map = $this->__getSerialisablePropertyMap();
        if (array_key_exists($propertyName, $map)) {
            return $map [$propertyName];
        } elseif (array_key_exists(substr(strtoupper($propertyName), 0, 1) . substr($propertyName, 1), $map)) {
            return $map [substr(strtoupper($propertyName), 0, 1) . substr($propertyName, 1)];
        } else {
            throw new PropertyNotReadableException (get_class($this), $propertyName);
        }
    }
765432
public static function getPropertyValue($obj,$propertyName,$fieldAccess=false)
    {
        $getter=self::getGetter($obj, $propertyName);
        if(!empty($getter)){
            return $obj->$getter();
        }else if($fieldAccess && property_exists($obj, $propertyName)){
            return $obj->$propertyName;
        }
    }
94414
public static function assignProperty($object, $property, $value)
    {
        $refl = new \ReflectionObject($object);
        $prop = $refl->getProperty($property);
        $prop->setAccessible(true);
        $prop->setValue($object, $value);

        return $value;
    }
47973
public function setProperty(&$object, $propertyName, $propertyValue)
    {
        $property = $this->getPropertyInstance($object, $propertyName);
        $property->setAccessible(true);
        $property->setValue($object, $propertyValue);
    }