/** * CallApi * * @param endPoint $endPoint partial end point url * @param params $params to be passed to api * @return array response from api or general error form this class */ public function callApi($endPoint, array $params) { /* check if end point is available prior to make request */ if (!in_array($endPoint, $this->endPoints)) { if (Mage::getSingleton("core/session")->getPsonifyDebug() == 'true') { echo "<br/><h1>End Point</h1><br/>"; echo $endPoint; echo "<br/><h1>Sent Params</h1><br/>"; Zend_Debug::dump($params); echo "<br/><h1>Received Result</h1><br/>"; Zend_Debug::Dump($this->getValidationErrorResponse('End point is not valid')); } return $this->getValidationErrorResponse('End point is not valid'); } else { $params["token"] = isset($params["token"]) ? $params["token"] : $params["data"]["token"]; /* initializing curl */ $ch = curl_init(); $curlConfig = array(CURLOPT_URL => $this->apiUrl . '/' . $endPoint, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode($params)); curl_setopt_array($ch, $curlConfig); $result = curl_exec($ch); if (Mage::getSingleton("core/session")->getPsonifyDebug() == 'true') { echo "<br/><h1>End Point</h1><br/>"; echo $endPoint; echo "<br/><h1>Sent Params</h1><br/>"; Zend_Debug::dump($params); echo "<br/><h1>Recieved Result</h1><br/>"; Zend_Debug::Dump($result); } curl_close($ch); return json_decode($result); } }
public function errorAction() { $errors = $this->_getParam('error_handler'); if (!$this->_config->environment->production) { echo "<br /><br />"; Zend_Debug::Dump($errors); } $exceptionClass = get_class($errors->exception); Zend_Registry::get('logger')->log("Exception {$exceptionClass}\nMessage: " . $errors->exception->getMessage() . "\nStack: \n" . print_r($errors->exception->getTraceAsString(), true), Zend_Log::ERR); switch ($exceptionClass) { case 'Monkeys_BadUrlException': $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found'); $this->view->message = $this->_getTranslationForException($exceptionClass); break; case 'Monkeys_AccessDeniedException': $this->getResponse()->setRawHeader('HTTP/1.1 401 Unauthorized'); $this->view->message = $this->_getTranslationForException($exceptionClass); break; default: $this->view->message = get_class($errors->exception) . '<br />' . $errors->exception->getMessage(); if (!$this->_config->environment->production) { $this->view->trace = $errors->exception->getTraceAsString(); } else { if ($this->_config->email->adminemail) { $mail = self::getMail($errors->exception, $this->user, $errors); $mail->send(); $this->view->message .= "<br />\n"; $this->view->message .= 'The system administrator has been notified.'; } } break; } $this->getResponse()->clearBody(); }
/** * {@inheritdoc} */ public function convertToDatabaseValue($value, Doctrine\DBAL\Platforms\AbstractPlatform $platform) { if ($value !== null) { Zend_Debug::Dump(pack('H*', str_replace('-', '', $value))); return pack('H*', str_replace('-', '', $value)); // return "0x" . str_replace('-', '', $value); } }
public function testDebugDumpLabel() { Zend_Debug::setSapi('cli'); $data = 'string'; $label = 'LABEL'; $result = Zend_Debug::Dump($data, $label, false); $result = str_replace(array(PHP_EOL, "\n"), '_', $result); $expected = "_{$label} _string(6) \"string\"__"; $this->assertEquals($expected, $result); }
public function testingvariablesAction() { $product = new Application_Model_Products_Product(); $productMapper = new $product->_mapperClass(); $product = $productMapper->find(24); $product->_colors = 'blah'; $product->_images = array('blah'); echo $product->_colors; Zend_Debug::Dump($product); }
public function testServices() { $service = new SDIS62_Service_Module_Generic("http://apps.sdis62.local/admin/api/user"); Zend_Debug::Dump($service->isAuthorized("9", "4eed9098bb09144dd00f431cc3c512031585bb9c")); // Zend_Debug::Dump($service->getMessagesByFeed("admin", null, 20, 1)); }
unset($bug); $bug = new bug($newbugid); Zend_Debug::Dump($bug->reportedBy->getId()); echo '<hr>'; $group = new groups(1); echo $group->users->count(); //Zend_Debug::Dump($group->users); echo '<hr>'; $u = new user(1); echo $u->groups_collection->count(); echo '<hr>'; $g = new groups(); $g->save(); $gid = $g->getId(); $g->setName('My new Group ' . $g->getId())->save(); Zend_Debug::Dump($g->getName()); $uc = new user_collection(); $uc->select("SELECT * FROM user"); $i = 0; foreach ($uc as $u) { if ($i == 1) { $u->remove(); } $i++; } $g->user_collection = $uc; $g->save(); unset($g); $gg = new groups($gid); Zend_Debug::Dump($gg->user_collection->count());