Swag: Fix swag (aka a whole bunch of code style issues..)

This commit is contained in:
Johannes Meyer 2017-01-27 14:48:59 +01:00
parent 91a315764c
commit 181e2ef05c
160 changed files with 612 additions and 515 deletions

View File

@ -26,7 +26,7 @@ class WebCommand extends Command
// TODO: Sanity check!!
if ($socket === null) {
$socket = $this->Config()->get('standalone','listen','0.0.0.0:80');
$socket = $this->Config()->get('standalone', 'listen', '0.0.0.0:80');
}
if ($documentRoot === null) {
$documentRoot = Icinga::app()->getBaseDir('public');
@ -68,7 +68,7 @@ class WebCommand extends Command
$pid = pcntl_fork();
if ($pid == -1) {
throw new IcingaException('Could not fork');
} else if ($pid) {
} elseif ($pid) {
echo $this->screen->colorize('[OK]')
. " Icinga Web server forked successfully\n";
fclose(STDIN);

View File

@ -181,7 +181,7 @@ class DashboardController extends ActionController
try {
$dashboardConfig->saveIni();
Notification::success(t('Dashlet has been removed from') . ' ' . $pane->getTitle());
} catch (Exception $e) {
} catch (Exception $e) {
$action->view->error = $e;
$action->view->config = $dashboardConfig;
$action->render('error');
@ -217,7 +217,7 @@ class DashboardController extends ActionController
try {
$dashboardConfig->saveIni();
Notification::success(t('Dashboard has been removed') . ': ' . $pane->getTitle());
} catch (Exception $e) {
} catch (Exception $e) {
$action->view->error = $e;
$action->view->config = $dashboardConfig;
$action->render('error');

View File

@ -27,7 +27,9 @@ class GroupController extends AuthBackendController
$this->assertPermission('config/authentication/groups/show');
$this->createListTabs()->activate('group/list');
$backendNames = array_map(
function ($b) { return $b->getName(); },
function ($b) {
return $b->getName();
},
$this->loadUserGroupBackends('Icinga\Data\Selectable')
);
if (empty($backendNames)) {

View File

@ -27,10 +27,7 @@ class ListController extends Controller
{
$this->getTabs()->add($action, array(
'label' => ucfirst($action),
'url' => Url::fromPath(
'list/'
. str_replace(' ', '', $action)
)
'url' => Url::fromPath('list/' . str_replace(' ', '', $action))
))->extend(new OutputFormat())->extend(new DashboardAction())->extend(new MenuAction())->activate($action);
}

View File

@ -27,7 +27,9 @@ class UserController extends AuthBackendController
$this->assertPermission('config/authentication/users/show');
$this->createListTabs()->activate('user/list');
$backendNames = array_map(
function ($b) { return $b->getName(); },
function ($b) {
return $b->getName();
},
$this->loadUserBackends('Icinga\Data\Selectable')
);
if (empty($backendNames)) {

View File

@ -51,7 +51,6 @@ class SshResourceForm extends Form
);
if ($this->getRequest()->getActionName() != 'editresource') {
$callbackValidator = new Zend_Validate_Callback(function ($value) {
if (openssl_pkey_get_private($value) === false) {
return false;

View File

@ -100,8 +100,7 @@ class UserBackendConfigForm extends ConfigForm
*/
public function getBackendForm($type)
{
switch ($type)
{
switch ($type) {
case 'db':
$form = new DbBackendForm();
$form->setResources(isset($this->resources['db']) ? $this->resources['db'] : array());

View File

@ -346,8 +346,7 @@ class LdapUserGroupBackendForm extends Form
foreach (UserBackend::getBackendConfigs() as $name => $config) {
if (in_array(strtolower($config->backend), array('ldap', 'msldap'))) {
$backendResource = ResourceFactory::create($config->resource);
if (
$backendResource->getHostname() === $resource->getHostname()
if ($backendResource->getHostname() === $resource->getHostname()
&& $backendResource->getPort() === $resource->getPort()
) {
$names[] = $name;

View File

@ -40,8 +40,7 @@ class UserGroupBackendForm extends ConfigForm
*/
public function getBackendForm($type)
{
switch ($type)
{
switch ($type) {
case 'db':
return new DbUserGroupBackendForm();
case 'ldap':

View File

@ -137,6 +137,8 @@ class ConfigForm extends Form
*/
public static function transformEmptyValuesToNull(array $values)
{
return array_map(function ($v) { return empty($v) ? null : $v; }, $values);
return array_map(function ($v) {
return empty($v) ? null : $v;
}, $values);
}
}

View File

@ -213,8 +213,7 @@ class NavigationConfigForm extends ConfigForm
$names = array();
foreach ($this->getShareConfig($type) as $sectionName => $sectionConfig) {
if (
$sectionName !== $this->itemToLoad
if ($sectionName !== $this->itemToLoad
&& $sectionConfig->owner === ($owner ?: $this->getUser()->getUsername())
&& !in_array($sectionName, $children, true)
) {
@ -223,8 +222,7 @@ class NavigationConfigForm extends ConfigForm
}
foreach ($this->getUserConfig($type) as $sectionName => $sectionConfig) {
if (
$sectionName !== $this->itemToLoad
if ($sectionName !== $this->itemToLoad
&& !in_array($sectionName, $children, true)
) {
$names[] = $sectionName;
@ -581,8 +579,7 @@ class NavigationConfigForm extends ConfigForm
)
);
if (
(! $itemForm->requiresParentSelection() || !isset($formData['parent']) || !$formData['parent'])
if ((! $itemForm->requiresParentSelection() || !isset($formData['parent']) || !$formData['parent'])
&& $this->getUser()->can('application/share/navigation')
) {
$checked = isset($formData['shared']) ? null : (isset($formData['users']) || isset($formData['groups']));
@ -781,8 +778,7 @@ class NavigationConfigForm extends ConfigForm
if ($this->getUserConfig()->hasSection($name)) {
return $this->getUserConfig();
} elseif ($this->getShareConfig()->hasSection($name)) {
if (
$this->getShareConfig()->get($name, 'owner') === $this->getUser()->getUsername()
if ($this->getShareConfig()->get($name, 'owner') === $this->getUser()->getUsername()
|| $this->getUser()->can('config/application/navigation')
) {
return $this->getShareConfig();

View File

@ -62,7 +62,7 @@ class NavigationItemForm extends Form
'Callback',
false,
array(
'callback' => function($url) {
'callback' => function ($url) {
// Matches if the given url contains obviously
// a username but not any protocol identifier
return !preg_match('#^((?=[^/@]).)+@.*$#', $url);

View File

@ -180,7 +180,9 @@ class PreferenceForm extends Form
'label' => $this->translate('Theme', 'Form element label'),
'multiOptions' => $themes,
'value' => $this->preferences->getValue(
'icingaweb', 'theme', $defaultTheme
'icingaweb',
'theme',
$defaultTheme
)
)
);
@ -194,7 +196,10 @@ class PreferenceForm extends Form
}
$tzList = array();
$tzList['autodetect'] = sprintf($this->translate('Browser (%s)', 'preferences.form'), $this->getDefaultTimezone());
$tzList['autodetect'] = sprintf(
$this->translate('Browser (%s)', 'preferences.form'),
$this->getDefaultTimezone()
);
foreach (DateTimeZone::listIdentifiers() as $tz) {
$tzList[$tz] = $tz;
}
@ -251,7 +256,9 @@ class PreferenceForm extends Form
array(
'required' => false,
'label' => $this->translate('Enable auto refresh'),
'description' => $this->translate('This option allows you to enable or to disable the global page content auto refresh'),
'description' => $this->translate(
'This option allows you to enable or to disable the global page content auto refresh'
),
'value' => 1
)
);

View File

@ -6,7 +6,8 @@
*/
class Zend_View_Helper_ProtectId extends Zend_View_Helper_Abstract
{
public function protectId($id) {
public function protectId($id)
{
return Zend_Controller_Front::getInstance()->getRequest()->protectId($id);
}
}

View File

@ -6,13 +6,16 @@
*/
class Zend_View_Helper_Util extends Zend_View_Helper_Abstract
{
public function util() {
public function util()
{
return $this;
}
public static function showTimeSince($timestamp)
{
if (! $timestamp) return 'unknown';
if (! $timestamp) {
return 'unknown';
}
$duration = time() - $timestamp;
if ($duration > 3600 * 24 * 3) {
if (date('Y') === date('Y', $timestamp)) {

View File

@ -483,7 +483,7 @@ abstract class ApplicationBootstrap
// Error was suppressed with the @-operator
return false; // Continue with the normal error handler
}
switch($errno) {
switch ($errno) {
case E_NOTICE:
case E_WARNING:
case E_STRICT:
@ -554,7 +554,7 @@ abstract class ApplicationBootstrap
*
* @return $this
*/
protected final function setupTimezone()
final protected function setupTimezone()
{
$timezone = $this->detectTimeZone();
if ($timezone === null || @date_default_timezone_set($timezone) === false) {
@ -582,7 +582,7 @@ abstract class ApplicationBootstrap
*
* @return $this
*/
protected final function setupInternationalization()
final protected function setupInternationalization()
{
if ($this->hasLocales()) {
Translator::registerDomain(Translator::DEFAULT_DOMAIN, $this->getLocaleDir());

View File

@ -141,7 +141,9 @@ class Benchmark
// TODO: Move formatting to CSS file
$html = '<table class="benchmark">' . "\n" . '<tr>';
foreach ($data->columns as & $col) {
if ($col->title === 'Time') continue;
if ($col->title === 'Time') {
continue;
}
$html .= sprintf(
'<td align="%s">%s</td>',
$col->align,
@ -153,7 +155,9 @@ class Benchmark
foreach ($data->rows as & $row) {
$html .= '<tr>';
foreach ($data->columns as $key => & $col) {
if ($col->title === 'Time') continue;
if ($col->title === 'Time') {
continue;
}
$html .= sprintf(
'<td align="%s">%s</td>',
$col->align,

View File

@ -137,11 +137,8 @@ class ClassLoader
$namespace = $this->extractModuleNamespace($class);
if ($this->hasNamespace($namespace)) {
return $this->buildClassFilename($class, $namespace);
} elseif (! $modules->loadedAllEnabledModules()) {
$moduleName = $this->extractModuleName($class);
if ($modules->hasEnabled($moduleName)) {

View File

@ -140,7 +140,6 @@ class Cli extends ApplicationBootstrap
} else {
$this->dispatchEndless();
}
}
protected function dispatchOnce()

View File

@ -226,7 +226,6 @@ class Hook
}
if (!$instance instanceof $base_class) {
// This is a compatibility check. Should be removed one far day:
if ($module !== null) {
$compat_class = 'Icinga\\Module\\'

View File

@ -93,7 +93,7 @@ abstract class TicketHook
// Remove preg_offset from match for the ticket pattern
$carry = array();
array_walk($match, function ($value, $key) use (&$carry) {
array_walk($match, function ($value, $key) use (&$carry) {
$carry[$key] = $value[0];
}, $carry);
$ticketPattern->setMatch($carry);

View File

@ -143,7 +143,6 @@ class Manager
if (($dh = opendir($this->enableDir)) !== false) {
$this->enabledDirs = array();
while (($file = readdir($dh)) !== false) {
if ($file[0] === '.' || $file === 'README') {
continue;
}

View File

@ -660,7 +660,6 @@ class Module
);
if (file_exists($this->metadataFile)) {
$key = null;
$file = new File($this->metadataFile, 'r');
foreach ($file as $line) {
@ -682,7 +681,6 @@ class Module
$key = lcfirst($key);
switch ($key) {
case 'depends':
if (strpos($val, ' ') === false) {
$metadata->depends[$val] = true;
@ -710,7 +708,6 @@ class Module
default:
$metadata->{$key} = $val;
}
}
}

View File

@ -86,7 +86,8 @@ class Platform
foreach (array('/etc/os-release', '/usr/lib/os-release') as $osReleaseFile) {
if (false === ($osRelease = @file(
$osReleaseFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
$osReleaseFile,
FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
))) {
continue;
}

View File

@ -51,12 +51,10 @@ $special = array(
);
if (in_array($path, $special)) {
include_once __DIR__ . '/EmbeddedWeb.php';
EmbeddedWeb::start();
switch($path) {
switch ($path) {
case 'css/icinga.css':
Stylesheet::send();
exit;
@ -79,7 +77,6 @@ if (in_array($path, $special)) {
default:
return false;
}
} elseif ($path === 'svg/chart.php') {
if (!array_key_exists('data', $_GET)) {
return false;
@ -90,7 +87,6 @@ if (in_array($path, $special)) {
$pie = new PieChart();
$pie->initFromRequest();
$pie->toSvg();
} elseif ($path === 'png/chart.php') {
if (!array_key_exists('data', $_GET)) {
return false;
@ -101,11 +97,9 @@ if (in_array($path, $special)) {
$pie = new PieChart();
$pie->initFromRequest();
$pie->toPng();
} elseif (file_exists($baseDir . '/' . $path) && is_file($baseDir . '/' . $path)) {
return false;
} else {
include __DIR__ . '/Web.php';
Web::start()->dispatch();
}

View File

@ -242,7 +242,9 @@ class AuthChain implements Authenticatable, Iterator
} catch (ConfigurationError $e) {
Logger::error(
new ConfigurationError(
'Can\'t create authentication backend "%s". An exception was thrown:', $name, $e
'Can\'t create authentication backend "%s". An exception was thrown:',
$name,
$e
)
);
$this->next();

View File

@ -713,8 +713,7 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
throw new ConfigurationError('User backend "%s" is not of type LDAP', $config->user_backend);
}
if (
$this->ds->getHostname() !== $userBackend->getDataSource()->getHostname()
if ($this->ds->getHostname() !== $userBackend->getDataSource()->getHostname()
|| $this->ds->getPort() !== $userBackend->getDataSource()->getPort()
) {
// TODO(jom): Elaborate whether it makes sense to link directories on different hosts

View File

@ -184,7 +184,6 @@ class Axis implements Drawable
$i = 0;
foreach ($this->xUnit as $label => $pos) {
if ($i % $ticks === 0) {
/*
$tick = new Line($pos, 100, $pos, 101);
@ -280,7 +279,7 @@ class Axis implements Drawable
if ($this->yLabel || $this->xLabel) {
if ($this->yLabel && $this->xLabel) {
$txt = $this->yLabel . ' / ' . $this->xLabel;
} else if ($this->xLabel) {
} elseif ($this->xLabel) {
$txt = $this->xLabel;
} else {
$txt = $this->yLabel;

View File

@ -95,13 +95,13 @@ class BarGraph extends Styleable implements Drawable
* Draw a single rectangle
*
* @param array $point The
* @param null $index
* @param string $fill The fill color to use
* @param $strokeWidth
* @param null $index
*
* @return Rect
*/
private function drawSingleBar($point, $index = null, $fill, $strokeWidth)
private function drawSingleBar($point, $fill, $strokeWidth, $index = null)
{
$rect = new Rect($point[0] - ($this->barWidth / 2), $point[1], $this->barWidth, 100 - $point[1]);
$rect->setFill($fill);
@ -137,11 +137,11 @@ class BarGraph extends Styleable implements Drawable
foreach ($this->dataSet as $x => $point) {
// add white background bar, to prevent other bars from altering transparency effects
$bar = $this->drawSingleBar($point, $idx++, 'white', $this->strokeWidth, $idx)->toSvg($ctx);
$bar = $this->drawSingleBar($point, 'white', $this->strokeWidth, $idx++)->toSvg($ctx);
$group->appendChild($bar);
// draw actual bar
$bar = $this->drawSingleBar($point, null, $this->fill, $this->strokeWidth, $idx)->toSvg($ctx);
$bar = $this->drawSingleBar($point, $this->fill, $this->strokeWidth)->toSvg($ctx);
$bar->setAttribute('class', 'chart-data');
if (isset($this->tooltips[$x])) {
$data = array(

View File

@ -162,40 +162,39 @@ class LineGraph extends Styleable implements Drawable
$path->setId($this->id);
$group = $path->toSvg($ctx);
foreach ($this->dataset as $x => $point) {
if ($this->showDataPoints === true) {
$dot = new Circle($point[0], $point[1], $this->dotWith);
$dot->setFill($this->strokeColor);
$group->appendChild($dot->toSvg($ctx));
}
// Draw invisible circle for tooltip hovering
$invisible = new Circle($point[0], $point[1], 20);
$invisible->setFill($this->strokeColor);
$invisible->setAdditionalStyle('opacity: 0.0;');
$invisible->setAttribute('class', 'chart-data');
if (isset($this->tooltips[$x])) {
$data = array(
'label' => isset($this->graphs[$this->order]['label']) ?
strtolower($this->graphs[$this->order]['label']) : '',
'color' => isset($this->graphs[$this->order]['color']) ?
strtolower($this->graphs[$this->order]['color']) : '#fff'
);
$format = isset($this->graphs[$this->order]['tooltip'])
? $this->graphs[$this->order]['tooltip'] : null;
$invisible->setAttribute(
'title',
$this->tooltips[$x]->renderNoHtml($this->order, $data, $format)
);
$invisible->setAttribute(
'data-title-rich',
$this->tooltips[$x]->render($this->order, $data, $format)
);
}
$group->appendChild($invisible->toSvg($ctx));
foreach ($this->dataset as $x => $point) {
if ($this->showDataPoints === true) {
$dot = new Circle($point[0], $point[1], $this->dotWith);
$dot->setFill($this->strokeColor);
$group->appendChild($dot->toSvg($ctx));
}
// Draw invisible circle for tooltip hovering
$invisible = new Circle($point[0], $point[1], 20);
$invisible->setFill($this->strokeColor);
$invisible->setAdditionalStyle('opacity: 0.0;');
$invisible->setAttribute('class', 'chart-data');
if (isset($this->tooltips[$x])) {
$data = array(
'label' => isset($this->graphs[$this->order]['label']) ?
strtolower($this->graphs[$this->order]['label']) : '',
'color' => isset($this->graphs[$this->order]['color']) ?
strtolower($this->graphs[$this->order]['color']) : '#fff'
);
$format = isset($this->graphs[$this->order]['tooltip'])
? $this->graphs[$this->order]['tooltip'] : null;
$invisible->setAttribute(
'title',
$this->tooltips[$x]->renderNoHtml($this->order, $data, $format)
);
$invisible->setAttribute(
'data-title-rich',
$this->tooltips[$x]->render($this->order, $data, $format)
);
}
$group->appendChild($invisible->toSvg($ctx));
}
return $group;
}
}

View File

@ -64,7 +64,7 @@ class Tooltip
* @param array $data Map of global properties
* @param string $format The default format string
*/
public function __construct (
public function __construct(
$data = array(),
$format = '<b>{title}</b>: {value} {label}'
) {

View File

@ -193,14 +193,13 @@ class GridChart extends Chart
private function initTooltips($data)
{
foreach ($data as &$graph) {
foreach ($graph['data'] as $x => $point) {
foreach ($graph['data'] as $x => $point) {
if (!array_key_exists($x, $this->tooltips)) {
$this->tooltips[$x] = new Tooltip(
array(
'color' => $graph['color'],
)
);
}
$this->tooltips[$x]->addDataPoint($point);

View File

@ -92,6 +92,5 @@ class Inline
if (array_key_exists('height', $_GET)) {
$this->height = (int)$_GET['height'];
}
}
}

View File

@ -208,7 +208,6 @@ class PieChart extends Chart
if (!$this->noCaption && isset($pie['labels'])) {
$slice->setCaption($pie['labels'][$labelPos++])
->setLabelGroup($labelBox);
}
$lastRadius += $dataset;
}
@ -305,4 +304,3 @@ class PieChart extends Chart
$clipBox->addElement($rect);
}
}

View File

@ -3,7 +3,6 @@
namespace Icinga\Chart\Primitive;
use DOMElement;
use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Format;

View File

@ -161,7 +161,7 @@ class SVGRenderer
if ($this->preserveAspectRatio) {
$svg->setAttribute(
'preserveAspectRatio',
sprintf (
sprintf(
'%s%s %s',
$this->xAspectRatio,
$this->yAspectRatio,
@ -182,12 +182,12 @@ class SVGRenderer
* @param $title The title text
* @param $description The description text
*/
private function addAriaDescription (DOMNode $svg, $titleText, $descriptionText)
private function addAriaDescription(DOMNode $svg, $titleText, $descriptionText)
{
$doc = $svg->ownerDocument;
$titleId = $descId = '';
if (isset ($this->ariaTitle)) {
if (isset($this->ariaTitle)) {
$titleId = 'aria-title-' . $this->stripNonAlphanumeric($titleText);
$title = $doc->createElement('title');
$title->setAttribute('id', $titleId);
@ -196,7 +196,7 @@ class SVGRenderer
$svg->appendChild($title);
}
if (isset ($this->ariaDescription)) {
if (isset($this->ariaDescription)) {
$descId = 'aria-desc-' . $this->stripNonAlphanumeric($descriptionText);
$desc = $doc->createElement('desc');
$desc->setAttribute('id', $descId);

View File

@ -53,7 +53,7 @@ class LogarithmicUnit implements AxisUnit
* @param int $nrOfTicks The number of ticks to use
*/
public function __construct($base = 10)
{;
{
$this->base = $base;
$this->minExp = PHP_INT_MAX;
$this->maxExp = ~PHP_INT_MAX;

View File

@ -4,7 +4,6 @@
namespace Icinga\Chart\Unit;
class StaticAxis implements AxisUnit
{
private $items = array();

View File

@ -34,7 +34,6 @@ class CommentParser
$plain = preg_replace('~\n\s*\*/\s*~s', "\n", $plain);
$p = null;
foreach (preg_split('~\n~', $plain) as $line) {
// Strip * at line start
$line = preg_replace('~^\s*\*\s?~', '', $line);
$line = rtrim($line);

View File

@ -49,7 +49,9 @@ class Params
$key = substr($argv[$i], 2);
$matches = array();
if (1 === preg_match(
'/(?<!.)([^=]+)=(.*)(?!.)/ms', $key, $matches
'/(?<!.)([^=]+)=(.*)(?!.)/ms',
$key,
$matches
)) {
$this->params[$matches[1]] = $matches[2];
} elseif (! isset($argv[$i + 1]) || substr($argv[$i + 1], 0, 2) === '--') {

View File

@ -3,4 +3,6 @@
namespace Icinga\Data;
interface ConnectionInterface extends Selectable, Queryable {};
interface ConnectionInterface extends Selectable, Queryable
{
}

View File

@ -143,16 +143,23 @@ abstract class Filter
public static function expression($col, $op, $expression)
{
switch ($op) {
case '=': return new FilterMatch($col, $op, $expression);
case '<': return new FilterLessThan($col, $op, $expression);
case '>': return new FilterGreaterThan($col, $op, $expression);
case '>=': return new FilterEqualOrGreaterThan($col, $op, $expression);
case '<=': return new FilterEqualOrLessThan($col, $op, $expression);
case '!=': return new FilterMatchNot($col, $op, $expression);
default: throw new ProgrammingError(
'There is no such filter sign: %s',
$op
);
case '=':
return new FilterMatch($col, $op, $expression);
case '<':
return new FilterLessThan($col, $op, $expression);
case '>':
return new FilterGreaterThan($col, $op, $expression);
case '>=':
return new FilterEqualOrGreaterThan($col, $op, $expression);
case '<=':
return new FilterEqualOrLessThan($col, $op, $expression);
case '!=':
return new FilterMatchNot($col, $op, $expression);
default:
throw new ProgrammingError(
'There is no such filter sign: %s',
$op
);
}
}
@ -213,9 +220,12 @@ abstract class Filter
public static function chain($operator, $filters = array())
{
switch ($operator) {
case 'AND': return self::matchAll($filters);
case 'OR' : return self::matchAny($filters);
case 'NOT': return self::not($filters);
case 'AND':
return self::matchAll($filters);
case 'OR':
return self::matchAny($filters);
case 'NOT':
return self::not($filters);
}
throw new ProgrammingError(
'"%s" is not a valid filter chain operator',

View File

@ -10,4 +10,6 @@ use Icinga\Exception\IcingaException;
*
* Filter Exceptions should be thrown on filter parse errors or similar
*/
class FilterException extends IcingaException {}
class FilterException extends IcingaException
{
}

View File

@ -5,7 +5,8 @@ namespace Icinga\Data\Filter;
class FilterMatchCaseInsensitive extends FilterMatch
{
public function __construct($column, $sign, $expression) {
public function __construct($column, $sign, $expression)
{
parent::__construct($column, $sign, $expression);
$this->caseSensitive = false;
}

View File

@ -5,7 +5,8 @@ namespace Icinga\Data\Filter;
class FilterMatchNotCaseInsensitive extends FilterMatchNot
{
public function __construct($column, $sign, $expression) {
public function __construct($column, $sign, $expression)
{
parent::__construct($column, $sign, $expression);
$this->caseSensitive = false;
}

View File

@ -21,8 +21,17 @@ class FilterQueryString
protected function debug($msg, $level = 0, $op = null)
{
if ($op === null) $op = 'NULL';
$this->debug[] = sprintf('%s[%d=%s] (%s): %s', str_repeat('* ', $level), $this->pos, $this->string[$this->pos - 1], $op, $msg);
if ($op === null) {
$op = 'NULL';
}
$this->debug[] = sprintf(
'%s[%d=%s] (%s): %s',
str_repeat('* ', $level),
$this->pos,
$this->string[$this->pos - 1],
$op,
$msg
);
}
public static function parse($string)
@ -63,7 +72,9 @@ class FilterQueryString
foreach (array('<', '>') as $sign) {
if (false !== ($pos = strpos($key, $sign))) {
if ($this->nextChar() === '=') break;
if ($this->nextChar() === '=') {
break;
}
$var = substr($key, $pos + 1);
$key = substr($key, 0, $pos);
return Filter::expression($key, $sign, $var);
@ -123,7 +134,6 @@ class FilterQueryString
{
$filters = array();
while ($this->pos < $this->length) {
if ($op === '!' && count($filters) === 1) {
break;
}
@ -132,7 +142,6 @@ class FilterQueryString
if ($filter === false) {
$this->debug('Got no next expression, next is ' . $next, $nestingLevel, $op);
if ($next === '!') {
$not = $this->readFilters($nestingLevel + 1, '!');
@ -171,7 +180,6 @@ class FilterQueryString
continue;
}
$this->parseError($next, "$op level $nestingLevel");
} else {
$this->debug('Got new expression: ' . $filter, $nestingLevel, $op);
@ -225,11 +233,16 @@ class FilterQueryString
$this->debug(sprintf('Got %d filters, returning', count($filters)), $nestingLevel, $op);
switch ($op) {
case '&': return Filter::matchAll($filters);
case '|': return Filter::matchAny($filters);
case '!': return Filter::not($filters);
case null: return Filter::matchAll();
default: $this->parseError($op);
case '&':
return Filter::matchAll($filters);
case '|':
return Filter::matchAny($filters);
case '!':
return Filter::not($filters);
case null:
return Filter::matchAll();
default:
$this->parseError($op);
}
}

View File

@ -5,5 +5,6 @@ namespace Icinga\Data;
use Countable;
interface Paginatable extends Limitable, Countable {};
interface Paginatable extends Limitable, Countable
{
}

View File

@ -341,8 +341,7 @@ class PivotTable implements Sortable
*/
public function toArray()
{
if (
($this->xAxisFilter === null && $this->yAxisFilter === null)
if (($this->xAxisFilter === null && $this->yAxisFilter === null)
|| ($this->xAxisFilter !== null && $this->yAxisFilter !== null)
) {
$xAxis = $this->queryXAxis()->fetchPairs();
@ -370,13 +369,13 @@ class PivotTable implements Sortable
if (! empty($xAxis) && ! empty($yAxis)) {
$this->baseQuery
->where($this->xAxisColumn, array_map(
function($key) {
function ($key) {
return (string) $key;
},
$xAxisKeys
))
->where($this->yAxisColumn, array_map(
function($key) {
function ($key) {
return (string) $key;
},
$yAxisKeys

View File

@ -3,4 +3,6 @@
namespace Icinga\Data;
interface QueryInterface extends Fetchable, Filterable, Paginatable, Sortable {};
interface QueryInterface extends Fetchable, Filterable, Paginatable, Sortable
{
}

View File

@ -131,7 +131,9 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
* Overwrite this instead of __construct (it's called at the end of the construct) to
* implement custom initialization logic on construction time
*/
protected function init() {}
protected function init()
{
}
/**
* Get the data source

View File

@ -6,4 +6,6 @@ namespace Icinga\Exception;
/**
* Exception thrown if a property does not exist
*/
class InvalidPropertyException extends IcingaException {}
class InvalidPropertyException extends IcingaException
{
}

View File

@ -9,7 +9,9 @@ class Csv
{
protected $query;
protected function __construct() {}
protected function __construct()
{
}
public static function fromQuery(Traversable $query)
{

View File

@ -119,7 +119,7 @@ class Directive
public function render()
{
$str = '';
if (! empty ($this->commentsPre)) {
if (! empty($this->commentsPre)) {
$comments = array();
foreach ($this->commentsPre as $comment) {
$comments[] = $comment->render();
@ -127,7 +127,7 @@ class Directive
$str = implode(PHP_EOL, $comments) . PHP_EOL;
}
$str .= sprintf('%s = "%s"', $this->sanitizeKey($this->key), $this->sanitizeValue($this->value));
if (isset ($this->commentPost)) {
if (isset($this->commentPost)) {
$str .= ' ' . $this->commentPost->render();
}
return $str;

View File

@ -73,7 +73,7 @@ class Document
*/
public function removeSection($name)
{
unset ($this->sections[trim($name)]);
unset($this->sections[trim($name)]);
}
/**

View File

@ -68,7 +68,7 @@ class Section
*/
public function removeDirective($key)
{
unset ($this->directives[$key]);
unset($this->directives[$key]);
}
/**

View File

@ -37,7 +37,11 @@ class Pdf
$layout->content = $controller->getResponse();
$html = $layout->render();
$imgDir = Url::fromPath('img');
$html = preg_replace('~src="' . $imgDir . '/~', 'src="' . Icinga::app()->getBootstrapDirectory() . '/img/', $html);
$html = preg_replace(
'~src="' . $imgDir . '/~',
'src="' . Icinga::app()->getBootstrapDirectory() . '/img/',
$html
);
$options = new Options();
$options->set('defaultPaperSize', 'A4');
$dompdf = new Dompdf($options);

View File

@ -7,4 +7,6 @@ use Icinga\Exception\IcingaException;
/**
* Exception thrown if a file reader specific error occurs
*/
class FileReaderException extends IcingaException {}
class FileReaderException extends IcingaException
{
}

View File

@ -67,7 +67,7 @@ class FileIterator extends EnumeratingFilterIterator
if ($matched === false) {
throw new FileReaderException('Failed parsing regular expression!');
} else if ($matched === 1) {
} elseif ($matched === 1) {
foreach ($data as $key => $value) {
if (is_int($key)) {
unset($data[$key]);

View File

@ -33,7 +33,8 @@ class FileQuery extends SimpleQuery
* Nothing to do here
*/
public function applyFilter(Filter $filter)
{}
{
}
/**
* Sort query result chronological

View File

@ -132,7 +132,7 @@ class FileReader implements Selectable, Countable
$count = $this->count($query);
if ($count <= $skip) {
return $lines;
} else if ($count < ($skip + $read)) {
} elseif ($count < ($skip + $read)) {
$read = $count - $skip;
$skip = 0;
} else {

View File

@ -112,7 +112,8 @@ class LogFileIterator implements Iterator
$this->valid = null;
while ($this->file->valid()) {
if (false === ($res = preg_match(
$this->fields, $current = $this->file->current()
$this->fields,
$current = $this->file->current()
))) {
throw new IcingaException('Failed at preg_match()');
}
@ -120,7 +121,7 @@ class LogFileIterator implements Iterator
if ($res === 1) {
$message[] = $current;
}
} else if ($res === 1) {
} elseif ($res === 1) {
$this->next = $current;
$this->valid = true;
break;
@ -139,7 +140,9 @@ class LogFileIterator implements Iterator
while (! empty($message)) {
$matches = array();
if (false === ($res = preg_match(
$this->fields, implode(PHP_EOL, $message), $matches
$this->fields,
implode(PHP_EOL, $message),
$matches
))) {
throw new IcingaException('Failed at preg_match()');
}

View File

@ -6,8 +6,8 @@ namespace Icinga\Protocol\Ldap;
use Icinga\Data\ConfigObject;
use Icinga\Protocol\Dns;
class Discovery {
class Discovery
{
/**
* @var LdapConnection
*/

View File

@ -944,8 +944,7 @@ class LdapConnection implements Selectable, Inspectable
);
}
}
} while (
(! $serverSorting || $limit === 0 || $limit !== count($entries))
} while ((! $serverSorting || $limit === 0 || $limit !== count($entries))
&& ($entry = ldap_next_entry($ds, $entry))
);
@ -1053,8 +1052,7 @@ class LdapConnection implements Selectable, Inspectable
}
}
if (
$unfoldAttribute !== null
if ($unfoldAttribute !== null
&& isset($cleanedAttributes[$unfoldAttribute])
&& is_array($cleanedAttributes[$unfoldAttribute])
) {
@ -1110,7 +1108,6 @@ class LdapConnection implements Selectable, Inspectable
if ($attributeOctets >= 127) {
// Use the indefinite form of the length octets (the long form would be another option)
$attributeType = '0440' . $attributeType . '0000';
} else {
$attributeType = '04' . str_pad(dechex($attributeOctets), 2, '0', STR_PAD_LEFT) . $attributeType;
}
@ -1177,7 +1174,6 @@ class LdapConnection implements Selectable, Inspectable
if (! ldap_start_tls($ds)) {
throw new LdapException('LDAP STARTTLS failed: %s', ldap_error($ds));
}
} elseif ($this->encryption !== static::LDAPS) {
$this->encrypted = false;
$info->write('Connect without encryption');
@ -1249,7 +1245,7 @@ class LdapConnection implements Selectable, Inspectable
));
}
switch($scope) {
switch ($scope) {
case LdapQuery::SCOPE_SUB:
$function = 'ldap_search';
break;

View File

@ -284,11 +284,11 @@ class LdapQuery extends SimpleQuery
if (! in_array($scope, static::$scopes)) {
throw new LogicException(
'Can\'t set scope %d, it is is invalid. Use one of %s or LdapQuery\'s constants.',
$scope, implode(', ', static::$scopes)
$scope,
implode(', ', static::$scopes)
);
}
$this->scope = $scope;
return $this;
}
}

View File

@ -125,7 +125,7 @@ class Connection
*/
public function count(Query $query)
{
return 100;
return 100;
$count = clone($query);
// WTF? $count->count();
Benchmark::measure('Sending Livestatus Count Query');
@ -197,7 +197,9 @@ class Connection
while ($row = $this->fetchRowFromSocket()) {
$r = new ResponseRow($row, $query);
$res = $query->resultRow($row);
if ($filter !== null && ! $filter->matches($res)) continue;
if ($filter !== null && ! $filter->matches($res)) {
continue;
}
$result[] = $res;
}
@ -282,13 +284,17 @@ class Connection
$col = 0;
while (false !== ($pos = strpos($line, self::FIELD_SEPARATOR, $start))) {
// TODO: safety measure for not killing the SPL. To be removed once code is clean
if ($col > $size -1 ) return $res; // ???
if ($col > $size -1) {
return $res; // ???
}
$res[$col] = substr($line, $start, $pos - $start);
$start = $pos + 1;
$col++;
}
// TODO: safety measure for not killing the SPL. To be removed once code is clean
if ($col > $size - 1) return $res;
if ($col > $size - 1) {
return $res;
}
$res[$col] = rtrim(substr($line, $start), "\r\n");
return $res;
}
@ -421,8 +427,7 @@ if ($col > $size - 1) return $res;
public function disconnect()
{
if (is_resource($this->connection)
&& get_resource_type($this->connection) === 'Socket')
{
&& get_resource_type($this->connection) === 'Socket') {
Benchmark::measure('Disconnecting livestatus...');
socket_close($this->connection);
Benchmark::measure('...socket closed');

View File

@ -303,19 +303,19 @@ class Query extends SimpleQuery
}
foreach ($usedColumns as $col) {
// TODO: No alias if filter???
if (array_key_exists($col, $this->available_columns)) {
// Alias if such
$col = $this->available_columns[$col];
}
if ($col[0] === '_') {
$columns['custom_variables'] = true;
} elseif (is_array($col)) {
foreach ($col as $k) {
$columns[$k] = true;
}
} else {
$columns[$col] = true;
}
if (array_key_exists($col, $this->available_columns)) {
// Alias if such
$col = $this->available_columns[$col];
}
if ($col[0] === '_') {
$columns['custom_variables'] = true;
} elseif (is_array($col)) {
foreach ($col as $k) {
$columns[$k] = true;
}
} else {
$columns[$col] = true;
}
}
$this->preparedHeaders = array_keys($columns);

View File

@ -544,8 +544,7 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
return;
}
if (
! ($query !== null && $this->validateQueryColumnAssociation($table, $name))
if (! ($query !== null && $this->validateQueryColumnAssociation($table, $name))
&& !($query === null && $this->validateStatementColumnAssociation($table, $name))
) {
$table = $this->findTableName($name);
@ -620,8 +619,7 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
public function reassembleQueryColumnAlias($table, $column)
{
$alias = parent::reassembleQueryColumnAlias($table, $column);
if (
$alias === null
if ($alias === null
&& !$this->validateQueryColumnAssociation($table, $column)
&& ($tableName = $this->findTableName($column))
) {
@ -836,8 +834,7 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
*/
public function hasStatementColumn($table, $name)
{
if (
($this->resolveStatementColumnAlias($table, $name) === null
if (($this->resolveStatementColumnAlias($table, $name) === null
&& $this->reassembleStatementColumnAlias($table, $name) === null)
|| !$this->validateStatementColumnAssociation($table, $name)
) {

View File

@ -403,7 +403,7 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
*
* @throws ProgrammingError In case no valid section name is available
*/
protected function extractSectionName( & $config, $keyColumn)
protected function extractSectionName(& $config, $keyColumn)
{
if (! is_array($config) && !$config instanceof ConfigObject) {
throw new ProgrammingError('$config is neither an array nor a ConfigObject');

View File

@ -235,7 +235,6 @@ abstract class Repository implements Selectable
*/
protected function init()
{
}
/**
@ -937,8 +936,7 @@ abstract class Repository implements Selectable
return $value;
}
if (
($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false
if (($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false
|| ($dateTime = DateTime::createFromFormat('YmdHis.uZ', $value)) !== false
|| ($dateTime = DateTime::createFromFormat('YmdHis.u', $value)) !== false
|| ($dateTime = DateTime::createFromFormat('YmdHis', $value)) !== false

View File

@ -603,8 +603,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera
$aliases[1] !== 1 ? $this->getNativeAlias($aliases[1]) : $columns[1]
);
if (
$this->repository->providesValueConversion($this->target, $colOne)
if ($this->repository->providesValueConversion($this->target, $colOne)
|| $this->repository->providesValueConversion($this->target, $colTwo)
) {
$newResults = array();

View File

@ -152,7 +152,9 @@ namespace Icinga\Test {
->shouldReceive('getBaseUrl')->andReturn('/')->byDefault()
->shouldReceive('getQuery')->andReturn(array())->byDefault()
->shouldReceive('getParam')->with(Mockery::type('string'), Mockery::type('string'))
->andReturnUsing(function ($name, $default) { return $default; })->byDefault();
->andReturnUsing(function ($name, $default) {
return $default;
})->byDefault();
$responseMock = Mockery::mock('Icinga\Web\Response')->shouldDeferMissing();
// Can't express this as demeter chains. See: https://github.com/padraic/mockery/issues/59

View File

@ -59,10 +59,10 @@ class ClassLoader
foreach ($this->namespaces as $namespace => $dir) {
if ($class === strstr($class, $namespace)) {
$classPath = str_replace(
self::NAMESPACE_SEPARATOR,
DIRECTORY_SEPARATOR,
substr($class, strlen($namespace))
) . '.php';
self::NAMESPACE_SEPARATOR,
DIRECTORY_SEPARATOR,
substr($class, strlen($namespace))
) . '.php';
if (file_exists($file = $dir . $classPath)) {
return $file;
}

View File

@ -74,7 +74,6 @@ class DbStore extends PreferencesStore
*/
protected function init()
{
}
/**

View File

@ -322,7 +322,13 @@ class ActionController extends Zend_Controller_Action
*/
public function translatePlural($textSingular, $textPlural, $number, $context = null)
{
return Translator::translatePlural($textSingular, $textPlural, $number, $this->view->translationDomain, $context);
return Translator::translatePlural(
$textSingular,
$textPlural,
$number,
$this->view->translationDomain,
$context
);
}
protected function ignoreXhrBody()

View File

@ -69,7 +69,6 @@ class FileCache
public function store($file, $content)
{
if (! $this->enabled) {
return false;
}
@ -87,26 +86,22 @@ class FileCache
public function has($file, $newerThan = null)
{
if (! $this->enabled) {
return false;
}
$filename = $this->filename($file);
if (! file_exists($filename) || ! is_readable($filename)) {
return false;
}
if ($newerThan === null) {
return true;
}
$info = stat($file);
if ($info === false) {
return false;
}

View File

@ -805,7 +805,6 @@ class Form extends Zend_Form
*/
public function createElements(array $formData)
{
}
/**
@ -827,7 +826,6 @@ class Form extends Zend_Form
*/
public function onRequest()
{
}
/**
@ -1108,8 +1106,7 @@ class Form extends Zend_Form
protected function preserveDefaults(Zend_Form $form, array & $defaults)
{
foreach ($form->getElements() as $name => $_) {
if (
array_key_exists($name, $defaults)
if (array_key_exists($name, $defaults)
&& array_key_exists($name . static::DEFAULT_SUFFIX, $defaults)
&& $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX]
) {
@ -1243,8 +1240,7 @@ class Form extends Zend_Form
// Ensure that disabled elements are not overwritten
// (http://www.zendframework.com/issues/browse/ZF-6909)
$formData[$name] = $element->getValue();
} elseif (
array_key_exists($name . static::DEFAULT_SUFFIX, $formData)
} elseif (array_key_exists($name . static::DEFAULT_SUFFIX, $formData)
&& $formData[$name] === $formData[$name . static::DEFAULT_SUFFIX]
) {
unset($formData[$name]);

View File

@ -103,7 +103,12 @@ class Autosubmit extends Zend_Form_Decorator_Abstract
'class' => 'spinner autosubmit-info'
));
if (! $isForm && $this->getAccessible()) {
$content = '<span id="' . $this->getWarningId() . '" class="sr-only">' . $warning . '</span>' . $content;
$content = '<span id="'
. $this->getWarningId()
. '" class="sr-only">'
. $warning
. '</span>'
. $content;
}
$content .= sprintf(

View File

@ -45,4 +45,4 @@ class Spinner extends Zend_Form_Decorator_Abstract
return $spinner . $content;
}
}
}
}

View File

@ -45,7 +45,8 @@ class DateTimePicker extends FormElement
public function init()
{
$this->addValidator(
new DateTimeValidator($this->local), true // true for breaking the validator chain on failure
new DateTimeValidator($this->local),
true // true for breaking the validator chain on failure
);
if ($this->min !== null) {
$this->addValidator('GreaterThan', true, array('min' => $this->min));

View File

@ -10,4 +10,6 @@ use Icinga\Application\Hook\GrapherHook as BaseHook;
*
* Please implement hooks in Icinga\Application\Hook
*/
abstract class GrapherHook extends BaseHook {}
abstract class GrapherHook extends BaseHook
{
}

View File

@ -10,4 +10,6 @@ use Icinga\Application\Hook\TicketHook as BaseHook;
*
* Please implement hooks in Icinga\Application\Hook
*/
abstract class TicketHook extends BaseHook {}
abstract class TicketHook extends BaseHook
{
}

View File

@ -80,7 +80,9 @@ class MenuItemRenderer
'<a href="%s"%s>%s%s<span></span></a>',
$menu->getUrl() ? : '#',
$attributes,
$menu->getIcon() ? '<img aria-hidden="true" src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> ' : '',
$menu->getIcon()
? '<img aria-hidden="true" src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> '
: '',
$this->getView()->escape($menu->getTitle())
);
}

View File

@ -182,8 +182,12 @@ class MenuRenderer extends RecursiveIteratorIterator
*/
protected function isActive(Menu $child)
{
if (! $this->url) return false;
if (! ($childUrl = $child->getUrl())) return false;
if (! $this->url) {
return false;
}
if (! ($childUrl = $child->getUrl())) {
return false;
}
return $this->url && $this->url->matches($childUrl);
}

View File

@ -80,7 +80,7 @@ class DashboardPane extends NavigationItem
*
* @param bool $disabled
*/
public function setDisabled($disabled=true)
public function setDisabled($disabled = true)
{
$this->disabled = (bool) $disabled;
}

View File

@ -18,4 +18,3 @@ class DropdownItem extends NavigationItem
$this->children->setLayout(Navigation::LAYOUT_DROPDOWN);
}
}

View File

@ -153,7 +153,6 @@ class NavigationItem implements IteratorAggregate
*/
public function init()
{
}
/**

View File

@ -63,7 +63,6 @@ class NavigationItemRenderer
*/
public function init()
{
}
/**

View File

@ -39,7 +39,7 @@ class Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder implements Zend_Pagi
foreach (array(1, 2) as $i) {
$range[$i] = $i;
}
if ($pageNumber < 6 ) {
if ($pageNumber < 6) {
// We are on page 1-5 from
for ($i = 1; $i <= 7; $i++) {
$range[$i] = $i;
@ -69,7 +69,6 @@ class Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder implements Zend_Pagi
foreach (array($pageCount - 1, $pageCount) as $i) {
$range[$i] = $i;
}
}
if (empty($range)) {
$range[] = 1;

View File

@ -32,7 +32,8 @@ abstract class Session extends SessionNamespace
/**
* Persists changes to the underlying session implementation
*/
public function write() {
public function write()
{
throw new NotImplementedError('You are required to implement write() in your session implementation');
}

View File

@ -13,4 +13,3 @@ $this->addHelperFunction('auth', function () {
$this->addHelperFunction('widget', function ($name, $options = null) {
return Widget::create($name, $options);
});

View File

@ -10,5 +10,5 @@ $this->addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis =
});
$this->addHelperFunction('nl2br', function ($string) {
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
});

View File

@ -32,31 +32,34 @@ $this->addHelperFunction('url', function ($path = null, $params = null) {
return $url;
});
$this->addHelperFunction('qlink', function ($title, $url, $params = null, $properties = null, $escape = true) use ($view) {
$icon = '';
if ($properties) {
if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) {
$properties['aria-label'] = $properties['title'];
$this->addHelperFunction(
'qlink',
function ($title, $url, $params = null, $properties = null, $escape = true) use ($view) {
$icon = '';
if ($properties) {
if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) {
$properties['aria-label'] = $properties['title'];
}
if (array_key_exists('icon', $properties)) {
$icon = $view->icon($properties['icon']);
unset($properties['icon']);
}
if (array_key_exists('img', $properties)) {
$icon = $view->img($properties['img']);
unset($properties['img']);
}
}
if (array_key_exists('icon', $properties)) {
$icon = $view->icon($properties['icon']);
unset($properties['icon']);
}
if (array_key_exists('img', $properties)) {
$icon = $view->img($properties['img']);
unset($properties['img']);
}
return sprintf(
'<a href="%s"%s>%s</a>',
$view->url($url, $params),
$view->propertiesToString($properties),
$icon . ($escape ? $view->escape($title) : $title)
);
}
return sprintf(
'<a href="%s"%s>%s</a>',
$view->url($url, $params),
$view->propertiesToString($properties),
$icon . ($escape ? $view->escape($title) : $title)
);
});
);
$this->addHelperFunction('img', function ($url, $params = null, array $properties = array()) use ($view) {
if (! array_key_exists('alt', $properties)) {
@ -153,4 +156,3 @@ $this->addHelperFunction('attributeToString', function ($key, $value) use ($view
$view->escape($value)
);
});

View File

@ -12,8 +12,8 @@ use Icinga\Web\Widget\AbstractWidget;
* Display a colored grid that visualizes a set of values for each day
* on a given time-frame.
*/
class HistoryColorGrid extends AbstractWidget {
class HistoryColorGrid extends AbstractWidget
{
const CAL_GROW_INTO_PAST = 'past';
const CAL_GROW_INTO_PRESENT = 'present';
@ -32,7 +32,8 @@ class HistoryColorGrid extends AbstractWidget {
private $color;
public $opacity = 1.0;
public function __construct($color = '#51e551', $start = null, $end = null) {
public function __construct($color = '#51e551', $start = null, $end = null)
{
$this->setColor($color);
if (isset($start)) {
$this->start = $this->tsToDateStr($start);

View File

@ -153,7 +153,6 @@ class Dashboard extends AbstractWidget
if ((bool) $part->get('disabled', false) === true) {
$panes[$key]->setDisabled();
}
} else {
list($paneName, $dashletName) = explode('.', $key, 2);
$part->pane = $paneName;
@ -375,7 +374,7 @@ class Dashboard extends AbstractWidget
{
$active = null;
foreach ($this->panes as $key=>$pane) {
foreach ($this->panes as $key => $pane) {
if ($pane->getDisabled() === false) {
$active = $key;
break;

View File

@ -323,6 +323,4 @@ class Pane extends UserWidget
{
return $this->disabled;
}
}

View File

@ -509,7 +509,6 @@ class FilterEditor extends AbstractWidget
. $this->removeLink($filter)
. $this->addLink($filter)
;
}
}
@ -689,7 +688,7 @@ class FilterEditor extends AbstractWidget
$parent = $filter->getById($addTo);
$f = Filter::expression($add['column'], $add['sign'], $add['value']);
if (isset($add['operator'])) {
switch($add['operator']) {
switch ($add['operator']) {
case 'AND':
if ($parent->isExpression()) {
if ($parent->isRootNode()) {
@ -770,7 +769,10 @@ class FilterEditor extends AbstractWidget
return '';
}
if (! $this->preservedUrl()->getParam('modifyFilter')) {
return '<div class="filter">' . $this->renderSearch() . $this->view()->escape($this->shorten($this->filter, 50)) . '</div>';
return '<div class="filter">'
. $this->renderSearch()
. $this->view()->escape($this->shorten($this->filter, 50))
. '</div>';
}
return '<div class="filter">'
. $this->renderSearch()

View File

@ -42,9 +42,9 @@ class FilterWidget extends AbstractWidget
$url = Url::fromRequest();
if ($filter instanceof FilterChain) {
if ($level === 0) {
$op = '</li><li>)' . $filter->getOperatorName() . ' (';
$op = '</li><li>)' . $filter->getOperatorName() . ' (';
} else {
$op = '</li><li>) ' . $filter->getOperatorName() . ' ( ';
$op = '</li><li>) ' . $filter->getOperatorName() . ' ( ';
}
$parts = array();
foreach ($filter->filters() as $f) {
@ -85,7 +85,7 @@ class FilterWidget extends AbstractWidget
$editorUrl = clone $url;
$editorUrl->setParam('modifyFilter', true);
if ($this->filter->isEmpty()) {
if ($this->filter->isEmpty()) {
$title = t('Filter this list');
$txt = $view->icon('plus');
$remove = '';

View File

@ -124,7 +124,7 @@ class Paginator extends AbstractWidget
$range[$i] = $i;
}
if ($currentPage < 6 ) {
if ($currentPage < 6) {
// We are on page 1-5 from
for ($i = 1; $i <= 7; $i++) {
$range[$i] = $i;
@ -156,7 +156,6 @@ class Paginator extends AbstractWidget
foreach (array($pageCount - 1, $pageCount) as $i) {
$range[$i] = $i;
}
}
if (empty($range)) {

View File

@ -79,7 +79,6 @@ class Wizard
*/
protected function init()
{
}
/**
@ -245,7 +244,6 @@ class Wizard
*/
public function setupPage(Form $page, Request $request)
{
}
/**
@ -430,8 +428,7 @@ class Wizard
if (! $this->hasPageData($requestedPage) && ($index = array_search($page, $pages, true)) > 0) {
$previousPage = $pages[$index - 1];
if ($originPage === null || ($previousPage->getName() !== $originPage->getName()
&& array_search($originPage, $pages, true) < $index))
{
&& array_search($originPage, $pages, true) < $index)) {
$permitted = $this->hasPageData($previousPage->getName());
}
}

View File

@ -61,7 +61,6 @@ class ModuleController extends DocController
'title' => $this->translate('Module Documentation', 'Tab title'),
'url' => Url::fromRequest()
));
}
/**

Some files were not shown because too many files have changed in this diff Show More