Skip to content

Commit

Permalink
Included @throws in API that was missing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Jul 31, 2011
1 parent 9bc3e56 commit fedadc0
Show file tree
Hide file tree
Showing 28 changed files with 46 additions and 13 deletions.
3 changes: 2 additions & 1 deletion lib/Cake/Cache/Cache.php
Expand Up @@ -145,7 +145,8 @@ public static function config($name = null, $settings = array()) {
* Finds and builds the instance of the required engine class.
*
* @param string $name Name of the config array that needs an engine instance built
* @return void
* @return boolean
* @throws CacheException
*/
protected static function _buildEngine($name) {
$config = self::$_config[$name];
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Configure/IniReader.php
Expand Up @@ -85,6 +85,7 @@ public function __construct($path, $section = null) {
* @param string $file Name of the file to read. The chosen file
* must be on the reader's path.
* @return array
* @throws ConfigureException
*/
public function read($file) {
$filename = $this->_path . $file;
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Console/Command/TestsuiteShell.php
Expand Up @@ -165,6 +165,7 @@ public function getOptionParser() {
* Initialization method installs PHPUnit and loads all plugins
*
* @return void
* @throws Exception
*/
public function initialize() {
$this->_dispatcher = new CakeTestSuiteDispatcher();
Expand Down
5 changes: 3 additions & 2 deletions lib/Cake/Console/ConsoleOptionParser.php
Expand Up @@ -442,8 +442,7 @@ public function subcommands() {
* @param string $command The subcommand to use. If this parameter is a subcommand, that has a parser,
* That parser will be used to parse $argv instead.
* @return Array array($params, $args)
* @throws InvalidArgumentException When an invalid parameter is encountered.
* RuntimeException when required arguments are not supplied.
* @throws ConsoleException When an invalid parameter is encountered.
*/
public function parse($argv, $command = null) {
if (isset($this->_subcommands[$command]) && $this->_subcommands[$command]->parser()) {
Expand Down Expand Up @@ -555,6 +554,7 @@ protected function _parseShortOption($option, $params) {
* @param string $name The name to parse.
* @param array $params The params to append the parsed value into
* @return array Params with $option added in.
* @throws ConsoleException
*/
protected function _parseOption($name, $params) {
if (!isset($this->_options[$name])) {
Expand Down Expand Up @@ -584,6 +584,7 @@ protected function _parseOption($name, $params) {
* @param string $argument The argument to append
* @param array $args The array of parsed args to append to.
* @return array Args
* @throws ConsoleException
*/
protected function _parseArg($argument, $args) {
if (empty($this->_args)) {
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Console/ShellDispatcher.php
Expand Up @@ -96,6 +96,7 @@ protected function _initConstants() {
* Defines current working environment.
*
* @return void
* @throws CakeException
*/
protected function _initEnvironment() {
if (!$this->__bootstrap()) {
Expand Down Expand Up @@ -149,6 +150,7 @@ private function __bootstrap() {
* Dispatches a CLI request
*
* @return boolean
* @throws MissingShellMethodException
*/
public function dispatch() {
$shell = $this->shiftArgs();
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Controller/Component/Auth/BaseAuthorize.php
Expand Up @@ -84,7 +84,8 @@ abstract public function authorize($user, CakeRequest $request);
* Accessor to the controller object.
*
* @param mixed $controller null to get, a controller to set.
* @return mixed.
* @return mixed
* @throws CakeException
*/
public function controller($controller = null) {
if ($controller) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Controller/Component/Auth/ControllerAuthorize.php
Expand Up @@ -41,7 +41,8 @@ class ControllerAuthorize extends BaseAuthorize {
* Get/set the controller this authorize object will be working with. Also checks that isAuthorized is implemented.
*
* @param mixed $controller null to get, a controller to set.
* @return mixed.
* @return mixed
* @throws CakeException
*/
public function controller($controller = null) {
if ($controller) {
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -385,6 +385,7 @@ public function isAuthorized($user = null, $request = null) {
* Loads the authorization objects configured.
*
* @return mixed Either null when authorize is empty, or the loaded authorization objects.
* @throws CakeException
*/
public function constructAuthorize() {
if (empty($this->authorize)) {
Expand Down Expand Up @@ -632,6 +633,7 @@ public function identify(CakeRequest $request, CakeResponse $response) {
* loads the configured authentication objects.
*
* @return mixed either null on empty authenticate value, or an array of loaded objects.
* @throws CakeException
*/
public function constructAuthenticate() {
if (empty($this->authenticate)) {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Controller/Component/PaginatorComponent.php
Expand Up @@ -104,6 +104,7 @@ public function __construct(ComponentCollection $collection, $settings = array()
* @param array $whitelist List of allowed fields for ordering. This allows you to prevent ordering
* on non-indexed, or undesirable columns.
* @return array Model query results
* @throws MissingModelException
*/
public function paginate($object = null, $scope = array(), $whitelist = array()) {
if (is_array($object)) {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -660,6 +660,7 @@ public function mapAlias($alias) {
* be the handling callback, all other arguments should be additional parameters
* for the handler.
* @return void
* @throws CakeException
*/
public function addInputType($type, $handler) {
if (!is_array($handler) || !isset($handler[0]) || !is_callable($handler[0])) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Controller/Controller.php
Expand Up @@ -451,7 +451,8 @@ public function setRequest(CakeRequest $request) {
* exists and isn't private.
*
* @param CakeRequest $request
* @return The resulting response.
* @return mixed The resulting response.
* @throws PrivateActionException, MissingActionException
*/
public function invokeAction(CakeRequest $request) {
$reflection = new ReflectionClass($this);
Expand Down
6 changes: 5 additions & 1 deletion lib/Cake/Controller/Scaffold.php
Expand Up @@ -102,6 +102,7 @@ class Scaffold {
*
* @param Controller $controller Controller to scaffold
* @param CakeRequest $request Request parameters.
* @throws MissingModelException
*/
public function __construct(Controller $controller, CakeRequest $request) {
$this->controller = $controller;
Expand Down Expand Up @@ -154,6 +155,7 @@ public function __construct(Controller $controller, CakeRequest $request) {
*
* @param CakeRequest $request Request Object for scaffolding
* @return mixed A rendered view of a row from Models database table
* @throws NotFoundException
*/
protected function _scaffoldView(CakeRequest $request) {
if ($this->controller->_beforeScaffold('view')) {
Expand Down Expand Up @@ -212,6 +214,7 @@ protected function _scaffoldForm($action = 'edit') {
* @param CakeRequest $request Request Object for scaffolding
* @param string $action add or edt
* @return mixed Success on save/update, add/edit form if data is empty or error if save or update fails
* @throws NotFoundException
*/
protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
$formAction = 'edit';
Expand Down Expand Up @@ -284,7 +287,7 @@ protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
*
* @param CareRequest $request Request for scaffolding
* @return mixed Success on delete, error if delete fails
* @throws NotFoundException
* @throws MethodNotAllowedException, NotFoundException
*/
protected function _scaffoldDelete(CakeRequest $request) {
if ($this->controller->_beforeScaffold('delete')) {
Expand Down Expand Up @@ -347,6 +350,7 @@ protected function _scaffoldError() {
*
* @param CakeRequest $request Request object for scaffolding
* @return mixed A rendered view of scaffold action, or showing the error
* @throws MissingActionException, MissingDatabaseException
*/
protected function _scaffold(CakeRequest $request) {
$db = ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Log/CakeLog.php
Expand Up @@ -103,6 +103,7 @@ public static function config($key, $config) {
*
* @param string $loggerName the plugin.className of the logger class you want to build.
* @return mixed boolean false on any failures, string of classname to use if search was successful.
* @throws CakeLogException
*/
protected static function _getLogger($loggerName) {
list($plugin, $loggerName) = pluginSplit($loggerName, true);
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Model/Datasource/CakeSession.php
Expand Up @@ -510,6 +510,7 @@ protected static function _configureSession() {
*
* @param string $handler
* @return void
* @throws CakeSessionException
*/
protected static function _getHandler($handler) {
list($plugin, $class) = pluginSplit($handler, true);
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Model/Datasource/Database/Mysql.php
Expand Up @@ -133,6 +133,7 @@ class Mysql extends DboSource {
* Connects to the database using options in the given configuration array.
*
* @return boolean True if the database could be connected, else false
* @throws MissingConnectionException
*/
public function connect() {
$config = $this->config;
Expand Down Expand Up @@ -287,6 +288,7 @@ public function getCharsetName($name) {
*
* @param Model $model Name of database table to inspect or model instance
* @return array Fields in table. Keys are name and type
* @throws CakeException
*/
public function describe(Model $model) {
$cache = parent::describe($model);
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Model/Datasource/Database/Postgres.php
Expand Up @@ -103,7 +103,8 @@ class Postgres extends DboSource {
/**
* Connects to the database using options in the given configuration array.
*
* @return True if successfully connected.
* @return boolean True if successfully connected.
* @throws MissingConnectionException
*/
public function connect() {
$config = $this->config;
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Model/Datasource/Database/Sqlite.php
Expand Up @@ -100,6 +100,7 @@ class Sqlite extends DboSource {
* Connects to the database using config['database'] as a filename.
*
* @return boolean
* @throws MissingConnectionException
*/
public function connect() {
$config = $this->config;
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Model/Datasource/Database/Sqlserver.php
Expand Up @@ -133,6 +133,7 @@ class Sqlserver extends DboSource {
* Connects to the database using options in the given configuration array.
*
* @return boolean True if the database could be connected, else false
* @throws MissingConnectionException
*/
public function connect() {
$config = $this->config;
Expand Down Expand Up @@ -200,6 +201,7 @@ public function listSources($data = null) {
*
* @param Model $model Model object to describe
* @return array Fields in table. Keys are name and type
* @throws CakeException
*/
public function describe(Model $model) {
$cache = parent::describe($model);
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Model/Model.php
Expand Up @@ -2888,6 +2888,7 @@ public function getAffectedRows() {
*
* @param string $dataSource The name of the DataSource, as defined in app/Config/database.php
* @return boolean True on success
* @throws MissingConnectionException
*/
public function setDataSource($dataSource = null) {
$oldConfig = $this->useDbConfig;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/CakeRequest.php
Expand Up @@ -384,7 +384,7 @@ public function referer($local = false) {
* @param string $name The method called
* @param array $params Array of parameters for the method call
* @return mixed
* @throws BadMethodCallException when an invalid method is called.
* @throws CakeException when an invalid method is called.
*/
public function __call($name, $params) {
if (strpos($name, 'is') === 0) {
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/Network/Email/CakeEmail.php
Expand Up @@ -471,7 +471,7 @@ protected function _setEmail($varName, $email, $name) {
* @param string $name
* @param string $throwMessage
* @return object $this
* @throws SocketExpceiton
* @throws SocketException
*/
protected function _setEmailSingle($varName, $email, $name, $throwMessage) {
$current = $this->{$varName};
Expand All @@ -490,6 +490,7 @@ protected function _setEmailSingle($varName, $email, $name, $throwMessage) {
* @param mixed $email
* @param mixed $name
* @return object $this
* @throws SocketException
*/
protected function _addEmail($varName, $email, $name) {
if (!is_array($email)) {
Expand Down Expand Up @@ -987,6 +988,7 @@ public function send($content = null) {
* @param mixed $transportConfig String to use config from EmailConfig or array with configs
* @param boolean $send Send the email or just return the instance pre-configured
* @return object Instance of CakeEmail
* @throws SocketException
*/
public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true) {
$class = __CLASS__;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/Http/HttpResponse.php
Expand Up @@ -124,7 +124,7 @@ public function isOk() {
*
* @param string $message Message to parse
* @return void
* @throw SocketException
* @throws SocketException
*/
public function parseResponse($message) {
if (!is_string($message)) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Network/Http/HttpSocket.php
Expand Up @@ -203,7 +203,7 @@ public function configProxy($host, $port = 3128, $method = null, $user = null, $
*
* @param mixed $resource Resource or false to disable the resource use
* @return void
* @throw SocketException
* @throws SocketException
*/
public function setContentResource($resource) {
if ($resource === false) {
Expand All @@ -222,6 +222,7 @@ public function setContentResource($resource) {
*
* @param mixed $request Either an URI string, or an array defining host/uri
* @return mixed false on error, HttpResponse on success
* @throws SocketException
*/
public function request($request = array()) {
$this->reset(false);
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Utility/Xml.php
Expand Up @@ -180,6 +180,7 @@ public static function fromArray($input, $options = array()) {
* @param array $data Array of data to append to the $node.
* @param string $format Either 'attribute' or 'tags'. This determines where nested keys go.
* @return void
* @throws XmlException
*/
protected static function _fromArray($dom, $node, &$data, $format) {
if (empty($data) || !is_array($data)) {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -905,6 +905,7 @@ function __nestedListItem($items, $options, $itemOptions, $tag) {
* @param mixed $configFile String with the config file (load using PhpReader) or an array with file and reader name
* @param string $path Path with config file
* @return mixed False to error or loaded configs
* @throws ConfigureException
*/
public function loadConfig($configFile, $path = null) {
if (!$path) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/TimeHelper.php
Expand Up @@ -722,7 +722,7 @@ public function format($format, $date = null, $invalid = false, $userOffset = nu
* @param string $format strftime format string.
* @param boolean $invalid flag to ignore results of fromString == false
* @param int $userOffset User's offset from GMT (in hours)
* @return string Formatted and translated date string @access public
* @return string Formatted and translated date string
*/
public function i18nFormat($date, $format = null, $invalid = false, $userOffset = null) {
$date = $this->fromString($date, $userOffset);
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/View/MediaView.php
Expand Up @@ -89,6 +89,7 @@ public function __construct($controller = null) {
* @param string $view Not used
* @param string $layout Not used
* @return mixed
* @throws NotFoundException
*/
public function render($view = null, $layout = null) {
$name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null;
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/View/ScaffoldView.php
Expand Up @@ -32,6 +32,7 @@ class ScaffoldView extends ThemeView {
*
* @param string $name name of the view file to get.
* @return string action
* @throws MissingViewException
*/
protected function _getViewFileName($name = null) {
if ($name === null) {
Expand Down

0 comments on commit fedadc0

Please sign in to comment.