Returns an array of object properties as would be generated by var_export.
@param object $object Object to turn into array
@return array Properties of the object as passed to var_export
962059
private function getObjectState($object)
    {
        $class = new \ReflectionClass($object);
        $visibility = \ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED;
        $values = [];

        do {
            foreach ($class->getProperties($visibility) as $property) {
                $property->setAccessible(true);
                $values[$property->getName()] = $property->getValue($object);
            }

            $class = $class->getParentClass();
            $visibility = \ReflectionProperty::IS_PRIVATE;
        } while ($class);

        return get_object_vars($object) + $values;
    }
488823
public function extract($object)
    {
        $data = $object->getArrayCopy();
        $extractedData = [];

        foreach ($data as $key => $value) {
            $extractName = $this->extractName($key);

            if (array_key_exists($extractName, $this->map)) {
                $value = $this->extractValue($key, $value, $data);
                $extractedData[$extractName] = $value;
            }
        }

        return $extractedData;
    }
1116974
public static function toArray($object)
    {
        $object = AnConfig::unbox($object);

        if (is($object, 'AnObjectArray') || is($object, 'AnObjectSet')) {
            return $object->toArray();
        }

        return (array) $object;
    }
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;
    }
1239969
protected static function convert_object_to_array($object) {
	if (is_object($object) == false) {
		throw new \Exception('can only convert objects');
	}
	
	if ($object instanceof \alsvanzelf\jsonapi\resource) {
		return $object->get_array();
	}
	
	return get_object_vars($object);
}
123689
public function normalize($object) : array
    {
        return $this->asArray ? $this->normalizeAsArray($object) : $this->normalizeAsAttributes($object);
    }
73461
static private function objToArray(&$object)
    {
        if (is_object($object) && method_exists($object, '__trace')){
            $arr = $object->__trace();
            if (!is_array($arr)) return $arr;
        }else{
            $arr = (array)$object;
        }
        $result = [];
        while (list ($key, $value) = each($arr)){
            $keys = explode("\0", $key);
            $clear_key = $keys[sizeof($keys) - 1];
            $result[$clear_key] = &$arr[$key];
        }
        return $result;
    }
580944
protected function getSetProps($object = null) {
    $object = $object ?: $this->value;
    if (gettype($object) !== 'object') {
      return [];
    }

    return array_keys((array) $object);
  }
1147984
public static function toArray($object)
	{
		if(is_array($object))
			return $object;
		elseif(!is_object($object))
			return (array) $object;
		elseif ($object instanceof IlluminateCollection)
			return $object->all();
		elseif ($object instanceof IlluminateArrayable)
			return $object->toArray();
		elseif(method_exists($object, '__toString'))
			return [$object];
		elseif ($object instanceof IlluminateJsonable)
			return (array) json_decode($object->toJson(), true);
		elseif ($object instanceof JsonSerializable)
			return (array) $object->jsonSerialize();
		elseif ($object instanceof Traversable)
			return iterator_to_array($object);
		else
			return (array) $object;
	}
951747
private static function toArray($object)
    {
        $json = array();
        $props = self::getProperties($object);
        foreach ($props as $key => $value) {
            $check_references = explode("_", $key);
            $getter = "";
            if (count($check_references) > 0) {
                foreach ($check_references as $reference) {
                    $getter .= ucfirst($reference);
                }
            } else {
                $getter = ucfirst($key);
            }
            $getter = "get" . $getter;

            if (!method_exists($object, $getter)) {
                continue;
            }
            $key = self::toSnakeCase($key);
            $value = $object->$getter();
            if (self::isNull($value)) {
                continue;
            }
            if ($value instanceof \Iterator) {
                $value = iterator_to_array($value);
            }
            if (is_object($value)) {
                $json[$key] = self::toArray($value);
            } else {
                if (is_array($value)) {
                    $json[$key] = array();
                    if (ArrayHelper::isAssoc($value)) {
                        foreach ($value as $k => $anObject) {
                            if (is_object($anObject)) {
                                $json[$key][$k] = self::toArray($anObject);
                            } else {
                                $json[$key][$k] = $anObject;
                            }
                        }
                    } else {
                        foreach ($value as $anObject) {
                            if (is_object($anObject)) {
                                $json[$key][] = self::toArray($anObject);
                            } else {
                                $json[$key][] = $anObject;
                            }
                        }
                    }
                } else {
                    $json[$key] = $value;
                }
            }
        }

        return $json;
    }
344664
public static function pairs($object)
    {
        $result = [];
        static::each($object, function ($item, $key) use (& $result) {
            $result[] = [$key, $item];
        });

        return $result;
    }
697013
public function extract($object)
    {
        $data = [
            'revision_id' => $object->getRevision()->getId(),
            'name' => $object->getName(),
            'type' => $object->getType(),
            'ordering' => $object->getOrdering(),
            'include_pattern' => $object->getIncludePattern(),
            'exclude_pattern' => $object->getExcludePattern(),
        ];
        if ($object->getId()) {
            $data['id'] = $object->getId();
        }
        return $data;
    }
945565
public function extract($object)
    {
        return [
            'type' => $object->getType(),
            'data' => $object->getData(),
            'store' => $object->getStore(),
            'download' => $object->isDownload(),
            'output_filename' => $object->getOutputFilename(),
            'category' => $object->getCategory(),
        ];
    }
563078
public static function objectArray($object)
    {
        if (is_object($object)) {
            $reflectionClass = new \ReflectionClass(get_class($object));
            $array = [];
            foreach ($reflectionClass->getProperties() as $property) {
                $property->setAccessible(true);
                $array[$property->getName()] = $property->getValue($object);
                $property->setAccessible(false);
            }

            //If above method failed? try, this one.
            $array = (empty($array)) ? json_decode(json_encode($object), true) : $array;

            return $array;
        }

        return false;
    }
376469
public function extract($object)
    {
        $data = [
            'environment_id' => $object->getEnvironment()->getId(),
            'released_at' => $object->getReleasedAt() !== null ? $object->getReleasedAt()->format(self::SQL_FORMAT) : null,
            'released_by' => $object->getReleasedBy(),
            'comment' => $object->getComment()
        ];
        if ($object->getId()) {
            $data['id'] = $object->getId();
        }
        return $data;
    }
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;
    }
1110283
public function extract($object)
    {
        $data = parent::extract($object);

        foreach ($this->getFreeValuesKeys() as $key) {
            $data[$key] = $object->get($key);
        }

        return $data;
    }