From e802d5204b96d645ec3d40b81b4a8bdc6e0ee675 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 4 Nov 2019 23:31:31 +0100 Subject: refactor: switch to psr-4 autoloading --- app/class/Route.php | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 app/class/Route.php (limited to 'app/class/Route.php') diff --git a/app/class/Route.php b/app/class/Route.php new file mode 100644 index 0000000..4f2a6de --- /dev/null +++ b/app/class/Route.php @@ -0,0 +1,86 @@ +hydrate($vars); + } + + public function hydrate($vars) + { + foreach ($vars as $var => $value) { + $method = 'set' . $var; + if (method_exists($this, $method)) { + $this->$method($value); + } + } + } + + public function toarray() + { + $array = []; + if (!empty($this->id)) { + $array[] = 'page'; + } + if (!empty($this->aff)) { + $array[] = 'aff='.$this->aff; + } + if (!empty($this->action)) { + $array[] = 'action=' . $this->action; + } + if (!empty($this->redirect)) { + $array[] = $this->redirect; + } + + + return $array; + } + + function tostring() + { + return implode(' ', $this->toarray()); + } + + + + public function setid($id) + { + $this->id = $id; + } + + public function setaff($aff) + { + $this->aff = $aff; + + } + + public function setaction($action) + { + $this->action = $action; + } + + public function setredirect($redirect) + { + $this->redirect = $redirect; + } + + public function id() + { + return $this->id; + } +} + + + + +?> \ No newline at end of file -- cgit v1.2.3