aboutsummaryrefslogtreecommitdiffstats
path: root/library/HTMLPurifier/Context.php
diff options
context:
space:
mode:
authorChristian Vogeley <christian.vogeley@hotmail.de>2015-01-11 16:22:59 +0100
committerChristian Vogeley <christian.vogeley@hotmail.de>2015-01-11 16:22:59 +0100
commitf0c7612bcd49d32e408e67ac1829ee891c677f7e (patch)
treed4cff4aa2d728524b631776ffffee71f42056421 /library/HTMLPurifier/Context.php
parent43f143a211c75138d09ceb89acc48ea7d5c31ca9 (diff)
parent10102ac2ac4d5b02012a9794e23656717ab05556 (diff)
downloadvolse-hubzilla-f0c7612bcd49d32e408e67ac1829ee891c677f7e.tar.gz
volse-hubzilla-f0c7612bcd49d32e408e67ac1829ee891c677f7e.tar.bz2
volse-hubzilla-f0c7612bcd49d32e408e67ac1829ee891c677f7e.zip
Merge remote-tracking branch 'upstream/master'
Conflicts: doc/html/classRedmatrix_1_1Import_1_1Import-members.html doc/html/classRedmatrix_1_1Import_1_1Import.js
Diffstat (limited to 'library/HTMLPurifier/Context.php')
-rw-r--r--library/HTMLPurifier/Context.php61
1 files changed, 37 insertions, 24 deletions
diff --git a/library/HTMLPurifier/Context.php b/library/HTMLPurifier/Context.php
index 9ddf0c547..00e509c85 100644
--- a/library/HTMLPurifier/Context.php
+++ b/library/HTMLPurifier/Context.php
@@ -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) {
- if (isset($this->_storage[$name])) {
- trigger_error("Name $name produces collision, cannot re-register",
- E_USER_ERROR);
+ public function register($name, &$ref)
+ {
+ if (array_key_exists($name, $this->_storage)) {
+ 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) {
- if (!isset($this->_storage[$name])) {
+ public function &get($name, $ignore_error = false)
+ {
+ if (!array_key_exists($name, $this->_storage)) {
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) {
- if (!isset($this->_storage[$name])) {
- trigger_error("Attempted to destroy non-existent variable $name",
- E_USER_ERROR);
+ public function destroy($name)
+ {
+ if (!array_key_exists($name, $this->_storage)) {
+ 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) {
- return isset($this->_storage[$name]);
+ public function exists($name)
+ {
+ return array_key_exists($name, $this->_storage);
}
/**
* 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