قرینه از
https://github.com/matomo-org/matomo.git
synced 2025-08-23 23:47:37 +00:00

* [Coding Style] Enable rule PSR12.Files.FileHeader * Apply CS * Replace Piwik with Matomo in file headers * Unify file headers (position, no. of lines, https links) * Rebuild dist files * Apply CS * Fix system test that relies on line numbers in a file that had the file header updated --------- Co-authored-by: Stefan Giehl <stefan@matomo.org>
52 خطوط
1.2 KiB
PHP
52 خطوط
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Matomo - free/libre analytics platform
|
|
*
|
|
* @link https://matomo.org
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
|
*/
|
|
|
|
namespace Piwik\Plugins\SegmentEditor\Services;
|
|
|
|
use Piwik\Plugins\SegmentEditor\Model;
|
|
use Matomo\Cache\Transient as TransientCache;
|
|
|
|
/**
|
|
* Service layer class for stored segments.
|
|
*/
|
|
class StoredSegmentService
|
|
{
|
|
/**
|
|
* @var Model
|
|
*/
|
|
private $model;
|
|
|
|
/**
|
|
* @var TransientCache
|
|
*/
|
|
private $transientCache;
|
|
|
|
public function __construct(Model $model, TransientCache $transientCache)
|
|
{
|
|
$this->model = $model;
|
|
$this->transientCache = $transientCache;
|
|
}
|
|
|
|
/**
|
|
* Returns all stored segments that haven't been deleted.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getAllSegmentsAndIgnoreVisibility()
|
|
{
|
|
$cacheKey = 'SegmentEditor.getAllSegmentsAndIgnoreVisibility';
|
|
if (!$this->transientCache->contains($cacheKey)) {
|
|
$result = $this->model->getAllSegmentsAndIgnoreVisibility();
|
|
|
|
$this->transientCache->save($cacheKey, $result);
|
|
}
|
|
return $this->transientCache->fetch($cacheKey);
|
|
}
|
|
}
|