예제 #1
0
 /**
  * Default task
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Get route
     $route = $this->app['route.resolver']->process($this->input->get('__xly', '', 'string'));
     if ($route instanceof \Expressly\Entity\Route) {
         switch ($route->getName()) {
             case Ping::getName():
                 $this->ping();
                 break;
             case UserData::getName():
                 $data = $route->getData();
                 $this->retrieveUserByEmail($data['email']);
                 break;
             case CampaignPopup::getName():
                 $data = $route->getData();
                 $this->migratestart($data['uuid']);
                 break;
             case CampaignMigration::getName():
                 $data = $route->getData();
                 $this->migratecomplete($data['uuid']);
                 break;
             case BatchCustomer::getName():
                 $this->batchCustomer();
                 break;
             case BatchInvoice::getName():
                 $this->batchInvoice();
                 break;
         }
     }
 }
 public function testResolver()
 {
     $this->mockSecurity();
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $route = $this->routeResolver->process('/expressly/api/batch/customer');
     $this->assertInstanceOf('Expressly\\Entity\\Route', $route);
     $this->assertEquals($route->getName(), BatchCustomer::getName());
 }
예제 #3
0
 public function match(RequestInterface $request)
 {
     if ($request->getModuleName() == null && method_exists($request, 'getPathInfo')) {
         $route = $this->application['route.resolver']->process($request->getPathInfo());
         if ($route instanceof Route) {
             switch ($route->getName()) {
                 case Ping::getName():
                     return $this->dispatch($request, 'ping');
                     break;
                 case Registered::getName():
                     return $this->dispatch($request, 'registered');
                     break;
                 case UserData::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'user', 'index', $data);
                     break;
                 case CampaignPopup::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'migration', 'popup', $data);
                     break;
                 case CampaignMigration::getName():
                     $data = $route->getData();
                     return $this->dispatch($request, 'migration', 'migrate', $data);
                     break;
                 case BatchCustomer::getName():
                     return $this->dispatch($request, 'batch', 'customer');
                     break;
                 case BatchInvoice::getName():
                     return $this->dispatch($request, 'batch', 'invoice');
                     break;
             }
         }
         if (http_response_code() === 401) {
             return $this->dispatch($request, 'unauthorized');
         }
     }
     //        return $this->actionFactory->create(Forward::class, ['request' => $request]);
 }