Convert BaseDto object to array

@param BaseDto $dto
@return array
180032
protected function dtoToArray(BaseDto $dto)
    {
        $itemData = [];

        foreach ($this->scheme as $fieldName => $fieldInfo) {
            $getter = 'get' . ucfirst($fieldName);

            if (!method_exists($dto, $getter)) {
                throw new RuntimeException("Undefined method '$getter' in " . get_class($dto));
            }

            /** @var FormatterInterface $formatter */
            $formatter = $this->formatterPluginManager->get($fieldInfo['formatter']);

            $itemData[$fieldName] = $formatter->format($dto->$getter());
        }

        return $itemData;
    }
382389
public function toArray(): array
	{
		$columns = $this->columns;

		// Removes protected columns from the array

		if(!empty($this->protected))
		{
			$columns = array_diff_key($columns, array_flip($this->protected));
		}

		// Mutate column values if needed

		foreach($columns as $name => $value)
		{
			$value = $this->getColumnValue($name);

			if($value instanceof DateTimeInterface)
			{
				$value = $value->format($this->dateOutputFormat);
			}

			$columns[$name] = $value;
		}

		// Merge in related records

		foreach($this->related as $relation => $related)
		{
			if(in_array($relation, $this->protected))
			{
				continue;
			}

			$columns += [$relation => ($related === false ? $related : $related->toArray())];
		}

		// Returns array representation of the record

		return $columns;
	}
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;
    }
689713
public function toArray()
	{
		$list = parent::toArray();

		$list['order.base.product.baseid'] = $this->getBaseId();
		$list['order.base.product.ordprodid'] = $this->getOrderProductId();
		$list['order.base.product.type'] = $this->getType();
		$list['order.base.product.suppliercode'] = $this->getSupplierCode();
		$list['order.base.product.productid'] = $this->getProductId();
		$list['order.base.product.prodcode'] = $this->getProductCode();
		$list['order.base.product.name'] = $this->getName();
		$list['order.base.product.mediaurl'] = $this->getMediaUrl();
		$list['order.base.product.position'] = $this->getPosition();
		$list['order.base.product.price'] = $this->_price->getValue();
		$list['order.base.product.costs'] = $this->_price->getCosts();
		$list['order.base.product.rebate'] = $this->_price->getRebate();
		$list['order.base.product.taxrate'] = $this->_price->getTaxRate();
		$list['order.base.product.quantity'] = $this->getQuantity();
		$list['order.base.product.status'] = $this->getStatus();
		$list['order.base.product.flags'] = $this->getFlags();

		return $list;
	}
1003045
public function toArray()
    {
        if ($this->rootElement instanceof CanConvertToArray) {
            return array(
                'currentTime' => $this->request_time,
                'cachedUntil' => $this->cached_until,
                'result' => $this->rootElement->toArray()
            );
        } else {
            return array();
        }
    }
484864
protected function annotationToArray($annotation)
    {
        $options = array();
        foreach ((array) $annotation as $key => $value) {
            if ($value !== null) {
                $options[$key] = $value;
            }
        }

        return $options;
    }
458029
public static function toArray($object): array
    {
        $array = array();

        $class = get_class($object);

        $methods = get_class_methods($class);

        foreach ($methods as $method) {

            preg_match(' /^(get)(.*?)$/i', $method, $results);

            $pre = $results[1] ?? '';

            $k = $results[2] ?? '';

            $k = strtolower(substr($k, 0, 1)) . substr($k, 1);

            if ($pre == 'get') {

                $array[$k] = $object->$method();
            }
        }
        return array_filter($array);
    }
934640
public function objectToArray($object)
    {
        if (!is_object($object) && !is_array($object)) {
            return $object;
        }
        if (is_object($object)) {
            $object = get_object_vars($object);
        }

        return array_map([get_class(), 'objectToArray'], $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;
    }
1026766
public function getNameAndPayload(array $serializedObject)
    {
        if (!$this->isSerializedObject($serializedObject)) {
            throw new \InvalidArgumentException();
        }

        $name = $serializedObject['_metadata']['name'];
        $payload = $serializedObject;
        unset($payload['_metadata']);

        return [
            $name,
            $payload,
        ];
    }
173495
protected function arrayToDto(array $itemData)
    {
        foreach ($itemData as $field => $value) {
            if (!isset($this->scheme[$field])) {
                throw new InvalidArgumentException("Undefined field '$field' in scheme");
            }

            $typeService = $this->scheme[$field]['type'];
            $itemData[$field] = $this->typePluginManager->get($typeService, ['value' => $value]);
        }

        return new $this->dtoClassName($itemData);
    }
1103067
public function toArray($object)
    {
        $this->assertObjectInstance($object);

        return array_map(
            function (Field $field) use ($object) {
                return $field->get($object);
            },
            $this->getFields()
        );
    }
620451
public function findAll(DTO $dto = null)
    {
        if(is_null($dto))
            $dto = new DTO();
        return $this->dao->findAll($dto);
    }
260183
public function serialize($object)
    {
        if (!$this->canHandle(get_class($object))) {
            throw new \InvalidArgumentException();
        }

        return [ $object->getTimestamp(), $object->getTimezone() ];
    }
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;
    }
939675
public static function getUtcDateTime( BaseDateTime $date )
    {
        $newDate = new BaseDateTime( );
        $newDate->setTimestamp( $date->getTimestamp() );
        $newDate->setTimezone( new DateTimeZone( 'UTC' ) );
        
        return $newDate;
    }
932824
public function toArray($object, $deep = self::SHALLOW)
    {
        return $deep ? $this->toDeepArray($object) : $this->toShallowArray($object);
    }