コード例 #1
0
ファイル: MapContext.php プロジェクト: getbonder/bonder
 public function get($resource)
 {
     if (!$this->resources->containsKey($resource)) {
         throw new \Bonder\Exceptions\ResourceNotFoundException();
     }
     return $this->resources->get($resource);
 }
コード例 #2
0
ファイル: MapTest.php プロジェクト: getbonder/bonder
 public function testFromReference()
 {
     $array = array('7' => 'seven', '19' => 'nineteen', '31' => 'thirty-one');
     $map = \Bonder\Collections\Map::fromReference($array);
     $this->assertEquals(3, $map->size());
     unset($array['19']);
     $this->assertEquals(2, $map->size());
     $map->remove('31');
     $this->assertEquals(1, $map->size());
     $this->assertTrue($map->isLinkedTo($array));
 }
コード例 #3
0
ファイル: BaseHttpResponse.php プロジェクト: getbonder/bonder
 protected function getStatusCodeHeader()
 {
     $texts = \Bonder\Collections\Map::fromArray(array(100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 509 => 'Bandwidth Limit Exceeded', 510 => 'Not Extended'));
     return "HTTP/1.1 " . $this->statusCode . " " . $texts->get($this->statusCode, "");
 }
コード例 #4
0
 /**
  * @param array $serverVars
  * @return HTTPRequest
  */
 public function create(array $serverVars)
 {
     return new \Bonder\Http\MapsHttpRequest(new \Bonder\Collections\Map(), new \Bonder\Collections\Map(), new \Bonder\Collections\Map(), new \Bonder\Collections\Map(), \Bonder\Collections\Map::fromArray($serverVars), new \Bonder\Collections\Map(), new \Bonder\Collections\Map());
     // URI VARIABLES
 }
コード例 #5
0
 /**
  * (non-PHPdoc)
  * @see Bonder.RequestFactory::createRequest()
  */
 public function createRequest(\Bonder\Collections\Map $uriVariables)
 {
     return new \Bonder\Http\MapsHttpRequest(\Bonder\Collections\Map::fromReference($_GET), \Bonder\Collections\Map::fromReference($_POST), \Bonder\Collections\Map::fromReference($_COOKIE), \Bonder\Collections\Map::fromReference($_SESSION), \Bonder\Collections\Map::fromReference($_SERVER), \Bonder\Collections\Map::fromReference($_FILES), $uriVariables);
 }
コード例 #6
0
ファイル: LauncherFactory.php プロジェクト: getbonder/bonder
 /**
  * Returns the standard filter chain provider builder.
  * 
  * @param array $resources the resources.
  * @param array $controllers the controllers.
  * @param array $filters the filters
  * 
  * @return \Bonder\Builders\StandardFilterChainProviderBuilder the builder.
  */
 public static function getStandardFCPBuilder(array $resources, array $controllers, array $filters)
 {
     $builder = new \Bonder\Builders\StandardFilterChainProviderBuilder();
     return $builder->setContext(new \Bonder\Contexts\MapContext(\Bonder\Collections\Map::fromArray($resources)))->setControllers($controllers)->setFilters($filters);
 }