* tsp-info parts added
This commit is contained in:
@@ -31,7 +31,7 @@ class JcatInfoCollectorService
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function getTrFlow()
|
||||
public function getTrFlowErrors()
|
||||
{
|
||||
/** @var Config $kanbanBoardUriParams */
|
||||
$trFlowUri = $this->config->get('url.jcatTrFlow');
|
||||
@@ -47,8 +47,13 @@ class JcatInfoCollectorService
|
||||
return $this->parseFlowHtmlResult($response->getBody());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $html
|
||||
* @return array
|
||||
*/
|
||||
private function parseFlowHtmlResult(string $html)
|
||||
{
|
||||
$teamMembers = $this->config->get('team.members')->toArray();
|
||||
$xmlErrorHandling = libxml_use_internal_errors(TRUE);
|
||||
$domDocument = new \DOMDocument();
|
||||
$domDocument->loadHTML($html);
|
||||
@@ -62,9 +67,21 @@ class JcatInfoCollectorService
|
||||
$result = [];
|
||||
/** @var \DOMElement $element */
|
||||
foreach ($elements as $element) {
|
||||
$result[] = trim($element->nodeValue);
|
||||
/** @var \DOMNodeList $ownerElements */
|
||||
$ownerElements = $documentXpath->query('./td[6]', $element->parentNode);
|
||||
$owner = strtolower(trim($ownerElements->item(0)->nodeValue));
|
||||
if (in_array($owner, $teamMembers)) {
|
||||
$result[] = trim($element->nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
return array_count_values($result);
|
||||
$errorsCounted = array_count_values($result);
|
||||
|
||||
return array_map(function($type, $count) {
|
||||
return [
|
||||
'label' => $type,
|
||||
'value' => $count,
|
||||
];
|
||||
}, array_keys($errorsCounted), $errorsCounted);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user