@param $object
@param $exclude

@return array
@throws TransformerException
165893
protected function objectToArray($object, array $exclude)
  {
    $array = (array) $this->objectToPublicObject($object, $exclude);

    foreach ($array as $key => $value)
    {
      if (is_object($value))
      {
        $value = $this->objectToArray($value, $this->excludeNext($key, $exclude));
      }
      $array[$key] = $value;
    }

    return $array;
  }
1022868
protected function toString($value, array $exclude)
  {
    switch (gettype($value))
    {
      case ConversionEnum::ARRAY_CONVERSION:
        return $this->arrayToString($this->prepareArray($value, $exclude));
      case ConversionEnum::STRING_CONVERSION:
        return $value;
      case ConversionEnum::OBJECT_CONVERSION:
        $rc = new \ReflectionObject($value);
        if ($rc->hasMethod('__toString'))
        {
          return $rc->getMethod('__toString')->invoke($value);
        }

        return json_encode($this->objectToPublicObject($value));
    }
    throw new TransformerException(
      sprintf(
        'Value of type %s can not be converted to String by this method.',
        gettype($value)
      )
    );
  }
331476
public function extract(object $object, string $snakeCaseSeparator = '_'): array
    {
        $this->nameConverter->setSnakeCaseSeparator($snakeCaseSeparator);

        return $this->normalize($object);
    }
61256
public function transform(Arrayable $object)
    {
        $result = [];
        foreach ($this->fields as $field) {
            if (str_contains($field, '.')) {
                $result[$field] = $this->getFieldRecursive($object, $field);
            } else {
                $result[$field] = $object->$field;
            }
        }
        return $result;
    }
1135009
public function extract($object)
    {
        if (!$object instanceof Entity) {
            throw new \InvalidArgumentException('$object must be an instance of EmailVerification entity');
        }
        /* @var $object Entity*/
        $data = parent::extract($object);
        if ($data['request_time'] instanceof \DateTime) {
            $data['request_time'] = $data['request_time']->format('Y-m-d H:i:s');
        }

        return $data;
    }
415478
public function extract($object)
    {
        return [
            'newsId'        => $object->getNewsId(),
            'userId'        => $object->getUserId(),
            'title'         => $object->getTitle(),
            'slug'          => $object->getSlug(),
            'content'       => $object->getContent(),
            'description'   => $object->getDescription(),
            'pageHits'      => $object->getPageHits(),
            'image'         => $object->getImage(),
            'layout'        => $object->getLayout(),
            'lead'          => $object->getLead(),
            'dateCreated'   => $this->extractValue('dateCreated', $object->getDateCreated()),
            'dateModified'  => $this->extractValue('dateModified', $object->getDateModified()),
        ];
    }
1237806
protected function normalizeRawCollection($object, $format = null, array $context = []): array
    {
        $data = [];
        foreach ($object as $index => $obj) {
            $data[$index] = $this->normalizer->normalize($obj, $format, $context);
        }

        return $data;
    }
1027765
public function getCustomFields($object)
    {
        $customFields = [];
        foreach ($object->getCustomFields() as $field) {
            $customFields[$field->getInternalFieldName()] = $field->getValue();
        }

        return $customFields;
    }
744109
protected function generateReference($exclude = [])
    {
        $oDb = Factory::service('Database');

        do {

            $refOk = false;

            do {

                $ref = strtoupper(random_string('alnum', 10));
                if (array_search($ref, $exclude) === false) {
                    $refOk = true;
                }

            } while (!$refOk);

            $oDb->where('ref', $ref);
            $result = $oDb->get($this->sTable);

        } while ($result->num_rows());

        return $ref;
    }
106190
public function reverseProcess($config, $object)
  {
    try
    {
      $object = $this->process('\stdClass', $config, $object);

      $this->init();
      $configurator = new EnmConfigurator($config, $this->dispatcher);

      $returnClass = $this->reverseBuild(
        '\stdClass',
        $configurator->getConfig(),
        $this->converter->convertTo($object, ConversionEnum::ARRAY_CONVERSION)
      );

      $this->destroy();

      return $returnClass;
    }
    catch (\Exception $e)
    {
      $this->dispatcher->dispatch(TransformerEvents::ON_EXCEPTION, new ExceptionEvent($e));
      throw new TransformerException($e->getMessage());
    }
  }
604497
public function extract($object)
    {
        if (!$object instanceof DownloadList) {
            throw new Exception('$object must be an instance of Downloadlist');
        }
        /* @var $object DownloadList */
        $data = parent::extract($object);

        return $data;
    }
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;
    }
1277843
private function transform($object)
    {
        $class = trim(get_class($object), '\\');
        $transformer = array_key_exists($class, $this->transformers)
            ? $this->transformers[$class]
            : false;
        if (! $transformer) {
            return $this->convert($object);
        }

        return is_callable(($cb = $this->transformer($transformer)))
            ? $this->forceArray(call_user_func($cb, $object))
            : $this->convert($object);
    }
267792
public function extract($object)
    {
        if (!$object instanceof CountryEntityInterface) {
            throw new Exception\InvalidArgumentException('$object must be an instance of DelCountriesFlags\Entity\CountryInterface');
        }
        /* @var $object CountryInterface*/
        $data = parent::extract($object);
        return $data;
    }
1113649
public function extract( $object )
    {
        $result = array();
        $type   = $object->paragraph->type;

        $result['paragraph-' . $type] = $this->getParagraphMapper()
                                             ->extract( $object->paragraph );

        $propertyHydrator = $this->getHydrateSimpleProperties();

        foreach ( $object->rules as $key => $rule )
        {
            $result['customize-' . $key] = $propertyHydrator->extract( $rule )
                                                              [ 'properties' ];
        }

        return $result;
    }
355233
protected function extractViewParameters(Request $request, array $exclude = [])
    {
        $parameters = [];

        foreach ($request->attributes as $key => $value) {
            if (strpos($key, '_') !== 0 && !in_array($key, $exclude)) {
                $parameters[$key] = $value;
            }
        }

        return $parameters;
    }
1132899
public function extract($object)
    {
        if (!$object instanceof News) {
            throw new \Exception('$object must be an instance of News');
        }
        /* @var $object News */
        $data = parent::extract($object);

        return $data;
    }