[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class ConduitAPIRequest { 4 5 protected $params; 6 private $user; 7 8 public function __construct(array $params) { 9 $this->params = $params; 10 } 11 12 public function getValue($key, $default = null) { 13 return coalesce(idx($this->params, $key), $default); 14 } 15 16 public function getAllParameters() { 17 return $this->params; 18 } 19 20 public function setUser(PhabricatorUser $user) { 21 $this->user = $user; 22 return $this; 23 } 24 25 /** 26 * Retrieve the authentic identity of the user making the request. If a 27 * method requires authentication (the default) the user object will always 28 * be available. If a method does not require authentication (i.e., overrides 29 * shouldRequireAuthentication() to return false) the user object will NEVER 30 * be available. 31 * 32 * @return PhabricatorUser Authentic user, available ONLY if the method 33 * requires authentication. 34 */ 35 public function getUser() { 36 if (!$this->user) { 37 throw new Exception( 38 'You can not access the user inside the implementation of a Conduit '. 39 'method which does not require authentication (as per '. 40 'shouldRequireAuthentication()).'); 41 } 42 return $this->user; 43 } 44 45 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |