original_string: public function getNodeStat(NodeInterface $node, ControllerContext $controllerContext, $statIdentifier, \DateTime $startDate, \DateTime $endDate)
      {
          $this->analytics->requireAuthentication();
          if (!isset($this->statsSettings[$statIdentifier])) {
              throw new \InvalidArgumentException(sprintf('Unknown stat identifier "%s"', $statIdentifier), 1416917316);
          }
          $statConfiguration = $this->statsSettings[$statIdentifier];
          $siteConfiguration = $this->getSiteConfigurationByNode($node);
  
          $startDateFormatted = $startDate->format('Y-m-d');
          $endDateFormatted = $endDate->format('Y-m-d');
  
          $nodeUri = $this->getLiveNodeUri($node, $controllerContext);
          $filters = 'ga:pagePath==' . $nodeUri->getPath() . ';ga:hostname==' . $nodeUri->getHost();
          $parameters = [
              'filters' => $filters
          ];
          if (isset($statConfiguration['dimensions'])) {
              $parameters['dimensions'] = $statConfiguration['dimensions'];
          }
          if (isset($statConfiguration['sort'])) {
              $parameters['sort'] = $statConfiguration['sort'];
          }
          if (isset($statConfiguration['max-results'])) {
              $parameters['max-results'] = $statConfiguration['max-results'];
          }
          $gaResult = $this->analytics->data_ga->get(
              'ga:' . $siteConfiguration->getProfileId(),
              $startDateFormatted,
              $endDateFormatted,
              $statConfiguration['metrics'],
              $parameters
          );
  
          return new DataResult($gaResult);
      }
code: public function getNodeStat(NodeInterface $node, ControllerContext $controllerContext, $statIdentifier, \DateTime $startDate, \DateTime $endDate)
      {
          $this->analytics->requireAuthentication();
          if (!isset($this->statsSettings[$statIdentifier])) {
              throw new \InvalidArgumentException(sprintf('Unknown stat identifier "%s"', $statIdentifier), 1416917316);
          }
          $statConfiguration = $this->statsSettings[$statIdentifier];
          $siteConfiguration = $this->getSiteConfigurationByNode($node);
  
          $startDateFormatted = $startDate->format('Y-m-d');
          $endDateFormatted = $endDate->format('Y-m-d');
  
          $nodeUri = $this->getLiveNodeUri($node, $controllerContext);
          $filters = 'ga:pagePath==' . $nodeUri->getPath() . ';ga:hostname==' . $nodeUri->getHost();
          $parameters = [
              'filters' => $filters
          ];
          if (isset($statConfiguration['dimensions'])) {
              $parameters['dimensions'] = $statConfiguration['dimensions'];
          }
          if (isset($statConfiguration['sort'])) {
              $parameters['sort'] = $statConfiguration['sort'];
          }
          if (isset($statConfiguration['max-results'])) {
              $parameters['max-results'] = $statConfiguration['max-results'];
          }
          $gaResult = $this->analytics->data_ga->get(
              'ga:' . $siteConfiguration->getProfileId(),
              $startDateFormatted,
              $endDateFormatted,
              $statConfiguration['metrics'],
              $parameters
          );
  
          return new DataResult($gaResult);
      }
code_tokens: public function getNodeStat ( NodeInterface $ node , ControllerContext $ controllerContext , $ statIdentifier , \ DateTime $ startDate , \ DateTime $ endDate ) { $ this -> analytics -> requireAuthentication ( ) ; if ( ! isset ( $ this -> statsSettings [ $ statIdentifier ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown stat identifier "%s"' , $ statIdentifier ) , 1416917316 ) ; } $ statConfiguration = $ this -> statsSettings [ $ statIdentifier ] ; $ siteConfiguration = $ this -> getSiteConfigurationByNode ( $ node ) ; $ startDateFormatted = $ startDate -> format ( 'Y-m-d' ) ; $ endDateFormatted = $ endDate -> format ( 'Y-m-d' ) ; $ nodeUri = $ this -> getLiveNodeUri ( $ node , $ controllerContext ) ; $ filters = 'ga:pagePath==' . $ nodeUri -> getPath ( ) . ';ga:hostname==' . $ nodeUri -> getHost ( ) ; $ parameters = [ 'filters' => $ filters ] ; if ( isset ( $ statConfiguration [ 'dimensions' ] ) ) { $ parameters [ 'dimensions' ] = $ statConfiguration [ 'dimensions' ] ; } if ( isset ( $ statConfiguration [ 'sort' ] ) ) { $ parameters [ 'sort' ] = $ statConfiguration [ 'sort' ] ; } if ( isset ( $ statConfiguration [ 'max-results' ] ) ) { $ parameters [ 'max-results' ] = $ statConfiguration [ 'max-results' ] ; } $ gaResult = $ this -> analytics -> data_ga -> get ( 'ga:' . $ siteConfiguration -> getProfileId ( ) , $ startDateFormatted , $ endDateFormatted , $ statConfiguration [ 'metrics' ] , $ parameters ) ; return new DataResult ( $ gaResult ) ; }
docstring: Get metrics and dimension values for a configured stat
  
  TODO Catch "(403) Access Not Configured" (e.g. IP does not match)
  
  @param NodeInterface $node
  @param ControllerContext $controllerContext
  @param string $statIdentifier
  @param \DateTime $startDate
  @param \DateTime $endDate
  @return DataResult
  @throws MissingConfigurationException
  @throws AnalyticsNotAvailableException
docstring_tokens: Get metrics and dimension values for a configured stat