Passed
Push — master ( 7df7a9...eea192 )
by Alain
02:24
created
src/MethodInvokerTrait.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -26,45 +26,45 @@
 block discarded – undo
26 26
 trait MethodInvokerTrait
27 27
 {
28 28
 
29
-    /**
30
-     * Check the accepted arguments for a given method and pass associative
31
-     * array values in the right order.
32
-     *
33
-     * @since 0.1.0
34
-     *
35
-     * @param  object $object The object that contains the method to invoke.
36
-     * @param  string $method Name of the method to invoke.
37
-     * @param  array  $args   Associative array that contains the arguments.
38
-     * @return mixed          Return value of the invoked method.
39
-     * @throws InvalidArgumentException If a valid method is missing.
40
-     */
41
-    protected function invokeMethod($object, $method, array $args = [])
42
-    {
29
+	/**
30
+	 * Check the accepted arguments for a given method and pass associative
31
+	 * array values in the right order.
32
+	 *
33
+	 * @since 0.1.0
34
+	 *
35
+	 * @param  object $object The object that contains the method to invoke.
36
+	 * @param  string $method Name of the method to invoke.
37
+	 * @param  array  $args   Associative array that contains the arguments.
38
+	 * @return mixed          Return value of the invoked method.
39
+	 * @throws InvalidArgumentException If a valid method is missing.
40
+	 */
41
+	protected function invokeMethod($object, $method, array $args = [])
42
+	{
43 43
 
44
-        if (! $method || ! is_string($method) || '' === $method) {
45
-            throw new InvalidArgumentException(_('Missing valid method to invoke.'));
46
-        }
44
+		if (! $method || ! is_string($method) || '' === $method) {
45
+			throw new InvalidArgumentException(_('Missing valid method to invoke.'));
46
+		}
47 47
 
48
-        try {
49
-            $reflection = new ReflectionMethod(get_class($object), $method);
50
-            $pass       = array();
48
+		try {
49
+			$reflection = new ReflectionMethod(get_class($object), $method);
50
+			$pass       = array();
51 51
 
52
-            foreach ($reflection->getParameters() as $param) {
53
-                $pass[] = array_key_exists($param->name, $args)
54
-                    ? $args[$param->name]
55
-                    : $param->getDefaultValue();
56
-            }
52
+			foreach ($reflection->getParameters() as $param) {
53
+				$pass[] = array_key_exists($param->name, $args)
54
+					? $args[$param->name]
55
+					: $param->getDefaultValue();
56
+			}
57 57
 
58
-            return $reflection->invokeArgs($object, $pass);
59
-        } catch (Exception $exception) {
60
-            throw new InvalidArgumentException(
61
-                sprintf(
62
-                    _('Failed to invoke method "%1$s" of class "%2$s". Reason: %3$s'),
63
-                    $method,
64
-                    get_class($object),
65
-                    $exception->getMessage()
66
-                )
67
-            );
68
-        }
69
-    }
58
+			return $reflection->invokeArgs($object, $pass);
59
+		} catch (Exception $exception) {
60
+			throw new InvalidArgumentException(
61
+				sprintf(
62
+					_('Failed to invoke method "%1$s" of class "%2$s". Reason: %3$s'),
63
+					$method,
64
+					get_class($object),
65
+					$exception->getMessage()
66
+				)
67
+			);
68
+		}
69
+	}
70 70
 }
Please login to merge, or discard this patch.
src/FunctionInvokerTrait.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * FunctionInvokerTrait
4
- *
5
- * @package   BrightNucleus\Invoker
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2015-2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * FunctionInvokerTrait
4
+	 *
5
+	 * @package   BrightNucleus\Invoker
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2015-2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\Invoker;
13 13
 
@@ -26,43 +26,43 @@  discard block
 block discarded – undo
26 26
 trait FunctionInvokerTrait
27 27
 {
28 28
 
29
-    /**
30
-     * Check the accepted arguments for a given function and pass associative
31
-     * array values in the right order.
32
-     *
33
-     * @since 0.1.0
34
-     *
35
-     * @param  string $function Name of the function to invoke.
36
-     * @param  array  $args     Associative array that contains the arguments.
37
-     * @return mixed            Return value of the invoked function.
38
-     * @throws InvalidArgumentException If a valid function is missing.
39
-     */
40
-    public function invokeFunction($function, array $args = array())
41
-    {
29
+	/**
30
+	 * Check the accepted arguments for a given function and pass associative
31
+	 * array values in the right order.
32
+	 *
33
+	 * @since 0.1.0
34
+	 *
35
+	 * @param  string $function Name of the function to invoke.
36
+	 * @param  array  $args     Associative array that contains the arguments.
37
+	 * @return mixed            Return value of the invoked function.
38
+	 * @throws InvalidArgumentException If a valid function is missing.
39
+	 */
40
+	public function invokeFunction($function, array $args = array())
41
+	{
42 42
 
43
-        if (! $function || ! is_string($function) || '' === $function) {
44
-            throw new InvalidArgumentException(_('Missing valid function to invoke.'));
45
-        }
43
+		if (! $function || ! is_string($function) || '' === $function) {
44
+			throw new InvalidArgumentException(_('Missing valid function to invoke.'));
45
+		}
46 46
 
47
-        try {
48
-            $reflection = new ReflectionFunction($function);
49
-            $pass       = array();
47
+		try {
48
+			$reflection = new ReflectionFunction($function);
49
+			$pass       = array();
50 50
 
51
-            foreach ($reflection->getParameters() as $param) {
52
-                $pass[] = array_key_exists($param->name, $args)
53
-                    ? $args[$param->name]
54
-                    : $param->getDefaultValue();
55
-            }
51
+			foreach ($reflection->getParameters() as $param) {
52
+				$pass[] = array_key_exists($param->name, $args)
53
+					? $args[$param->name]
54
+					: $param->getDefaultValue();
55
+			}
56 56
 
57
-            return $reflection->invokeArgs($pass);
58
-        } catch (Exception $exception) {
59
-            throw new InvalidArgumentException(
60
-                sprintf(
61
-                    _('Failed to invoke function "%1$s". Reason: %2$s'),
62
-                    $function,
63
-                    $exception->getMessage()
64
-                )
65
-            );
66
-        }
67
-    }
57
+			return $reflection->invokeArgs($pass);
58
+		} catch (Exception $exception) {
59
+			throw new InvalidArgumentException(
60
+				sprintf(
61
+					_('Failed to invoke function "%1$s". Reason: %2$s'),
62
+					$function,
63
+					$exception->getMessage()
64
+				)
65
+			);
66
+		}
67
+	}
68 68
 }
Please login to merge, or discard this patch.