Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-08-06 14:54:34 +0300
committerdiosmosis <benaka@piwik.pro>2015-08-07 17:15:43 +0300
commit2f91d3c83a834b0e451d3e58fa246ef0a87740fb (patch)
tree4c650ff22651921af10f84344557bf78106f4952 /core/Tracker/Visit/VisitProperties.php
parent0f67ba1ae63db2ccef642ef215002379c3ee8bfe (diff)
Add public methods to VisitProperties for property access and use instead of direct access.
Diffstat (limited to 'core/Tracker/Visit/VisitProperties.php')
-rw-r--r--core/Tracker/Visit/VisitProperties.php54
1 files changed, 51 insertions, 3 deletions
diff --git a/core/Tracker/Visit/VisitProperties.php b/core/Tracker/Visit/VisitProperties.php
index 7cc5133de7..30b3168f4c 100644
--- a/core/Tracker/Visit/VisitProperties.php
+++ b/core/Tracker/Visit/VisitProperties.php
@@ -10,8 +10,6 @@ namespace Piwik\Tracker\Visit;
/**
* Holds temporary data for tracking requests.
- *
- * RequestProcessors
*/
class VisitProperties
{
@@ -21,7 +19,7 @@ class VisitProperties
*
* @var array
*/
- public $visitorInfo = array();
+ private $visitInfo = array();
/**
* Stores plugin specific tracking request metadata. RequestProcessors can store
@@ -55,4 +53,54 @@ class VisitProperties
{
return @$this->requestMetadata[$pluginName][$key];
}
+
+ /**
+ * Returns a visit property, or `null` if none is set.
+ *
+ * @param string $name The property name.
+ * @return mixed
+ */
+ public function getProperty($name)
+ {
+ return isset($this->visitInfo[$name]) ? $this->visitInfo[$name] : null;
+ }
+
+ /**
+ * Returns all visit properties by reference.
+ *
+ * @return array
+ */
+ public function &getProperties()
+ {
+ return $this->visitInfo;
+ }
+
+ /**
+ * Sets a visit property.
+ *
+ * @param string $name The property name.
+ * @param mixed $value The property value.
+ */
+ public function setProperty($name, $value)
+ {
+ $this->visitInfo[$name] = $value;
+ }
+
+ /**
+ * Unsets all visit properties.
+ */
+ public function clearProperties()
+ {
+ $this->visitInfo = array();
+ }
+
+ /**
+ * Sets all visit properties.
+ *
+ * @param array $properties
+ */
+ public function setProperties($properties)
+ {
+ $this->visitInfo = $properties;
+ }
}