/** * The constructor is similar to the one of ArrayObject(AbstractArray) and * expects additionally the type of the elements. * @param array|int|blaze\collections\ArrayI $arrayOrSize * @param string|blaze\lang\String|blaze\lang\ClassWrapper $type */ public function __construct($arrayOrSize, $type) { $this->typeChecker = \blaze\collections\TypeChecker::getInstance($type); parent::__construct($arrayOrSize); foreach ($this->objects as $obj) { if (!$this->typeChecker->isType($obj)) { throw new \blaze\lang\IllegalArgumentException('The array may only contain objects of the given type ' . $this->typeChecker->getType()); } } }
/** * This method returns the native datatype of a wrapper class. * * @return array */ public static function asNative($value) { return AbstractArray::asNative($value); }