/** * Overloading * * For PHP < 5.3.0, provides access to the getPrevious() method. * * @param string $method * @param array $args * @return mixed */ public function __call($method, array $args) { if ('getprevious' == i::lower($method)) { return $this->_getPrevious(); } return null; }
public function run($method, $parameters = array()) { $class = 'Service_' . ucfirst(\i::lower($this->_name)) . '_' . ucfirst(\i::lower($method)); $code = '<?php' . "\nclass " . $class . "\n{\n"; foreach ($this->_methods as $name => $methodCode) { $code .= "\t" . $methodCode . "\n"; } $code .= '}'; $file = CACHE_PATH . DS . sha1($this->_name . $method . time()) . '.php'; file_put_contents($file, $code); require_once $file; $return = call_user_func_array(array($class, $method), $parameters); unlink($file); return $return; }
case 'new': validate_security($security_level, 2); break; case 'save': $id = (int) db_prepare_input($_POST['id']); // if present, then its an edit $id ? validate_security($security_level, 3) : validate_security($security_level, 2); // error check $error = $cInfo->data_complete($error); // start saving data if (!$error) { $cInfo->save_contact(); $cInfo->save_addres(); if ($type != 'i' && ($_POST['i_short_name'] || $_POST['address']['im']['primary_name'])) { // is null $crmInfo = new i(); $crmInfo->auto_field = $cInfo->type == 'v' ? 'next_vend_id_num' : 'next_cust_id_num'; $crmInfo->dept_rep_id = $cInfo->id; // error check contact $error = $crmInfo->data_complete($error); if (!$error) { $crmInfo->save_contact(); $crmInfo->save_addres(); } } // payment fields if (ENABLE_ENCRYPTION && $_POST['payment_cc_name'] && $_POST['payment_cc_number']) { // save payment info $encrypt = new encryption(); $cc_info = array('name' => db_prepare_input($_POST['payment_cc_name']), 'number' => db_prepare_input($_POST['payment_cc_number']), 'exp_mon' => db_prepare_input($_POST['payment_exp_month']), 'exp_year' => db_prepare_input($_POST['payment_exp_year']), 'cvv2' => db_prepare_input($_POST['payment_cc_cvv2'])); if ($enc_value = $encrypt->encrypt_cc($cc_info)) {
public function testShouldReturnUpdateResult() { $this->userMailNotifyCriteria->shouldReceive('update')->andReturn(true); $service = new MailNotifyService($this->userMailNotifyCriteria); $this->assertTrue($service->updateSetting(1235, 'comment', 0)); }
public function __call($name, $arguments) { foreach ($this->_items as $key => $item) { if (is_callable($item, $name) || method_exists($item, $name)) { $items[] = (new ReflectionMethod($item, $name))->invokeArgs($item, $arguments); } else { // not callable } } return i::o($items); }
/** * @todo use file cache * * @throws Exception * @return string */ protected function _render() { if (mb_strlen($this->_html, 'utf-8') === 0 && empty($this->_url)) { throw new Exception("HTML content or source URL not set."); } if ($this->getUrl()) { $input = $this->getUrl(); } else { File::put($this->getFilePath(), $this->getHtml()); $input = $this->getFilePath(); } $content = $this->_exec(repl('%input%', $input, $this->_getCommand())); if (strpos(i::lower($content['stderr']), 'error')) { throw new Exception("System error <pre>" . $content['stderr'] . "</pre>"); } if (mb_strlen($content['stdout'], 'utf-8') === 0) { throw new Exception("WKHTMLTOPDF didn't return any data."); } if ((int) $content['return'] > 1) { throw new Exception("Shell error, return code : " . (int) $content['return']); } return $content['stdout']; }