Extract values from an object

@param  object                             $object
@return array
@throws Exception\InvalidArgumentException
350949
public function extract($object)
    {
        if (!$object instanceof PageEntityInterface) {
            throw new Exception\InvalidArgumentException(
                '$object must be an instance of PlaygroundCms\Entity\PageInterface'
            );
        }

        /* @var $object PageInterface*/
        $data = parent::extract($object);
        $data = $this->mapField('id', 'page_id', $data);

        return $data;
    }
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;
    }
647065
public function extract( $object )
    {
        if ( $object instanceof Structure )
        {
            return array(
                'rootId'    => $object->rootId,
                'css'       => $object->render()
                                      ->getBuffer(),
            );
        }

        return array(
            'rootId'    => isset( $object->rootId )
                            ? (string) $object->rootId
                            : null,
            'css'       => isset( $object->css )
                            ? (string) $object->css
                            : null,
        );
    }
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;
    }
803690
public function extract($object)
    {
        if (!$object instanceof TicketEntry) {
            throw new \InvalidArgumentException('$object must be an instance of TicketEntry');
        }
        /* @var $object TicketEntry */
        $data = parent::extract($object);

        return $data;
    }
260183
public function serialize($object)
    {
        if (!$this->canHandle(get_class($object))) {
            throw new \InvalidArgumentException();
        }

        return [ $object->getTimestamp(), $object->getTimezone() ];
    }
38802
public function extract($object)
    {
        $pdfConverterHydrator = new PdfConverterHydrator();

        return [
            'responseStatus' => $object->getResponseStatus(),
            'sourceContainer' => $pdfConverterHydrator->extract($object->getSourceContainer()),
            'url' => $object->getUrl(),
        ];
    }
547091
public function extract($object)
    {
        $this->prepare($object);

        if ($this->byValue) {
            return $this->extractByValue($object);
        }

        return $this->extractByReference($object);
    }
1244202
protected function extractAttributes($object, $format = null, array $context = []): array
    {
        $class = \get_class($object);

        if (false === isset($this->localStorage[$class]))
        {
            $this->localStorage[$class] = parent::extractAttributes($object, $format, $context);
        }

        return $this->localStorage[$class];
    }
661192
public static function convertSumupObjectToArray($object)
    {
        $results = [];
        foreach ($object->_keys as $property) {
            $v = $object->{$property};
            if ($v instanceof SumupObject) {
                $results[$property] = $v->__toArray();
            } elseif (is_array($v)) {
                $results[$property] = self::convertSumupObjectToArray($v);
            } else {
                $results[$property] = $v;
            }
        }
        return $results;
    }
480938
public function extract($object)
    {
        $data = parent::extract($object);
        $data['description-description']    = $this->extractValue('descriptiondescription', $object);
        $data['description-requirements']   = $this->extractValue('descriptionrequirements', $object);
        $data['description-benefits']       = $this->extractValue('descriptionbenefits', $object);
        $data['description-qualifications'] = $this->extractValue('descriptionqualifications', $object);
        $data['description-title']          = $this->extractValue('descriptiontitle', $object);

        $data['description-html']           = $object->getTemplateValues()->getHtml();
        return $data;
    }
1213617
public static function readAttributes($object)
    {
        // Bail out if a non-object was passed.
        if (!is_object($object)) {
            throw self::getInvalidArgumentException(1, 'object');
        }

        $reflector = new ReflectionObject($object);
        $result    = [];

        // Iterate over the attributes of the object.
        foreach ($reflector->getProperties() as $attribute) {
            $attribute->setAccessible(true);
            $result[$attribute->getName()] = $attribute->getValue($object);
        }

        return $result;
    }
1190405
protected function normalizeAsArray($object) : array
    {
        $wrapper = $this->factory->make($object);

        $value = $wrapper->getEntityAttributes();

        if ($this->asJson) {
            $value = json_encode($value);
        }

        return [$this->relation => $value];
    }
801902
protected static function objectToArray($object)
    {
        if (!\is_object($object)) {
            return $object;
        }

        if (\is_object($object)) {
            $object = \get_object_vars($object);
        }

        return \array_map(['static', 'objectToArray'], $object);
    }
864829
private function convert(Array $object): Array {
    $parse = Array();
    foreach ($object as $key => $value) {
      if ($value instanceof stdClass) {
        $parse[$key] = $this->convert((Array) $value);
      } else {
        $parse[$key] = $value;
      }
    }
    return $parse;
  }
12691
public function extract($object)
    {
        if (!$object instanceof Request) {
            throw new \Exception('$object must be an instance of Request');
        }
        /* @var $object Request */
        $data = parent::extract($object);

        return $data;
    }
1110283
public function extract($object)
    {
        $data = parent::extract($object);

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

        return $data;
    }