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;
  }