diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-10-02 14:33:09 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-10-02 14:33:09 +0300 |
commit | 5fcd9f15d478b32b4abd0242c712876ab13f3bad (patch) | |
tree | aa7a7d33a7018a670ef1f6131770ae06bd474ed5 /plugins/API | |
parent | ca85d28c8857296e0c2aeab5dede7eee2ab65db8 (diff) |
Fix System tests
Diffstat (limited to 'plugins/API')
-rw-r--r-- | plugins/API/API.php | 6 | ||||
-rw-r--r-- | plugins/API/Glossary.php | 16 |
2 files changed, 12 insertions, 10 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php index d320306a61..809c94fa13 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -564,8 +564,7 @@ class API extends \Piwik\Plugin\API public function getGlossaryReports($idSite) { $glossary = StaticContainer::get('Piwik\Plugins\API\Glossary'); - $glossary->setIdSite($idSite); - return $glossary->reportsGlossary(); + return $glossary->reportsGlossary($idSite); } /** @@ -577,8 +576,7 @@ class API extends \Piwik\Plugin\API public function getGlossaryMetrics($idSite) { $glossary = StaticContainer::get('Piwik\Plugins\API\Glossary'); - $glossary->setIdSite($idSite); - return $glossary->metricsGlossary(); + return $glossary->metricsGlossary($idSite); } /** diff --git a/plugins/API/Glossary.php b/plugins/API/Glossary.php index df42a3d145..c6e15a25b1 100644 --- a/plugins/API/Glossary.php +++ b/plugins/API/Glossary.php @@ -13,15 +13,17 @@ class Glossary { protected $metadata = array(); - public function setIdSite($idSite) + public function __construct(API $api) { - $this->metadata = API::getInstance()->getReportMetadata($idSite); + $this->api = $api; } - public function reportsGlossary() + public function reportsGlossary($idSite) { + $metadata = $this->api->getReportMetadata($idSite); + $reports = array(); - foreach ($this->metadata as $report) { + foreach ($metadata as $report) { if (isset($report['documentation'])) { $reports[] = array( 'name' => sprintf("%s (%s)", $report['name'], $report['category']), @@ -37,10 +39,12 @@ class Glossary return $reports; } - public function metricsGlossary() + public function metricsGlossary($idSite) { + $metadata = $this->api->getReportMetadata($idSite); + $metrics = array(); - foreach ($this->metadata as $report) { + foreach ($metadata as $report) { if (!isset($report['metricsDocumentation'])) { continue; } |