/** * setRegistry() * * @param Zend_Tool_Framework_Registry_Interface $registry * @return Zend_Tool_Framework_Client_Console_ArgumentParser */ public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) { // get the client registry $this->_registry = $registry; // set manifest repository, request, response for easy access $this->_manifestRepository = $this->_registry->getManifestRepository(); $this->_request = $this->_registry->getRequest(); $this->_response = $this->_registry->getResponse(); return $this; }
/** * undocumented function * * @return void * @author Alistair Stead **/ protected function _bootstrap() { //load Magento $mageFilename = 'app/Mage.php'; $this->_isInstalled($mageFilename); require_once $mageFilename; Mage::setIsDeveloperMode(true); Mage::app(); // get request/response object $this->_request = $this->_registry->getRequest(); $this->_response = $this->_registry->getResponse(); }
/** * respondWithErrorMessage() * * @param string $errorMessage * @param Exception $exception */ public function respondWithErrorMessage($errorMessage, Exception $exception = null) { // break apart the message into wrapped chunks $errorMessages = explode(PHP_EOL, wordwrap($errorMessage, 70, PHP_EOL, false)); $text = 'An Error Has Occurred'; $this->_response->appendContent($text, array('color' => array('hiWhite', 'bgRed'), 'aligncenter' => true)); $this->_response->appendContent($errorMessage, array('indention' => 1, 'blockize' => 72, 'color' => array('white', 'bgRed'))); if ($exception && $this->_registry->getRequest()->isDebug()) { $this->_response->appendContent($exception->getTraceAsString()); } $this->_response->appendContent(null, array('separator' => true)); return $this; }
/** * respondWithErrorMessage() * * @param string $errorMessage * @param Exception $exception */ public function respondWithErrorMessage($errorMessage, Exception $exception = null) { // break apart the message into wrapped chunks $errorMessages = explode(PHP_EOL, wordwrap($errorMessage, 70, PHP_EOL, false)); $text = ' An Error Has Occurred '; $this->_response->appendContent($text, array('color' => array('hiWhite', 'bgRed'))); foreach ($errorMessages as $errorMessage) { $errorMessage = sprintf('%-70s', $errorMessage); $this->_response->appendContent(' ' . $errorMessage . ' ', array('color' => array('white', 'bgRed'))); } if ($exception && $this->_registry->getRequest()->isDebug()) { $this->_response->appendContent($exception->getTraceAsString()); } $this->_response->appendContent(null, array('separator' => true)); return $this; }