Exemple #1
0
 /**
  * @param SlimServiceMetadata $md
  * @param SlimServiceRegistration $endpoint
  * @param Slim\Slim $app
  */
 private static function EchoCommon(SlimServiceMetadata $md, $endpoint, Slim\Slim $app)
 {
     $response = $md->Response();
     echo "<h4>Name</h4>" . $md->Name();
     echo "<h4>Description</h4>" . str_replace("\n", "<br/>", $md->Description());
     echo '<h4>Route</h4>' . $app->urlFor($endpoint->RouteName());
     if ($endpoint->IsSecure()) {
         echo '<h4>This service is secure and requires authentication</h4>';
     }
     if ($endpoint->IsLimitedToAdmin()) {
         echo '<h4>This service is only available to application administrators</h4>';
     }
     echo '<h4>Response</h4>';
     if (is_object($response)) {
         echo '<div class="code">' . json_encode($response) . '</div>';
     } elseif (is_null($response)) {
         echo 'No response';
     } else {
         echo 'Unstructured response of type <i>' . $response . '</i>';
     }
 }
 private function SecureRegistration(SlimServiceRegistration $registration)
 {
     if ($registration->IsSecure()) {
         $this->secureRoutes[$registration->RouteName()] = true;
     }
     if ($registration->IsLimitedToAdmin()) {
         $this->adminRoutes[$registration->RouteName()] = true;
     }
 }