public function run() { $route = $this->router->match($this->request); if ($route === false) { $actionName = self::ACTION_NOT_FOUND; } else { $actionName = $route->getName(); } if (!$this->actions->has($actionName)) { throw new \Exception(sprintf('Action %s not found', $actionName)); } $this->store->setFileName($actionName); if ($this->request->isAjax()) { $this->view->setRenderType(View::RENDER_JSON); } else { $this->view->setContentView('error'); } $action = $this->actions->get($actionName); call_user_func_array($action, array($this)); if (is_callable($this->postAction)) { call_user_func_array($this->postAction, array($this)); } $this->response->setContent($this->view->render()); $this->response->send(); }
/** * To String * * @return string */ public final function toString() { $result = ""; foreach ($this->values as $key => $value) { $value = $this->values->get($key); $result .= $key . ": " . $value . "\r\n"; } // add cookies $result .= $this->getCookie(); return $result; }
/** * * @return mixed */ public function get() { if (method_exists($this->_field, 'get')) { $value = $this->_field->get($value); } $values = $this->_values(); $name = $this->_field->name; if ($values->offsetExists($name)) { return $values[$name]; } else { return $this->_field->default; } }
public function testConstructor1() { $a = array('name', 'age'); $b = new ArrayObject('name', 'age'); $c = new ArrayObject($a); $d = new ArrayObject($b); $this->assertEquals('name', $a['0']); $this->assertEquals('name', $b['0']); $this->assertEquals('name', $c['0']); $this->assertEquals('name', $d['0']); $this->assertEquals('age', $a[1]); $this->assertEquals('age', $b[1]); $this->assertEquals('age', $c[1]); $this->assertEquals('age', $d[1]); $this->assertEquals('age', $b->get(1)); $this->assertEquals('age', $c->get(1)); $this->assertEquals('age', $d->get(1)); $this->assertEquals('age', $b->get('1')); $this->assertEquals('age', $c->get('1')); $this->assertEquals('age', $d->get('1')); $this->assertEquals('name', $b->get(0)); $this->assertEquals('name', $c->get(0)); $this->assertEquals('name', $d->get(0)); }
public function getURI() { return $this->server->get('REQUEST_URI', '/'); }