src/Headzoo/Core/Objects.php
public static function isInstance($obj, $class)
    {
        if (is_array($obj)) {
            $reduced = array_filter($obj, function($o) use($class) {
                    return self::isInstance($o, $class);
                });
            $is_instance = count($obj) == count($reduced);
        } else {
            if (!is_object($obj)) {
                $is_instance = false;
            } else {
                $class = self::getFullName($class);
                $is_instance = is_subclass_of($obj, $class) ||
                    self::getFullName($obj) === $class;
            }
        }

        return $is_instance;
    }
public static function isInstance($obj, $class)
    {
        if (is_array($obj)) {
            $reduced = array_filter($obj, function($o) use($class) {
                    return self::isInstance($o, $class);
                });
            $is_instance = count($obj) == count($reduced);
        } else {
            if (!is_object($obj)) {
                $is_instance = false;
            } else {
                $class = self::getFullName($class);
                $is_instance = is_subclass_of($obj, $class) ||
                    self::getFullName($obj) === $class;
            }
        }

        return $is_instance;
    }
public static function isInstance ( $ obj , $ class ) { if ( is_array ( $ obj ) ) { $ reduced = array_filter ( $ obj , function ( $ o ) use ( $ class ) { return self :: isInstance ( $ o , $ class ) ; } ) ; $ is_instance = count ( $ obj ) == count ( $ reduced ) ; } else { if ( ! is_object ( $ obj ) ) { $ is_instance = false ; } else { $ class = self :: getFullName ( $ class ) ; $ is_instance = is_subclass_of ( $ obj , $ class ) || self :: getFullName ( $ obj ) === $ class ; } } return $ is_instance ; }
Returns whether the object, or array of objects, is an instance of a class

Similar to PHP's own instanceof comparison operator, this method differs in two ways:
- The first argument may be an array of objects to test.
- The second argument may be a string with the name of a class.

Throws an exception when $obj is not an object or an array of objects.

Examples:
```php
$is = Objects::isInstance(new Strings(), new Strings());
var_dump($is);
// Outputs: bool(true)

$is = Objects::isInstance(new Strings(), Strings::class);
var_dump($is);
// Outputs: bool(true)

$is = Objects::isInstance(new Arrays(), new Strings());
var_dump($is);
// Outputs: bool(false)

$is = Objects::isInstance(new Arrays(), Arrays::class);
var_dump($is);
// Outputs: bool(false)

$objects = [
new Strings(),
new Strings()
];
$is = Objects::isInstance($objects, Strings::class);
var_dump($is);
// Outputs: bool(true)

$objects = [
new Strings(),
new stdClass()
];
$is = Objects::isInstance($objects, Strings::class);
var_dump($is);
// Outputs: bool(false)

$objects = [
[
new Strings(),
new Strings()
],
[
new Strings(),
new Strings()
]
];
$is = Objects::isInstance($objects, Strings::class);
var_dump($is);
// Outputs: bool(true)
```

@param  object|object[] $obj   The object or array of objects to test
@param  object|string   $class Object or string naming a class
@return bool
@throws Exceptions\LogicException When the $obj argument is not an object or array of objects
Returns whether the object or array of objects is an instance of a class