Passed
Push — master ( 5fab33...3076eb )
by Morris
61:14 queued 49:22
created
lib/private/Hooks/Emitter.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@
 block discarded – undo
34 34
  * @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service
35 35
  */
36 36
 interface Emitter {
37
-	/**
38
-	 * @param string $scope
39
-	 * @param string $method
40
-	 * @param callable $callback
41
-	 * @return void
42
-	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
43
-	 */
44
-	public function listen($scope, $method, callable $callback);
37
+    /**
38
+     * @param string $scope
39
+     * @param string $method
40
+     * @param callable $callback
41
+     * @return void
42
+     * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
43
+     */
44
+    public function listen($scope, $method, callable $callback);
45 45
 
46
-	/**
47
-	 * @param string $scope optional
48
-	 * @param string $method optional
49
-	 * @param callable $callback optional
50
-	 * @return void
51
-	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
52
-	 */
53
-	public function removeListener($scope = null, $method = null, callable $callback = null);
46
+    /**
47
+     * @param string $scope optional
48
+     * @param string $method optional
49
+     * @param callable $callback optional
50
+     * @return void
51
+     * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
52
+     */
53
+    public function removeListener($scope = null, $method = null, callable $callback = null);
54 54
 }
Please login to merge, or discard this patch.
lib/private/Hooks/PublicEmitter.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
  * @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service
30 30
  */
31 31
 class PublicEmitter extends BasicEmitter {
32
-	/**
33
-	 * @param string $scope
34
-	 * @param string $method
35
-	 * @param array $arguments optional
36
-	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped
37
-	 *
38
-	 * @suppress PhanAccessMethodProtected
39
-	 */
40
-	public function emit($scope, $method, array $arguments = []) {
41
-		parent::emit($scope, $method, $arguments);
42
-	}
32
+    /**
33
+     * @param string $scope
34
+     * @param string $method
35
+     * @param array $arguments optional
36
+     * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped
37
+     *
38
+     * @suppress PhanAccessMethodProtected
39
+     */
40
+    public function emit($scope, $method, array $arguments = []) {
41
+        parent::emit($scope, $method, $arguments);
42
+    }
43 43
 }
Please login to merge, or discard this patch.
lib/private/Hooks/EmitterTrait.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -29,83 +29,83 @@
 block discarded – undo
29 29
  */
