This function handles the addressbook-query REPORT.

This report is used by the client to filter an addressbook based on a
complex query.

@param Xml\Request\AddressBookQueryReport $report
435635
protected function addressbookQueryReport($report)
    {
        $depth = $this->server->getHTTPDepth(0);

        if (0 == $depth) {
            $candidateNodes = [
                $this->server->tree->getNodeForPath($this->server->getRequestUri()),
            ];
            if (!$candidateNodes[0] instanceof ICard) {
                throw new ReportNotSupported('The addressbook-query report is not supported on this url with Depth: 0');
            }
        } else {
            $candidateNodes = $this->server->tree->getChildren($this->server->getRequestUri());
        }

        $contentType = $report->contentType;
        if ($report->version) {
            $contentType .= '; version='.$report->version;
        }

        $vcardType = $this->negotiateVCard(
            $contentType
        );

        $validNodes = [];
        foreach ($candidateNodes as $node) {
            if (!$node instanceof ICard) {
                continue;
            }

            $blob = $node->get();
            if (is_resource($blob)) {
                $blob = stream_get_contents($blob);
            }

            if (!$this->validateFilters($blob, $report->filters, $report->test)) {
                continue;
            }

            $validNodes[] = $node;

            if ($report->limit && $report->limit <= count($validNodes)) {
                // We hit the maximum number of items, we can stop now.
                break;
            }
        }

        $result = [];
        foreach ($validNodes as $validNode) {
            if (0 == $depth) {
                $href = $this->server->getRequestUri();
            } else {
                $href = $this->server->getRequestUri().'/'.$validNode->getName();
            }

            list($props) = $this->server->getPropertiesForPath($href, $report->properties, 0);

            if (isset($props[200]['{'.self::NS_CARDDAV.'}address-data'])) {
                $props[200]['{'.self::NS_CARDDAV.'}address-data'] = $this->convertVCard(
                    $props[200]['{'.self::NS_CARDDAV.'}address-data'],
                    $vcardType,
                    $report->addressDataProperties
                );
            }
            $result[] = $props;
        }

        $prefer = $this->server->getHTTPPrefer();

        $this->server->httpResponse->setStatus(207);
        $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
        $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
        $this->server->httpResponse->setBody($this->server->generateMultiStatus($result, 'minimal' === $prefer['return']));
    }
506687
@Override
    public Iterable<TableReportEntry> getReportEntries(String reportId, final AllTablesReportQuery query) {
        checkNotNull(reportId, "reportId");

        final String reportTable = getTableName(reportId);

        // Set up several filters based on the query attributes

        final Predicate<String> placementFilter = query.getPlacements().isEmpty()
                ? Predicates.<String>alwaysTrue()
                : Predicates.in(query.getPlacements());

        final Predicate<Boolean> droppedFilter = query.isIncludeDropped()
                ? Predicates.<Boolean>alwaysTrue()
                : Predicates.equalTo(false);

        final Predicate<Boolean> facadeFilter = query.isIncludeFacades()
                ? Predicates.<Boolean>alwaysTrue()
                : Predicates.equalTo(false);

        return new Iterable<TableReportEntry>() {
            @Override
            public Iterator<TableReportEntry> iterator() {
                return Iterators.limit(
                        Iterators.filter(
                                Iterators.transform(
                                        queryDataStoreForTableReportResults(reportTable, query),
                                        new Function<Map<String, Object>, TableReportEntry>() {
                                            @Nullable
                                            @Override
                                            public TableReportEntry apply(Map<String, Object> map) {
                                                if (Intrinsic.getId(map).startsWith("~")) {
                                                    // Skip this row, it's the metadata
                                                    return null;
                                                }
                                                return convertToTableReportEntry(
                                                        map, placementFilter, droppedFilter, facadeFilter);
                                            }
                                        }),
                                Predicates.notNull()
                        ),
                        query.getLimit()
                );
            }
        };
    }
