@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | protected function setUp() |
| 27 | 27 | { |
| 28 | - if( class_exists( '\\TYPO3\\Flow\\Log\\Logger' ) === false ) { |
|
| 29 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Log\\Logger not found' ); |
|
| 28 | + if (class_exists('\\TYPO3\\Flow\\Log\\Logger') === false) { |
|
| 29 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Log\\Logger not found'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $be = new \TYPO3\Flow\Log\Backend\FileBackend(); |
| 33 | - $be->setSeverityThreshold( LOG_ERR ); |
|
| 34 | - $be->setLogFileURL( 'flow.log' ); |
|
| 33 | + $be->setSeverityThreshold(LOG_ERR); |
|
| 34 | + $be->setLogFileURL('flow.log'); |
|
| 35 | 35 | |
| 36 | 36 | $log = new \TYPO3\Flow\Log\Logger(); |
| 37 | - $log->addBackend( $be ); |
|
| 37 | + $log->addBackend($be); |
|
| 38 | 38 | |
| 39 | - $this->object = new \Aimeos\MW\Logger\Flow( $log ); |
|
| 39 | + $this->object = new \Aimeos\MW\Logger\Flow($log); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -48,34 +48,34 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function tearDown() |
| 50 | 50 | { |
| 51 | - @unlink( 'flow.log' ); |
|
| 51 | + @unlink('flow.log'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testLog() |
| 56 | 56 | { |
| 57 | - $this->object->log( 'error' ); |
|
| 58 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents( 'flow.log' ) ); |
|
| 57 | + $this->object->log('error'); |
|
| 58 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents('flow.log')); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testNonScalarLog() |
| 63 | 63 | { |
| 64 | - $this->object->log( array( 'error', 'error2', 2 ) ); |
|
| 65 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents( 'flow.log' ) ); |
|
| 64 | + $this->object->log(array('error', 'error2', 2)); |
|
| 65 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents('flow.log')); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testLogDebug() |
| 70 | 70 | { |
| 71 | - $this->object->log( 'debug', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 72 | - $this->assertEquals( '', file_get_contents( 'flow.log' ) ); |
|
| 71 | + $this->object->log('debug', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 72 | + $this->assertEquals('', file_get_contents('flow.log')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | public function testBadPriority() |
| 77 | 77 | { |
| 78 | - $this->setExpectedException( '\\Aimeos\\MW\\Logger\\Exception' ); |
|
| 79 | - $this->object->log( 'error', -1 ); |
|
| 78 | + $this->setExpectedException('\\Aimeos\\MW\\Logger\\Exception'); |
|
| 79 | + $this->object->log('error', -1); |
|
| 80 | 80 | } |
| 81 | 81 | } |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | protected function setUp() |
| 27 | 27 | { |
| 28 | - if( class_exists( '\\TYPO3\\Flow\\Session\\Session' ) === false ) { |
|
| 29 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Session\\Session not found' ); |
|
| 28 | + if (class_exists('\\TYPO3\\Flow\\Session\\Session') === false) { |
|
| 29 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Session\\Session not found'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $session = new \TYPO3\Flow\Session\TransientSession(); |
| 33 | 33 | $session->start(); |
| 34 | 34 | |
| 35 | - $this->object = new \Aimeos\MW\Session\Flow( $session ); |
|
| 35 | + $this->object = new \Aimeos\MW\Session\Flow($session); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -44,26 +44,26 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function tearDown() |
| 46 | 46 | { |
| 47 | - unset( $this->object ); |
|
| 47 | + unset($this->object); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testGetDefault() |
| 52 | 52 | { |
| 53 | - $this->assertEquals( null, $this->object->get( 'notexist' ) ); |
|
| 53 | + $this->assertEquals(null, $this->object->get('notexist')); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | public function testGetSet() |
| 58 | 58 | { |
| 59 | - $this->object->set( 'key', 'value' ); |
|
| 60 | - $this->assertEquals( 'value', $this->object->get( 'key' ) ); |
|
| 59 | + $this->object->set('key', 'value'); |
|
| 60 | + $this->assertEquals('value', $this->object->get('key')); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function testGetSetArray() |
| 65 | 65 | { |
| 66 | - $this->object->set( 'key', array( 'value' ) ); |
|
| 67 | - $this->assertEquals( array( 'value' ), $this->object->get( 'key' ) ); |
|
| 66 | + $this->object->set('key', array('value')); |
|
| 67 | + $this->assertEquals(array('value'), $this->object->get('key')); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function setUp() |
| 23 | 23 | { |
| 24 | - if( interface_exists( 'TYPO3\Flow\Cache\Frontend\FrontendInterface' ) === false ) { |
|
| 25 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface not found' ); |
|
| 24 | + if (interface_exists('TYPO3\Flow\Cache\Frontend\FrontendInterface') === false) { |
|
| 25 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface not found'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $this->mock = $this->getMock( 'TYPO3\Flow\Cache\Frontend\FrontendInterface' ); |
|
| 29 | - $this->object = new \Aimeos\MW\Cache\Flow( array(), $this->mock ); |
|
| 28 | + $this->mock = $this->getMock('TYPO3\Flow\Cache\Frontend\FrontendInterface'); |
|
| 29 | + $this->object = new \Aimeos\MW\Cache\Flow(array(), $this->mock); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
@@ -38,181 +38,181 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | protected function tearDown() |
| 40 | 40 | { |
| 41 | - unset( $this->mock, $this->object ); |
|
| 41 | + unset($this->mock, $this->object); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testDelete() |
| 46 | 46 | { |
| 47 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 48 | - $this->object->delete( 'key' ); |
|
| 47 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('key')); |
|
| 48 | + $this->object->delete('key'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testDeleteWithSiteId() |
| 53 | 53 | { |
| 54 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 54 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 55 | 55 | |
| 56 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 57 | - $object->delete( 'key' ); |
|
| 56 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 57 | + $object->delete('key'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | public function testDeleteList() |
| 62 | 62 | { |
| 63 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 64 | - $this->object->deleteList( array( 'key', 'key' ) ); |
|
| 63 | + $this->mock->expects($this->exactly(2))->method('remove')->with($this->equalTo('key')); |
|
| 64 | + $this->object->deleteList(array('key', 'key')); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testDeleteListWithSiteId() |
| 69 | 69 | { |
| 70 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 70 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 71 | 71 | |
| 72 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 73 | - $object->deleteList( array( 'key' ) ); |
|
| 72 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 73 | + $object->deleteList(array('key')); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testDeleteByTags() |
| 78 | 78 | { |
| 79 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'flushByTag' )->with( $this->equalTo( 'tag' ) ); |
|
| 80 | - $this->object->deleteByTags( array( 'tag', 'tag' ) ); |
|
| 79 | + $this->mock->expects($this->exactly(2))->method('flushByTag')->with($this->equalTo('tag')); |
|
| 80 | + $this->object->deleteByTags(array('tag', 'tag')); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testDeleteByTagsWithSiteId() |
| 85 | 85 | { |
| 86 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 86 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 87 | 87 | |
| 88 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-tag' ) ); |
|
| 89 | - $object->deleteByTags( array( 'tag' ) ); |
|
| 88 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-tag')); |
|
| 89 | + $object->deleteByTags(array('tag')); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | public function testFlush() |
| 94 | 94 | { |
| 95 | - $this->mock->expects( $this->once() )->method( 'flush' ); |
|
| 95 | + $this->mock->expects($this->once())->method('flush'); |
|
| 96 | 96 | $this->object->flush(); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | public function testFlushWithSiteId() |
| 101 | 101 | { |
| 102 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 102 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 103 | 103 | |
| 104 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-siteid' ) ); |
|
| 104 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-siteid')); |
|
| 105 | 105 | $object->flush(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testGet() |
| 110 | 110 | { |
| 111 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 112 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( 'value' ) ); |
|
| 111 | + $this->mock->expects($this->once())->method('get') |
|
| 112 | + ->with($this->equalTo('key'))->will($this->returnValue('value')); |
|
| 113 | 113 | |
| 114 | - $this->assertEquals( 'value', $this->object->get( 'key', 'default' ) ); |
|
| 114 | + $this->assertEquals('value', $this->object->get('key', 'default')); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testGetWithSiteId() |
| 119 | 119 | { |
| 120 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 120 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 121 | 121 | |
| 122 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 123 | - $object->get( 'key', 'default' ); |
|
| 122 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 123 | + $object->get('key', 'default'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | public function testGetList() |
| 128 | 128 | { |
| 129 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
| 130 | - ->will( $this->returnValue( 'value' ) ); |
|
| 129 | + $this->mock->expects($this->exactly(2))->method('get') |
|
| 130 | + ->will($this->returnValue('value')); |
|
| 131 | 131 | |
| 132 | - $expected = array( 'key1' => 'value', 'key2' => 'value' ); |
|
| 133 | - $this->assertEquals( $expected, $this->object->getList( array( 'key1', 'key2' ) ) ); |
|
| 132 | + $expected = array('key1' => 'value', 'key2' => 'value'); |
|
| 133 | + $this->assertEquals($expected, $this->object->getList(array('key1', 'key2'))); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | public function testGetListWithSiteId() |
| 138 | 138 | { |
| 139 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 139 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 140 | 140 | |
| 141 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 142 | - $object->getList( array( 'key' ) ); |
|
| 141 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 142 | + $object->getList(array('key')); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | 146 | public function testGetListByTags() |
| 147 | 147 | { |
| 148 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'getByTag' ) |
|
| 149 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( array( 'key' => 'value' ) ) ); |
|
| 148 | + $this->mock->expects($this->exactly(2))->method('getByTag') |
|
| 149 | + ->with($this->equalTo('key'))->will($this->returnValue(array('key' => 'value'))); |
|
| 150 | 150 | |
| 151 | - $this->assertEquals( array( 'key' => 'value' ), $this->object->getListByTags( array( 'key', 'key' ) ) ); |
|
| 151 | + $this->assertEquals(array('key' => 'value'), $this->object->getListByTags(array('key', 'key'))); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | public function testGetListByTagsWithSiteId() |
| 156 | 156 | { |
| 157 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 157 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 158 | 158 | |
| 159 | - $this->mock->expects( $this->once() )->method( 'getByTag' ) |
|
| 160 | - ->with( $this->equalTo( '1-key' ) )->will( $this->returnValue( array( '1-key' => 'value' ) ) ); |
|
| 159 | + $this->mock->expects($this->once())->method('getByTag') |
|
| 160 | + ->with($this->equalTo('1-key'))->will($this->returnValue(array('1-key' => 'value'))); |
|
| 161 | 161 | |
| 162 | - $this->assertEquals( array( 'key' => 'value' ), $object->getListByTags( array( 'key' ) ) ); |
|
| 162 | + $this->assertEquals(array('key' => 'value'), $object->getListByTags(array('key'))); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | public function testSet() |
| 167 | 167 | { |
| 168 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 168 | + $this->mock->expects($this->once())->method('set') |
|
| 169 | 169 | ->with( |
| 170 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 171 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 170 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 171 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | - $this->object->set( 'key', 'value', array( 'tag' ), '2000-01-01 00:00:00' ); |
|
| 174 | + $this->object->set('key', 'value', array('tag'), '2000-01-01 00:00:00'); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | public function testSetWithSiteId() |
| 179 | 179 | { |
| 180 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 180 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 181 | 181 | |
| 182 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 182 | + $this->mock->expects($this->once())->method('set') |
|
| 183 | 183 | ->with( |
| 184 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 185 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 184 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 185 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | - $object->set( 'key', 'value', array( 'tag' ), null ); |
|
| 188 | + $object->set('key', 'value', array('tag'), null); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
| 192 | 192 | public function testSetList() |
| 193 | 193 | { |
| 194 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 194 | + $this->mock->expects($this->once())->method('set') |
|
| 195 | 195 | ->with( |
| 196 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 197 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 196 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 197 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | - $expires = array( 'key' => '2000-01-01 00:00:00' ); |
|
| 201 | - $this->object->setList( array( 'key' => 'value' ), array( 'key' => array( 'tag' ) ), $expires ); |
|
| 200 | + $expires = array('key' => '2000-01-01 00:00:00'); |
|
| 201 | + $this->object->setList(array('key' => 'value'), array('key' => array('tag')), $expires); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | public function testSetListWithSiteId() |
| 206 | 206 | { |
| 207 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 207 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 208 | 208 | |
| 209 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 209 | + $this->mock->expects($this->once())->method('set') |
|
| 210 | 210 | ->with( |
| 211 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 212 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 211 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 212 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | - $object->setList( array( 'key' => 'value' ), array( 'key' => array( 'tag' ) ), array() ); |
|
| 215 | + $object->setList(array('key' => 'value'), array('key' => array('tag')), array()); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | } |
@@ -26,42 +26,42 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function setUp() |
| 28 | 28 | { |
| 29 | - if( !class_exists( '\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder' ) ) { |
|
| 30 | - $this->markTestSkipped( '\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder is not available' ); |
|
| 29 | + if (!class_exists('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder')) { |
|
| 30 | + $this->markTestSkipped('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder is not available'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $view = new \Aimeos\MW\View\Standard(); |
| 34 | 34 | |
| 35 | - $mockHttpRequest = $this->getMockBuilder( 'TYPO3\Flow\Http\Request' ) |
|
| 35 | + $mockHttpRequest = $this->getMockBuilder('TYPO3\Flow\Http\Request') |
|
| 36 | 36 | ->disableOriginalConstructor() |
| 37 | - ->setMethods( array( 'getBaseUri' ) ) |
|
| 37 | + ->setMethods(array('getBaseUri')) |
|
| 38 | 38 | ->getMock(); |
| 39 | - $mockHttpRequest->expects( $this->any() ) |
|
| 40 | - ->method( 'getBaseUri' ) |
|
| 41 | - ->will( $this->returnValue( 'http://localhost/' ) ); |
|
| 39 | + $mockHttpRequest->expects($this->any()) |
|
| 40 | + ->method('getBaseUri') |
|
| 41 | + ->will($this->returnValue('http://localhost/')); |
|
| 42 | 42 | |
| 43 | - $mockMainRequest = $this->getMock( 'TYPO3\Flow\Mvc\ActionRequest', array( 'getControllerObjectName' ), array( $mockHttpRequest ) ); |
|
| 44 | - $mockMainRequest->expects( $this->any() ) |
|
| 45 | - ->method( 'getArgumentNamespace' ) |
|
| 46 | - ->will( $this->returnValue( 'ai' ) ); |
|
| 43 | + $mockMainRequest = $this->getMock('TYPO3\Flow\Mvc\ActionRequest', array('getControllerObjectName'), array($mockHttpRequest)); |
|
| 44 | + $mockMainRequest->expects($this->any()) |
|
| 45 | + ->method('getArgumentNamespace') |
|
| 46 | + ->will($this->returnValue('ai')); |
|
| 47 | 47 | |
| 48 | - $this->mockRouter = $this->getMock( 'TYPO3\Flow\Mvc\Routing\Router' ); |
|
| 49 | - $mockEnv = $this->getMock( 'TYPO3\Flow\Utility\Environment', array( 'isRewriteEnabled' ), array(), '', false ); |
|
| 48 | + $this->mockRouter = $this->getMock('TYPO3\Flow\Mvc\Routing\Router'); |
|
| 49 | + $mockEnv = $this->getMock('TYPO3\Flow\Utility\Environment', array('isRewriteEnabled'), array(), '', false); |
|
| 50 | 50 | |
| 51 | 51 | $builder = new \TYPO3\Flow\Mvc\Routing\UriBuilder(); |
| 52 | - $builder->setRequest( $mockMainRequest ); |
|
| 52 | + $builder->setRequest($mockMainRequest); |
|
| 53 | 53 | |
| 54 | - $objectReflection = new \ReflectionObject( $builder ); |
|
| 54 | + $objectReflection = new \ReflectionObject($builder); |
|
| 55 | 55 | |
| 56 | - $property = $objectReflection->getProperty( 'router' ); |
|
| 57 | - $property->setAccessible( true ); |
|
| 58 | - $property->setValue( $builder, $this->mockRouter ); |
|
| 56 | + $property = $objectReflection->getProperty('router'); |
|
| 57 | + $property->setAccessible(true); |
|
| 58 | + $property->setValue($builder, $this->mockRouter); |
|
| 59 | 59 | |
| 60 | - $property = $objectReflection->getProperty( 'environment' ); |
|
| 61 | - $property->setAccessible( true ); |
|
| 62 | - $property->setValue( $builder, $mockEnv ); |
|
| 60 | + $property = $objectReflection->getProperty('environment'); |
|
| 61 | + $property->setAccessible(true); |
|
| 62 | + $property->setValue($builder, $mockEnv); |
|
| 63 | 63 | |
| 64 | - $this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $builder, array( 'site' => 'unittest' ) ); |
|
| 64 | + $this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $builder, array('site' => 'unittest')); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -79,48 +79,48 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function testTransform() |
| 81 | 81 | { |
| 82 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 83 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 82 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 83 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 84 | 84 | |
| 85 | - $this->assertEquals( '/index.php/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) ); |
|
| 85 | + $this->assertEquals('/index.php/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists')); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public function testTransformSlashes() |
| 90 | 90 | { |
| 91 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 92 | - ->will( $this->returnValue( 'shop/catalog/lists?test=a%2Fb') ); |
|
| 91 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 92 | + ->will($this->returnValue('shop/catalog/lists?test=a%2Fb')); |
|
| 93 | 93 | |
| 94 | - $this->assertEquals( '/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) ); |
|
| 94 | + $this->assertEquals('/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b'))); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | public function testTransformArrays() |
| 99 | 99 | { |
| 100 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 101 | - ->will( $this->returnValue( 'shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') ); |
|
| 100 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 101 | + ->will($this->returnValue('shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b')); |
|
| 102 | 102 | |
| 103 | - $this->assertEquals( '/index.php/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => array( 'a', 'b' ) ) ) ); |
|
| 103 | + $this->assertEquals('/index.php/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform('shop', 'catalog', 'lists', array('test' => array('a', 'b')))); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | public function testTransformTrailing() |
| 108 | 108 | { |
| 109 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 110 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 109 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 110 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 111 | 111 | |
| 112 | - $this->assertEquals( '/index.php/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', array(), array( 'a', 'b' ) ) ); |
|
| 112 | + $this->assertEquals('/index.php/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', array(), array('a', 'b'))); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | public function testTransformAbsolute() |
| 117 | 117 | { |
| 118 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 119 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 118 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 119 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 120 | 120 | |
| 121 | - $options = array( 'absoluteUri' => true ); |
|
| 122 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
| 121 | + $options = array('absoluteUri' => true); |
|
| 122 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
| 123 | 123 | |
| 124 | - $this->assertEquals( 'http://localhost/index.php/shop/catalog/lists', $result ); |
|
| 124 | + $this->assertEquals('http://localhost/index.php/shop/catalog/lists', $result); |
|
| 125 | 125 | } |
| 126 | 126 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | * Set error reporting to maximum |
| 10 | 10 | */ |
| 11 | 11 | error_reporting( -1 ); |
| 12 | -ini_set( 'display_errors', '1' ); |
|
| 12 | +ini_set('display_errors', '1'); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /* |
| 16 | 16 | * Set locale settings to reasonable defaults |
| 17 | 17 | */ |
| 18 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
| 19 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
| 20 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
| 21 | -setlocale( LC_TIME, 'POSIX' ); |
|
| 22 | -date_default_timezone_set( 'UTC' ); |
|
| 18 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 19 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
| 20 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
| 21 | +setlocale(LC_TIME, 'POSIX'); |
|
| 22 | +date_default_timezone_set('UTC'); |
|
| 23 | 23 | |
| 24 | 24 | require_once 'TestHelper.php'; |
| 25 | 25 | TestHelper::bootstrap(); |
@@ -17,14 +17,14 @@ discard block |
||
| 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 |
||
| 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( dirname( __FILE__ ) ) ) ); |
|
| 42 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
| 41 | + $extdir = dirname(dirname(dirname(dirname(__FILE__)))); |
|
| 42 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | return self::$aimeos; |
@@ -52,37 +52,37 @@ discard block |
||
| 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' ); |
|
| 61 | + $paths = $mshop->getConfigPaths('mysql'); |
|
| 62 | 62 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 63 | 63 | |
| 64 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
| 65 | - $ctx->setConfig( $conf ); |
|
| 64 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $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-flow:unittest' ); |
|
| 85 | + $ctx->setEditor('ai-flow:unittest'); |
|
| 86 | 86 | |
| 87 | 87 | return $ctx; |
| 88 | 88 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param \TYPO3\Flow\Log\SystemLoggerInterface $logger Flow logger object |
| 31 | 31 | */ |
| 32 | - public function __construct( \TYPO3\Flow\Log\SystemLoggerInterface $logger ) |
|
| 32 | + public function __construct(\TYPO3\Flow\Log\SystemLoggerInterface $logger) |
|
| 33 | 33 | { |
| 34 | 34 | $this->logger = $logger; |
| 35 | 35 | } |
@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | * @throws \Aimeos\MW\Logger\Exception If an error occurs in Zend_Log |
| 45 | 45 | * @see \Aimeos\MW\Logger\Base for available log level constants |
| 46 | 46 | */ |
| 47 | - public function log( $message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message' ) |
|
| 47 | + public function log($message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message') |
|
| 48 | 48 | { |
| 49 | 49 | try |
| 50 | 50 | { |
| 51 | - if( !is_scalar( $message ) ) { |
|
| 52 | - $message = json_encode( $message ); |
|
| 51 | + if (!is_scalar($message)) { |
|
| 52 | + $message = json_encode($message); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $this->logger->log( $message, $this->translatePriority( $priority ) ); |
|
| 55 | + $this->logger->log($message, $this->translatePriority($priority)); |
|
| 56 | 56 | } |
| 57 | - catch( \Exception $e ) { |
|
| 58 | - throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e ); |
|
| 57 | + catch (\Exception $e) { |
|
| 58 | + throw new \Aimeos\MW\Logger\Exception($e->getMessage(), $e->getCode(), $e); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @return integer Log level from Monolog\Logger |
| 68 | 68 | * @throws \Aimeos\MW\Logger\Exception If log level is unknown |
| 69 | 69 | */ |
| 70 | - protected function translatePriority( $priority ) |
|
| 70 | + protected function translatePriority($priority) |
|
| 71 | 71 | { |
| 72 | - switch( $priority ) |
|
| 72 | + switch ($priority) |
|
| 73 | 73 | { |
| 74 | 74 | case \Aimeos\MW\Logger\Base::EMERG: |
| 75 | 75 | return LOG_EMERG; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | case \Aimeos\MW\Logger\Base::DEBUG: |
| 89 | 89 | return LOG_DEBUG; |
| 90 | 90 | default: |
| 91 | - throw new \Aimeos\MW\Logger\Exception( 'Invalid log level' ); |
|
| 91 | + throw new \Aimeos\MW\Logger\Exception('Invalid log level'); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | \ No newline at end of file |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $this->logger->log( $message, $this->translatePriority( $priority ) ); |
| 56 | - } |
|
| 57 | - catch( \Exception $e ) { |
|
| 56 | + } catch( \Exception $e ) { |
|
| 58 | 57 | throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e ); |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param \TYPO3\Flow\Session\SessionInterface $object Flow session object |
| 30 | 30 | */ |
| 31 | - public function __construct( \TYPO3\Flow\Session\SessionInterface $object ) |
|
| 31 | + public function __construct(\TYPO3\Flow\Session\SessionInterface $object) |
|
| 32 | 32 | { |
| 33 | 33 | $this->object = $object; |
| 34 | 34 | } |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | * @param mixed $default Value returned if requested key isn't found |
| 44 | 44 | * @return mixed Value associated to the requested key |
| 45 | 45 | */ |
| 46 | - public function get( $name, $default = null ) |
|
| 46 | + public function get($name, $default = null) |
|
| 47 | 47 | { |
| 48 | - if( $this->object->hasKey( $name ) !== true ) { |
|
| 48 | + if ($this->object->hasKey($name) !== true) { |
|
| 49 | 49 | return $default; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return $this->object->getData( $name ); |
|
| 52 | + return $this->object->getData($name); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param mixed $value Value that should be associated with the given key |
| 63 | 63 | * @return void |
| 64 | 64 | */ |
| 65 | - public function set( $name, $value ) |
|
| 65 | + public function set($name, $value) |
|
| 66 | 66 | { |
| 67 | - $this->object->putData( $name, $value ); |
|
| 67 | + $this->object->putData($name, $value); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param array $config List of configuration values |
| 32 | 32 | * @param \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache TYPO3 cache object |
| 33 | 33 | */ |
| 34 | - public function __construct( array $config, \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache ) |
|
| 34 | + public function __construct(array $config, \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache) |
|
| 35 | 35 | { |
| 36 | - $this->prefix = ( isset( $config['siteid'] ) ? $config['siteid'] . '-' : '' ); |
|
| 36 | + $this->prefix = (isset($config['siteid']) ? $config['siteid'] . '-' : ''); |
|
| 37 | 37 | $this->object = $cache; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @param string $key Key string that identifies the single cache entry |
| 47 | 47 | */ |
| 48 | - public function delete( $key ) |
|
| 48 | + public function delete($key) |
|
| 49 | 49 | { |
| 50 | - $this->object->remove( $this->prefix . $key ); |
|
| 50 | + $this->object->remove($this->prefix . $key); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * @param string[] $keys List of key strings that identify the cache entries |
| 60 | 60 | * that should be removed |
| 61 | 61 | */ |
| 62 | - public function deleteList( array $keys ) |
|
| 62 | + public function deleteList(array $keys) |
|
| 63 | 63 | { |
| 64 | - foreach( $keys as $key ) { |
|
| 65 | - $this->object->remove( $this->prefix . $key ); |
|
| 64 | + foreach ($keys as $key) { |
|
| 65 | + $this->object->remove($this->prefix . $key); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * @param string[] $tags List of tag strings that are associated to one or more |
| 76 | 76 | * cache entries that should be removed |
| 77 | 77 | */ |
| 78 | - public function deleteByTags( array $tags ) |
|
| 78 | + public function deleteByTags(array $tags) |
|
| 79 | 79 | { |
| 80 | - foreach( $tags as $tag ) { |
|
| 81 | - $this->object->flushByTag( $this->prefix . $tag ); |
|
| 80 | + foreach ($tags as $tag) { |
|
| 81 | + $this->object->flushByTag($this->prefix . $tag); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function flush() |
| 92 | 92 | { |
| 93 | - if( $this->prefix ) { |
|
| 94 | - $this->object->flushByTag( $this->prefix . 'siteid' ); |
|
| 93 | + if ($this->prefix) { |
|
| 94 | + $this->object->flushByTag($this->prefix . 'siteid'); |
|
| 95 | 95 | } else { |
| 96 | 96 | $this->object->flush(); |
| 97 | 97 | } |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | * @param string $default Value returned if requested key isn't found |
| 108 | 108 | * @return mixed Value associated to the requested key |
| 109 | 109 | */ |
| 110 | - public function get( $name, $default = null ) |
|
| 110 | + public function get($name, $default = null) |
|
| 111 | 111 | { |
| 112 | - if( ( $entry = $this->object->get( $this->prefix . $name ) ) !== false ) { |
|
| 112 | + if (($entry = $this->object->get($this->prefix . $name)) !== false) { |
|
| 113 | 113 | return $entry; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | * entries. If a cache entry doesn't exist, neither its key nor a value |
| 128 | 128 | * will be in the result list |
| 129 | 129 | */ |
| 130 | - public function getList( array $keys ) |
|
| 130 | + public function getList(array $keys) |
|
| 131 | 131 | { |
| 132 | 132 | $result = array(); |
| 133 | 133 | |
| 134 | - foreach( $keys as $key ) |
|
| 134 | + foreach ($keys as $key) |
|
| 135 | 135 | { |
| 136 | - if( ( $entry = $this->object->get( $this->prefix . $key ) ) !== false ) { |
|
| 136 | + if (($entry = $this->object->get($this->prefix . $key)) !== false) { |
|
| 137 | 137 | $result[$key] = $entry; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -152,17 +152,17 @@ discard block |
||
| 152 | 152 | * entries. If a tag isn't associated to any cache entry, nothing is returned |
| 153 | 153 | * for that tag |
| 154 | 154 | */ |
| 155 | - public function getListByTags( array $tags ) |
|
| 155 | + public function getListByTags(array $tags) |
|
| 156 | 156 | { |
| 157 | 157 | $result = array(); |
| 158 | - $len = strlen( $this->prefix ); |
|
| 158 | + $len = strlen($this->prefix); |
|
| 159 | 159 | |
| 160 | - foreach( $tags as $tag ) |
|
| 160 | + foreach ($tags as $tag) |
|
| 161 | 161 | { |
| 162 | - foreach( $this->object->getByTag( $this->prefix . $tag ) as $key => $value ) |
|
| 162 | + foreach ($this->object->getByTag($this->prefix . $tag) as $key => $value) |
|
| 163 | 163 | { |
| 164 | - if( strncmp( $key, $this->prefix, $len ) === 0 ) { |
|
| 165 | - $result[ substr( $key, $len ) ] = $value; |
|
| 164 | + if (strncmp($key, $this->prefix, $len) === 0) { |
|
| 165 | + $result[substr($key, $len)] = $value; |
|
| 166 | 166 | } else { |
| 167 | 167 | $result[$key] = $value; |
| 168 | 168 | } |
@@ -186,21 +186,21 @@ discard block |
||
| 186 | 186 | * @param string|null $expires Date/time string in "YYYY-MM-DD HH:mm:ss" |
| 187 | 187 | * format when the cache entry expires |
| 188 | 188 | */ |
| 189 | - public function set( $name, $value, array $tags = array(), $expires = null ) |
|
| 189 | + public function set($name, $value, array $tags = array(), $expires = null) |
|
| 190 | 190 | { |
| 191 | - if( $expires !== null && ( $timestamp = strtotime( $expires ) ) !== false ) { |
|
| 191 | + if ($expires !== null && ($timestamp = strtotime($expires)) !== false) { |
|
| 192 | 192 | $expires = $timestamp; |
| 193 | 193 | } else { |
| 194 | 194 | $expires = null; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $tagList = ( $this->prefix ? array( $this->prefix . 'siteid' ) : array() ); |
|
| 197 | + $tagList = ($this->prefix ? array($this->prefix . 'siteid') : array()); |
|
| 198 | 198 | |
| 199 | - foreach( $tags as $tag ) { |
|
| 199 | + foreach ($tags as $tag) { |
|
| 200 | 200 | $tagList[] = $this->prefix . $tag; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $this->object->set( $this->prefix . $name, $value, $tagList, $expires ); |
|
| 203 | + $this->object->set($this->prefix . $name, $value, $tagList, $expires); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | * to the key can either be a tag string or an array of tag strings |
| 218 | 218 | * @param array $expires Associative list of key/datetime pairs. |
| 219 | 219 | */ |
| 220 | - public function setList( array $pairs, array $tags = array(), array $expires = array() ) |
|
| 220 | + public function setList(array $pairs, array $tags = array(), array $expires = array()) |
|
| 221 | 221 | { |
| 222 | - foreach( $pairs as $key => $value ) |
|
| 222 | + foreach ($pairs as $key => $value) |
|
| 223 | 223 | { |
| 224 | - $tagList = ( isset( $tags[$key] ) ? (array) $tags[$key] : array() ); |
|
| 225 | - $keyExpire = ( isset( $expires[$key] ) ? $expires[$key] : null ); |
|
| 224 | + $tagList = (isset($tags[$key]) ? (array) $tags[$key] : array()); |
|
| 225 | + $keyExpire = (isset($expires[$key]) ? $expires[$key] : null); |
|
| 226 | 226 | |
| 227 | - $this->set( $key, $value, $tagList, $keyExpire ); |
|
| 227 | + $this->set($key, $value, $tagList, $keyExpire); |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | } |