Fix style issues

This commit is contained in:
Johannes Meyer 2021-04-08 15:31:09 +02:00
parent 3a0f6222ea
commit 53743669ec
9 changed files with 31 additions and 16 deletions

View file

@ -179,7 +179,7 @@ EOT
*
* @return array[]
*/
protected function cartesianProduct(array & $input)
protected function cartesianProduct(array &$input)
{
$results = [[]];

View file

@ -99,10 +99,10 @@ class GraphController extends MonitoringAwareController
/**
* Do all monitored object type independend actions
*
* @param MonitoredObject $monitoredObject The monitored object to render the graphs of
* @param string $checkCommand The check command of the monitored object we supply an image for
* @param string|null $obscuredCheckCommand The "real" check command (if any) of the monitored object
* we display graphs for
* @param MonitoredObject $monitoredObject The monitored object to render the graphs of
* @param string $checkCommand The check command of the monitored object we supply an image for
* @param string|null $obscuredCheckCommand The "real" check command (if any) of the monitored object
* we display graphs for
*/
protected function supplyImage(MonitoredObject $monitoredObject, $checkCommand, $obscuredCheckCommand)
{
@ -139,6 +139,7 @@ class GraphController extends MonitoringAwareController
->setShowLegend((bool) $this->graphParams['legend'])
->serveImage($this->getResponse());
// not falling through, serveImage exits
default:
throw new HttpBadRequestException('%s', $this->translate(
'Graphite Web yields more than one metric for the given filter.'

View file

@ -130,7 +130,8 @@ class CustomForm extends Form
$decorators = [];
foreach ($elementDecorators as $key => $decorator) {
if ($key === 'Zend_Form_Decorator_ViewHelper') {
$decorators['Zend_Form_Decorator_FormElements'] = $group->getDecorators()['Zend_Form_Decorator_FormElements'];
$decorators['Zend_Form_Decorator_FormElements'] =
$group->getDecorators()['Zend_Form_Decorator_FormElements'];
} else {
$decorators[$key] = (new Proxy())->setActualDecorator($decorator->setElement($element));
}

View file

@ -92,7 +92,8 @@ class GraphiteWebClient
*
* @return string
*/
public function escapeMetricPath($metricPath) {
public function escapeMetricPath($metricPath)
{
return preg_replace_callback(
'/[[\]]/',
function (array $matches) {

View file

@ -70,8 +70,12 @@ class Template
*
* @return Chart[]
*/
public function getCharts(MetricsDataSource $dataSource, MonitoredObject $monitoredObject, array $filter, array & $excludeMetrics = [])
{
public function getCharts(
MetricsDataSource $dataSource,
MonitoredObject $monitoredObject,
array $filter,
array &$excludeMetrics = []
) {
$metrics = [];
$metricsUsed = 0;
$metricsExcluded = 0;
@ -167,8 +171,12 @@ class Template
* @param string[][] $metricsCombinations
* @param string[] $currentCombination
*/
protected function combineMetrics(array & $metrics, array & $possibleCombinations, array & $metricsCombinations, array $currentCombination = [])
{
protected function combineMetrics(
array &$metrics,
array &$possibleCombinations,
array &$metricsCombinations,
array $currentCombination = []
) {
if (empty($currentCombination)) {
foreach ($metrics as $curveName => & $curveMetrics) {
foreach ($curveMetrics as $metric => & $_) {

View file

@ -144,7 +144,7 @@ class Templates
$templateName,
$path,
implode(', ', array_map(
function($option) {
function ($option) {
return "\"graph.$option\"";
},
$standalone

View file

@ -1,6 +1,7 @@
<?php
namespace Icinga\Module\Graphite\Util;
use Icinga\Authentication\Auth;
use Icinga\Security\SecurityException;

View file

@ -241,7 +241,10 @@ abstract class Graphs extends AbstractWidget
IPT::indent();
$charts = $template->getCharts(
static::getMetricsDataSource(), $this->monitoredObject, [], $excludeMetrics
static::getMetricsDataSource(),
$this->monitoredObject,
[],
$excludeMetrics
);
if (! empty($charts)) {
@ -295,8 +298,8 @@ abstract class Graphs extends AbstractWidget
$img = '<img id="graphiteImg-'
. md5((string) $imageUrl->without('cachebuster'))
. "\" src=\"$src\" data-actualimageurl=\"$imageUrl\" class=\"detach graphiteImg\" alt=\"\""
. " width=\"$this->width\" height=\"$this->height\""
. "\" src=\"$src\" data-actualimageurl=\"$imageUrl\" class=\"detach graphiteImg\""
. " alt=\"\" width=\"$this->width\" height=\"$this->height\""
. " style=\"min-width: {$this->width}px; min-height: {$this->height}px;\">";
}

View file

@ -35,7 +35,7 @@ class Service extends Graphs
{
return $url
->setParam('host.name', $this->monitoredObject->getHost()->getName())
->setParam('service.name', $this->monitoredObject->getName());
->setParam('service.name', $this->monitoredObject->getName());
}
protected function getMonitoredObjectIdentifier()