Returns the list of properties which are accessible for this given
object.

Properties are stored in local cache to improve performance.

@param object $object
@return array
497554
public function getGettablePropertiesOfObject($object)
    {
        $className = get_class($object);

        if (false === isset($this->gettablePropertiesOfObjects[$className])) {
            $this->gettablePropertiesOfObjects[$className] = [];
            $properties = $this->getReflectionService()->getClassPropertyNames($className);

            foreach ($properties as $propertyName) {
                if (true === $this->isPropertyGettable($object, $propertyName)) {
                    $this->gettablePropertiesOfObjects[$className][] = $propertyName;
                }
            }
        }

        return $this->gettablePropertiesOfObjects[$className];
    }
987704
private function buildDataFromObject($object)
    {
        $result = array();

        $stack = new \SplStack();
        $stack->push($object);

        while (!$stack->isEmpty()) {
            $current = $stack->pop();
            if (is_object($current)) {
                array_push($result, $current);
            }

            foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
                if (is_object($propertyValue) || is_array($propertyValue)) {
                    $stack->push($propertyValue);
                }
            }
        }

        return $result;
    }
1328962
public function extract($object): array
    {
        if (!is_object($object)) {
            throw new RuntimeException(
                sprintf('%s expects the provided $object to be a PHP object', __METHOD__)
            );
        }

        return (function (): array {
            return get_object_vars($this);
        })->call($object);
    }
1258422
static function getObjectProperties($object, bool $includeStatic = true): array
    {
        $properties = [];

        try {
            $filter =
                \ReflectionProperty::IS_PUBLIC
                | \ReflectionProperty::IS_PROTECTED
                | \ReflectionProperty::IS_PRIVATE;

            $parentFilter = \ReflectionProperty::IS_PRIVATE; // only fetch private parent properties

            $reflection = new \ReflectionObject($object);
            foreach ($reflection->getProperties($filter) as $property) {
                if (!$includeStatic && $property->isStatic()) {
                    continue;
                }

                $properties[$property->getName()] = $property;
            }

            foreach (class_parents($object) as $parentClass) {
                $reflection = new \ReflectionClass($parentClass);

                foreach ($reflection->getProperties($parentFilter) as $property) {
                    if (
                        ($includeStatic || !$property->isStatic())
                        && !key_exists($name = $property->getName(), $properties)
                    ) {
                        $properties[$name] = $property;
                    }
                }
            }
        } catch (\ReflectionException $e) {
            // some objects may not be fully accessible (e.g. instances of internal classes)
        }

        return $properties;
    }
588959
public static function fetchProperty($object, $property)
    {
        $refl = new \ReflectionObject($object);
        $prop = $refl->getProperty($property);
        $prop->setAccessible(true);

        return $prop->getValue($object);
    }
1149677
private function extractObjectProperties($object)
    {
        $propertyToValue = [];

        if (method_exists($object, '__sleep')) {
            $properties = $object->__sleep();
            foreach ($properties as $property) {
                $propertyToValue[$property] = $object->$property;
            }

            return $propertyToValue;
        }


        $reflectedProperties = [];
        $ref = new \ReflectionClass($object);
        foreach ($ref->getProperties() as $property) {
            $property->setAccessible(true);
            $propertyToValue[$property->getName()] = $property->getValue($object);
            $reflectedProperties[] = $property->getName();
        }

        $dynamicProperties = array_diff(array_keys(get_object_vars($object)), $reflectedProperties);

        foreach ($dynamicProperties as $property) {
            $propertyToValue[$property] = $object->$property;
        }

        return $propertyToValue;
    }
154613
private function getCachedDataByObject($object)
    {
        return $this->getCachedDataByReference(
            $this->mm->getMetadataForObject($object)->getReferenceForObject($object)
        );
    }
63117
public function toArray($object)
    {
        $result = array();
        $className = $this->getFullClassName($object);
        $metadata = $this->metadataFactory->getMetadataForClass($className);
        foreach ($metadata->getProperties() as $property) {
            if (!$property->isExpose() || $this->propertySkipper->shouldSkip($property)) {
                continue;
            }

            $value = $this->exposeValue($object, $property);
            $value = $this->handleValue($value, $property, self::DIRECTION_SERIALIZE);

            if ($property->isNullSkipped() && $value === null) {
                continue;
            }

            $result[$property->getSerializedName()] = $value;
        }

        return $result;
    }
1321636
public function readObject($object = null)
    {
        if ($object === null) {
            $object = array();
        }

        while (true) {
            $key        = $this->_stream->readUTF();
            $typeMarker = $this->_stream->readByte();
            if ($typeMarker != Zend_Amf_Constants::AMF0_OBJECTTERM ){
                //Recursivly call readTypeMarker to get the types of properties in the object
                $object[$key] = $this->readTypeMarker($typeMarker);
            } else {
                //encountered AMF object terminator
                break;
            }
        }
        $this->_reference[] = $object;
        return (object) $object;
    }
1306409
private function normalizeObject($object)
    {
        if ($this->objectToIndex->contains($object)) {
            return [$this->classAnnotation => '@' . $this->objectToIndex[$object]];
        }
        $this->objectToIndex->attach($object, $this->objectIndex++);

        $normalizedObject = [$this->classAnnotation => get_class($object)];
        $normalizedObject += array_map([$this, 'normalizeValue'], $this->extractObjectProperties($object));

        return $normalizedObject;
    }
317130
public static function ObjectAsArray($Object) {
      if (!is_object($Object))
         return $Object;

      $Return = array();
      foreach(get_object_vars($Object) as $Property => $Value) {
         $Return[$Property] = $Value;
      }
      return $Return;
   }
1064595
protected static function rawData( $object )
    {
        if ( is_object( $object ) )
        {
            $hash = spl_object_hash( $object );

            if ( isset( self::$rawCheck[$hash] ) )
            {
                return array( '#recursion#' => $hash );
            }

            self::$rawCheck[$hash] = true;
        }

        $object = (array) $object;

        foreach ( $object as $key => $value )
        {
            if ( is_array( $value ) || is_object( $value ) )
            {
                $object[$key] = self::rawData( $value );
            }
        }

        return (object) $object;
    }
341926
public function getPropertyValuesArray($object)
    {
        $values = [];
        foreach ($this->entityPropertiesMetadata as $entityPropertyMetadata) {
            $v = $entityPropertyMetadata->getValue($object);
            if (is_object($v)) {
                switch (get_class($v)) {
                    case \DateTime::class:
                        $v = $v->getTimestamp();
                        break;
                }
            }
            $values[$entityPropertyMetadata->getPropertyName()] = $v;
        }

        return $values;
    }
41406
public function persistObject($object) : array
    {
        $data = $this->preparePersistChangeSet($object);

        $class = $this->getClassMetadata();

        if (! isset($data[$class->getIdentifier()[0]])) {
            $data[$class->getIdentifier()[0]] = $this->generateNextId($class);
        }

        $this->objects[$data[$class->getIdentifier()[0]]] = $data;

        return $data;
    }
190642
public function extract($object)
    {
        $data = [
            'login' => $object->getLogin(),
            'name' => $object->getName(),
            'email' => $object->getEmail(),
            'role' => $object->getRole(),
        ];
        if ($object->getId() !== null) {
            $data['id'] = $object->getId();
        }
        return $data;
    }
1062340
protected function getInChangeSets($object)
    {
        $inChangeSetIDs = array_unique(ChangeSetItem::get_for_object($object)->column('ChangeSetID'));
        if ($inChangeSetIDs > 0) {
            $changeSets = $this->getAvailableChangeSets()->filter([
                'ID' => $inChangeSetIDs,
                'State' => ChangeSet::STATE_OPEN
            ]);
        } else {
            $changeSets = new ArrayList();
        }

        return $changeSets;
    }
1277971
public static function toArray( $object )
    {
        if ( is_object( $object ) )
        {
            return get_object_vars( $object );
        }

        if ( is_array( $object ) )
        {
            return array_map(
                array(
                    __CLASS__,
                    'toArray'
                ),
                $object
            );
        }

        // Return array
        return $object;
    }