Scalr\Tests\Functional\Api\ApiTestCase::isRecursivelyEmpty PHP Метод

isRecursivelyEmpty() публичный статический Метод

Recursively checks that data is empty
public static isRecursivelyEmpty ( mixed $data ) : boolean
$data mixed Data to check
Результат boolean Returns true if $data are empty or $data is object/array, all child elements of which recursively empty, false otherwise
    public static function isRecursivelyEmpty($data)
    {
        if (is_object($data)) {
            foreach ($data as $property) {
                if (!static::isRecursivelyEmpty($property)) {
                    return false;
                }
            }
            return true;
        } else {
            if (is_array($data)) {
                if (!empty($data)) {
                    foreach ($data as $entry) {
                        if (!static::isRecursivelyEmpty($entry)) {
                            return false;
                        }
                    }
                    return true;
                }
                return true;
            }
        }
        return empty($data);
    }