code: protected function output($aOut = [])
      {
          $oInput     = Factory::service('Input');
          $oOutput    = Factory::service('Output');
          $oHttpCodes = Factory::service('HttpCodes');
  
          //  Set cache headers
          $oOutput->set_header('Cache-Control: no-store, no-cache, must-revalidate');
          $oOutput->set_header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
          $oOutput->set_header('Pragma: no-cache');
  
          //  Set access control headers
          $oOutput->set_header('Access-Control-Allow-Origin: ' . static::ACCESS_CONTROL_ALLOW_ORIGIN);
          $oOutput->set_header('Access-Control-Allow-Headers: ' . implode(', ', static::ACCESS_CONTROL_ALLOW_HEADERS));
          $oOutput->set_header('Access-Control-Allow-Methods: ' . implode(', ', static::ACCESS_CONTROL_ALLOW_METHODS));
  
          // --------------------------------------------------------------------------
  
          //  Send the correct status header, default to 200 OK
          if ($this->bOutputSendHeader) {
              $sProtocol   = $oInput->server('SERVER_PROTOCOL');
              $iHttpCode   = getFromArray('status', $aOut, $oHttpCodes::STATUS_OK);
              $sHttpString = $oHttpCodes::getByCode($iHttpCode);
              $oOutput->set_header($sProtocol . ' ' . $iHttpCode . ' ' . $sHttpString);
          }
  
          // --------------------------------------------------------------------------
  
          //  Output content
          switch ($this->sOutputFormat) {
              case static::FORMAT_TXT:
                  $sOut = $this->outputTxt($aOut);
                  break;
  
              case static::FORMAT_JSON:
                  $sOut = $this->outputJson($aOut);
                  break;
          }
  
          $oOutput->set_output($sOut);
      }
docs: Sends $aOut to the browser in the desired format
  
  @param  array $aOut The data to output to the browser
  
  @return void