/**
  * Execute the controller.
  *
  * @return  boolean
  *
  * @since   1.0
  */
 public function execute()
 {
     // Check if we are allowed to receive the raw data
     $authorizedRaw = $this->getInput()->server->getString('HTTP_JOOMLA_RAW', 'fail') === $this->getApplication()->get('stats.rawdata', false);
     // Check if a single data source is requested
     $source = $this->getInput()->getString('source');
     $this->view->isAuthorizedRaw($authorizedRaw);
     $this->view->setSource($source);
     $this->getApplication()->setBody($this->view->render());
     return true;
 }
 /**
  * @testdox The data source is set to the view
  *
  * @covers  Stats\Views\Stats\StatsJsonView::setSource
  */
 public function testTheDataSourceIsSetToTheView()
 {
     $mockModel = $this->getMockBuilder('Stats\\Models\\StatsModel')->disableOriginalConstructor()->getMock();
     $source = 'php_version';
     $view = new StatsJsonView($mockModel);
     $view->setSource('php_version');
     $this->assertAttributeSame($source, 'source', $view);
 }