get() public method

Adds get route
public get ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
return Scalr\Api\Rest\Routing\Route Returns route instance
Example #1
0
 /**
  * @test
  */
 public function testGet()
 {
     $route = $this->app->get('/path', function () {
         /* do nothing */
     });
     $this->assertTrue($route->hasMethod(Request::METHOD_HEAD));
     $this->assertTrue($route->hasMethod(Request::METHOD_GET));
     $this->assertFalse($route->hasMethod(Request::METHOD_POST));
 }
Example #2
0
 /**
  * {@inheritdoc}
  * @see Application::get()
  */
 public function get($path, $options, $requirements = [])
 {
     return parent::get($path, $options, $requirements)->addMethod(Request::METHOD_OPTIONS);
 }