Completed
Push — master ( 3bc009...7bddac )
by Aimeos
02:56
created
lib/custom/src/MW/View/Helper/Response/Slim.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@
 block discarded – undo
29 29
 	 * @param string|resource Absolute file path or file descriptor
30 30
 	 * @return \Psr\Http\Message\StreamInterface Stream object
31 31
 	 */
32
-	public function createStream( $resource )
32
+	public function createStream($resource)
33 33
 	{
34
-		if( is_resource( $resource ) === true ) {
35
-			return new \Slim\Http\Stream( $resource );
34
+		if (is_resource($resource) === true) {
35
+			return new \Slim\Http\Stream($resource);
36 36
 		}
37 37
 
38
-		if( ( $fh = @fopen( $resource, 'r' ) ) !== false ) {
39
-			return new \Slim\Http\Stream( $fh );
38
+		if (($fh = @fopen($resource, 'r')) !== false) {
39
+			return new \Slim\Http\Stream($fh);
40 40
 		}
41 41
 
42
-		throw new \Aimeos\MW\Exception( sprintf( 'Unable to open file "%1$s"', $resource ) );
42
+		throw new \Aimeos\MW\Exception(sprintf('Unable to open file "%1$s"', $resource));
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Url/SlimTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,40 +17,40 @@
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		if( !class_exists( '\Slim\Router' ) ) {
21
-			$this->markTestSkipped( '\Slim\Router is not available' );
20
+		if (!class_exists('\Slim\Router')) {
21
+			$this->markTestSkipped('\Slim\Router is not available');
22 22
 		}
23 23
 
24 24
 		$view = new \Aimeos\MW\View\Standard();
25 25
 		$this->router = new \Slim\Router();
26
-		$this->object = new \Aimeos\MW\View\Helper\Url\Slim( $view, $this->router, array( 'site' => 'default' ) );
26
+		$this->object = new \Aimeos\MW\View\Helper\Url\Slim($view, $this->router, array('site' => 'default'));
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		unset( $this->object, $this->router );
32
+		unset($this->object, $this->router);
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testTransform()
37 37
 	{
38
-		$this->router->map( array( 'GET' ), 'shop/{site}', null )->setName( 'route' );
39
-		$result = $this->object->transform( 'route', 'catalog', 'lists', array( 'key' => 'value' ) );
38
+		$this->router->map(array('GET'), 'shop/{site}', null)->setName('route');
39
+		$result = $this->object->transform('route', 'catalog', 'lists', array('key' => 'value'));
40 40
 
41
-		$this->assertEquals( 'shop/default?key=value', $result );
41
+		$this->assertEquals('shop/default?key=value', $result);
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testTransformAbsolute()
46 46
 	{
47
-		$config = array( 'absoluteUri' => true );
47
+		$config = array('absoluteUri' => true);
48 48
 
49
-		$this->router->setBasePath( 'https://localhost/' );
50
-		$this->router->map( array( 'GET' ), 'shop/{site}', null )->setName( 'route' );
49
+		$this->router->setBasePath('https://localhost/');
50
+		$this->router->map(array('GET'), 'shop/{site}', null)->setName('route');
51 51
 
52
-		$result = $this->object->transform( 'route', 'catalog', 'lists', array( 'key' => 'value' ), array(), $config );
52
+		$result = $this->object->transform('route', 'catalog', 'lists', array('key' => 'value'), array(), $config);
53 53
 
54
-		$this->assertEquals( 'https://localhost/shop/default?key=value', $result );
54
+		$this->assertEquals('https://localhost/shop/default?key=value', $result);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
lib/custom/src/MW/View/Helper/Request/Slim.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers
28 28
 	 * @param \Psr\Http\Message\ServerRequestInterface $request PSR-7 request object
29 29
 	 */
30
-	public function __construct( \Aimeos\MW\View\Iface $view, \Psr\Http\Message\ServerRequestInterface $request )
30
+	public function __construct(\Aimeos\MW\View\Iface $view, \Psr\Http\Message\ServerRequestInterface $request)
31 31
 	{
32
-		$route = $request->getAttribute( 'route' );
32
+		$route = $request->getAttribute('route');
33 33
 
34
-		parent::__construct( $view, $request, $this->getIPAddress( $request ), ( $route ? $route->getName() : null ) );
34
+		parent::__construct($view, $request, $this->getIPAddress($request), ($route ? $route->getName() : null));
35 35
 	}
36 36
 
37 37
 
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 	 * @param \Psr\Http\Message\ServerRequestInterface $request
42 42
 	 * @return string|null IPv4 or IPv6 address or null if invalid
43 43
 	 */
44
-	protected function getIPAddress( \Psr\Http\Message\ServerRequestInterface $request )
44
+	protected function getIPAddress(\Psr\Http\Message\ServerRequestInterface $request)
45 45
 	{
46 46
 		$server = $request->getServerParams();
47 47
 		$flags = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6;
48 48
 
49
-		if( isset( $server['REMOTE_ADDR'] )
50
-			&& ( $ip = filter_var( $server['REMOTE_ADDR'], FILTER_VALIDATE_IP, $flags ) ) !== false
49
+		if (isset($server['REMOTE_ADDR'])
50
+			&& ($ip = filter_var($server['REMOTE_ADDR'], FILTER_VALIDATE_IP, $flags)) !== false
51 51
 		) {
52 52
 			return $ip;
53 53
 		}
Please login to merge, or discard this patch.
lib/custom/tests/TestHelper.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$includepaths = $aimeos->getIncludePaths();
20 20
 		$includepaths[] = get_include_path();
21
-		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
21
+		set_include_path(implode(PATH_SEPARATOR, $includepaths));
22 22
 	}
23 23
 
24 24
 
25
-	public static function getContext( $site = 'unittest' )
25
+	public static function getContext($site = 'unittest')
26 26
 	{
27
-		if( !isset( self::$context[$site] ) ) {
28
-			self::$context[$site] = self::createContext( $site );
27
+		if (!isset(self::$context[$site])) {
28
+			self::$context[$site] = self::createContext($site);
29 29
 		}
30 30
 
31 31
 		return clone self::$context[$site];
@@ -34,58 +34,58 @@  discard block
 block discarded – undo
34 34
 
35 35
 	private static function getAimeos()
36 36
 	{
37
-		if( !isset( self::$aimeos ) )
37
+		if (!isset(self::$aimeos))
38 38
 		{
39 39
 			require_once 'Bootstrap.php';
40
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
40
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
41 41
 
42
-			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
43
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
42
+			$extdir = dirname(dirname(dirname(__DIR__)));
43
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
44 44
 		}
45 45
 
46 46
 		return self::$aimeos;
47 47
 	}
48 48
 
49 49
 
50
-	private static function createContext( $site )
50
+	private static function createContext($site)
51 51
 	{
52 52
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
53 53
 		$aimeos = self::getAimeos();
54 54
 
55 55
 
56
-		$paths = $aimeos->getConfigPaths( 'mysql' );
57
-		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
56
+		$paths = $aimeos->getConfigPaths('mysql');
57
+		$paths[] = __DIR__.DIRECTORY_SEPARATOR.'config';
58 58
 
59
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), $paths );
60
-		$ctx->setConfig( $conf );
59
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
60
+		$ctx->setConfig($conf);
61 61
 
62 62
 
63
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
64
-		$ctx->setDatabaseManager( $dbm );
63
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
64
+		$ctx->setDatabaseManager($dbm);
65 65
 
66 66
 
67
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
68
-		$ctx->setLogger( $logger );
67
+		$logger = new \Aimeos\MW\Logger\File($site.'.log', \Aimeos\MW\Logger\Base::DEBUG);
68
+		$ctx->setLogger($logger);
69 69
 
70 70
 
71 71
 		$cache = new \Aimeos\MW\Cache\None();
72
-		$ctx->setCache( $cache );
72
+		$ctx->setCache($cache);
73 73
 
74 74
 
75
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
76
-		$ctx->setI18n( array( 'de' => $i18n ) );
75
+		$i18n = new \Aimeos\MW\Translation\None('de');
76
+		$ctx->setI18n(array('de' => $i18n));
77 77
 
78 78
 
79 79
 		$session = new \Aimeos\MW\Session\None();
80
-		$ctx->setSession( $session );
80
+		$ctx->setSession($session);
81 81
 
82 82
 
83
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
84
-		$localeItem = $localeManager->bootstrap( $site, '', '', false );
83
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
84
+		$localeItem = $localeManager->bootstrap($site, '', '', false);
85 85
 
86
-		$ctx->setLocale( $localeItem );
86
+		$ctx->setLocale($localeItem);
87 87
 
88
-		$ctx->setEditor( 'ai-slim:unittest' );
88
+		$ctx->setEditor('ai-slim:unittest');
89 89
 
90 90
 		return $ctx;
91 91
 	}
Please login to merge, or discard this patch.
lib/custom/src/MW/View/Helper/Url/Slim.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param \Slim\Router $router Slim router object
33 33
 	 * @param array Associative list of fixed parameters that should be available for all routes
34 34
 	 */
35
-	public function __construct( \Aimeos\MW\View\Iface $view, \Slim\Router $router, array $fixed )
35
+	public function __construct(\Aimeos\MW\View\Iface $view, \Slim\Router $router, array $fixed)
36 36
 	{
37
-		parent::__construct( $view );
37
+		parent::__construct($view);
38 38
 
39 39
 		$this->router = $router;
40 40
 		$this->fixed = $fixed;
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 	 * @param array $config Additional configuration parameter per URL
53 53
 	 * @return string Complete URL that can be used in the template
54 54
 	 */
55
-	public function transform( $target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array() )
55
+	public function transform($target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array())
56 56
 	{
57
-		$params = $this->sanitize( $params );
57
+		$params = $this->sanitize($params);
58 58
 
59
-		if( isset( $config['absoluteUri'] ) && (bool) $config['absoluteUri'] === true ) {
60
-			return $this->router->pathFor( $target, $this->fixed + $params );
59
+		if (isset($config['absoluteUri']) && (bool) $config['absoluteUri'] === true) {
60
+			return $this->router->pathFor($target, $this->fixed + $params);
61 61
 		}
62 62
 
63
-		return $this->router->relativePathFor( $target, $this->fixed + $params );
63
+		return $this->router->relativePathFor($target, $this->fixed + $params);
64 64
 	}
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
lib/custom/tests/Slim/RouterTest.php 2 patches
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -10,136 +10,136 @@
 block discarded – undo
10 10
 
11 11
 class RouterTest extends \PHPUnit_Framework_TestCase
12 12
 {
13
-    /** @var Router */
14
-    protected $router;
15
-
16
-    public function setUp()
17
-    {
18
-        $this->router = new \Aimeos\Slim\Router;
19
-    }
20
-
21
-    public function testRelativePathFor()
22
-    {
23
-        $this->router->setBasePath('/base/path');
24
-
25
-        $methods = ['GET'];
26
-        $pattern = '/hello/{first:\w+}/{last}';
27
-        $callable = function ($request, $response, $args) {
28
-            echo sprintf('Hello %s %s', $args['first'], $args['last']);
29
-        };
30
-        $route = $this->router->map($methods, $pattern, $callable);
31
-        $route->setName('foo');
32
-
33
-        $this->assertEquals(
34
-            '/hello/josh/lockhart',
35
-            $this->router->relativePathFor('foo', ['first' => 'josh', 'last' => 'lockhart'])
36
-        );
37
-    }
38
-
39
-    public function testPathForWithNoBasePath()
40
-    {
41
-        $this->router->setBasePath('');
42
-
43
-        $methods = ['GET'];
44
-        $pattern = '/hello/{first:\w+}/{last}';
45
-        $callable = function ($request, $response, $args) {
46
-            echo sprintf('Hello %s %s', $args['first'], $args['last']);
47
-        };
48
-        $route = $this->router->map($methods, $pattern, $callable);
49
-        $route->setName('foo');
50
-
51
-        $this->assertEquals(
52
-            '/hello/josh/lockhart',
53
-            $this->router->pathFor('foo', ['first' => 'josh', 'last' => 'lockhart'])
54
-        );
55
-    }
56
-
57
-    public function testPathForWithBasePath()
58
-    {
59
-        $methods = ['GET'];
60
-        $pattern = '/hello/{first:\w+}/{last}';
61
-        $callable = function ($request, $response, $args) {
62
-            echo sprintf('Hello %s %s', $args['first'], $args['last']);
63
-        };
64
-        $this->router->setBasePath('/base/path');
65
-        $route = $this->router->map($methods, $pattern, $callable);
66
-        $route->setName('foo');
67
-
68
-        $this->assertEquals(
69
-            '/base/path/hello/josh/lockhart',
70
-            $this->router->pathFor('foo', ['first' => 'josh', 'last' => 'lockhart'])
71
-        );
72
-    }
73
-
74
-    public function testPathForWithOptionalParameters()
75
-    {
76
-        $methods = ['GET'];
77
-        $pattern = '/archive/{year}[/{month:[\d:{2}]}[/d/{day}]]';
78
-        $callable = function ($request, $response, $args) {
79
-            return $response;
80
-        };
81
-        $route = $this->router->map($methods, $pattern, $callable);
82
-        $route->setName('foo');
83
-
84
-        $this->assertEquals(
85
-            '/archive/2015',
86
-            $this->router->pathFor('foo', ['year' => '2015'])
87
-        );
88
-        $this->assertEquals(
89
-            '/archive/2015/07',
90
-            $this->router->pathFor('foo', ['year' => '2015', 'month' => '07'])
91
-        );
92
-        $this->assertEquals(
93
-            '/archive/2015/07/d/19',
94
-            $this->router->pathFor('foo', ['year' => '2015', 'month' => '07', 'day' => '19'])
95
-        );
96
-    }
97
-
98
-    public function testPathForWithSurplusRouteParameters()
99
-    {
100
-        $methods = ['GET'];
101
-        $pattern = '/hello/{name}';
102
-        $callable = function ($request, $response, $args) {
103
-            echo sprintf('Hello %s', $args['name']);
104
-        };
105
-        $route = $this->router->map($methods, $pattern, $callable);
106
-        $route->setName('foo');
107
-
108
-        $this->assertEquals(
109
-            '/hello/josh?a=b',
110
-            $this->router->pathFor('foo', ['name' => 'josh', 'a' => 'b'])
111
-        );
112
-    }
113
-
114
-    /**
115
-     * @expectedException \InvalidArgumentException
116
-     */
117
-    public function testPathForWithMissingSegmentData()
118
-    {
119
-        $methods = ['GET'];
120
-        $pattern = '/hello/{first}/{last}';
121
-        $callable = function ($request, $response, $args) {
122
-            echo sprintf('Hello %s %s', $args['first'], $args['last']);
123
-        };
124
-        $route = $this->router->map($methods, $pattern, $callable);
125
-        $route->setName('foo');
126
-
127
-        $this->router->pathFor('foo', ['last' => 'lockhart']);
128
-    }
129
-
130
-    /**
131
-     * @expectedException \RuntimeException
132
-     */
133
-    public function testPathForRouteNotExists()
134
-    {
135
-        $methods = ['GET'];
136
-        $pattern = '/hello/{first}/{last}';
137
-        $callable = function ($request, $response, $args) {
138
-            echo sprintf('Hello %s %s', $args['first'], $args['last']);
139
-        };
140
-        $route = $this->router->map($methods, $pattern, $callable);
141
-        $route->setName('foo');
142
-
143
-        $this->router->pathFor('bar', ['first' => 'josh', 'last' => 'lockhart']);
144
-    }
13
+	/** @var Router */
14
+	protected $router;
15
+
16
+	public function setUp()
17
+	{
18
+		$this->router = new \Aimeos\Slim\Router;
19
+	}
20
+
21
+	public function testRelativePathFor()
22
+	{
23
+		$this->router->setBasePath('/base/path');
24
+
25
+		$methods = ['GET'];
26
+		$pattern = '/hello/{first:\w+}/{last}';
27
+		$callable = function ($request, $response, $args) {
28
+			echo sprintf('Hello %s %s', $args['first'], $args['last']);
29
+		};
30
+		$route = $this->router->map($methods, $pattern, $callable);
31
+		$route->setName('foo');
32
+
33
+		$this->assertEquals(
34
+			'/hello/josh/lockhart',
35
+			$this->router->relativePathFor('foo', ['first' => 'josh', 'last' => 'lockhart'])
36
+		);
37
+	}
38
+
39
+	public function testPathForWithNoBasePath()
40
+	{
41
+		$this->router->setBasePath('');
42
+
43
+		$methods = ['GET'];
44
+		$pattern = '/hello/{first:\w+}/{last}';
45
+		$callable = function ($request, $response, $args) {
46
+			echo sprintf('Hello %s %s', $args['first'], $args['last']);
47
+		};
48
+		$route = $this->router->map($methods, $pattern, $callable);
49
+		$route->setName('foo');
50
+
51
+		$this->assertEquals(
52
+			'/hello/josh/lockhart',
53
+			$this->router->pathFor('foo', ['first' => 'josh', 'last' => 'lockhart'])
54
+		);
55
+	}
56
+
57
+	public function testPathForWithBasePath()
58
+	{
59
+		$methods = ['GET'];
60
+		$pattern = '/hello/{first:\w+}/{last}';
61
+		$callable = function ($request, $response, $args) {
62
+			echo sprintf('Hello %s %s', $args['first'], $args['last']);
63
+		};
64
+		$this->router->setBasePath('/base/path');
65
+		$route = $this->router->map($methods, $pattern, $callable);
66
+		$route->setName('foo');
67
+
68
+		$this->assertEquals(
69
+			'/base/path/hello/josh/lockhart',
70
+			$this->router->pathFor('foo', ['first' => 'josh', 'last' => 'lockhart'])
71
+		);
72
+	}
73
+
74
+	public function testPathForWithOptionalParameters()
75
+	{
76
+		$methods = ['GET'];
77
+		$pattern = '/archive/{year}[/{month:[\d:{2}]}[/d/{day}]]';
78
+		$callable = function ($request, $response, $args) {
79
+			return $response;
80
+		};
81
+		$route = $this->router->map($methods, $pattern, $callable);
82
+		$route->setName('foo');
83
+
84
+		$this->assertEquals(
85
+			'/archive/2015',
86
+			$this->router->pathFor('foo', ['year' => '2015'])
87
+		);
88
+		$this->assertEquals(
89
+			'/archive/2015/07',
90
+			$this->router->pathFor('foo', ['year' => '2015', 'month' => '07'])
91
+		);
92
+		$this->assertEquals(
93
+			'/archive/2015/07/d/19',
94
+			$this->router->pathFor('foo', ['year' => '2015', 'month' => '07', 'day' => '19'])
95
+		);
96
+	}
97
+
98
+	public function testPathForWithSurplusRouteParameters()
99
+	{
100
+		$methods = ['GET'];
101
+		$pattern = '/hello/{name}';
102
+		$callable = function ($request, $response, $args) {
103
+			echo sprintf('Hello %s', $args['name']);
104
+		};
105
+		$route = $this->router->map($methods, $pattern, $callable);
106
+		$route->setName('foo');
107
+
108
+		$this->assertEquals(
109
+			'/hello/josh?a=b',
110
+			$this->router->pathFor('foo', ['name' => 'josh', 'a' => 'b'])
111
+		);
112
+	}
113
+
114
+	/**
115
+	 * @expectedException \InvalidArgumentException
116
+	 */
117
+	public function testPathForWithMissingSegmentData()
118
+	{
119
+		$methods = ['GET'];
120
+		$pattern = '/hello/{first}/{last}';
121
+		$callable = function ($request, $response, $args) {
122
+			echo sprintf('Hello %s %s', $args['first'], $args['last']);
123
+		};
124
+		$route = $this->router->map($methods, $pattern, $callable);
125
+		$route->setName('foo');
126
+
127
+		$this->router->pathFor('foo', ['last' => 'lockhart']);
128
+	}
129
+
130
+	/**
131
+	 * @expectedException \RuntimeException
132
+	 */
133
+	public function testPathForRouteNotExists()
134
+	{
135
+		$methods = ['GET'];
136
+		$pattern = '/hello/{first}/{last}';
137
+		$callable = function ($request, $response, $args) {
138
+			echo sprintf('Hello %s %s', $args['first'], $args['last']);
139
+		};
140
+		$route = $this->router->map($methods, $pattern, $callable);
141
+		$route->setName('foo');
142
+
143
+		$this->router->pathFor('bar', ['first' => 'josh', 'last' => 'lockhart']);
144
+	}
145 145
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
         $methods = ['GET'];
26 26
         $pattern = '/hello/{first:\w+}/{last}';
27
-        $callable = function ($request, $response, $args) {
27
+        $callable = function($request, $response, $args) {
28 28
             echo sprintf('Hello %s %s', $args['first'], $args['last']);
29 29
         };
30 30
         $route = $this->router->map($methods, $pattern, $callable);
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         $methods = ['GET'];
44 44
         $pattern = '/hello/{first:\w+}/{last}';
45
-        $callable = function ($request, $response, $args) {
45
+        $callable = function($request, $response, $args) {
46 46
             echo sprintf('Hello %s %s', $args['first'], $args['last']);
47 47
         };
48 48
         $route = $this->router->map($methods, $pattern, $callable);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $methods = ['GET'];
60 60
         $pattern = '/hello/{first:\w+}/{last}';
61
-        $callable = function ($request, $response, $args) {
61
+        $callable = function($request, $response, $args) {
62 62
             echo sprintf('Hello %s %s', $args['first'], $args['last']);
63 63
         };
64 64
         $this->router->setBasePath('/base/path');
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     {
76 76
         $methods = ['GET'];
77 77
         $pattern = '/archive/{year}[/{month:[\d:{2}]}[/d/{day}]]';
78
-        $callable = function ($request, $response, $args) {
78
+        $callable = function($request, $response, $args) {
79 79
             return $response;
80 80
         };
81 81
         $route = $this->router->map($methods, $pattern, $callable);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $methods = ['GET'];
101 101
         $pattern = '/hello/{name}';
102
-        $callable = function ($request, $response, $args) {
102
+        $callable = function($request, $response, $args) {
103 103
             echo sprintf('Hello %s', $args['name']);
104 104
         };
105 105
         $route = $this->router->map($methods, $pattern, $callable);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $methods = ['GET'];
120 120
         $pattern = '/hello/{first}/{last}';
121
-        $callable = function ($request, $response, $args) {
121
+        $callable = function($request, $response, $args) {
122 122
             echo sprintf('Hello %s %s', $args['first'], $args['last']);
123 123
         };
124 124
         $route = $this->router->map($methods, $pattern, $callable);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $methods = ['GET'];
136 136
         $pattern = '/hello/{first}/{last}';
137
-        $callable = function ($request, $response, $args) {
137
+        $callable = function($request, $response, $args) {
138 138
             echo sprintf('Hello %s %s', $args['first'], $args['last']);
139 139
         };
140 140
         $route = $this->router->map($methods, $pattern, $callable);
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Response/SlimTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,48 +16,48 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		if( !class_exists( '\Slim\Http\Stream' ) ) {
20
-			$this->markTestSkipped( '\Slim\Http\Stream is not available' );
19
+		if (!class_exists('\Slim\Http\Stream')) {
20
+			$this->markTestSkipped('\Slim\Http\Stream is not available');
21 21
 		}
22 22
 
23
-		$response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock();
23
+		$response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock();
24 24
 
25 25
 		$view = new \Aimeos\MW\View\Standard();
26
-		$this->object = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response );
26
+		$this->object = new \Aimeos\MW\View\Helper\Response\Slim($view, $response);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		unset( $this->object );
32
+		unset($this->object);
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testTransform()
37 37
 	{
38
-		$this->assertInstanceOf( '\Aimeos\MW\View\Helper\Response\Slim', $this->object->transform() );
39
-		$this->assertInstanceOf( '\Psr\Http\Message\ResponseInterface', $this->object->transform() );
38
+		$this->assertInstanceOf('\Aimeos\MW\View\Helper\Response\Slim', $this->object->transform());
39
+		$this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $this->object->transform());
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testCreateStream()
44 44
 	{
45
-		$stream = $this->object->createStream( fopen( __FILE__, 'r' ) );
45
+		$stream = $this->object->createStream(fopen(__FILE__, 'r'));
46 46
 
47
-		$this->assertInstanceOf( '\Slim\Http\Stream', $stream );
48
-		$this->assertInstanceOf( '\Psr\Http\Message\StreamInterface', $stream );
47
+		$this->assertInstanceOf('\Slim\Http\Stream', $stream);
48
+		$this->assertInstanceOf('\Psr\Http\Message\StreamInterface', $stream);
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testCreateStreamFilename()
53 53
 	{
54
-		$this->assertInstanceOf( '\Psr\Http\Message\StreamInterface', $this->object->createStream( __FILE__ ) );
54
+		$this->assertInstanceOf('\Psr\Http\Message\StreamInterface', $this->object->createStream(__FILE__));
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testCreateStreamInvalid()
59 59
 	{
60
-		$this->setExpectedException( '\Exception' );
60
+		$this->setExpectedException('\Exception');
61 61
 		$this->object->createStream( -1 );
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Request/SlimTest.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,51 +17,51 @@
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		if( !interface_exists( '\Psr\Http\Message\ServerRequestInterface' ) ) {
21
-			$this->markTestSkipped( '\Psr\Http\Message\ServerRequestInterface is not available' );
20
+		if (!interface_exists('\Psr\Http\Message\ServerRequestInterface')) {
21
+			$this->markTestSkipped('\Psr\Http\Message\ServerRequestInterface is not available');
22 22
 		}
23 23
 
24
-		if( !class_exists( '\Slim\Route' ) ) {
25
-			$this->markTestSkipped( '\Slim\Route is not available' );
24
+		if (!class_exists('\Slim\Route')) {
25
+			$this->markTestSkipped('\Slim\Route is not available');
26 26
 		}
27 27
 
28 28
 		$view = new \Aimeos\MW\View\Standard();
29
-		$route = new \Slim\Route( array( 'GET' ), '/shop', null );
30
-		$route->setName( 'route' );
29
+		$route = new \Slim\Route(array('GET'), '/shop', null);
30
+		$route->setName('route');
31 31
 
32
-		$this->mock = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock();
32
+		$this->mock = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock();
33 33
 
34
-		$this->mock->expects( $this->once() )->method( 'getAttribute' )
35
-			->will( $this->returnValue( $route ) );
34
+		$this->mock->expects($this->once())->method('getAttribute')
35
+			->will($this->returnValue($route));
36 36
 
37
-		$this->mock->expects( $this->once() )->method( 'getServerParams' )
38
-			->will( $this->returnValue( array( 'REMOTE_ADDR' => '127.0.0.1' ) ) );
37
+		$this->mock->expects($this->once())->method('getServerParams')
38
+			->will($this->returnValue(array('REMOTE_ADDR' => '127.0.0.1')));
39 39
 
40
-		$this->object = new \Aimeos\MW\View\Helper\Request\Slim( $view, $this->mock );
40
+		$this->object = new \Aimeos\MW\View\Helper\Request\Slim($view, $this->mock);
41 41
 	}
42 42
 
43 43
 
44 44
 	protected function tearDown()
45 45
 	{
46
-		unset( $this->object, $this->mock );
46
+		unset($this->object, $this->mock);
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testTransform()
51 51
 	{
52
-		$this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Slim', $this->object->transform() );
53
-		$this->assertInstanceOf( '\Psr\Http\Message\ServerRequestInterface', $this->object->transform() );
52
+		$this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Slim', $this->object->transform());
53
+		$this->assertInstanceOf('\Psr\Http\Message\ServerRequestInterface', $this->object->transform());
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetClientAddress()
58 58
 	{
59
-		$this->assertEquals( '127.0.0.1', $this->object->getClientAddress() );
59
+		$this->assertEquals('127.0.0.1', $this->object->getClientAddress());
60 60
 	}
61 61
 
62 62
 
63 63
 	public function testGetTarget()
64 64
 	{
65
-		$this->assertEquals( 'route', $this->object->getTarget() );
65
+		$this->assertEquals('route', $this->object->getTarget());
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
lib/custom/src/Slim/Router.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,13 +75,13 @@
 block discarded – undo
75 75
 		}
76 76
 
77 77
 		if (empty($segments)) {
78
-			throw new InvalidArgumentException('Missing data for URL segment: ' . $segmentName);
78
+			throw new InvalidArgumentException('Missing data for URL segment: '.$segmentName);
79 79
 		}
80 80
 		$url = implode('', $segments);
81 81
 
82 82
 		$params = array_merge(array_diff_key($data, $segmentKeys), $queryParams);
83 83
 		if ($params) {
84
-			$url .= '?' . http_build_query($params);
84
+			$url .= '?'.http_build_query($params);
85 85
 		}
86 86
 
87 87
 		return $url;
Please login to merge, or discard this patch.