HEX
Server: Apache/2.4.65 (Debian)
System: Linux 88f31f35b0b8 6.1.0-38-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.147-1 (2025-08-02) x86_64
User: www-data (33)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wp-rss-aggregator/v4/src/Util/Normalize.php
<?php

namespace RebelCode\Wpra\Core\Util;

use InvalidArgumentException;
use stdClass;
use Traversable;

class Normalize
{
    /**
     * Normalizes a value into an array.
     *
     * @since [*next-version*]
     *
     * @param array|stdClass|Traversable $value The value to normalize.
     *
     * @return array The normalized value.
     * @throws InvalidArgumentException If value cannot be normalized.
     *
     */
    public static function toArray($value)
    {
        if (is_array($value) || $value instanceof stdClass) {
            return (array) $value;
        }

        if (!($value instanceof Traversable)) {
            throw new InvalidArgumentException(__('Not an iterable'), null, null);
        } else {
            return iterator_to_array($value, true);
        }
    }
}