/** * This will decide what should happen with the return value of the initialized item * * @return void * @throws Core_Main_AbstractException */ protected final function _afterInit($methodName, $value) { // If there is no value if (null === $value) { return; } // Decision tree here. There should not be many exceptions switch ($methodName) { case 'IncludePath': set_include_path($value); break; // Store registry locally // Store registry locally case 'Registry': // check interface of registry, make sure it has the right accessors (get() and set()) if (false === Core_Utility::hasInterface($value, 'Core_Interface_Registry')) { throw new Core_Main_AbstractException(sprintf('Registry does not implement %s', $registryInterface)); } $this->_registry = $value; break; default: $this->_registry->set(strtolower($methodName), $value); break; } }
/** * Initialize * * @return void */ public function __construct($responseObject) { // Check response object if (Core_Utility::hasInterface('Core_Interface_HTTP_Response')) { throw new Core_HTTP_Helper_Response_JsonException(sprintf('Response object %s does not implement %s.', get_class($responseObject), 'Core_Interface_HTTP_Response')); } $this->_responseObject = $responseObject; }