diff --git a/include/class_Combinations.inc b/include/class_Combinations.inc index d0ef2ac59839c0074c3adeb860d36b93d3e8d782..2821f6df5717e39ad4d3ff69feb0ae1f30de5da4 100644 --- a/include/class_Combinations.inc +++ b/include/class_Combinations.inc @@ -28,7 +28,7 @@ class Combinations implements Iterator protected $size = 0; protected $pos = 0; - function __construct($input, $size) + function __construct(array $input, $size) { $this->input = array_values($input); $this->n = count($this->input); diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 963d99a9d0406db1583812589f15007db2df8d23..038a697d07862d5427cbd0a9f90a0efeff28f7f2 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -677,9 +677,9 @@ class LDAP /*! * \brief Modify a entry of the directory LDAP * - * \param string $attrs The new entry + * \param array $attrs The new entry */ - function modify($attrs) + function modify(array $attrs) { if (count($attrs) == 0) { return 0; diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc index f1eb2b2a9f0a6d74aa58b26a50b5eb5033c01f65..dfbc1f44f3d350abdcf75ea9f575df3a43eac950 100644 --- a/include/class_msgPool.inc +++ b/include/class_msgPool.inc @@ -577,24 +577,15 @@ class msgPool { * * \param array $depends Contains all the settings enabled */ - public static function featuresEnabled($name, $depends = "") + public static function featuresEnabled($name, $depends = '') { - if (($depends == "") || (is_array($depends) && count($depends) == 0)) { + if (($depends == "") || (is_array($depends) && (count($depends) == 0))) { return sprintf(_("This account has %s settings enabled. You can disable them by clicking below."), $name); } else { - if (count($depends) == 1) { - if (is_array($depends)) { - $depends = $depends[0]; - } - return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $name, $depends); - } else { - $deps = ""; - foreach ($depends as $dep) { - $deps .= "$dep / "; - } - $deps = preg_replace("/ \/ $/", "", $deps); - return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $name, $deps); + if (is_array($depends)) { + $depends = implode(' / ', $depends); } + return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $name, $depends); } } diff --git a/include/class_objects.inc b/include/class_objects.inc index 69a27b1063ee3ff4530f84b9fb68df289cce9c1a..4f6716d26db4c8fdcd59d61561c5f4edda77e9b3 100644 --- a/include/class_objects.inc +++ b/include/class_objects.inc @@ -74,8 +74,7 @@ class objects $attrs = array_unique($attrs); if (count($attrs) == 1) { $attrs = $attrs[0]; - } - if (count($attrs) == 0) { + } elseif (count($attrs) == 0) { $attrs = array('dn' => 'raw'); } } elseif ($checkAcl) { diff --git a/include/functions.inc b/include/functions.inc index f1155cb125a447d96ccd95f89aa098e1d4b1d78a..90c37abe14a70ecfaa16f9b5998937cbec0af2e0 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -739,7 +739,7 @@ function get_locks($objects, $allow_readonly = FALSE) { global $config; - if (is_array($objects) && count($objects == 1)) { + if (is_array($objects) && (count($objects) == 1)) { $objects = reset($objects); } if (is_array($objects)) { @@ -1410,7 +1410,7 @@ function netmask_to_bits($netmask) /*! * \brief Recursion helper for gen_uids() */ -function _recurse_gen_uids($rule, $variables) +function _recurse_gen_uids($rule, array $variables) { $result = array(); diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 2a607334ca7ed7c7cd43002205675473d7b7399f..20a94870e9dea6113b68928356ed946b66f5f48f 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -1153,7 +1153,7 @@ class simplePlugin /* Convert arrays with one element to non arrays, if the saved attributes are no array, too */ if (is_array($this->attrs[$index]) && - count ($this->attrs[$index]) == 1 && + (count($this->attrs[$index]) == 1) && isset($this->saved_attributes[$index]) && !is_array($this->saved_attributes[$index])) { $this->attrs[$index] = $this->attrs[$index][0]; @@ -1161,7 +1161,7 @@ class simplePlugin /* Remove emtpy arrays if they do not differ */ if (is_array($this->attrs[$index]) && - count($this->attrs[$index]) == 0 && + (count($this->attrs[$index]) == 0) && !isset($this->saved_attributes[$index])) { unset ($this->attrs[$index]); continue; @@ -1171,7 +1171,7 @@ class simplePlugin if (!is_array($this->attrs[$index]) && isset($this->saved_attributes[$index]) && !is_array($this->saved_attributes[$index]) && - $this->attrs[$index] == $this->saved_attributes[$index]) { + ($this->attrs[$index] == $this->saved_attributes[$index])) { unset ($this->attrs[$index]); continue; }