Converts stdObject or json string to traversable array

@return array
19584
public function toArrayFunction($object)
    {
        if (is_string($object)) {
            return json_decode($object, true);
        }

        return json_decode(json_encode($object), true);
    }
784298
public function toArray() {

        $properties = get_object_vars($this);

        foreach($properties as $var => &$value) {
            if(gettype($value)  === 'object') {
                unset($properties[$var]);
            }
        }

        return $properties;
    }
1266940
public function getJSONObject()
    {
        $o = parent::getBaseJSONObject();
        foreach ($this->files as $file) {
            $o->files[] = $file->getJSONObject();
        }

        return $o;
    }
419377
public function toArray()
    {
        $raw = $this->dsn->toArray();
        $allKeys = array_unique(array_merge(static::$mandatoryKeys, array_keys($raw)));
        $return = [];

        foreach ($allKeys as $key) {
            if (isset($this->keyMap[$key])) {
                $key = $this->keyMap[$key];
                if (!$key) {
                    continue;
                }
            }

            $val = $this->$key;
            if ($val !== null) {
                $return[$key] = $val;
            }
        }

        return $return;
    }
1186665
function toArray()
    {
        $out = array ();

        $attributes = $this->attribute( 'attributes' );
        if ( count( $attributes ) )
        {
            $out['attributes'] = $attributes;
        }

        $children = $this->attribute( 'children' );
        foreach( $children as $name => $value )
        {
            if ( is_object( $value ) )
            {
                $out['children'][$name] = $value->toArray();
            }
            else if ( is_array( $value ) )
            {
                foreach( $value as $key => $val )
                {
                    if ( is_object( $val ) )
                    {
                        $value[$key] = $val->toArray();
                    }
                }
                $out['children'][$name] = $value;
            }
            else
            {
                $out['children'][$name] = $value;
            }
        }

        if ( !count( $children ) )
        {
            $textContent = $this->attribute( 'textContent' );
            if ( $textContent != '' )
            {
                $out['textContent'] = $textContent;
            }
        }

        return $out;
    }
1258981
function jsonSerialize(): \stdClass {
    return (object) [
      'name' => $this->getName(),
      'url' => ($url = $this->getUrl()) ? (string) $url : null
    ];
  }
981361
public function toJson()
    {
        array_walk_recursive($this->params, function (&$value) {
            $value = (string) $value;
        });
        return json_encode($this->params);
    }
881933
public function nestedObjectsToArray()
    {
        $attributes = [];

        foreach ($this->getAttributes() as $key => $value) {
            // If the values implements the Arrayable interface we can just call this
            // toArray method on the instances which will convert both objects and
            // collections to their proper array form and we'll set the values.
            if ($value instanceof Arrayable) {
                $attributes[$key] = $value->toArray();
            }
            if (is_array($value)) {
                $attributes[$key] = collect($value)->toArray();
            }
        }

        return $attributes;
    }
1252108
public function jsonSerialize()
    {
        $out = [];
        foreach ($this as $model) {
            if (!is_object($model)) {
                continue;
            }
            if ($model instanceof JsonSerializable) {
                $out[] = $model->jsonSerialize();
            } else {
                $out[] = (object)(array)$model;
            }
        }
        return $out;
    }
833731
public function object_to_array($object, array $fields){
        $array= array();
        if(is_array($object) || $object instanceof \Traversable){
            $array= array();
            foreach ($object as $var) {
                $array[]= $this->object_to_array_internal($var, $fields);
            }
        }else if(! is_null($object)){        
            $array= $this->object_to_array_internal($object, $fields);
        }else{
            $array= NULL;
        }
        return $array;        
    }
556363
public static function objectToArray($d)
    {
        if (is_object($d)) {
            $d = get_object_vars($d);
        }
        if (!is_array($d)) {
            return $d;
        }
        return array_map(array(__CLASS__, __FUNCTION__), $d); // recursive
    }
996608
function jsonSerialize(): \stdClass {
    return (object) [
      'lineNumber' => $this->getLineNumber(),
      'blockNumber' => $this->getBlockNumber(),
      'branchNumber' => $this->getBranchNumber(),
      'taken' => $this->getTaken()
    ];
  }
1342388
protected function toJsonSerialize()
    {
        return [
            'attributes' => $this->attributes,
            'restriction' => $this->isRestriction,
            'struct' => $this->isStruct,
            'types' => $this->types,
            'values' => $this->values,
            'list' => $this->list,
        ];
    }
537509
public function toArray()
	{
		return [
			'creator' => SerializationHelper::stringOrNull($this->creator),
			'metadata' => SerializationHelper::serialize($this->metadata),
			'waypoints' => SerializationHelper::serialize($this->waypoints),
			'routes' => SerializationHelper::serialize($this->routes),
			'tracks' => SerializationHelper::serialize($this->tracks),
			'extensions' => SerializationHelper::serialize($this->extensions)
		];
	}
171589
public function toStdObject()
    {
        $object = new \stdClass();
        $object->uid = $this->getUid();
        $object->level = $this->getLevel();
        $object->keyword = $this->getKeyword();
        $object->children = array();
        return $object;
    }
760128
public function toArray() : ?array
    {
        if (null === $this->stmt || false === $this->stmt) {
            return null;
        }
        return $this->stmt->toArray();
    }
1348847
public function getJsonObject()
    {
        // array_filter() ensures that empty values are filtered out
        // array_values() ensures encoding to array rather than object
        $this->sslRoutingRestrictedUrls     = array_values(array_filter($this->sslRoutingRestrictedUrls));
        $this->maintenanceModeAuthorizedIps = array_values(array_filter($this->maintenanceModeAuthorizedIps));

        return json_encode(get_object_vars($this));
    }