29 private $strGroup = null;
37 static private $arrValidatorList = array();
45 static private $arrDataObjects = array();
58 if(!is_string($strGroup))
61 $this->strGroup = $strGroup;
63 if(!array_key_exists($this->strGroup, self::$arrValidatorList))
64 self::$arrValidatorList[$this->strGroup] = null;
66 if(!array_key_exists($this->strGroup, self::$arrDataObjects))
67 self::$arrDataObjects[$this->strGroup] = array();
84 if(!is_callable($cloValidator))
87 self::$arrValidatorList[$this->strGroup] = $cloValidator;
110 public function add($strIdentifier, array $arrData) {
112 if(!is_string($strIdentifier))
115 if($this->exists($strIdentifier))
116 throw new \Exception (
"identifier already in use: $strIdentifier");
118 $objDataObject =
new DataObject(self::$arrValidatorList[$this->strGroup], $arrData);
120 self::$arrDataObjects[$this->strGroup][$strIdentifier] = $objDataObject;
122 return $objDataObject;
135 public function delete($strIdentifier) {
137 if(!is_string($strIdentifier))
140 if(!$this->exists($strIdentifier))
141 throw new \Exception (
"DataObject not found, identifier unknown: $strIdentifier");
143 unset(self::$arrDataObjects[$this->strGroup][$strIdentifier]);
158 if(!is_string($strIdentifier))
161 if(!isset(self::$arrDataObjects[$this->strGroup][$strIdentifier]))
179 public function get($strIdentifier) {
181 if(!is_string($strIdentifier))
184 if(!$this->exists($strIdentifier))
185 throw new \Exception (
"DataObject not found, identifier unknown: $strIdentifier");
187 return self::$arrDataObjects[$this->strGroup][$strIdentifier];
203 return self::$arrDataObjects[$this->strGroup];