@param Report $report

@return array
186467
public function getReport(Report $report): array
    {
        $uri = $report->getUriPath();
        $request = new Request(
            'GET',
            $uri,
            $this->getDefaultHeaders()
        );
        $response = $this->send($request);
        $halDocument = HalDeserializer::deserializeDocument((string) $response->getBody());

        return $halDocument->getData();
    }
924137
public function phploc($report = FALSE)
	{
		// Command for generating reports
		$report_cmd_parts = [
			'vendor/bin/phploc',
			'--count-tests',
			'--log-csv=build/logs/phploc.csv',
			'--log-xml=build/logs/phploc.xml',
			'src',
			'tests'
		];

		// Command for generating direct output
		$normal_cmd_parts = [
			'vendor/bin/phploc',
			'--count-tests',
			'src',
			'tests'
		];

		$cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts;

		$this->_run($cmd_parts);
	}
679392
public function get($reportId, array $params = array())
    {
        $endpoint = '/admin/reports/'.$reportId.'.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createObject(Report::class, $response['report']);
    }
1026900
public function getByPivot($pivot)
    {
        $result = [];
        foreach ($this->added as $entry) {
            if (!isset($entry[$pivot])) {
                throw new InvalidArgumentException("Invalid pivot given: '$pivot'.");
            }
            if (isset($result[$entry[$pivot]])) {
                $result[$entry[$pivot]]++;
            } else {
                $result[$entry[$pivot]] = 1;
            }
        }
        foreach ($this->removed as $entry) {
            if (!isset($entry[$pivot])) {
                throw new InvalidArgumentException("Invalid pivot given: '$pivot'.");
            }
            if (isset($result[$entry[$pivot]])) {
                $result[$entry[$pivot]]--;
                if ($result[$entry[$pivot]] === 0) {
                    unset($result[$entry[$pivot]]);
                }
            } else {
                $result[$entry[$pivot]] = -1;
            }
        }
        return $result;
    }
147142
def get_report_data(self, report):
        
        ar = report.getAnalysisRequest()
        attachments = map(self.get_attachment_data, ar.getAttachment())
        pdf = self.get_pdf(report)
        filesize = "{} Kb".format(self.get_filesize(pdf))
        filename = "{}.pdf".format(ar.getId())

        return {
            "ar": ar,
            "attachments": attachments,
            "pdf": pdf,
            "obj": report,
            "uid": api.get_uid(report),
            "filesize": filesize,
            "filename": filename,
        }
231080
public function normalize(ServerDoc $doc) : array
    {
        return array_merge(
            $this->getMethodsExternalSchemaList($doc),
            $this->getMethodErrorsExternalSchemaList($doc),
            $this->getServerErrorsExtraSchemaList($doc)
        );
    }
300491
private function request(ReportRequest $reportRequest, array $options = [])
    {
        $reportDefinition = $reportRequest->getDefinition();

        if (empty($reportDefinition)) {
            throw new ReportDefinitionException(sprintf(
                'The report definition cannot be empty. Was expected XML document. You can build it with builder %s.',
                ReportDefinitionBuilder::class
            ));
        }

        $request = new Request(
            'POST',
            $this->user->resolveWsdl(self::ENDPOINT),
            $this->buildRequestHeaders($reportRequest),
            $reportDefinition
        );
        $invoker = $this->user->getInvoker();

        return $invoker(function () use ($request, $options, $reportRequest) {
            $this->lastRequest = $request;

            $event = new PreCallEvent('Reports:request', [$reportRequest], $this->user);
            $this->dispatcher->dispatch(Events::BEFORE_REQUEST, $event);

            $response = $this->httpClient->send($request, $options + [
                RequestOptions::HTTP_ERRORS => false,
            ]);
            $this->lastResponse = $response;

            if ($response->getStatusCode() >= 200 && $response->getStatusCode() <= 202) {
                $event = new PostCallEvent(
                    'Reports:request',
                    [$reportRequest],
                    $this->user,
                    $this,
                    $response->getBody()
                );
                $this->dispatcher->dispatch(Events::AFTER_REQUEST, $event);

                return $response;
            }

            $exception = $this->createException($response);

            $event = new FailCallEvent('Reports:request', [$reportRequest], $this->user, $this, $exception);
            $this->dispatcher->dispatch(Events::FAIL_REQUEST, $event);

            throw $exception;
        });
    }
1348411
public function attribute($attribute, Report $report=null) {
		if(is_string($attribute))
			$attribute = explode('.', $attribute);

		$next = array_shift($attribute);
		if(!isset($this->attributes[$next]))
			$this->attributes[$next] = new static;

		if($report !== null) {
			if(count($attribute) == 0)
				$this->attributes[$next] = $report;
			else
				$this->attributes[$next]->attribute($attribute, $report);
			return $this;
		}
		else {
			if(count($attribute) == 0)
				return $this->attributes[$next];
			else
				return $this->attributes[$next]->attribute($attribute);
		}
	}
1096239
public static function render(common_report_Report $report) {
        
        $stack = new SplStack();
        $renderingStack = new SplStack();
        $traversed = array();
        
        $stack->push($report);
        $nesting = 0;
        
        while ($stack->count() > 0) {
            
            $current = $stack->pop();
            
            if (in_array($current, $traversed, true) === false && $current->hasChildren() === true) {
                $nesting++;
                // -- Hierarchical report, 1st pass (descending).
                
                // Repush report for a 2ndpass.
                $stack->push($current);
                
                // Tag as already traversed.
                $traversed[] = $current;
                
                // Push the children for a 1st pass.
                foreach ($current as $child) {
                    $stack->push($child);
                }
            }
            else if (in_array($current, $traversed, true) === true && $current->hasChildren() === true) {
                $nesting--;
                // -- Hierachical report, 2nd pass (ascending).
                
                // Get the nested renderings of the current report.
                $children = array();
                foreach ($current as $child) {
                    $children[] = $renderingStack->pop();
                }
                
                $renderingStack->push(self::renderReport($current, $children, $nesting));
            }
            else {
                // -- Leaf report, 1st & single pass.
                $renderingStack->push(self::renderReport($current, array(), $nesting, true));
            }
        }
        
        return $renderingStack->pop();
    }
893224
public function transformNews($news)
    {
        $articles = [];

        if (!is_array($news)) {
            $news = [$news];
        }

        foreach ($news as $item) {
            $articles[] = [
                'title'       => $item->get('title'),
                'description' => $item->get('description'),
                'url'         => $item->get('url'),
                'picurl'      => $item->get('pic_url'),
                'btntxt'      => $item->get('btntxt'),
            ];
        }

        return ['msgtype' => 'news', 'news' => ['articles' => $articles]];
    }
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,
        ]);
    }
930674
public function setReports($reports)
    {
        $this->_reports = array();
        $token          = ' ,;';
        $report         = strtok($reports, $token);

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

    }
36737
public function renderReport(Report $report)
    {
        foreach ($report->getRuleViolations() as $violation) {
            $fileName = $violation->getFileName();
            $this->cache->remove($fileName, null);
        }
    }
731554
protected function getOptions()
    {
        $options = parent::getOptions();

        // Add --report flag.
        $options[] = array(
            'report',
            null,
            InputOption::VALUE_REQUIRED,
            'Print either the "full", "xml", "checkstyle", "csv", "json", "emacs", "source", "summary", "svnblame",
"gitblame", "hgblame" or "notifysend" report (the "full" report is printed by default).',
        );

        // Add --report-file flag.
        $options[] = array(
            'report-file',
            null,
            InputOption::VALUE_REQUIRED,
            'Write the report to the specified file path.',
        );

        // Add --tab-width flag.
        $options[] = array(
            'tab-width',
            null,
            InputOption::VALUE_REQUIRED,
            'Set the number of spaces which should be substituted for each tab when sniffing.',
            4
        );

        return $options;
    }
524948
public function transform(AuditEvent $auditEvent): array
    {
        return array(
            'id'          => $auditEvent->getId(),
            'reported_at' => $auditEvent->getReportedAt()->format(\DateTime::ISO8601),
            'level'       => (int) $auditEvent->getLevel(),
            'namespace'   => $auditEvent->getNamespace(),
            'message'     => $auditEvent->getMessage(),
            'backtrace'   => $auditEvent->getBackTrace(),
            'user'        => $auditEvent->getUser(),
            'server'      => $auditEvent->getServer(),
            'command'     => $auditEvent->getCommand(),
            'origin'      => $auditEvent->getOrigin(),
            'category'    => (int) $auditEvent->getCategory(),
            'env'         => $auditEvent->getEnv(),
            'context'     => $auditEvent->getContext(),
        );
    }
512814
public function update(Report &$report)
    {
        $data = $report->exportData();
        $endpoint = '/admin/reports/'.$report->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'report' => $data
            )
        );
        $report->setData($response['report']);
    }
118832
public function prepareUpdateData($document): array
    {
        $script = [];
        $body = [];

        $changeSet = $this->dm->getUnitOfWork()->getDocumentChangeSet($document);
        $class = $this->dm->getClassMetadata(get_class($document));
        $typeManager = $this->dm->getTypeManager();

        foreach ($changeSet as $name => $value) {
            $field = $class->getField($name);
            $type = $typeManager->getType($field->type);

            if ($field->multiple) {
                $body[$field->fieldName] = array_map(function ($item) use ($type, $field) {
                    return $type->toDatabase($item, $field->options);
                }, (array) $value[1]);
            } elseif (null !== $value[1]) {
                $body[$field->fieldName] = $type->toDatabase($value[1], $field->options);
            } else {
                $script[] = 'ctx._source.remove(\''.str_replace('\'', '\\\'', $field->fieldName).'\')';
            }
        }

        return [
            'body' => $body,
            'script' => implode('; ', $script),
        ];
    }