Example #1
0
 /**
  * Start listen to routes
  */
 public function start()
 {
     $this->url = $_SERVER['REQUEST_URI'];
     $method = $_SERVER['REQUEST_METHOD'];
     $this->route = new Route($method, $this->url, $this->routes);
     $entityName = $this->route->getController();
     $modelName = 'App\\Models\\' . $entityName . 'Model';
     $modelPath = 'application/models/' . $entityName . 'Model.php';
     if (file_exists($modelPath)) {
         include $modelPath;
     }
     $controllerName = 'App\\Controllers\\' . $entityName . 'Controller';
     $controllerPath = 'application/controllers/' . $entityName . 'Controller.php';
     // include controller
     if (file_exists($controllerPath)) {
         include $controllerPath;
     } else {
         Router::ErrorResponse('Page not found.', 404);
     }
     $requestData = Request::getRequestParams();
     // create controoler
     $controller = new $controllerName(new $modelName(), $requestData);
     $action = $this->route->getAction() . 'Action';
     if (method_exists($controller, $action)) {
         // call controller action
         call_user_func_array(array($controller, $action), $this->route->getTokens());
     } else {
         Router::ErrorResponse('Page not found.', 404);
     }
 }
Example #2
0
 public function testGetParams()
 {
     $result = array('ALIAS' => NULL, 'BACK_REF' => 'http://path/to/your/returnUrlScript', 'BILL_ADDRESS' => 'ADDRESS1', 'BILL_ADDRESS2' => 'ADDRESS2', 'BILL_BANK' => NULL, 'BILL_BANKACCOUNT' => NULL, 'BILL_CIISSUER' => NULL, 'BILL_CINUMBER' => '324322', 'BILL_CISERIAL' => NULL, 'BILL_CITYPE' => NULL, 'BILL_CITY' => 'Bucuresti', 'BILL_CNP' => NULL, 'BILL_COMPANY' => NULL, 'BILL_COUNTRYCODE' => 'RO', 'BILL_EMAIL' => '*****@*****.**', 'BILL_FAX' => NULL, 'BILL_FISCALCODE' => NULL, 'BILL_FNAME' => 'John', 'BILL_LNAME' => 'Doe', 'BILL_PHONE' => '0755167887', 'BILL_REGNUMBER' => NULL, 'BILL_STATE' => NULL, 'BILL_ZIPCODE' => NULL, 'CARD_PROGRAM_NAME' => NULL, 'CC_CVV' => 123, 'CC_NUMBER' => '5431210111111111', 'CC_NUMBER_RECIPIENT' => NULL, 'CC_OWNER' => 'test', 'CLIENT_IP' => '127.0.0.1', 'CLIENT_TIME' => '', 'DELIVERY_ADDRESS' => 'ADDRESS1', 'DELIVERY_ADDRESS2' => 'ADDRESS2', 'DELIVERY_CITY' => NULL, 'DELIVERY_COMPANY' => NULL, 'DELIVERY_COUNTRYCODE' => 'RO', 'DELIVERY_EMAIL' => '*****@*****.**', 'DELIVERY_FNAME' => 'John', 'DELIVERY_LNAME' => 'Doe', 'DELIVERY_PHONE' => '0755167887', 'DELIVERY_STATE' => NULL, 'DELIVERY_ZIPCODE' => NULL, 'DISCOUNT' => NULL, 'EXP_MONTH' => '11', 'EXP_YEAR' => 2016, 'MERCHANT' => 'MERCHANT_CODE', 'ORDER_DATE' => '2014-09-19 10:00:00', 'ORDER_MPLACE_MERCHANT' => array(0 => NULL, 1 => NULL), 'ORDER_PCODE' => array(0 => 'PCODE01', 1 => 'PCODE02'), 'ORDER_PGROUP' => array(0 => NULL, 1 => NULL), 'ORDER_PINFO' => array(0 => NULL, 1 => NULL), 'ORDER_PNAME' => array(0 => 'PNAME01', 1 => 'PNAME02'), 'ORDER_PRICE' => array(0 => 100, 1 => 200), 'ORDER_QTY' => array(0 => 1, 1 => 1), 'ORDER_REF' => 'MerchantOrderRef', 'ORDER_SHIPPING' => NULL, 'ORDER_VER' => array(0 => NULL, 1 => NULL), 'PAY_METHOD' => 'CCVISAMC', 'PRICES_CURRENCY' => 'RON', 'SELECTED_INSTALLMENTS_NUMBER' => '2', 'USE_LOYALTY_POINTS' => NULL, 'LOYALTY_POINTS_AMOUNT' => NULL, 'CAMPAIGN_TYPE' => 'EXTRA_INSTALLMENTS');
     $this->assertEquals($result, $this->request->getRequestParams());
 }