Passed
Push — 16.1 ( 647407...8fe467 )
by Ralf
12:04
created
api/src/Hooks.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 
65 65
 		if (!isset(self::$locations)) self::read();
66 66
 		$hooks = self::$locations[$location];
67
-		if (!isset($hooks) || empty($hooks)) return array();	// not a single app implements that hook
67
+		if (!isset($hooks) || empty($hooks)) return array(); // not a single app implements that hook
68 68
 
69 69
 		$apps = array_keys($hooks);
70 70
 		if (!$no_permission_check)
71 71
 		{
72 72
 			// on install of a new egroupware both hook-apps and user apps may be empty/not set
73
-			$apps = array_intersect((array)$apps,array_keys((array)$GLOBALS['egw_info']['user']['apps']));
73
+			$apps = array_intersect((array)$apps, array_keys((array)$GLOBALS['egw_info']['user']['apps']));
74 74
 		}
75 75
 		if ($order)
76 76
 		{
77
-			$apps = array_unique(array_merge((array)$order,$apps));
77
+			$apps = array_unique(array_merge((array)$order, $apps));
78 78
 		}
79 79
 		$results = array();
80
-		foreach((array)$apps as $appname)
80
+		foreach ((array)$apps as $appname)
81 81
 		{
82
-			$results[$appname] = self::single($args,$appname,$no_permission_check);
82
+			$results[$appname] = self::single($args, $appname, $no_permission_check);
83 83
 		}
84 84
 		return $results;
85 85
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 
117 117
 		$ret = array();
118
-		foreach((array)self::$locations[$location][$appname] as $hook)
118
+		foreach ((array)self::$locations[$location][$appname] as $hook)
119 119
 		{
120 120
 			try {
121 121
 				// old style file hook
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		}
150 150
 
151 151
 		// hooks only existing in filesystem used by setup
152
-		if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook='/'.$appname.'/inc/hook_'.$location.'.inc.php')))
152
+		if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook = '/'.$appname.'/inc/hook_'.$location.'.inc.php')))
153 153
 		{
154 154
 			include(EGW_SERVER_ROOT.$hook);
155 155
 			return true;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param boolean $return_methods =false true: return hook-method(s)
182 182
 	 * @return int|array the number of found hooks or for $return_methods array with methods
183 183
 	 */
184
-	public static function exists($location, $app, $return_methods=false)
184
+	public static function exists($location, $app, $return_methods = false)
185 185
 	{
186 186
 		if (!isset(self::$locations)) self::read();
187 187
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param boolan $force_rescan =false true: do not use instance cache
210 210
 	 */
211
-	public static function read($force_rescan=false)
211
+	public static function read($force_rescan = false)
212 212
 	{
213 213
 		//$starttime = microtime(true);
214 214
 		if ($force_rescan) Cache::unsetInstance(__CLASS__, 'locations');
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
 
225 225
 			// read all apps using just filesystem data
226 226
 			$locations = array();
227
-			foreach(array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
227
+			foreach (array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
228 228
 			{
229 229
 				if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname)) continue;
230 230
 
231
-				$f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
231
+				$f = EGW_SERVER_ROOT.'/'.$appname.'/setup/setup.inc.php';
232 232
 				$setup_info = array($appname => array());
233
-				if(@file_exists($f)) include($f);
233
+				if (@file_exists($f)) include($f);
234 234
 
235 235
 				// some apps have setup_info for more then themselfs (eg. api for groupdav)
236
-				foreach($setup_info as $appname => $data)
236
+				foreach ($setup_info as $appname => $data)
237 237
 				{
238
-					foreach((array)$data['hooks'] as $location => $methods)
238
+					foreach ((array)$data['hooks'] as $location => $methods)
239 239
 					{
240 240
 						if (is_int($location))
241 241
 						{
Please login to merge, or discard this patch.