GraphAware\Neo4j\Client\Formatter\Result::setStats PHP Method

setStats() public method

public setStats ( array $stats )
$stats array
    public function setStats(array $stats)
    {
        $this->resultSummary->setStatistics(new StatementStatistics($stats));
    }

Usage Example

 /**
  * Formats the Neo4j Response.
  *
  * @param array                                 $response
  * @param \GraphAware\Common\Cypher\Statement[] $statements
  *
  * @return ResultCollection
  *
  * @throws Neo4jException
  */
 public function format(array $response, array $statements)
 {
     if (isset($response['errors'][0])) {
         $e = new Neo4jException($response['errors'][0]['message']);
         $e->setNeo4jStatusCode($response['errors'][0]['code']);
         throw $e;
     }
     $results = new ResultCollection();
     foreach ($response['results'] as $k => $result) {
         $resultO = new Result($statements[$k]);
         $resultO->setFields($result['columns']);
         foreach ($result['data'] as $data) {
             $resultO->pushRecord($data['rest'], $data['graph']);
         }
         if (array_key_exists('stats', $result)) {
             $resultO->setStats($result['stats']);
         }
         $results->add($resultO, $statements[$k]->getTag());
     }
     return $results;
 }