Skip to content

Commit

Permalink
documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
stwalkerster committed Jun 1, 2015
1 parent 9a3798e commit 80cc313
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 12 deletions.
20 changes: 12 additions & 8 deletions LogClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class LogPage

/**
* @param integer $logListCount
* @param integer $count
* @param integer $offset
* @param integer $limit
*/
private function createPager($offset, $limit, $logListCount, $count)
{
Expand Down Expand Up @@ -57,12 +60,13 @@ private function createPager($offset, $limit, $logListCount, $count)
$pager = substr($pager, 0, -3);
return $pager;
}


// FIXME: boolean value called count?
/**
* Summary of getLog
* @param mixed $offset
* @param mixed $limit Accepts number or "infinity"
* @param mixed $count
* @param integer $offset
* @param integer|string $limit Accepts number or "infinity"
* @param boolean $count
* @return PdoStatement
*/
private function getLog($offset = 0, $limit = 100, $count = false)
Expand Down Expand Up @@ -134,7 +138,7 @@ private function swapUrlParams($limit, $offset)
* Summary of showListLog
* @param mixed $offset
* @param mixed $limit
* @return mixed
* @return string|null
* @deprecated
*/
public function showListLog($offset, $limit)
Expand Down Expand Up @@ -301,9 +305,9 @@ public function showListLog($offset, $limit)

/**
* Summary of getArrayLog
* @param mixed $offset
* @param mixed $limit
* @return mixed
* @param integer $offset
* @param integer|string $limit
* @return array
* @deprecated
*/
public function getArrayLog($offset = 0, $limit = "infinity")
Expand Down
18 changes: 17 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ function doSort(array $items)
}

/**
* Parses an XFF header and client IP to find the last trusted client IP
*
* @param string $dbip The IP address the request came from
* @param string $dbproxyip The contents of the XFF header of the request
* @return string
*/
function getTrustedClientIP($dbip, $dbproxyip)
Expand All @@ -227,6 +231,12 @@ function getTrustedClientIP($dbip, $dbproxyip)
return $clientIpAddr;
}

/**
* Explodes a CIDR range into an array of addresses
*
* @param string $range A CIDR-format range
* @return array An array containing every IP address in the range
*/
function explodeCidr($range)
{
$ip_arr = explode('/', $range);
Expand All @@ -252,8 +262,9 @@ function explodeCidr($range)
}

/**
* Takes an array( "low" => "high ) values, and returns true if $needle is in at least one of them.
* Takes an array( "low" => "high" ) values, and returns true if $needle is in at least one of them.
* @param string $ip
* @param array $haystack
*/
function ipInRange($haystack, $ip)
{
Expand Down Expand Up @@ -344,6 +355,11 @@ function relativedate($input)
return $output;
}

/**
* Summary of reattachOAuthAccount
* @param User $user
* @throws TransactionException
*/
function reattachOAuthAccount(User $user)
{
global $oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal;
Expand Down
3 changes: 2 additions & 1 deletion includes/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function setDatabase(PdoDatabase $db)

/**
* Retrieves a data object by it's row ID.
* @param $id
* @param int $id
* @return DataObject|null
*/
public static function getById($id, PdoDatabase $database)
{
Expand Down
12 changes: 10 additions & 2 deletions includes/DataObjects/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function getForRequest($id, PdoDatabase $database = null)
public function save()
{
if ($this->isNew) {
// insert
// insert
$statement = $this->dbObject->prepare("INSERT INTO comment ( time, user, comment, visibility, request ) VALUES ( CURRENT_TIMESTAMP(), :user, :comment, :visibility, :request );");
$statement->bindValue(":user", $this->user);
$statement->bindValue(":comment", $this->comment);
Expand All @@ -63,7 +63,7 @@ public function save()
}
}
else {
// update
// update
$statement = $this->dbObject->prepare("UPDATE comment SET comment = :comment, visibility = :visibility WHERE id = :id LIMIT 1;");
$statement->bindValue(":id", $this->id);
$statement->bindValue(":comment", $this->comment);
Expand All @@ -85,6 +85,10 @@ public function getUser()
return $this->user;
}

/**
* Summary of getUserObject
* @return User|null
*/
public function getUserObject()
{
return User::getById($this->user, $this->dbObject);
Expand Down Expand Up @@ -120,6 +124,10 @@ public function getRequest()
return $this->request;
}

/**
* Summary of getRequestObject
* @return Request|null
*/
public function getRequestObject()
{
return Request::getById($this->request, $this->dbObject);
Expand Down
16 changes: 16 additions & 0 deletions includes/DataObjects/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function getObjectId()
return $this->objectid;
}

/**
* Summary of setObjectId
* @param int $objectid
*/
public function setObjectId($objectid)
{
$this->objectid = $objectid;
Expand All @@ -65,6 +69,10 @@ public function getObjectType()
return $this->objecttype;
}

/**
* Summary of setObjectType
* @param string $objecttype
*/
public function setObjectType($objecttype)
{
$this->objecttype = $objecttype;
Expand Down Expand Up @@ -94,6 +102,10 @@ public function getAction()
return $this->action;
}

/**
* Summary of setAction
* @param string $action
*/
public function setAction($action)
{
$this->action = $action;
Expand All @@ -109,6 +121,10 @@ public function getComment()
return $this->comment;
}

/**
* Summary of setComment
* @param string $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
Expand Down
8 changes: 8 additions & 0 deletions includes/Helpers/MockBanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

class MockBanHelper implements IBanHelper
{
/**
* Summary of $result
* @var Ban|boolean
*/
private $result = false;

/**
* Summary of setResult
* @param Ban|boolean $result
*/
public function setResult($result)
{
$this->result = $result;
Expand Down
14 changes: 14 additions & 0 deletions includes/PdoDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public function hasActiveTransaction()
return $this->hasActiveTransaction;
}

/**
* Summary of beginTransaction
* @return bool
*/
public function beginTransaction()
{
// Override the pre-existing method, which doesn't stop you from
Expand Down Expand Up @@ -98,6 +102,10 @@ public function rollBack()
$this->hasActiveTransaction = false;
}

/**
* Summary of transactionally
* @param Closure $method
*/
public function transactionally($method)
{
if (!$this->beginTransaction()) {
Expand Down Expand Up @@ -128,6 +136,12 @@ public function transactionally($method)
}
}

/**
* Summary of prepare
* @param string $statement
* @param array $driver_options
* @return PDOStatement
*/
public function prepare($statement, $driver_options = array())
{
global $enableQueryLog;
Expand Down

0 comments on commit 80cc313

Please sign in to comment.