1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-30 19:00:10 +02:00

PSR-2 reformatting PHPDoc corrections

With minor corrections.

Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Marcus Bointon
2013-07-16 13:56:14 +02:00
committed by Edward Z. Yang
parent 19eee14899
commit fac747bdbd
433 changed files with 13302 additions and 6690 deletions

View File

@@ -12,18 +12,22 @@ class HTMLPurifier_Context
/**
* Private array that stores the references.
* @type array
*/
private $_storage = array();
/**
* Registers a variable into the context.
* @param $name String name
* @param $ref Reference to variable to be registered
* @param string $name String name
* @param mixed $ref Reference to variable to be registered
*/
public function register($name, &$ref) {
public function register($name, &$ref)
{
if (isset($this->_storage[$name])) {
trigger_error("Name $name produces collision, cannot re-register",
E_USER_ERROR);
trigger_error(
"Name $name produces collision, cannot re-register",
E_USER_ERROR
);
return;
}
$this->_storage[$name] =& $ref;
@@ -31,14 +35,18 @@ class HTMLPurifier_Context
/**
* Retrieves a variable reference from the context.
* @param $name String name
* @param $ignore_error Boolean whether or not to ignore error
* @param string $name String name
* @param bool $ignore_error Boolean whether or not to ignore error
* @return mixed
*/
public function &get($name, $ignore_error = false) {
public function &get($name, $ignore_error = false)
{
if (!isset($this->_storage[$name])) {
if (!$ignore_error) {
trigger_error("Attempted to retrieve non-existent variable $name",
E_USER_ERROR);
trigger_error(
"Attempted to retrieve non-existent variable $name",
E_USER_ERROR
);
}
$var = null; // so we can return by reference
return $var;
@@ -47,13 +55,16 @@ class HTMLPurifier_Context
}
/**
* Destorys a variable in the context.
* @param $name String name
* Destroys a variable in the context.
* @param string $name String name
*/
public function destroy($name) {
public function destroy($name)
{
if (!isset($this->_storage[$name])) {
trigger_error("Attempted to destroy non-existent variable $name",
E_USER_ERROR);
trigger_error(
"Attempted to destroy non-existent variable $name",
E_USER_ERROR
);
return;
}
unset($this->_storage[$name]);
@@ -61,22 +72,24 @@ class HTMLPurifier_Context
/**
* Checks whether or not the variable exists.
* @param $name String name
* @param string $name String name
* @return bool
*/
public function exists($name) {
public function exists($name)
{
return isset($this->_storage[$name]);
}
/**
* Loads a series of variables from an associative array
* @param $context_array Assoc array of variables to load
* @param array $context_array Assoc array of variables to load
*/
public function loadArray($context_array) {
public function loadArray($context_array)
{
foreach ($context_array as $key => $discard) {
$this->register($key, $context_array[$key]);
}
}
}
// vim: et sw=4 sts=4