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:
authorStefan Giehl <stefan@matomo.org>2020-04-23 10:43:30 +0300
committerGitHub <noreply@github.com>2020-04-23 10:43:30 +0300
commita8d917778e75346eab9509ac9707f7e6e2e6c58d (patch)
tree8259898ab33eb882e631f1f5475cd1482f70e402 /plugins/DevicesDetection
parent0cdeb6da6e4679c56aa351c004cbd6afe7843c56 (diff)
Refactores the way segments are configured in dimensions (#15836)
* Improve naming of methods for segments to rescrict access for anonymous user * Introduce new classes SegmentsList nad DimensionSegmentFactory * removes SegmentEditor\SegmentList and adds some tests * submodule updates
Diffstat (limited to 'plugins/DevicesDetection')
-rw-r--r--plugins/DevicesDetection/Columns/BrowserName.php8
-rw-r--r--plugins/DevicesDetection/Columns/Os.php8
2 files changed, 10 insertions, 6 deletions
diff --git a/plugins/DevicesDetection/Columns/BrowserName.php b/plugins/DevicesDetection/Columns/BrowserName.php
index 9a1e59ee23..58df84ba6f 100644
--- a/plugins/DevicesDetection/Columns/BrowserName.php
+++ b/plugins/DevicesDetection/Columns/BrowserName.php
@@ -9,9 +9,11 @@
namespace Piwik\Plugins\DevicesDetection\Columns;
use DeviceDetector\Parser\Client\Browser;
+use Piwik\Columns\DimensionSegmentFactory;
use Piwik\Common;
use Piwik\Metrics\Formatter;
use Piwik\Plugin\Segment;
+use Piwik\Segment\SegmentsList;
use Piwik\Tracker\Request;
use Piwik\Tracker\Visitor;
use Piwik\Tracker\Action;
@@ -26,11 +28,11 @@ class BrowserName extends Base
protected $acceptValues = 'FF, IE, CH, SF, OP etc.';
protected $type = self::TYPE_TEXT;
- protected function configureSegments()
+ public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
{
$segment = new Segment();
$segment->setName('DevicesDetection_BrowserCode');
- $this->addSegment($segment);
+ $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
$segment = new Segment();
$segment->setSegment('browserName');
@@ -52,7 +54,7 @@ class BrowserName extends Base
$segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn) {
return array_values(Browser::getAvailableBrowsers() + ['Unknown']);
});
- $this->addSegment($segment);
+ $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
}
public function formatValue($value, $idSite, Formatter $formatter)
diff --git a/plugins/DevicesDetection/Columns/Os.php b/plugins/DevicesDetection/Columns/Os.php
index 947a35490c..200f93b055 100644
--- a/plugins/DevicesDetection/Columns/Os.php
+++ b/plugins/DevicesDetection/Columns/Os.php
@@ -9,10 +9,12 @@
namespace Piwik\Plugins\DevicesDetection\Columns;
use DeviceDetector\Parser\OperatingSystem;
+use Piwik\Columns\DimensionSegmentFactory;
use Piwik\Common;
use Piwik\Metrics\Formatter;
use Piwik\Piwik;
use Piwik\Plugin\Segment;
+use Piwik\Segment\SegmentsList;
use Piwik\Tracker\Request;
use Piwik\Tracker\Settings;
use Piwik\Tracker\Visitor;
@@ -28,11 +30,11 @@ class Os extends Base
protected $acceptValues = 'WIN, LIN, MAX, AND, IOS etc.';
protected $type = self::TYPE_TEXT;
- protected function configureSegments()
+ public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
{
$segment = new Segment();
$segment->setName('DevicesDetection_OperatingSystemCode');
- $this->addSegment($segment);
+ $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
$segment = new Segment();
$segment->setSegment('operatingSystemName');
@@ -54,7 +56,7 @@ class Os extends Base
$segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn) {
return array_values(OperatingSystem::getAvailableOperatingSystems() + ['Unknown']);
});
- $this->addSegment($segment);
+ $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
}
public function formatValue($value, $idSite, Formatter $formatter)