Just a couple of phpcs complaints fixed

This commit is contained in:
Thomas Gelf 2016-10-21 21:13:33 +00:00
parent 0791b900f3
commit 5b4e7509f4
5 changed files with 20 additions and 10 deletions

View File

@ -48,7 +48,7 @@ class IcingaServiceForm extends DirectorObjectForm
if (!$this->isNew() && $this->host === null) {
$this->host = $this->object->getResolvedRelated('host');
}
} catch(NestingError $nestingError) {
} catch (NestingError $nestingError) {
// ignore for the form to load
}
@ -279,8 +279,12 @@ class IcingaServiceForm extends DirectorObjectForm
protected function addApplyForElement()
{
if ($this->object->isApplyRule()) {
$hostProperties = IcingaHost::enumProperties($this->object->getConnection(), 'host.',
new ArrayCustomVariablesFilter());
$hostProperties = IcingaHost::enumProperties(
$this->object->getConnection(),
'host.',
new ArrayCustomVariablesFilter()
);
$this->addElement('select', 'apply_for', array(
'label' => $this->translate('Apply For'),
'class' => 'assign-property autosubmit',

View File

@ -17,7 +17,8 @@ class PropertiesFilter
'accept_config',
);
public function match($type, $name, $object=null) {
public function match($type, $name, $object = null)
{
return ($type != self::$HOST_PROPERTY || !in_array($name, $this->blacklist));
}
}

View File

@ -2,11 +2,12 @@
namespace Icinga\Module\Director\Data\PropertiesFilter;
class ArrayCustomVariablesFilter extends CustomVariablesFilter {
public function match($type, $name, $object=null) {
class ArrayCustomVariablesFilter extends CustomVariablesFilter
{
public function match($type, $name, $object = null)
{
return parent::match($type, $name, $object)
&& $object !== null
&& preg_match('/DataTypeArray[\w]*$/', $object->datatype);
}
}

View File

@ -6,7 +6,8 @@ use Icinga\Module\Director\Data\PropertiesFilter;
class CustomVariablesFilter extends PropertiesFilter
{
public function match($type, $name, $object=null) {
public function match($type, $name, $object = null)
{
return parent::match($type, $name, $object) && $type === self::$CUSTOM_PROPERTY;
}
}

View File

@ -82,8 +82,11 @@ class IcingaHost extends IcingaObject
protected $supportsFields = true;
public static function enumProperties(DbConnection $connection = null, $prefix = '', $filter= null)
{
public static function enumProperties(
DbConnection $connection = null,
$prefix = '',
$filter = null
) {
$hostProperties = array();
if ($filter === null) {
$filter = new PropertiesFilter();