Passed
Push — master ( 5992dd...593539 )
by Alain
02:25
created
src/Helper.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -25,34 +25,34 @@
 block discarded – undo
25 25
 class Helper
26 26
 {
27 27
 
28
-    /**
29
-     *
30
-     *
31
-     * @since 0.1.0
32
-     *
33
-     * @param ReflectionParameter[] $params The reflection parameters to parse.
34
-     * @param array                 $args   The arguments to check against.
35
-     * @return array The correctly ordered arguments to pass to the reflected callable.
36
-     * @throws RuntimeException If a $param does not have a name() method.
37
-     */
38
-    public static function parseParams(array $params, $args)
39
-    {
40
-        $ordered_args = array();
28
+	/**
29
+	 *
30
+	 *
31
+	 * @since 0.1.0
32
+	 *
33
+	 * @param ReflectionParameter[] $params The reflection parameters to parse.
34
+	 * @param array                 $args   The arguments to check against.
35
+	 * @return array The correctly ordered arguments to pass to the reflected callable.
36
+	 * @throws RuntimeException If a $param does not have a name() method.
37
+	 */
38
+	public static function parseParams(array $params, $args)
39
+	{
40
+		$ordered_args = array();
41 41
 
42
-        foreach ($params as $param) {
43
-            if (! $param instanceof ReflectionParameter) {
44
-                throw new RuntimeException(
45
-                    sprintf(
46
-                        _('Parameter %1$s is not an instance of ReflectionParameter.'),
47
-                        $param
48
-                    )
49
-                );
50
-            }
51
-            $ordered_args[] = array_key_exists($param->name, $args)
52
-                ? $args[$param->name]
53
-                : $param->getDefaultValue();
54
-        }
42
+		foreach ($params as $param) {
43
+			if (! $param instanceof ReflectionParameter) {
44
+				throw new RuntimeException(
45
+					sprintf(
46
+						_('Parameter %1$s is not an instance of ReflectionParameter.'),
47
+						$param
48
+					)
49
+				);
50
+			}
51
+			$ordered_args[] = array_key_exists($param->name, $args)
52
+				? $args[$param->name]
53
+				: $param->getDefaultValue();
54
+		}
55 55
 
56
-        return $ordered_args;
57
-    }
56
+		return $ordered_args;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         $ordered_args = array();
41 41
 
42 42
         foreach ($params as $param) {
43
-            if (! $param instanceof ReflectionParameter) {
43
+            if ( ! $param instanceof ReflectionParameter) {
44 44
                 throw new RuntimeException(
45 45
                     sprintf(
46 46
                         _('Parameter %1$s is not an instance of ReflectionParameter.'),
Please login to merge, or discard this patch.
src/FunctionInvokerTrait.php 1 patch
Indentation   +41 added lines, -41 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,40 +26,40 @@  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
-            $ordered_arguments = Helper::parseParams(
50
-                $reflection->getParameters(),
51
-                $args
52
-            );
47
+		try {
48
+			$reflection        = new ReflectionFunction($function);
49
+			$ordered_arguments = Helper::parseParams(
50
+				$reflection->getParameters(),
51
+				$args
52
+			);
53 53
 
54
-            return $reflection->invokeArgs($ordered_arguments);
55
-        } catch (Exception $exception) {
56
-            throw new InvalidArgumentException(
57
-                sprintf(
58
-                    _('Failed to invoke function "%1$s". Reason: %2$s'),
59
-                    $function,
60
-                    $exception->getMessage()
61
-                )
62
-            );
63
-        }
64
-    }
54
+			return $reflection->invokeArgs($ordered_arguments);
55
+		} catch (Exception $exception) {
56
+			throw new InvalidArgumentException(
57
+				sprintf(
58
+					_('Failed to invoke function "%1$s". Reason: %2$s'),
59
+					$function,
60
+					$exception->getMessage()
61
+				)
62
+			);
63
+		}
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/MethodInvokerTrait.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
- * MethodInvokerTrait
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
+	 * MethodInvokerTrait
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,42 +26,42 @@  discard block
 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
-            $ordered_arguments = Helper::parseParams(
51
-                $reflection->getParameters(),
52
-                $args
53
-            );
48
+		try {
49
+			$reflection        = new ReflectionMethod(get_class($object), $method);
50
+			$ordered_arguments = Helper::parseParams(
51
+				$reflection->getParameters(),
52
+				$args
53
+			);
54 54
 
55
-            return $reflection->invokeArgs($object, $ordered_arguments);
56
-        } catch (Exception $exception) {
57
-            throw new InvalidArgumentException(
58
-                sprintf(
59
-                    _('Failed to invoke method "%1$s" of class "%2$s". Reason: %3$s'),
60
-                    $method,
61
-                    get_class($object),
62
-                    $exception->getMessage()
63
-                )
64
-            );
65
-        }
66
-    }
55
+			return $reflection->invokeArgs($object, $ordered_arguments);
56
+		} catch (Exception $exception) {
57
+			throw new InvalidArgumentException(
58
+				sprintf(
59
+					_('Failed to invoke method "%1$s" of class "%2$s". Reason: %3$s'),
60
+					$method,
61
+					get_class($object),
62
+					$exception->getMessage()
63
+				)
64
+			);
65
+		}
66
+	}
67 67
 }
Please login to merge, or discard this patch.