public function __construct()
 {
     $this->app = App::getInstance();
     $this->view = View::getInstance();
     $this->config = $this->app->getConfig();
     $this->input = InputData::getInstance();
     $this->session = $this->app->getSession();
     $this->db = new SimpleDB();
 }
 private function processController()
 {
     $input = InputData::getInstance();
     $input->setGet($this->_params);
     $input->setPost($this->_router->GetPost());
     $file = ucfirst($this->_namespace) . '\\' . ucfirst($this->_controller);
     $this->_controller = $file;
     $realPath = str_replace('\\', DIRECTORY_SEPARATOR, '../' . $file . '.php');
     $realPath = realpath($realPath);
     if (file_exists($realPath) && is_readable($realPath)) {
         $calledController = new $file();
         if (method_exists($calledController, $this->_method)) {
             if ($this->isValidRequestMethod($calledController, $this->_method)) {
                 // Create binding model
                 $refMethod = new \ReflectionMethod($calledController, $this->_method);
                 $doc = $refMethod->getDocComment();
                 // Validate accessibility
                 $this->ValidateAuthorization($doc);
                 if (preg_match('/@param\\s+\\\\?([\\s\\S]+BindingModel)\\s+\\$/', $doc, $match)) {
                     $bindingModelName = $match[1];
                     $bindingModelsNamespace = App::getInstance()->getConfig()->app['namespaces']['Models'] . 'BindingModels/';
                     $bindingModelsNamespace = str_replace('../', '', $bindingModelsNamespace);
                     $bindingModelPath = str_replace('/', '\\', $bindingModelsNamespace . $bindingModelName);
                     $bindingReflection = new \ReflectionClass($bindingModelPath);
                     $properties = $bindingReflection->getProperties();
                     $params = array();
                     foreach ($properties as $property) {
                         $name = $property->getName();
                         $value = $input->postForDb($name);
                         if ($value === null) {
                             throw new \Exception("Invalid binding model! Property '{$name}' not found", 400);
                         } else {
                             $params[$name] = $value;
                         }
                     }
                     $bindingModel = new $bindingModelPath($params);
                     Injector::getInstance()->loadDependencies($calledController);
                     $calledController->{strtolower($this->_method)}($bindingModel);
                 } else {
                     Injector::getInstance()->loadDependencies($calledController);
                     $calledController->{strtolower($this->_method)}();
                 }
                 exit;
             } else {
                 throw new \Exception("Method does not allow '" . ucfirst($this->_requestMethod) . "' requests!", 500);
             }
         } else {
             throw new \Exception("'" . $this->_method . "' not found in '" . $file . '.php', 404);
         }
     } else {
         throw new \Exception("File '" . $file . '.php' . "' not found!", 404);
     }
 }