Skip to content
Snippets Groups Projects
Commit 57a55b78 authored by Benjamin Ledel's avatar Benjamin Ledel
Browse files

* init

parent bd29c35f
No related branches found
No related tags found
No related merge requests found
......@@ -25,10 +25,23 @@ class PolarisDashboardHelper
return $response->token;
}
public function fetchDashboardResult($visualisation_token)
public function fetchDashboardResult($visualisation_token, $asDot = false)
{
$response = $this->getRequest("/api/v1/provider/result",$visualisation_token);
return $response;
$analytics_engine_result = $this->getRequest("/api/v1/provider/result",$visualisation_token);
if($asDot)
{
$ritit = new RecursiveIteratorIterator(new RecursiveArrayIterator($analytics_engine_result));
$result = array();
foreach ($ritit as $leafValue) {
$keys = array();
foreach (range(0, $ritit->getDepth()) as $depth) {
$keys[] = $ritit->getSubIterator($depth)->key();
}
$result[ join('.', $keys) ] = $leafValue;
}
return $result;
}
return $analytics_engine_result;
}
function getRequest($url,$visualisation_token)
......
......@@ -20,8 +20,8 @@ class PolarisDashboardHelperTest
public function testFetchAnalyticsResult($visualisationToken)
{
$result = $this->helper->fetchDashboardResult($visualisationToken);
print_r($result);
$analytics_engine_result = $this->helper->fetchDashboardResult($visualisationToken,true);
print_r($analytics_engine_result);
}
public function testFetchVisualisationTokenWithContext($user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment