Completed
Push — master ( 24a86a...771b97 )
by Aimeos
10:31
created
lib/mwlib/src/MW/DB/Result/PDO.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		try {
50 50
 			return $this->statement->rowCount();
51
-		} catch ( \PDOException $e ) {
51
+		} catch( \PDOException $e ) {
52 52
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
53 53
 		}
54 54
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	{
66 66
 		try {
67 67
 			return $this->statement->fetch( $this->style[$style] );
68
-		} catch ( \PDOException $e ) {
68
+		} catch( \PDOException $e ) {
69 69
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
70 70
 		}
71 71
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	{
81 81
 		try {
82 82
 			$this->statement->closeCursor();
83
-		} catch ( \PDOException $e ) {
83
+		} catch( \PDOException $e ) {
84 84
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
85 85
 		}
86 86
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	{
96 96
 		try {
97 97
 			return $this->statement->nextRowset();
98
-		} catch ( \PDOException $e ) {
98
+		} catch( \PDOException $e ) {
99 99
 			return false;
100 100
 		}
101 101
 	}
Please login to merge, or discard this patch.
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,9 +46,12 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function affectedRows()
48 48
 	{
49
-		try {
49
+		try
50
+		{
50 51
 			return $this->statement->rowCount();
51
-		} catch ( \PDOException $e ) {
52
+		}
53
+		catch ( \PDOException $e )
54
+		{
52 55
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
53 56
 		}
54 57
 	}
@@ -63,9 +66,12 @@  discard block
 block discarded – undo
63 66
 	 */
64 67
 	public function fetch( $style = \Aimeos\MW\DB\Result\Base::FETCH_ASSOC )
65 68
 	{
66
-		try {
69
+		try
70
+		{
67 71
 			return $this->statement->fetch( $this->style[$style] );
68
-		} catch ( \PDOException $e ) {
72
+		}
73
+		catch ( \PDOException $e )
74
+		{
69 75
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
70 76
 		}
71 77
 	}
@@ -78,9 +84,12 @@  discard block
 block discarded – undo
78 84
 	 */
79 85
 	public function finish()
80 86
 	{
81
-		try {
87
+		try
88
+		{
82 89
 			$this->statement->closeCursor();
83
-		} catch ( \PDOException $e ) {
90
+		}
91
+		catch ( \PDOException $e )
92
+		{
84 93
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
85 94
 		}
86 95
 	}
@@ -93,9 +102,12 @@  discard block
 block discarded – undo
93 102
 	 */
94 103
 	public function nextResult()
95 104
 	{
96
-		try {
105
+		try
106
+		{
97 107
 			return $this->statement->nextRowset();
98
-		} catch ( \PDOException $e ) {
108
+		}
109
+		catch ( \PDOException $e )
110
+		{
99 111
 			return false;
100 112
 		}
101 113
 	}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/DB/Factory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 	 */
31 31
 	static public function createManager( \Aimeos\MW\Config\Iface $config, $type = 'PDO' )
32 32
 	{
33
-		$classname = '\\Aimeos\\MW\\DB\\Manager\\' . $type;
34
-		$filename = 'MW/DB/Manager/' . $type . '.php';
33
+		$classname = '\\Aimeos\\MW\\DB\\Manager\\'.$type;
34
+		$filename = 'MW/DB/Manager/'.$type.'.php';
35 35
 
36 36
 		$paths = explode( PATH_SEPARATOR, get_include_path() );
37 37
 
38 38
 		foreach( $paths as $path )
39 39
 		{
40
-			$file = $path . DIRECTORY_SEPARATOR . $filename;
41
-			if( file_exists( $file ) === true  && ( include_once $file ) !== false && class_exists($classname)) {
40
+			$file = $path.DIRECTORY_SEPARATOR.$filename;
41
+			if( file_exists( $file ) === true && ( include_once $file ) !== false && class_exists( $classname ) ) {
42 42
 				return new $classname( $config );
43 43
 			}
44 44
 		}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/DB/Manager/DBAL.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,8 @@
 block discarded – undo
88 88
 			return array_pop( $this->connections[$name] );
89 89
 
90 90
 		}
91
-		catch( \Exception $e ) {
91
+		catch( \Exception $e )
92
+		{
92 93
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() );
93 94
 		}
94 95
 	}
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		try
74 74
 		{
75
-			$adapter = $this->config->get( 'resource/' . $name . '/adapter', 'mysql' );
75
+			$adapter = $this->config->get( 'resource/'.$name.'/adapter', 'mysql' );
76 76
 
77 77
 			if( !isset( $this->connections[$name] ) || empty( $this->connections[$name] ) )
78 78
 			{
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 					$this->count[$name] = 0;
81 81
 				}
82 82
 
83
-				$limit = $this->config->get( 'resource/' . $name . '/limit', -1 );
83
+				$limit = $this->config->get( 'resource/'.$name.'/limit', -1 );
84 84
 
85 85
 				if( $limit >= 0 && $this->count[$name] >= $limit )
86 86
 				{
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function createConnection( $name, $adapter )
128 128
 	{
129
-		$params = $this->config->get( 'resource/' . $name );
129
+		$params = $this->config->get( 'resource/'.$name );
130 130
 
131
-		$params['user'] = $this->config->get( 'resource/' . $name . '/username' );
132
-		$params['dbname'] = $this->config->get( 'resource/' . $name . '/database' );
131
+		$params['user'] = $this->config->get( 'resource/'.$name.'/username' );
132
+		$params['dbname'] = $this->config->get( 'resource/'.$name.'/database' );
133 133
 
134
-		if( ( $socket = $this->config->get( 'resource/' . $name . '/socket' ) ) != null ) {
134
+		if( ( $socket = $this->config->get( 'resource/'.$name.'/socket' ) ) != null ) {
135 135
 			$params['unix_socket'] = $socket;
136 136
 		}
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			default: $params['driver'] = $adapter;
145 145
 		}
146 146
 
147
-		$stmts = $this->config->get( 'resource/' . $name . '/stmt', [] );
147
+		$stmts = $this->config->get( 'resource/'.$name.'/stmt', [] );
148 148
 
149 149
 		return new \Aimeos\MW\DB\Connection\DBAL( $params, $stmts );
150 150
 	}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/DB/Manager/PDO.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,8 @@  discard block
 block discarded – undo
88 88
 			return array_pop( $this->connections[$name] );
89 89
 
90 90
 		}
91
-		catch( \PDOException $e ) {
91
+		catch( \PDOException $e )
92
+		{
92 93
 			throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
93 94
 		}
94 95
 	}
@@ -131,8 +132,7 @@  discard block
 block discarded – undo
131 132
 		{
132 133
 			$dsn .= isset( $host ) ? ';host=' . $host : '';
133 134
 			$dsn .= isset( $port ) ? ';port=' . $port : '';
134
-		}
135
-		else
135
+		} else
136 136
 		{
137 137
 			$dsn .= ';unix_socket=' . $sock;
138 138
 		}
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	{
74 74
 		try
75 75
 		{
76
-			$adapter = $this->config->get( 'resource/' . $name . '/adapter', 'mysql' );
76
+			$adapter = $this->config->get( 'resource/'.$name.'/adapter', 'mysql' );
77 77
 
78 78
 			if( !isset( $this->connections[$name] ) || empty( $this->connections[$name] ) )
79 79
 			{
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 					$this->count[$name] = 0;
82 82
 				}
83 83
 
84
-				$limit = $this->config->get( 'resource/' . $name . '/limit', -1 );
84
+				$limit = $this->config->get( 'resource/'.$name.'/limit', -1 );
85 85
 
86 86
 				if( $limit >= 0 && $this->count[$name] >= $limit )
87 87
 				{
@@ -127,27 +127,27 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function createConnection( $name, $adapter )
129 129
 	{
130
-		$host = $this->config->get( 'resource/' . $name . '/host' );
131
-		$port = $this->config->get( 'resource/' . $name . '/port' );
132
-		$user = $this->config->get( 'resource/' . $name . '/username' );
133
-		$pass = $this->config->get( 'resource/' . $name . '/password' );
134
-		$sock = $this->config->get( 'resource/' . $name . '/socket' );
135
-		$dbase = $this->config->get( 'resource/' . $name . '/database' );
136
-		$persist = $this->config->get( 'resource/' . $name . '/opt-persistent', false );
137
-
138
-		$dsn = $adapter . ':dbname=' . $dbase;
130
+		$host = $this->config->get( 'resource/'.$name.'/host' );
131
+		$port = $this->config->get( 'resource/'.$name.'/port' );
132
+		$user = $this->config->get( 'resource/'.$name.'/username' );
133
+		$pass = $this->config->get( 'resource/'.$name.'/password' );
134
+		$sock = $this->config->get( 'resource/'.$name.'/socket' );
135
+		$dbase = $this->config->get( 'resource/'.$name.'/database' );
136
+		$persist = $this->config->get( 'resource/'.$name.'/opt-persistent', false );
137
+
138
+		$dsn = $adapter.':dbname='.$dbase;
139 139
 		if( $sock == null )
140 140
 		{
141
-			$dsn .= isset( $host ) ? ';host=' . $host : '';
142
-			$dsn .= isset( $port ) ? ';port=' . $port : '';
141
+			$dsn .= isset( $host ) ? ';host='.$host : '';
142
+			$dsn .= isset( $port ) ? ';port='.$port : '';
143 143
 		}
144 144
 		else
145 145
 		{
146
-			$dsn .= ';unix_socket=' . $sock;
146
+			$dsn .= ';unix_socket='.$sock;
147 147
 		}
148 148
 
149 149
 		$params = array( $dsn, $user, $pass, array( \PDO::ATTR_PERSISTENT => $persist ) );
150
-		$stmts = $this->config->get( 'resource/' . $name . '/stmt', array() );
150
+		$stmts = $this->config->get( 'resource/'.$name.'/stmt', array() );
151 151
 
152 152
 		return new \Aimeos\MW\DB\Connection\PDO( $params, $stmts );
153 153
 	}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/Logger/Errorlog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 				$message = json_encode( $message );
72 72
 			}
73 73
 
74
-			if( error_log( '<' . $facility . '> ' . $level . ' ' . $message ) === false ) {
74
+			if( error_log( '<'.$facility.'> '.$level.' '.$message ) === false ) {
75 75
 				throw new \Aimeos\MW\Logger\Exception( sprintf(
76 76
 					'Unable to log message with priority "%1$d": %2$s', $priority, $message ) );
77 77
 			}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/Logger/DB.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 /**
16 16
  * Log messages to a database table.
17
-  *
17
+ *
18 18
  * @package MW
19 19
  * @subpackage Logger
20 20
  */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 		$this->facilities = $facilities;
46 46
 
47 47
 		if( $requestid === null ) {
48
-			$requestid = md5( php_uname('n') . getmypid() . date( 'Y-m-d H:i:s' ) );
48
+			$requestid = md5( php_uname( 'n' ).getmypid().date( 'Y-m-d H:i:s' ) );
49 49
 		}
50 50
 		$this->requestid = $requestid;
51 51
 	}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/Common/Base.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function checkClass( $name, $object )
31 31
 	{
32
-		if( ($object instanceof $name) === false ) {
32
+		if( ( $object instanceof $name ) === false ) {
33 33
 			throw new \Aimeos\MW\Common\Exception( sprintf( 'Object doesn\'t implement "%1$s"', $name ) );
34 34
 		}
35 35
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	public static function checkClassList( $name, array $list )
46 46
 	{
47 47
 		foreach( $list as $object ) {
48
-			if( ($object instanceof $name) === false ) {
48
+			if( ( $object instanceof $name ) === false ) {
49 49
 				throw new \Aimeos\MW\Common\Exception( sprintf( 'Object doesn\'t implement "%1$s"', $name ) );
50 50
 			}
51 51
 		}
Please login to merge, or discard this patch.
lib/mwlib/src/MW/Common/Manager/Base.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		foreach( $attributes as $key => $item )
99 99
 		{
100 100
 			if( $item instanceof $iface ) {
101
-				$translations[ $item->getCode() ] = $item->getInternalCode();
101
+				$translations[$item->getCode()] = $item->getInternalCode();
102 102
 			} else if( isset( $item['code'] ) ) {
103
-				$translations[ $item['code'] ] = $item['internalcode'];
103
+				$translations[$item['code']] = $item['internalcode'];
104 104
 			} else {
105 105
 				throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid attribute at position "%1$d"', $key ) );
106 106
 			}
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 		foreach( $attributes as $key => $item )
127 127
 		{
128 128
 			if( $item instanceof $iface ) {
129
-				$types[ $item->getCode() ] = $item->getInternalType();
129
+				$types[$item->getCode()] = $item->getInternalType();
130 130
 			} else if( isset( $item['code'] ) ) {
131
-				$types[ $item['code'] ] = $item['internaltype'];
131
+				$types[$item['code']] = $item['internaltype'];
132 132
 			} else {
133 133
 				throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid attribute at position "%1$d"', $key ) );
134 134
 			}
Please login to merge, or discard this patch.
controller/common/tests/Controller/Common/Media/StandardTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -335,6 +335,9 @@
 block discarded – undo
335 335
 	}
336 336
 
337 337
 
338
+	/**
339
+	 * @param string $name
340
+	 */
338 341
 	protected function access( $name )
339 342
 	{
340 343
 		$class = new \ReflectionClass( '\Aimeos\Controller\Common\Media\Standard' );
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 		$file = $this->getMockBuilder( '\Psr\Http\Message\UploadedFileInterface' )->getMock();
42 42
 		$file->expects( $this->once() )->method( 'getStream' )
43
-			->will( $this->returnValue( file_get_contents( __DIR__ . '/testfiles/test.gif' ) ) );
43
+			->will( $this->returnValue( file_get_contents( __DIR__.'/testfiles/test.gif' ) ) );
44 44
 
45 45
 		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'media' )->createItem();
46 46
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 		$file = $this->getMockBuilder( '\Psr\Http\Message\UploadedFileInterface' )->getMock();
62 62
 		$file->expects( $this->once() )->method( 'getStream' )
63
-			->will( $this->returnValue( file_get_contents( __DIR__ . '/testfiles/test.pdf' ) ) );
63
+			->will( $this->returnValue( file_get_contents( __DIR__.'/testfiles/test.pdf' ) ) );
64 64
 
65 65
 		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'media' )->createItem();
66 66
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			->getMock();
109 109
 
110 110
 		$object->expects( $this->once() )->method( 'getFileContent' )
111
-			->will( $this->returnValue( file_get_contents( __DIR__ . '/testfiles/test.png' ) ) );
111
+			->will( $this->returnValue( file_get_contents( __DIR__.'/testfiles/test.png' ) ) );
112 112
 
113 113
 		$object->expects( $this->exactly( 2 ) )->method( 'storeFile' );
114 114
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 	public function testGetFileContent()
206 206
 	{
207
-		$dest = dirname( dirname( dirname( __DIR__ ) ) ) . '/tmp/';
207
+		$dest = dirname( dirname( dirname( __DIR__ ) ) ).'/tmp/';
208 208
 		if( !is_dir( $dest ) ) { mkdir( $dest, 0755, true ); }
209
-		copy( __DIR__ . '/testfiles/test.gif', $dest . 'test.gif' );
209
+		copy( __DIR__.'/testfiles/test.gif', $dest.'test.gif' );
210 210
 
211 211
 		$result = $this->access( 'getFileContent' )->invokeArgs( $this->object, array( 'test.gif', 'fs-media' ) );
212 212
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
 	public function testGetMimeType()
298 298
 	{
299
-		$file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.png' );
299
+		$file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.png' );
300 300
 
301 301
 		$result = $this->access( 'getMimeType' )->invokeArgs( $this->object, array( $file, 'files' ) );
302 302
 		$this->assertEquals( 'image/png', $result );
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
 	public function testGetMimeTypeNotAllowed()
307 307
 	{
308
-		$file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.gif' );
308
+		$file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.gif' );
309 309
 		$this->context->getConfig()->set( 'controller/common/media/standard/files/allowedtypes', array( 'image/jpeg' ) );
310 310
 
311 311
 		$result = $this->access( 'getMimeType' )->invokeArgs( $this->object, array( $file, 'files' ) );
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 	public function testGetMimeTypeNoTypes()
317 317
 	{
318
-		$file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.gif' );
318
+		$file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.gif' );
319 319
 		$this->context->getConfig()->set( 'controller/common/media/standard/files/allowedtypes', [] );
320 320
 
321 321
 		$this->setExpectedException( '\Aimeos\Controller\Common\Exception' );
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 	public function testScaleImage()
327 327
 	{
328
-		$file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.gif' );
328
+		$file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.gif' );
329 329
 
330 330
 		$this->access( 'scaleImage' )->invokeArgs( $this->object, array( $file, 'files' ) );
331 331
 	}
@@ -333,18 +333,18 @@  discard block
 block discarded – undo
333 333
 
334 334
 	public function testStoreFile()
335 335
 	{
336
-		$content = file_get_contents( __DIR__ . '/testfiles/test.gif' );
336
+		$content = file_get_contents( __DIR__.'/testfiles/test.gif' );
337 337
 
338
-		$dest = dirname( dirname( dirname( __DIR__ ) ) ) . '/tmp/';
338
+		$dest = dirname( dirname( dirname( __DIR__ ) ) ).'/tmp/';
339 339
 		if( !is_dir( $dest ) ) { mkdir( $dest, 0755, true ); }
340
-		copy( __DIR__ . '/testfiles/test.gif', $dest . 'test2.gif' );
340
+		copy( __DIR__.'/testfiles/test.gif', $dest.'test2.gif' );
341 341
 
342 342
 		$this->access( 'storeFile' )->invokeArgs( $this->object, array( $content, 'fs-media', 'test.gif', 'test2.gif' ) );
343 343
 
344
-		$this->assertFalse( file_exists( $dest . 'test2.gif' ) );
345
-		$this->assertTrue( file_exists( $dest . 'test.gif' ) );
344
+		$this->assertFalse( file_exists( $dest.'test2.gif' ) );
345
+		$this->assertTrue( file_exists( $dest.'test.gif' ) );
346 346
 
347
-		unlink( $dest . 'test.gif' );
347
+		unlink( $dest.'test.gif' );
348 348
 	}
349 349
 
350 350
 
Please login to merge, or discard this patch.