From 9228f85b1b4f59cc88ba7c4addc258a7a5fd0ac0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 7 Feb 2014 23:40:22 +0200 Subject: [ci skip] Add return types to common and error handling functions docs --- user_guide_src/source/general/common_functions.rst | 35 ++++++++++++++-------- user_guide_src/source/general/errors.rst | 15 ++-------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'user_guide_src/source/general') diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index c466ca0b9..2ca7478ec 100644 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -16,7 +16,8 @@ loading any libraries or helpers. .. function:: is_php([$version = '5.3.0']) :param string $version: Version number - :returns: bool + :returns: TRUE if the running PHP version is at least the one specified or FALSE if not + :rtype: bool Determines of the PHP version being used is greater than the supplied version number. @@ -35,7 +36,8 @@ loading any libraries or helpers. .. function:: is_really_writable($file) :param string $file: File path - :returns: bool + :returns: TRUE if the path is writable, FALSE if not + :rtype: bool ``is_writable()`` returns TRUE on Windows servers when you really can't write to the file as the OS reports to PHP as FALSE only if the @@ -61,7 +63,8 @@ loading any libraries or helpers. .. function:: config_item($key) :param string $key: Config item key - :returns: mixed + :returns: Configuration key value or FALSE if not found + :rtype: mixed The :doc:`Config Library <../libraries/config>` is the preferred way of accessing configuration information, however ``config_item()`` can be used @@ -73,7 +76,7 @@ loading any libraries or helpers. :param mixed $message: Error message :param int $status_code: HTTP Response status code :param string $heading: Error page heading - :returns: void + :rtype: void This function calls ``CI_Exception::show_error()``. For more info, please see the :doc:`Error Handling ` documentation. @@ -82,7 +85,7 @@ loading any libraries or helpers. :param string $page: URI string :param bool $log_error: Whether to log the error - :returns: void + :rtype: void This function calls ``CI_Exception::show_404()``. For more info, please see the :doc:`Error Handling ` documentation. @@ -91,7 +94,7 @@ loading any libraries or helpers. :param string $level: Log level: 'error', 'debug' or 'info' :param string $message: Message to log - :returns: void + :rtype: void This function is an alias for ``CI_Log::write_log()``. For more info, please see the :doc:`Error Handling ` documentation. @@ -100,7 +103,7 @@ loading any libraries or helpers. :param int $code: HTTP Reponse status code :param string $text: A custom message to set with the status code - :returns: void + :rtype: void Permits you to manually set a server status header. Example:: @@ -114,7 +117,8 @@ loading any libraries or helpers. :param string $str: Input string :param bool $url_encoded: Whether to remove URL-encoded characters as well - :returns: string + :returns: Sanitized string + :rtype: string This function prevents inserting NULL characters between ASCII characters, like Java\\0script. @@ -127,7 +131,8 @@ loading any libraries or helpers. .. function:: html_escape($var) :param mixed $var: Variable to escape (string or array) - :returns: mixed + :returns: HTML escaped string(s) + :rtype: mixed This function acts as an alias for PHP's native ``htmlspecialchars()`` function, with the advantage of being able to accept an array of strings. @@ -136,21 +141,24 @@ loading any libraries or helpers. .. function:: get_mimes() - :returns: array + :returns: An associative array of file types + :rtype: array This function returns a *reference* to the MIMEs array from *application/config/mimes.php*. .. function:: is_https() - :returns: bool + :returns: TRUE if currently using HTTP-over-SSL, FALSE if not + :rtype: bool Returns TRUE if a secure (HTTPS) connection is used and FALSE in any other case (including non-HTTP requests). .. function:: is_cli() - :returns: bool + :returns: TRUE if currently running under CLI, FALSE otherwise + :rtype: bool Returns TRUE if the application is run through the command line and FALSE if not. @@ -161,7 +169,8 @@ loading any libraries or helpers. .. function:: function_usable($function_name) :param string $function_name: Function name - :returns: bool + :returns: TRUE if the function can be used, FALSE if not + :rtype: bool Returns TRUE if a function exists and is usable, FALSE otherwise. diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 6cc8a0966..26c26bea1 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -29,15 +29,12 @@ software keep track of your scripts and the health of your application. The following functions let you generate errors: -show_error() -============ - .. function:: show_error($message, $status_code, $heading = 'An Error Was Encountered') :param mixed $message: Error message :param int $status_code: HTTP Response status code :param string $heading: Error page heading - :returns: void + :rtype: void This function will display the error message supplied to it using the following error template:: @@ -52,14 +49,11 @@ be set to ``$status_code + EXIT__AUTO_MIN``. If that value is larger than status code will be set to ``EXIT_ERROR``. You can check in *application/config/constants.php* for more detail. -show_404() -========== - .. function:: show_404($page = '', $log_error = TRUE) :param string $page: URI string :param bool $log_error: Whether to log the error - :returns: void + :rtype: void This function will display the 404 error message supplied to it using the following error template:: @@ -74,15 +68,12 @@ not found. CodeIgniter automatically logs any ``show_404()`` calls. Setting the optional second parameter to FALSE will skip logging. -log_message() -============= - .. function:: log_message($level, $message, $php_error = FALSE) :param string $level: Log level: 'error', 'debug' or 'info' :param string $message: Message to log :param bool $php_error: Whether we're logging a native PHP error message - :returns: void + :rtype: void This function lets you write messages to your log files. You must supply one of three "levels" in the first parameter, indicating what type of -- cgit v1.2.3-24-g4f1b