Skip to content

Commit

Permalink
Fixed documentation to methods that use func_get_args().
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Aug 22, 2011
1 parent e939098 commit f7f3515
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
12 changes: 4 additions & 8 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -427,13 +427,11 @@ public function constructAuthorize() {
*
* `$this->Auth->allow('*');`
*
* @param mixed $action Controller action name or array of actions
* @param string $action Controller action name
* @param string ... etc.
* @param mixed $action,... Controller action name or array of actions
* @return void
* @link http://book.cakephp.org/view/1257/allow
*/
public function allow() {
public function allow($action) {

This comment has been minimized.

Copy link
@ceeram

ceeram Aug 30, 2011

Contributor

defining $action as param, makes it required, while you should be abe to call just allow() without arguments:

if (empty($args) || $args == array('*')) {

it will allow all methods, i dont know why the test passes for this, will check why it doesnt fail here

This comment has been minimized.

Copy link
@jrbasso

jrbasso Aug 31, 2011

Author Member

Ow! It is true. I will fix it right now. Sorry by my fault.

This comment has been minimized.

Copy link
@ADmad

ADmad Aug 31, 2011

Member

The doc block should also be updated that the function can take a string '*' as param.

This comment has been minimized.

Copy link
@ADmad

ADmad Aug 31, 2011

Member

nvm it already does mention that

$args = func_get_args();
if (empty($args) || $args == array('*')) {
$this->allowedActions = $this->_methods;
Expand All @@ -453,14 +451,12 @@ public function allow() {
* `$this->Auth->deny(array('edit', 'add'));` or
* `$this->Auth->deny('edit', 'add');`
*
* @param mixed $action Controller action name or array of actions
* @param string $action Controller action name
* @param string ... etc.
* @param mixed $action,... Controller action name or array of actions
* @return void
* @see AuthComponent::allow()
* @link http://book.cakephp.org/view/1258/deny
*/
public function deny() {
public function deny($action) {
$args = func_get_args();
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/Model.php
Expand Up @@ -2831,11 +2831,11 @@ public function isUnique($fields, $or = true) {
/**
* Returns a resultset for a given SQL statement. Custom SQL queries should be performed with this method.
*
* @param string $sql SQL statement
* @param string $sql,... SQL statement
* @return array Resultset
* @link http://book.cakephp.org/view/1027/query
*/
public function query() {
public function query($sql) {
$params = func_get_args();
$db = $this->getDataSource();
return call_user_func_array(array(&$db, 'query'), $params);
Expand Down
3 changes: 1 addition & 2 deletions lib/Cake/Network/CakeRequest.php
Expand Up @@ -667,8 +667,7 @@ public static function acceptLanguage($language = null) {
* You can write to any value, even paths/keys that do not exist, and the arrays
* will be created for you.
*
* @param string $name Dot separated name of the value to read/write
* @param mixed $value Value to write to the data array.
* @param string $name,... Dot separated name of the value to read/write
* @return mixed Either the value being read, or this so you can chain consecutive writes.
*/
public function data($name) {
Expand Down
6 changes: 2 additions & 4 deletions lib/Cake/Utility/Sanitize.php
Expand Up @@ -169,13 +169,11 @@ public static function stripAll($str) {
*
* Will remove all `<b>`, `<p>`, and `<div>` tags from the $dirty string.
*
* @param string $str String to sanitize
* @param string $tag Tag to remove (add more parameters as needed)
* @param string $str,... String to sanitize
* @return string sanitized String
*/
public static function stripTags() {
public static function stripTags($str) {
$params = func_get_args();
$str = $params[0];

for ($i = 1, $count = count($params); $i < $count; $i++) {
$str = preg_replace('/<' . $params[$i] . '\b[^>]*>/i', '', $str);
Expand Down

0 comments on commit f7f3515

Please sign in to comment.