Completed
Push — master ( 11e741...1dddac )
by Aimeos
11:34
created
lib/custom/src/MW/View/Helper/Request/Symfony2.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers
35 35
 	 * @param \Symfony\Component\HttpFoundation\Request $request Symfony2 request object
36 36
 	 */
37
-	public function __construct( $view, \Symfony\Component\HttpFoundation\Request $request )
37
+	public function __construct($view, \Symfony\Component\HttpFoundation\Request $request)
38 38
 	{
39 39
 		$this->request = $request;
40 40
 
41
-		parent::__construct( $view, $this->createRequest( $request ) );
41
+		parent::__construct($view, $this->createRequest($request));
42 42
 	}
43 43
 
44 44
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function getTarget()
62 62
 	{
63
-		return $this->request->get( '_route' );
63
+		return $this->request->get('_route');
64 64
 	}
65 65
 
66 66
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 	 * @param \Symfony\Component\HttpFoundation\Request $nativeRequest Symfony request object
71 71
 	 * @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object
72 72
 	 */
73
-	protected function createRequest( \Symfony\Component\HttpFoundation\Request $nativeRequest )
73
+	protected function createRequest(\Symfony\Component\HttpFoundation\Request $nativeRequest)
74 74
 	{
75
-		$files = ServerRequestFactory::normalizeFiles( $this->getFiles( $nativeRequest->files->all() ) );
76
-		$server = ServerRequestFactory::normalizeServer( $nativeRequest->server->all() );
75
+		$files = ServerRequestFactory::normalizeFiles($this->getFiles($nativeRequest->files->all()));
76
+		$server = ServerRequestFactory::normalizeServer($nativeRequest->server->all());
77 77
 		$headers = $nativeRequest->headers->all();
78 78
 		$cookies = $nativeRequest->cookies->all();
79 79
 		$post = $nativeRequest->request->all();
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 		$method = $nativeRequest->getMethod();
82 82
 		$uri = $nativeRequest->getUri();
83 83
 
84
-		$body = new Stream( 'php://temp', 'wb+' );
85
-		$body->write( $nativeRequest->getContent() );
84
+		$body = new Stream('php://temp', 'wb+');
85
+		$body->write($nativeRequest->getContent());
86 86
 
87
-		$request = new ServerRequest( $server, $files, $uri, $method, $body, $headers, $cookies, $query, $post );
87
+		$request = new ServerRequest($server, $files, $uri, $method, $body, $headers, $cookies, $query, $post);
88 88
 
89
-		foreach( $nativeRequest->attributes->all() as $key => $value ) {
90
-			$request = $request->withAttribute( $key, $value );
89
+		foreach ($nativeRequest->attributes->all() as $key => $value) {
90
+			$request = $request->withAttribute($key, $value);
91 91
 		}
92 92
 
93 93
 		return $request;
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 * @param array $files Multi-dimensional list of uploaded files from Symfony request
101 101
 	 * @return array Multi-dimensional list of uploaded files as PSR-7 objects
102 102
 	 */
103
-	protected function getFiles( array $files )
103
+	protected function getFiles(array $files)
104 104
 	{
105 105
 		$list = [];
106 106
 
107
-		foreach( $files as $key => $value )
107
+		foreach ($files as $key => $value)
108 108
 		{
109
-			if( $value instanceof \Symfony\Component\HttpFoundation\File\UploadedFile )
109
+			if ($value instanceof \Symfony\Component\HttpFoundation\File\UploadedFile)
110 110
 			{
111 111
 				$list[$key] = new \Zend\Diactoros\UploadedFile(
112 112
 					$value->getRealPath(),
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 					$value->getClientMimeType()
117 117
 				);
118 118
 			}
119
-			elseif( is_array( $value ) )
119
+			elseif (is_array($value))
120 120
 			{
121
-				$list[$key] = $this->getFiles( $value );
121
+				$list[$key] = $this->getFiles($value);
122 122
 			}
123 123
 		}
124 124
 
Please login to merge, or discard this patch.
lib/custom/src/MW/View/Helper/Url/Symfony2.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param Symfony\Component\Routing\RouterInterface $router Symfony2 Router implementation
33 33
 	 * @param array $fixed Fixed parameters that should be added to each URL
34 34
 	 */
35
-	public function __construct( $view, \Symfony\Component\Routing\RouterInterface $router, array $fixed )
35
+	public function __construct($view, \Symfony\Component\Routing\RouterInterface $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,19 +52,19 @@  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 $trailing = [], array $config = [] )
55
+	public function transform($target = null, $controller = null, $action = null, array $params = [], array $trailing = [], array $config = [])
56 56
 	{
57
-		if( !empty( $trailing ) ) {
58
-			$params['trailing'] = join( '_', $trailing );
57
+		if (!empty($trailing)) {
58
+			$params['trailing'] = join('_', $trailing);
59 59
 		}
60 60
 
61
-		$params = $this->sanitize( $params );
61
+		$params = $this->sanitize($params);
62 62
 		$refType = \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_PATH;
63 63
 
64
-		if( isset( $config['absoluteUri'] ) ) {
64
+		if (isset($config['absoluteUri'])) {
65 65
 			$refType = \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL;
66 66
 		}
67 67
 
68
-		return $this->router->generate( $target, $params + $this->fixed, $refType );
68
+		return $this->router->generate($target, $params + $this->fixed, $refType);
69 69
 	}
70 70
 }
Please login to merge, or discard this patch.
lib/custom/tests/TestHelper.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 
18 18
 		$includepaths = $mshop->getIncludePaths();
19 19
 		$includepaths[] = get_include_path();
20
-		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
20
+		set_include_path(implode(PATH_SEPARATOR, $includepaths));
21 21
 	}
22 22
 
23 23
 
24
-	public static function getContext( $site = 'unittest' )
24
+	public static function getContext($site = 'unittest')
25 25
 	{
26
-		if( !isset( self::$context[$site] ) ) {
27
-			self::$context[$site] = self::createContext( $site );
26
+		if (!isset(self::$context[$site])) {
27
+			self::$context[$site] = self::createContext($site);
28 28
 		}
29 29
 
30 30
 		return clone self::$context[$site];
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 
34 34
 	private static function getAimeos()
35 35
 	{
36
-		if( !isset( self::$aimeos ) )
36
+		if (!isset(self::$aimeos))
37 37
 		{
38 38
 			require_once 'Bootstrap.php';
39
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
39
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
40 40
 
41
-			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
42
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
41
+			$extdir = dirname(dirname(dirname(__DIR__)));
42
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
43 43
 		}
44 44
 
45 45
 		return self::$aimeos;
@@ -52,37 +52,37 @@  discard block
 block discarded – undo
52 52
 	 * @param string $site Unique site code
53 53
 	 * @return \\Aimeos\MShop\Context\Item\Iface Context object
54 54
 	 */
55
-		private static function createContext( $site )
55
+		private static function createContext($site)
56 56
 	{
57 57
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
58 58
 		$mshop = self::getAimeos();
59 59
 
60 60
 
61
-		$paths = $mshop->getConfigPaths( 'mysql' );
62
-		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
61
+		$paths = $mshop->getConfigPaths('mysql');
62
+		$paths[] = __DIR__.DIRECTORY_SEPARATOR.'config';
63 63
 
64
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
65
-		$ctx->setConfig( $conf );
64
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
65
+		$ctx->setConfig($conf);
66 66
 
67 67
 
68
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
69
-		$ctx->setDatabaseManager( $dbm );
68
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
69
+		$ctx->setDatabaseManager($dbm);
70 70
 
71 71
 
72
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
73
-		$ctx->setLogger( $logger );
72
+		$logger = new \Aimeos\MW\Logger\File($site.'.log', \Aimeos\MW\Logger\Base::DEBUG);
73
+		$ctx->setLogger($logger);
74 74
 
75 75
 
76 76
 		$session = new \Aimeos\MW\Session\None();
77
-		$ctx->setSession( $session );
77
+		$ctx->setSession($session);
78 78
 
79 79
 
80
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
81
-		$localeItem = $localeManager->bootstrap( $site, '', '', false );
80
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
81
+		$localeItem = $localeManager->bootstrap($site, '', '', false);
82 82
 
83
-		$ctx->setLocale( $localeItem );
83
+		$ctx->setLocale($localeItem);
84 84
 
85
-		$ctx->setEditor( 'ai-symfony:unittest' );
85
+		$ctx->setEditor('ai-symfony:unittest');
86 86
 
87 87
 		return $ctx;
88 88
 	}
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Request/Symfony2Test.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,42 +15,42 @@
 block discarded – undo
15 15
 
16 16
 	protected function setUp()
17 17
 	{
18
-		if( !class_exists( '\Symfony\Component\HttpFoundation\Request' ) ) {
19
-			$this->markTestSkipped( '\Symfony\Component\HttpFoundation\Request is not available' );
18
+		if (!class_exists('\Symfony\Component\HttpFoundation\Request')) {
19
+			$this->markTestSkipped('\Symfony\Component\HttpFoundation\Request is not available');
20 20
 		}
21 21
 
22
-		if( !class_exists( '\Zend\Diactoros\Response' ) ) {
23
-			$this->markTestSkipped( '\Zend\Diactoros\Response is not available' );
22
+		if (!class_exists('\Zend\Diactoros\Response')) {
23
+			$this->markTestSkipped('\Zend\Diactoros\Response is not available');
24 24
 		}
25 25
 
26 26
 		$view = new \Aimeos\MW\View\Standard();
27
-		$files = array( 'test' => array( 'file' => array(
27
+		$files = array('test' => array('file' => array(
28 28
 			'name' => 'test.txt',
29 29
 			'type' => 'text/plain',
30
-			'tmp_name' => tempnam( sys_get_temp_dir(), 'ai-symfony_' ),
30
+			'tmp_name' => tempnam(sys_get_temp_dir(), 'ai-symfony_'),
31 31
 			'error' => UPLOAD_ERR_OK,
32 32
 			'size' => 123
33
-		) ) );
34
-		$param = array( 'HTTP_HOST' => 'localhost', 'REMOTE_ADDR' => '127.0.0.1' );
35
-		$request = new \Symfony\Component\HttpFoundation\Request( [], [], [], [], $files, $param, 'Content' );
36
-		$this->object = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
33
+		)));
34
+		$param = array('HTTP_HOST' => 'localhost', 'REMOTE_ADDR' => '127.0.0.1');
35
+		$request = new \Symfony\Component\HttpFoundation\Request([], [], [], [], $files, $param, 'Content');
36
+		$this->object = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request);
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testTransform()
41 41
 	{
42
-		$this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Symfony2', $this->object->transform() );
42
+		$this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Symfony2', $this->object->transform());
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testGetClientAddress()
47 47
 	{
48
-		$this->assertEquals( '127.0.0.1', $this->object->getClientAddress() );
48
+		$this->assertEquals('127.0.0.1', $this->object->getClientAddress());
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testGetTarget()
53 53
 	{
54
-		$this->assertEquals( null, $this->object->getTarget() );
54
+		$this->assertEquals(null, $this->object->getTarget());
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Url/Symfony2Test.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	protected function setUp()
27 27
 	{
28
-		if( !class_exists( '\Symfony\Component\Routing\Router' ) ) {
29
-			$this->markTestSkipped( 'Symfony\Component\Routing\Router is not available' );
28
+		if (!class_exists('\Symfony\Component\Routing\Router')) {
29
+			$this->markTestSkipped('Symfony\Component\Routing\Router is not available');
30 30
 		}
31 31
 
32 32
 		$view = new \Aimeos\MW\View\Standard();
33 33
 
34
-		$loc = new \Symfony\Component\Config\FileLocator( array( __DIR__ . DIRECTORY_SEPARATOR . '_testfiles' ) );
35
-		$loader = new \Symfony\Component\Routing\Loader\PhpFileLoader( $loc );
36
-		$router = new \Symfony\Component\Routing\Router( $loader, 'routing.php' );
34
+		$loc = new \Symfony\Component\Config\FileLocator(array(__DIR__.DIRECTORY_SEPARATOR.'_testfiles'));
35
+		$loader = new \Symfony\Component\Routing\Loader\PhpFileLoader($loc);
36
+		$router = new \Symfony\Component\Routing\Router($loader, 'routing.php');
37 37
 
38
-		$this->object = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $router, array( 'site' => 'unittest' ) );
38
+		$this->object = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $router, array('site' => 'unittest'));
39 39
 	}
40 40
 
41 41
 
@@ -53,26 +53,26 @@  discard block
 block discarded – undo
53 53
 
54 54
 	public function testTransform()
55 55
 	{
56
-		$this->assertEquals( '/unittest/lists', $this->object->transform( 'catalog_list' ) );
56
+		$this->assertEquals('/unittest/lists', $this->object->transform('catalog_list'));
57 57
 	}
58 58
 
59 59
 
60 60
 	public function testTransformArrays()
61 61
 	{
62
-		$this->assertEquals( '/unittest/lists?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'catalog_list', null, null, array( 'test' => array( 'a', 'b' ) ) ) );
62
+		$this->assertEquals('/unittest/lists?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform('catalog_list', null, null, array('test' => array('a', 'b'))));
63 63
 	}
64 64
 
65 65
 
66 66
 	public function testTransformTrailing()
67 67
 	{
68
-		$this->assertEquals( '/unittest/lists?trailing=a_b', $this->object->transform( 'catalog_list', null, null, [], array( 'a', 'b' ) ) );
68
+		$this->assertEquals('/unittest/lists?trailing=a_b', $this->object->transform('catalog_list', null, null, [], array('a', 'b')));
69 69
 	}
70 70
 
71 71
 
72 72
 	public function testTransformAbsolute()
73 73
 	{
74
-		$options = array( 'absoluteUri' => true );
75
-		$result = $this->object->transform( 'catalog_list', null, null, [], [], $options );
76
-		$this->assertEquals( 'http://localhost/unittest/lists', $result );
74
+		$options = array('absoluteUri' => true);
75
+		$result = $this->object->transform('catalog_list', null, null, [], [], $options);
76
+		$this->assertEquals('http://localhost/unittest/lists', $result);
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.