예제 #1
0
 /**
  * {@inheritDoc}
  * In addition, the value gets type checked.
  * @throws \blaze\lang\IllegalArgumentException If the offset is not a number.
  * @throws \blaze\lang\IndexOutOfBoundsException If the offset is not within the range of the array.
  * @throws \blaze\lang\ClassCastException When the type of the value does not fit.
  */
 public function offsetSet($offset, $value)
 {
     if (!\blaze\lang\Integer::isNativeType($offset)) {
         throw new \blaze\lang\IllegalArgumentException('The index must be a number');
     }
     if ($offset < 0 || $offset > $this->size) {
         throw new \blaze\lang\IndexOutOfBoundsException($offset);
     }
     if (!$this->typeChecker->isType($value)) {
         throw new \blaze\lang\ClassCastException('This array may only contain objects of the given type ' . $this->typeChecker->getType());
     }
     $this->objects[$offset] = $value;
 }
예제 #2
0
 /**
  * Unsets the object at the offset in the array.
  * @throws \blaze\lang\IllegalArgumentException If the offset is not a number.
  */
 public function offsetUnset($offset)
 {
     if (!\blaze\lang\Integer::isNativeType($offset)) {
         throw new \blaze\lang\IllegalArgumentException('The index must be a number');
     }
     // Not needed?
 }
예제 #3
0
 public function validate(\blaze\web\application\BlazeContext $context, $obj)
 {
     if (!Integer::isNativeType($obj)) {
         throw new ValidatorException('No valid int.');
     }
 }