84272
public function Create($reportRequest, $idempotencyKey = null)
    {
        $type = $reportRequest->ReportType;

        if (is_null($type) || strlen($type) == 0)
            throw new Libraries\Exception('Report type property is required when create a report request.');

        switch ($type) {
            case ReportType::Transactions:
                return $this->CreateObject('reports_transactions_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey);
            case ReportType::Wallets:
                return $this->CreateObject('reports_wallets_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey);
            default:
                throw new Libraries\Exception('Unexpected Report type. Wrong ReportType value.');
        }
    }
479100
public function execute(IDS_Report $data) 
    {
        if (!isset($_SERVER['REQUEST_URI'])) {
            $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
            if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { 
                $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 
            } 
        }     	

        foreach ($data as $event) {
            $page = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
            $ip   = $this->ip;
            $ip2  = $this->ip2;
            
            $name   = $event->getName();
            $value  = $event->getValue();
            $impact = $event->getImpact();
            $tags   = implode(', ', $event->getTags());

            $this->statement->bindParam('name', $name);
            $this->statement->bindParam('value', $value);
            $this->statement->bindParam('page', $page);
            $this->statement->bindParam('tags', $tags);
            $this->statement->bindParam('ip', $ip);
            $this->statement->bindParam('ip2', $ip2);
            $this->statement->bindParam('impact', $impact);
            $this->statement->bindParam('origin', $_SERVER['SERVER_ADDR']);

            if (!$this->statement->execute()) {

                $info = $this->statement->errorInfo();
                throw new Exception(
                    $this->statement->errorCode() . ', ' . $info[1] . ', ' . $info[2]
                );
            }
        }

        return true;
    }
320697
public function filter(string $path, array $report) : array
    {
        $report['messages'] = isset($this->paths[$path]) ? array_intersect_key(
            $report['messages'],
            array_flip($this->paths[$path])
        ) : [];

        $errors = $warnings = $fixable = 0;

        foreach ($report['messages'] as $line) {
            foreach ($line as $messages) {
                foreach ($messages as $message) {
                    switch ($message['type']) {
                        case 'ERROR':
                            $errors++;
                            break;
                        case 'WARNING':
                            $warnings++;
                            break;
                    }

                    if ($message['fixable']) {
                        $fixable++;
                    }
                }
            }
        }

        return array_merge($report, [
            'errors' => $errors,
            'warnings' => $warnings,
            'fixable' => $fixable,
        ]);
    }
327161
public function run(JobReport $report)
    {
        $this->report = $report;
        $report->setStartTime(microtime(true));
        $this->getProcess()->start(function ($type, $buffer) use ($report) {
            if (Process::ERR === $type) {
                $report->addError($buffer);
            } else {
                $report->addOutput($buffer);
            }
        });
    }
614392
public function writeReport(Report $report): void
    {
        $xml = new \DOMDocument('1.0', 'UTF-8');

        $root = $xml->createElement('checkstyle');
        $root->setAttribute('version', APP_NAME . '-' . APP_VERSION);

        foreach ($report->getFiles() as $file) {
            $xmlFile = $xml->createElement('file');
            $xmlFile->setAttribute('name', $file->getFilename());

            foreach ($file->getIssues() as $issue) {
                $xmlWarning = $xml->createElement('error');
                $xmlWarning->setAttribute('line', "" . $issue->getLine());
                $xmlWarning->setAttribute('severity', $issue->getSeverity());
                $xmlWarning->setAttribute('message', $issue->getMessage());
                $xmlWarning->setAttribute('source', $issue->getSource());

                if ($issue->getColumn() !== null) {
                    $xmlWarning->setAttribute('column', "" . $issue->getColumn());
                }

                $xmlFile->appendChild($xmlWarning);
            }

            $root->appendChild($xmlFile);
        }

        $xml->appendChild($root);
        $xml->formatOutput = true;

        $this->output->write($xml->saveXML());
    }
1066551
private function addExternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping)
    {
        $data = $this->queryExternalReferrers(
            $idaction, $actionType, $logAggregator, $limitBeforeGrouping);

        $report['pageMetrics']['entries'] = 0;
        $report['referrers'] = array();
        foreach ($data->getRows() as $row) {
            $referrerId = $row->getColumn('label');
            $visits = $row->getColumn(Metrics::INDEX_NB_VISITS);
            if ($visits) {
                // load details (i.e. subtables)
                $details = array();
                $subTable = $row->getSubtable();
                if ($subTable) {
                    foreach ($subTable->getRows() as $subRow) {
                        $details[] = array(
                            'label'     => $subRow->getColumn('label'),
                            'referrals' => $subRow->getColumn(Metrics::INDEX_NB_VISITS)
                        );
                    }
                }
                $report['referrers'][] = array(
                    'label'     => $this->getReferrerLabel($referrerId),
                    'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeFromShortName($referrerId),
                    'visits'    => $visits,
                    'details'   => $details
                );
                $report['pageMetrics']['entries'] += $visits;
            }
        }

        // if there's no data for referrers, ResponseBuilder::handleMultiDimensionalArray
        // does not detect the multi dimensional array and the data is rendered differently, which
        // causes an exception.
        if (count($report['referrers']) == 0) {
            $report['referrers'][] = array(
                'label'     => $this->getReferrerLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
                'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
                'visits'    => 0
            );
        }
    }
1251655
public void actionRename(I_CmsReport report) {

        m_report = report;
        List locales = OpenCms.getLocaleManager().getAvailableLocales();
        List xmlPages = getXmlPages();
        if (ALL.equals(getParamLocale())) {
            Iterator i = locales.iterator();
            while (i.hasNext()) {
                Locale locale = (Locale)i.next();
                performRenameOperation(xmlPages, locale);
            }
        } else {
            performRenameOperation(xmlPages, CmsLocaleManager.getLocale(getParamLocale()));
        }
    }
983336
public function addReport(string $report_name, & $form = null, array $options = []) {
		$this->data[$report_name] = [
			'name' => $report_name,
			'options' => $options,
			'header' => [],
			'header_options' => [],
			'filter' => [],
			'data' => []
		];
		// extrace filter out of form
		if (isset($form)) {
			if (empty($options['skip_filter'])) {
				$this->data[$report_name]['filter'] = $form->generateFilter();
			}
			$this->form = & $form;
		}
	}
930674
public function setReports($reports)
    {
        $this->_reports = array();
        $token          = ' ,;';
        $report         = strtok($reports, $token);

        while ($report !== false) {
            $this->_reports[] = $reports;
            $report           = strtok($token);
        }

    }
745175
public function fetch(ReportInterface $report, array $configuration = [])
    {
        if (null === $type = $report->getDataFetcher()) {
            throw new \InvalidArgumentException('Cannot fetch data for ReportInterface instance without DataFetcher defined.');
        }

        /** @var DataFetcherInterface $dataFetcher */
        $dataFetcher = $this->registry->get($type);
        $configuration = empty($configuration) ? $report->getDataFetcherConfiguration() : $configuration;

        return $dataFetcher->fetch($configuration);
    }
792103
function RTCStatsReport (reports) {
    for (var id in reports) {
      if (reports.hasOwnProperty(id)) {
        this[id] = reports[id];
      }
    }
  }
525518
public static String getSql(Report report) {
		String sql;
		if (report.getSql() != null) {
			sql = report.getSql();
		} else {
			sql = report.getQuery().toString();
		}
		return sql;
	}
171841
public function updateTaskReport($taskId, $report)
    {
        if ($this->getPersistence()->has($taskId)) {
            $this->getPersistence()->setReport($taskId, $report);
        }
        return $this;
    }
667729
public function report(Exception $exception)
    {
        // check if we should mail this exception
        if ($this->shouldMail($exception)) {
            // if we passed our validation lets mail the exception
            $this->mailException($exception);
        }

        // run the parent report (logs exception and all that good stuff)
        $this->callParentReport($exception);
    }
731595
public function execute(IDS_Report $data) 
    {
    	// make sure request uri is set right on IIS
        if (!isset($_SERVER['REQUEST_URI'])) {
            $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
            if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { 
                $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 
            } 
        } 
        
        // make sure server address is set right on IIS
        if (isset($_SERVER['LOCAL_ADDR'])) {
            $_SERVER['SERVER_ADDR'] = $_SERVER['LOCAL_ADDR'];
        } 
    	
        foreach ($this->loggers as $logger) {
            $logger->execute($data);
        }
    }