30 30
 trait EmitterTrait {
31 31
 
32
-	/**
33
-	 * @var callable[][] $listeners
34
-	 */
35
-	protected $listeners = [];
32
+    /**
33
+     * @var callable[][] $listeners
34
+     */
35
+    protected $listeners = [];
36 36
 
37
-	/**
38
-	 * @param string $scope
39
-	 * @param string $method
40
-	 * @param callable $callback
41
-	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
42
-	 */
43
-	public function listen($scope, $method, callable $callback) {
44
-		$eventName = $scope . '::' . $method;
45
-		if (!isset($this->listeners[$eventName])) {
46
-			$this->listeners[$eventName] = [];
47
-		}
48
-		if (array_search($callback, $this->listeners[$eventName], true) === false) {
49
-			$this->listeners[$eventName][] = $callback;
50
-		}
51
-	}
37
+    /**
38
+     * @param string $scope
39
+     * @param string $method
40
+     * @param callable $callback
41
+     * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
42
+     */
43
+    public function listen($scope, $method, callable $callback) {
44
+        $eventName = $scope . '::' . $method;
45
+        if (!isset($this->listeners[$eventName])) {
46
+            $this->listeners[$eventName] = [];
47
+        }
48
+        if (array_search($callback, $this->listeners[$eventName], true) === false) {
49
+            $this->listeners[$eventName][] = $callback;
50
+        }
51
+    }
52 52
 
53
-	/**
54
-	 * @param string $scope optional
55
-	 * @param string $method optional
56
-	 * @param callable $callback optional
57
-	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
58
-	 */
59
-	public function removeListener($scope = null, $method = null, callable $callback = null) {
60
-		$names = [];
61
-		$allNames = array_keys($this->listeners);
62
-		if ($scope and $method) {
63
-			$name = $scope . '::' . $method;
64
-			if (isset($this->listeners[$name])) {
65
-				$names[] = $name;
66
-			}
67
-		} elseif ($scope) {
68
-			foreach ($allNames as $name) {
69
-				$parts = explode('::', $name, 2);
70
-				if ($parts[0] == $scope) {
71
-					$names[] = $name;
72
-				}
73
-			}
74
-		} elseif ($method) {
75
-			foreach ($allNames as $name) {
76
-				$parts = explode('::', $name, 2);
77
-				if ($parts[1] == $method) {
78
-					$names[] = $name;
79
-				}
80
-			}
81
-		} else {
82
-			$names = $allNames;
83
-		}
53
+    /**
54
+     * @param string $scope optional
55
+     * @param string $method optional
56
+     * @param callable $callback optional
57
+     * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
58
+     */
59
+    public function removeListener($scope = null, $method = null, callable $callback = null) {
60
+        $names = [];
61
+        $allNames = array_keys($this->listeners);
62
+        if ($scope and $method) {
63
+            $name = $scope . '::' . $method;
64
+            if (isset($this->listeners[$name])) {
65
+                $names[] = $name;
66
+            }
67
+        } elseif ($scope) {
68
+            foreach ($allNames as $name) {
69
+                $parts = explode('::', $name, 2);
70
+                if ($parts[0] == $scope) {
71
+                    $names[] = $name;
72
+                }
73
+            }
74
+        } elseif ($method) {
75
+            foreach ($allNames as $name) {
76
+                $parts = explode('::', $name, 2);
77
+                if ($parts[1] == $method) {
78
+                    $names[] = $name;
79
+                }
80
+            }
81
+        } else {
82
+            $names = $allNames;
83
+        }
84 84
 
85
-		foreach ($names as $name) {
86
-			if ($callback) {
87
-				$index = array_search($callback, $this->listeners[$name], true);
88
-				if ($index !== false) {
89
-					unset($this->listeners[$name][$index]);
90
-				}
91
-			} else {
92
-				$this->listeners[$name] = [];
93
-			}
94
-		}
95
-	}
85
+        foreach ($names as $name) {
86
+            if ($callback) {
87
+                $index = array_search($callback, $this->listeners[$name], true);
88
+                if ($index !== false) {
89
+                    unset($this->listeners[$name][$index]);
90
+                }
91
+            } else {
92
+                $this->listeners[$name] = [];
93
+            }
94
+        }
95
+    }
96 96
 
97
-	/**
98
-	 * @param string $scope
99
-	 * @param string $method
100
-	 * @param array $arguments optional
101
-	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped
102
-	 */
103
-	protected function emit($scope, $method, array $arguments = []) {
104
-		$eventName = $scope . '::' . $method;
105
-		if (isset($this->listeners[$eventName])) {
106
-			foreach ($this->listeners[$eventName] as $callback) {
107
-				call_user_func_array($callback, $arguments);
108
-			}
109
-		}
110
-	}
97
+    /**
98
+     * @param string $scope
99
+     * @param string $method
100
+     * @param array $arguments optional
101
+     * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped
102
+     */
103
+    protected function emit($scope, $method, array $arguments = []) {
104
+        $eventName = $scope . '::' . $method;
105
+        if (isset($this->listeners[$eventName])) {
106
+            foreach ($this->listeners[$eventName] as $callback) {
107
+                call_user_func_array($callback, $arguments);
108
+            }
109
+        }
110
+    }
111 111
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
42 42
 	 */
43 43
 	public function listen($scope, $method, callable $callback) {
44
-		$eventName = $scope . '::' . $method;
44
+		$eventName = $scope.'::'.$method;
45 45
 		if (!isset($this->listeners[$eventName])) {
46 46
 			$this->listeners[$eventName] = [];
47 47
 		}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$names = [];
61 61
 		$allNames = array_keys($this->listeners);
62 62
 		if ($scope and $method) {
63
-			$name = $scope . '::' . $method;
63
+			$name = $scope.'::'.$method;
64 64
 			if (isset($this->listeners[$name])) {
65 65
 				$names[] = $name;
66 66
 			}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped
102 102
 	 */
103 103
 	protected function emit($scope, $method, array $arguments = []) {
104
-		$eventName = $scope . '::' . $method;
104
+		$eventName = $scope.'::'.$method;
105 105
 		if (isset($this->listeners[$eventName])) {
106 106
 			foreach ($this->listeners[$eventName] as $callback) {
107 107
 				call_user_func_array($callback, $arguments);
Please login to merge, or discard this patch.