setBase($base); } protected function setBase($base){ foreach ($base as $key=>$value){ $this->base[$key] = ConstrainedFactory::build($value); } } public function getBase(){ return $this->base; } protected function addPathToChildException($myKey, ConstraintException $ex){ $newKey = $myKey."[".$ex->getRelatedKey()."]"; return new ConstraintException($ex->getRelatedOperation(), $newKey, $ex->getRelatedValue()); } protected function setInternal($key,$value){ if (is_null($key)) { $this->base[] = $value; } else { $this->base[$key] = $value; } } protected function getInternal($key){ return $this->offsetExists($key) ? $this->base[$key] : null; } protected function unsetInternal($key){ unset($this->base[$key]); } // ArrayAccess methods public function offsetExists($key) { return array_key_exists($key, $this->base); } public function offsetSet($key, $value) { $this->setConstrained($key, $value); } public function offsetUnset($key) { $this->unsetConstrained($key); } public function offsetGet($key) { $this->getConstrained($key); } } ?>