original_string: protected function renderReport($apiAction, $controllerAction = false)
      {
          if (empty($controllerAction) && is_string($apiAction)) {
              $report = ReportsProvider::factory($this->pluginName, $apiAction);
  
              if (!empty($report)) {
                  $apiAction = $report;
              }
          }
  
          if ($apiAction instanceof Report) {
              $this->checkSitePermission();
              $apiAction->checkIsEnabled();
  
              return $apiAction->render();
          }
  
          $pluginName = $this->pluginName;
  
          /** @var Proxy $apiProxy */
          $apiProxy = Proxy::getInstance();
  
          if (!$apiProxy->isExistingApiAction($pluginName, $apiAction)) {
              throw new \Exception("Invalid action name '$apiAction' for '$pluginName' plugin.");
          }
  
          $apiAction = $apiProxy->buildApiActionName($pluginName, $apiAction);
  
          if ($controllerAction !== false) {
              $controllerAction = $pluginName . '.' . $controllerAction;
          }
  
          $view      = ViewDataTableFactory::build(null, $apiAction, $controllerAction);
          $rendered  = $view->render();
  
          return $rendered;
      }
code: protected function renderReport($apiAction, $controllerAction = false)
      {
          if (empty($controllerAction) && is_string($apiAction)) {
              $report = ReportsProvider::factory($this->pluginName, $apiAction);
  
              if (!empty($report)) {
                  $apiAction = $report;
              }
          }
  
          if ($apiAction instanceof Report) {
              $this->checkSitePermission();
              $apiAction->checkIsEnabled();
  
              return $apiAction->render();
          }
  
          $pluginName = $this->pluginName;
  
          /** @var Proxy $apiProxy */
          $apiProxy = Proxy::getInstance();
  
          if (!$apiProxy->isExistingApiAction($pluginName, $apiAction)) {
              throw new \Exception("Invalid action name '$apiAction' for '$pluginName' plugin.");
          }
  
          $apiAction = $apiProxy->buildApiActionName($pluginName, $apiAction);
  
          if ($controllerAction !== false) {
              $controllerAction = $pluginName . '.' . $controllerAction;
          }
  
          $view      = ViewDataTableFactory::build(null, $apiAction, $controllerAction);
          $rendered  = $view->render();
  
          return $rendered;
      }
code_tokens: protected function renderReport ( $ apiAction , $ controllerAction = false ) { if ( empty ( $ controllerAction ) && is_string ( $ apiAction ) ) { $ report = ReportsProvider :: factory ( $ this -> pluginName , $ apiAction ) ; if ( ! empty ( $ report ) ) { $ apiAction = $ report ; } } if ( $ apiAction instanceof Report ) { $ this -> checkSitePermission ( ) ; $ apiAction -> checkIsEnabled ( ) ; return $ apiAction -> render ( ) ; } $ pluginName = $ this -> pluginName ; /** @var Proxy $apiProxy */ $ apiProxy = Proxy :: getInstance ( ) ; if ( ! $ apiProxy -> isExistingApiAction ( $ pluginName , $ apiAction ) ) { throw new \ Exception ( "Invalid action name '$apiAction' for '$pluginName' plugin." ) ; } $ apiAction = $ apiProxy -> buildApiActionName ( $ pluginName , $ apiAction ) ; if ( $ controllerAction !== false ) { $ controllerAction = $ pluginName . '.' . $ controllerAction ; } $ view = ViewDataTableFactory :: build ( null , $ apiAction , $ controllerAction ) ; $ rendered = $ view -> render ( ) ; return $ rendered ; }
docstring: Convenience method that creates and renders a ViewDataTable for a API method.
  
  @param string|\Piwik\Plugin\Report $apiAction The name of the API action (eg, `'getResolution'`) or
  an instance of an report.
  @param bool $controllerAction The name of the Controller action name  that is rendering the report. Defaults
  to the `$apiAction`.
  @param bool $fetch If `true`, the rendered string is returned, if `false` it is `echo`'d.
  @throws \Exception if `$pluginName` is not an existing plugin or if `$apiAction` is not an
  existing method of the plugin's API.
  @return string|void See `$fetch`.
  @api
docstring_tokens: Convenience method that creates and renders a ViewDataTable for a API method .