properties['code'] = isset($_POST['code']) ? 'decode' : 'encode'; $this->properties['type'] = isset($_POST['type']) ? 'rawurl' : 'url'; } /** * Decoder destructor. */ public function __destruct() { } /** * @param $in input from anywhere * @return string */ public function getDecoder($in = null) { return $this->decoder($in); } protected function decoder($in = null) { $func = $this->properties['type'].$this->properties['code']; $out = $func($in); return $out; } public function getProperties($exact = null) { if (array_key_exists($exact, $this->properties)) { return $this->properties[$exact]; } else { return $this->properties; } } public function setProperties($exact, $val = true) { if (array_key_exists($exact, $this->properties)) { $this->properties[$exact] = $val; return true; } else { return false; } } }