Test Failed
Branch master (04392b)
by htmlBurger
01:37
created
src/Routing/Route.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -45,41 +45,41 @@  discard block
 block discarded – undo
45 45
 	 * @param mixed           $target
46 46
 	 * @param string|\Closure $handler
47 47
 	 */
48
-	public function __construct( $methods, $target, $handler ) {
49
-		if ( is_string( $target ) ) {
50
-			$target = new UrlCondition( $target );
48
+	public function __construct($methods, $target, $handler) {
49
+		if (is_string($target)) {
50
+			$target = new UrlCondition($target);
51 51
 		}
52 52
 
53
-		if ( is_array( $target ) ) {
54
-			$target = $this->condition( $target );
53
+		if (is_array($target)) {
54
+			$target = $this->condition($target);
55 55
 		}
56 56
 
57
-		if ( ! is_a( $target, ConditionInterface::class ) ) {
58
-			throw new Exception( 'Route target is not a valid route string or condition.' );
57
+		if ( ! is_a($target, ConditionInterface::class)) {
58
+			throw new Exception('Route target is not a valid route string or condition.');
59 59
 		}
60 60
 
61 61
 		$this->methods = $methods;
62 62
 		$this->target = $target;
63
-		$this->handler = new Handler( $handler );
63
+		$this->handler = new Handler($handler);
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * {@inheritDoc}
68 68
 	 */
69
-	public function satisfied( Request $request ) {
70
-		if ( ! in_array( $request->getMethod(), $this->methods) ) {
69
+	public function satisfied(Request $request) {
70
+		if ( ! in_array($request->getMethod(), $this->methods)) {
71 71
 			return false;
72 72
 		}
73
-		return $this->target->satisfied( $request );
73
+		return $this->target->satisfied($request);
74 74
 	}
75 75
 
76 76
 	/**
77 77
 	 * {@inheritDoc}
78 78
 	 */
79
-	public function handle( Request $request ) {
80
-		$arguments = array_merge( [$request], $this->target->getArguments( $request ) );
81
-		return $this->executeMiddleware( $this->getMiddleware(), $request, function() use ( $arguments ) {
82
-			return call_user_func_array( [$this->handler, 'execute'], $arguments );
79
+	public function handle(Request $request) {
80
+		$arguments = array_merge([$request], $this->target->getArguments($request));
81
+		return $this->executeMiddleware($this->getMiddleware(), $request, function() use ($arguments) {
82
+			return call_user_func_array([$this->handler, 'execute'], $arguments);
83 83
 		} );
84 84
 	}
85 85
 
@@ -89,21 +89,21 @@  discard block
 block discarded – undo
89 89
 	 * @param  array $options
90 90
 	 * @return ConditionInterface
91 91
 	 */
92
-	public function condition( $options ) {
93
-		if ( count( $options ) === 0 ) {
94
-			throw new Exception( 'No condition type specified.' );
92
+	public function condition($options) {
93
+		if (count($options) === 0) {
94
+			throw new Exception('No condition type specified.');
95 95
 		}
96 96
 
97 97
 		$condition_type = $options[0];
98
-		$arguments = array_slice( $options, 1 );
98
+		$arguments = array_slice($options, 1);
99 99
 
100
-		$condition_class = Framework::resolve( 'framework.routing.conditions.' . $condition_type );
101
-		if ( $condition_class === null ) {
102
-			throw new Exception( 'Unknown condition type specified: ' . $condition_type );
100
+		$condition_class = Framework::resolve('framework.routing.conditions.' . $condition_type);
101
+		if ($condition_class === null) {
102
+			throw new Exception('Unknown condition type specified: ' . $condition_type);
103 103
 		}
104 104
 
105
-		$reflection = new ReflectionClass( $condition_class );
106
-		$condition = $reflection->newInstanceArgs( $arguments );
105
+		$reflection = new ReflectionClass($condition_class);
106
+		$condition = $reflection->newInstanceArgs($arguments);
107 107
 		return $condition;
108 108
 	}
109 109
 }
Please login to merge, or discard this patch.
src/Url.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	 * 
14 14
 	 * @return string
15 15
 	 */
16
-	public static function getCurrentPath( Request $request ) {
16
+	public static function getCurrentPath(Request $request) {
17 17
 		$url = $request->getUrl();
18
-		$relative_url = substr( $url, strlen( home_url( '/' ) ) );
19
-		return static::addTrailingSlash( static::addLeadingSlash( $relative_url ) );
18
+		$relative_url = substr($url, strlen(home_url('/')));
19
+		return static::addTrailingSlash(static::addLeadingSlash($relative_url));
20 20
 	}
21 21
 
22 22
 	/**
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param  string $url
26 26
 	 * @return string
27 27
 	 */
28
-	public static function addLeadingSlash( $url ) {
29
-		return '/' . static::removeLeadingSlash( $url );
28
+	public static function addLeadingSlash($url) {
29
+		return '/' . static::removeLeadingSlash($url);
30 30
 	}
31 31
 
32 32
 	/**
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @param  string $url
36 36
 	 * @return string
37 37
 	 */
38
-	public static function removeLeadingSlash( $url ) {
39
-		return preg_replace( '/^\/+/', '', $url );
38
+	public static function removeLeadingSlash($url) {
39
+		return preg_replace('/^\/+/', '', $url);
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param  string $url
46 46
 	 * @return string
47 47
 	 */
48
-	public static function addTrailingSlash( $url ) {
49
-		return trailingslashit( $url );
48
+	public static function addTrailingSlash($url) {
49
+		return trailingslashit($url);
50 50
 	}
51 51
 
52 52
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param  string $url
56 56
 	 * @return string
57 57
 	 */
58
-	public static function removeTrailingSlash( $url ) {
59
-		return untrailingslashit( $url );
58
+	public static function removeTrailingSlash($url) {
59
+		return untrailingslashit($url);
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.