code: private function buildRevenueData(array $result, $detailed = false)
      {
          $data = [];
  
          foreach ($result as $r) {
              $data[$r['date']] = $detailed ? json_decode($r['details'], true) : $r['revenue'];
          }
  
          return $data;
      }
docs: Builds the revenue data.
  
  @param array $result
  @param bool  $detailed
  
  @return array