public static function allInstanceOf(array $array, $class) {
    if(!is_string($class)) {
      throw new \InvalidArgumentException('$class must be a string.');
    }
    if(!class_exists($class)) {
      throw new \InvalidArgumentException("Class with name $class not found.");
    }
    foreach($array as $val) {
      if(!self::instanceOfClass($val, $class)) {
        return false;
      }
    }
    return true;
  }
public static function allInstanceOf(array $array, $class) {
    if(!is_string($class)) {
      throw new \InvalidArgumentException('$class must be a string.');
    }
    if(!class_exists($class)) {
      throw new \InvalidArgumentException("Class with name $class not found.");
    }
    foreach($array as $val) {
      if(!self::instanceOfClass($val, $class)) {
        return false;
      }
    }
    return true;
  }
public static function allInstanceOf ( array $ array , $ class ) { if ( ! is_string ( $ class ) ) { throw new \ InvalidArgumentException ( '$class must be a string.' ) ; } if ( ! class_exists ( $ class ) ) { throw new \ InvalidArgumentException ( "Class with name $class not found." ) ; } foreach ( $ array as $ val ) { if ( ! self :: instanceOfClass ( $ val , $ class ) ) { return false ; } } return true ; }
Checks whether every value in an array is an instance of a class.

@param $array array The array to test.

@param $class The fully qualified class name to check every array value
with.

@return bool Whether every value in the array is an instance of $class.

@throw \InvalidArgumentException if no class with name $class is found.
Checks whether every value in an array is an instance of a class .