@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Neos\FluidAdaptor\View\StandaloneView $view Flow template view object |
| 29 | 29 | */ |
| 30 | - public function __construct( \Neos\FluidAdaptor\View\StandaloneView $view ) |
|
| 30 | + public function __construct(\Neos\FluidAdaptor\View\StandaloneView $view) |
|
| 31 | 31 | { |
| 32 | 32 | $this->view = $view; |
| 33 | 33 | } |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | * @return string Output generated by the template |
| 43 | 43 | * @throws \Aimeos\MW\View\Exception If the template isn't found |
| 44 | 44 | */ |
| 45 | - public function render( \Aimeos\MW\View\Iface $view, $filename, array $values ) |
|
| 45 | + public function render(\Aimeos\MW\View\Iface $view, $filename, array $values) |
|
| 46 | 46 | { |
| 47 | 47 | $fluid = clone $this->view; |
| 48 | 48 | |
| 49 | - $fluid->setTemplatePathAndFilename( $filename ); |
|
| 50 | - $fluid->assign( '_aimeos_view', $view ); |
|
| 51 | - $fluid->assignMultiple( $values ); |
|
| 49 | + $fluid->setTemplatePathAndFilename($filename); |
|
| 50 | + $fluid->assign('_aimeos_view', $view); |
|
| 51 | + $fluid->assignMultiple($values); |
|
| 52 | 52 | |
| 53 | 53 | return $fluid->render(); |
| 54 | 54 | } |
@@ -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,31 +52,31 @@ 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' ); |
|
| 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 | - $ctx->setEditor( 'ai-flow:unittest' ); |
|
| 79 | + $ctx->setEditor('ai-flow:unittest'); |
|
| 80 | 80 | |
| 81 | 81 | return $ctx; |
| 82 | 82 | } |
@@ -16,32 +16,32 @@ |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - $this->mock = $this->getMockBuilder( '\Neos\FluidAdaptor\View\StandaloneView' ) |
|
| 20 | - ->setMethods( array( 'assign', 'assignMultiple', 'render', 'setTemplatePathAndFilename' ) ) |
|
| 19 | + $this->mock = $this->getMockBuilder('\Neos\FluidAdaptor\View\StandaloneView') |
|
| 20 | + ->setMethods(array('assign', 'assignMultiple', 'render', 'setTemplatePathAndFilename')) |
|
| 21 | 21 | ->disableOriginalConstructor() |
| 22 | 22 | ->getMock(); |
| 23 | 23 | |
| 24 | - $this->object = new \Aimeos\MW\View\Engine\Flow( $this->mock ); |
|
| 24 | + $this->object = new \Aimeos\MW\View\Engine\Flow($this->mock); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object, $this->mock ); |
|
| 30 | + unset($this->object, $this->mock); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testRender() |
| 35 | 35 | { |
| 36 | - $v = new \Aimeos\MW\View\Standard( [] ); |
|
| 36 | + $v = new \Aimeos\MW\View\Standard([]); |
|
| 37 | 37 | |
| 38 | - $this->mock->expects( $this->once() )->method( 'setTemplatePathAndFilename' ); |
|
| 39 | - $this->mock->expects( $this->once() )->method( 'assignMultiple' ); |
|
| 40 | - $this->mock->expects( $this->once() )->method( 'assign' ); |
|
| 41 | - $this->mock->expects( $this->once() )->method( 'render' ) |
|
| 42 | - ->will( $this->returnValue( 'test' ) ); |
|
| 38 | + $this->mock->expects($this->once())->method('setTemplatePathAndFilename'); |
|
| 39 | + $this->mock->expects($this->once())->method('assignMultiple'); |
|
| 40 | + $this->mock->expects($this->once())->method('assign'); |
|
| 41 | + $this->mock->expects($this->once())->method('render') |
|
| 42 | + ->will($this->returnValue('test')); |
|
| 43 | 43 | |
| 44 | - $result = $this->object->render( $v, 'filepath', array( 'key' => 'value' ) ); |
|
| 45 | - $this->assertEquals( 'test', $result ); |
|
| 44 | + $result = $this->object->render($v, 'filepath', array('key' => 'value')); |
|
| 45 | + $this->assertEquals('test', $result); |
|
| 46 | 46 | } |
| 47 | 47 | } |
@@ -26,48 +26,48 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function setUp() |
| 28 | 28 | { |
| 29 | - if( !class_exists( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder' ) ) { |
|
| 30 | - $this->markTestSkipped( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder is not available' ); |
|
| 29 | + if (!class_exists('\\Neos\\Flow\\Mvc\\Routing\\UriBuilder')) { |
|
| 30 | + $this->markTestSkipped('\\Neos\\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( 'Neos\Flow\Http\Request' ) |
|
| 36 | - ->setMethods( array( 'getBaseUri' ) ) |
|
| 35 | + $mockHttpRequest = $this->getMockBuilder('Neos\Flow\Http\Request') |
|
| 36 | + ->setMethods(array('getBaseUri')) |
|
| 37 | 37 | ->disableOriginalConstructor() |
| 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->getMockBuilder( 'Neos\Flow\Mvc\ActionRequest' ) |
|
| 44 | - ->setMethods( array( 'getControllerObjectName', 'getArgumentNamespace' ) ) |
|
| 45 | - ->setConstructorArgs( array( $mockHttpRequest ) ) |
|
| 43 | + $mockMainRequest = $this->getMockBuilder('Neos\Flow\Mvc\ActionRequest') |
|
| 44 | + ->setMethods(array('getControllerObjectName', 'getArgumentNamespace')) |
|
| 45 | + ->setConstructorArgs(array($mockHttpRequest)) |
|
| 46 | 46 | ->getMock(); |
| 47 | - $mockMainRequest->expects( $this->any() ) |
|
| 48 | - ->method( 'getArgumentNamespace' ) |
|
| 49 | - ->will( $this->returnValue( 'ai' ) ); |
|
| 47 | + $mockMainRequest->expects($this->any()) |
|
| 48 | + ->method('getArgumentNamespace') |
|
| 49 | + ->will($this->returnValue('ai')); |
|
| 50 | 50 | |
| 51 | - $this->mockRouter = $this->getMockBuilder( 'Neos\Flow\Mvc\Routing\Router' )->getMock(); |
|
| 52 | - $mockEnv = $this->getMockBuilder( 'Neos\Flow\Utility\Environment' ) |
|
| 53 | - ->setMethods( array( 'isRewriteEnabled' ) ) |
|
| 51 | + $this->mockRouter = $this->getMockBuilder('Neos\Flow\Mvc\Routing\Router')->getMock(); |
|
| 52 | + $mockEnv = $this->getMockBuilder('Neos\Flow\Utility\Environment') |
|
| 53 | + ->setMethods(array('isRewriteEnabled')) |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | 55 | ->getMock(); |
| 56 | 56 | |
| 57 | 57 | $builder = new \Neos\Flow\Mvc\Routing\UriBuilder(); |
| 58 | - $builder->setRequest( $mockMainRequest ); |
|
| 58 | + $builder->setRequest($mockMainRequest); |
|
| 59 | 59 | |
| 60 | - $objectReflection = new \ReflectionObject( $builder ); |
|
| 60 | + $objectReflection = new \ReflectionObject($builder); |
|
| 61 | 61 | |
| 62 | - $property = $objectReflection->getProperty( 'router' ); |
|
| 63 | - $property->setAccessible( true ); |
|
| 64 | - $property->setValue( $builder, $this->mockRouter ); |
|
| 62 | + $property = $objectReflection->getProperty('router'); |
|
| 63 | + $property->setAccessible(true); |
|
| 64 | + $property->setValue($builder, $this->mockRouter); |
|
| 65 | 65 | |
| 66 | - $property = $objectReflection->getProperty( 'environment' ); |
|
| 67 | - $property->setAccessible( true ); |
|
| 68 | - $property->setValue( $builder, $mockEnv ); |
|
| 66 | + $property = $objectReflection->getProperty('environment'); |
|
| 67 | + $property->setAccessible(true); |
|
| 68 | + $property->setValue($builder, $mockEnv); |
|
| 69 | 69 | |
| 70 | - $this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $builder, array( 'site' => 'unittest' ) ); |
|
| 70 | + $this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $builder, array('site' => 'unittest')); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
@@ -85,60 +85,60 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function testTransform() |
| 87 | 87 | { |
| 88 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 89 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 88 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 89 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 90 | 90 | |
| 91 | - $this->assertEquals( '/index.php/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) ); |
|
| 91 | + $this->assertEquals('/index.php/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists')); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | public function testTransformSlashes() |
| 96 | 96 | { |
| 97 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 98 | - ->will( $this->returnValue( 'shop/catalog/lists?test=a%2Fb') ); |
|
| 97 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 98 | + ->will($this->returnValue('shop/catalog/lists?test=a%2Fb')); |
|
| 99 | 99 | |
| 100 | - $this->assertEquals( '/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) ); |
|
| 100 | + $this->assertEquals('/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b'))); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | public function testTransformArrays() |
| 105 | 105 | { |
| 106 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 107 | - ->will( $this->returnValue( 'shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') ); |
|
| 106 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 107 | + ->will($this->returnValue('shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b')); |
|
| 108 | 108 | |
| 109 | - $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' ) ) ) ); |
|
| 109 | + $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')))); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | public function testTransformTrailing() |
| 114 | 114 | { |
| 115 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 116 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 115 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 116 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 117 | 117 | |
| 118 | - $this->assertEquals( '/index.php/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', [], array( 'a', 'b' ) ) ); |
|
| 118 | + $this->assertEquals('/index.php/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', [], array('a', 'b'))); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testTransformAbsolute() |
| 123 | 123 | { |
| 124 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 125 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 124 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 125 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 126 | 126 | |
| 127 | - $options = array( 'absoluteUri' => true ); |
|
| 128 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', [], [], $options ); |
|
| 127 | + $options = array('absoluteUri' => true); |
|
| 128 | + $result = $this->object->transform('shop', 'catalog', 'lists', [], [], $options); |
|
| 129 | 129 | |
| 130 | - $this->assertEquals( 'http://localhost/index.php/shop/catalog/lists', $result ); |
|
| 130 | + $this->assertEquals('http://localhost/index.php/shop/catalog/lists', $result); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | public function testTransformConfig() |
| 135 | 135 | { |
| 136 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 137 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 136 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 137 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 138 | 138 | |
| 139 | - $options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' ); |
|
| 140 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', [], [], $options ); |
|
| 139 | + $options = array('package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt'); |
|
| 140 | + $result = $this->object->transform('shop', 'catalog', 'lists', [], [], $options); |
|
| 141 | 141 | |
| 142 | - $this->assertEquals( '/index.php/shop/catalog/lists', $result ); |
|
| 142 | + $this->assertEquals('/index.php/shop/catalog/lists', $result); |
|
| 143 | 143 | } |
| 144 | 144 | } |
@@ -14,41 +14,41 @@ |
||
| 14 | 14 | |
| 15 | 15 | protected function setUp() |
| 16 | 16 | { |
| 17 | - if( !class_exists( '\Neos\Flow\Http\Request' ) ) { |
|
| 18 | - $this->markTestSkipped( '\Neos\Flow\Http\Request is not available' ); |
|
| 17 | + if (!class_exists('\Neos\Flow\Http\Request')) { |
|
| 18 | + $this->markTestSkipped('\Neos\Flow\Http\Request is not available'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if( !class_exists( '\Zend\Diactoros\ServerRequestFactory' ) ) { |
|
| 22 | - $this->markTestSkipped( '\Zend\Diactoros\ServerRequestFactory is not available' ); |
|
| 21 | + if (!class_exists('\Zend\Diactoros\ServerRequestFactory')) { |
|
| 22 | + $this->markTestSkipped('\Zend\Diactoros\ServerRequestFactory is not available'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $view = new \Aimeos\MW\View\Standard(); |
| 26 | - $server = array( 'REMOTE_ADDR' => '127.0.0.1' ); |
|
| 27 | - $request = new \Neos\Flow\Http\Request( [], [], [], $server ); |
|
| 28 | - $this->object = new \Aimeos\MW\View\Helper\Request\Flow( $view, $request, [], [], [], [], $server ); |
|
| 26 | + $server = array('REMOTE_ADDR' => '127.0.0.1'); |
|
| 27 | + $request = new \Neos\Flow\Http\Request([], [], [], $server); |
|
| 28 | + $this->object = new \Aimeos\MW\View\Helper\Request\Flow($view, $request, [], [], [], [], $server); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | protected function tearDown() |
| 33 | 33 | { |
| 34 | - unset( $this->object, $this->mock ); |
|
| 34 | + unset($this->object, $this->mock); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testTransform() |
| 39 | 39 | { |
| 40 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform() ); |
|
| 40 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetClientAddress() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( '127.0.0.1', $this->object->getClientAddress() ); |
|
| 46 | + $this->assertEquals('127.0.0.1', $this->object->getClientAddress()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testGetTarget() |
| 51 | 51 | { |
| 52 | - $this->assertEquals( null, $this->object->getTarget() ); |
|
| 52 | + $this->assertEquals(null, $this->object->getTarget()); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -17,201 +17,201 @@ |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - if( interface_exists( 'Neos\Cache\Frontend\FrontendInterface' ) === false ) { |
|
| 21 | - $this->markTestSkipped( 'Class \\Neos\\Cache\\Frontend\\FrontendInterface not found' ); |
|
| 20 | + if (interface_exists('Neos\Cache\Frontend\FrontendInterface') === false) { |
|
| 21 | + $this->markTestSkipped('Class \\Neos\\Cache\\Frontend\\FrontendInterface not found'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $this->mock = $this->getMockBuilder( 'Neos\Cache\Frontend\FrontendInterface' )->getMock(); |
|
| 25 | - $this->object = new \Aimeos\MW\Cache\Flow( [], $this->mock ); |
|
| 24 | + $this->mock = $this->getMockBuilder('Neos\Cache\Frontend\FrontendInterface')->getMock(); |
|
| 25 | + $this->object = new \Aimeos\MW\Cache\Flow([], $this->mock); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | protected function tearDown() |
| 30 | 30 | { |
| 31 | - unset( $this->mock, $this->object ); |
|
| 31 | + unset($this->mock, $this->object); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | public function testDelete() |
| 36 | 36 | { |
| 37 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 38 | - $this->object->delete( 'key' ); |
|
| 37 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('key')); |
|
| 38 | + $this->object->delete('key'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | public function testDeleteWithSiteId() |
| 43 | 43 | { |
| 44 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 44 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 45 | 45 | |
| 46 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 47 | - $object->delete( 'key' ); |
|
| 46 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 47 | + $object->delete('key'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testDeleteMultiple() |
| 52 | 52 | { |
| 53 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 54 | - $this->object->deleteMultiple( array( 'key', 'key' ) ); |
|
| 53 | + $this->mock->expects($this->exactly(2))->method('remove')->with($this->equalTo('key')); |
|
| 54 | + $this->object->deleteMultiple(array('key', 'key')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testDeleteMultipleWithSiteId() |
| 59 | 59 | { |
| 60 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 60 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 61 | 61 | |
| 62 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 63 | - $object->deleteMultiple( array( 'key' ) ); |
|
| 62 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 63 | + $object->deleteMultiple(array('key')); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | public function testDeleteByTags() |
| 68 | 68 | { |
| 69 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'flushByTag' )->with( $this->equalTo( 'tag' ) ); |
|
| 70 | - $this->object->deleteByTags( array( 'tag', 'tag' ) ); |
|
| 69 | + $this->mock->expects($this->exactly(2))->method('flushByTag')->with($this->equalTo('tag')); |
|
| 70 | + $this->object->deleteByTags(array('tag', 'tag')); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | public function testDeleteByTagsWithSiteId() |
| 75 | 75 | { |
| 76 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 76 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 77 | 77 | |
| 78 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-tag' ) ); |
|
| 79 | - $object->deleteByTags( array( 'tag' ) ); |
|
| 78 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-tag')); |
|
| 79 | + $object->deleteByTags(array('tag')); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | public function testClear() |
| 84 | 84 | { |
| 85 | - $this->mock->expects( $this->once() )->method( 'flush' ); |
|
| 85 | + $this->mock->expects($this->once())->method('flush'); |
|
| 86 | 86 | $this->object->clear(); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | public function testClearWithSiteId() |
| 91 | 91 | { |
| 92 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 92 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 93 | 93 | |
| 94 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-siteid' ) ); |
|
| 94 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-siteid')); |
|
| 95 | 95 | $object->clear(); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | public function testGet() |
| 100 | 100 | { |
| 101 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 102 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( 'value' ) ); |
|
| 101 | + $this->mock->expects($this->once())->method('get') |
|
| 102 | + ->with($this->equalTo('key'))->will($this->returnValue('value')); |
|
| 103 | 103 | |
| 104 | - $this->assertEquals( 'value', $this->object->get( 'key', 'default' ) ); |
|
| 104 | + $this->assertEquals('value', $this->object->get('key', 'default')); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testGetDefault() |
| 109 | 109 | { |
| 110 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 111 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( false ) ); |
|
| 110 | + $this->mock->expects($this->once())->method('get') |
|
| 111 | + ->with($this->equalTo('key'))->will($this->returnValue(false)); |
|
| 112 | 112 | |
| 113 | - $this->assertEquals( 'default', $this->object->get( 'key', 'default' ) ); |
|
| 113 | + $this->assertEquals('default', $this->object->get('key', 'default')); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | public function testGetWithSiteId() |
| 118 | 118 | { |
| 119 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 119 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 120 | 120 | |
| 121 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 122 | - $object->get( 'key', 'default' ); |
|
| 121 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 122 | + $object->get('key', 'default'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | public function testGetMultiple() |
| 127 | 127 | { |
| 128 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
| 129 | - ->will( $this->returnValue( 'value' ) ); |
|
| 128 | + $this->mock->expects($this->exactly(2))->method('get') |
|
| 129 | + ->will($this->returnValue('value')); |
|
| 130 | 130 | |
| 131 | - $expected = array( 'key1' => 'value', 'key2' => 'value' ); |
|
| 132 | - $this->assertEquals( $expected, $this->object->getMultiple( array( 'key1', 'key2' ) ) ); |
|
| 131 | + $expected = array('key1' => 'value', 'key2' => 'value'); |
|
| 132 | + $this->assertEquals($expected, $this->object->getMultiple(array('key1', 'key2'))); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | public function testGetMultipleWithSiteId() |
| 137 | 137 | { |
| 138 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 138 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 139 | 139 | |
| 140 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 141 | - $object->getMultiple( array( 'key' ) ); |
|
| 140 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 141 | + $object->getMultiple(array('key')); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | public function testGetMultipleByTags() |
| 146 | 146 | { |
| 147 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'getByTag' ) |
|
| 148 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( array( 'key' => 'value' ) ) ); |
|
| 147 | + $this->mock->expects($this->exactly(2))->method('getByTag') |
|
| 148 | + ->with($this->equalTo('key'))->will($this->returnValue(array('key' => 'value'))); |
|
| 149 | 149 | |
| 150 | - $this->assertEquals( array( 'key' => 'value' ), $this->object->getMultipleByTags( array( 'key', 'key' ) ) ); |
|
| 150 | + $this->assertEquals(array('key' => 'value'), $this->object->getMultipleByTags(array('key', 'key'))); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | public function testGetMultipleByTagsWithSiteId() |
| 155 | 155 | { |
| 156 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 156 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 157 | 157 | |
| 158 | - $this->mock->expects( $this->once() )->method( 'getByTag' ) |
|
| 159 | - ->with( $this->equalTo( '1-key' ) )->will( $this->returnValue( array( '1-key' => 'value' ) ) ); |
|
| 158 | + $this->mock->expects($this->once())->method('getByTag') |
|
| 159 | + ->with($this->equalTo('1-key'))->will($this->returnValue(array('1-key' => 'value'))); |
|
| 160 | 160 | |
| 161 | - $this->assertEquals( array( 'key' => 'value' ), $object->getMultipleByTags( array( 'key' ) ) ); |
|
| 161 | + $this->assertEquals(array('key' => 'value'), $object->getMultipleByTags(array('key'))); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | public function testSet() |
| 166 | 166 | { |
| 167 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 167 | + $this->mock->expects($this->once())->method('set') |
|
| 168 | 168 | ->with( |
| 169 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 170 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 169 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 170 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | - $this->object->set( 'key', 'value', '2100-01-01 00:00:00', array( 'tag' ) ); |
|
| 173 | + $this->object->set('key', 'value', '2100-01-01 00:00:00', array('tag')); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | public function testSetWithSiteId() |
| 178 | 178 | { |
| 179 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 179 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 180 | 180 | |
| 181 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 181 | + $this->mock->expects($this->once())->method('set') |
|
| 182 | 182 | ->with( |
| 183 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 184 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 183 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 184 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | - $object->set( 'key', 'value', null, array( 'tag' ) ); |
|
| 187 | + $object->set('key', 'value', null, array('tag')); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | public function testSetMultiple() |
| 192 | 192 | { |
| 193 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 193 | + $this->mock->expects($this->once())->method('set') |
|
| 194 | 194 | ->with( |
| 195 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 196 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 195 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 196 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | - $expires = array( 'key' => '2100-01-01 00:00:00' ); |
|
| 200 | - $this->object->setMultiple( array( 'key' => 'value' ), $expires, array( 'key' => array( 'tag' ) ) ); |
|
| 199 | + $expires = array('key' => '2100-01-01 00:00:00'); |
|
| 200 | + $this->object->setMultiple(array('key' => 'value'), $expires, array('key' => array('tag'))); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| 204 | 204 | public function testSetMultipleWithSiteId() |
| 205 | 205 | { |
| 206 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 206 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 207 | 207 | |
| 208 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 208 | + $this->mock->expects($this->once())->method('set') |
|
| 209 | 209 | ->with( |
| 210 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 211 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 210 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 211 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | - $object->setMultiple( array( 'key' => 'value' ), null, array( 'key' => array( 'tag' ) ) ); |
|
| 214 | + $object->setMultiple(array('key' => 'value'), null, array('key' => array('tag'))); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param \Neos\Flow\Mvc\Routing\UriBuilder $builder Flow URI builder object |
| 32 | 32 | * @param array Associative list of fixed parameters that should be available for all routes |
| 33 | 33 | */ |
| 34 | - public function __construct( $view, \Neos\Flow\Mvc\Routing\UriBuilder $builder, array $fixed ) |
|
| 34 | + public function __construct($view, \Neos\Flow\Mvc\Routing\UriBuilder $builder, array $fixed) |
|
| 35 | 35 | { |
| 36 | - parent::__construct( $view ); |
|
| 36 | + parent::__construct($view); |
|
| 37 | 37 | |
| 38 | 38 | $this->builder = $builder; |
| 39 | 39 | $this->fixed = $fixed; |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | * @param array $config Additional configuration parameter per URL |
| 52 | 52 | * @return string Complete URL that can be used in the template |
| 53 | 53 | */ |
| 54 | - public function transform( $target = null, $controller = null, $action = null, array $params = [], array $trailing = [], array $config = [] ) |
|
| 54 | + public function transform($target = null, $controller = null, $action = null, array $params = [], array $trailing = [], array $config = []) |
|
| 55 | 55 | { |
| 56 | - $params = $this->sanitize( $params ); |
|
| 57 | - $values = $this->getValues( $config ); |
|
| 56 | + $params = $this->sanitize($params); |
|
| 57 | + $values = $this->getValues($config); |
|
| 58 | 58 | |
| 59 | 59 | $this->builder |
| 60 | 60 | ->reset() |
| 61 | - ->setSection( join( '/', $trailing ) ) |
|
| 62 | - ->setCreateAbsoluteUri( $values['absoluteUri'] ) |
|
| 63 | - ->setFormat( $values['format'] ); |
|
| 61 | + ->setSection(join('/', $trailing)) |
|
| 62 | + ->setCreateAbsoluteUri($values['absoluteUri']) |
|
| 63 | + ->setFormat($values['format']); |
|
| 64 | 64 | |
| 65 | 65 | $params['node'] = $target; |
| 66 | 66 | |
| 67 | - return $this->builder->uriFor( $action, $params + $this->fixed, $controller, $values['package'], $values['subpackage'] ); |
|
| 67 | + return $this->builder->uriFor($action, $params + $this->fixed, $controller, $values['package'], $values['subpackage']); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param array $config Associative list of key/value pairs |
| 75 | 75 | * @return array Associative list of sanitized key/value pairs |
| 76 | 76 | */ |
| 77 | - protected function getValues( array $config ) |
|
| 77 | + protected function getValues(array $config) |
|
| 78 | 78 | { |
| 79 | 79 | $values = array( |
| 80 | 80 | 'package' => 'Aimeos.Shop', |
@@ -83,19 +83,19 @@ discard block |
||
| 83 | 83 | 'format' => 'html', |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - if( isset( $config['package'] ) ) { |
|
| 86 | + if (isset($config['package'])) { |
|
| 87 | 87 | $values['package'] = (string) $config['package']; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if( isset( $config['subpackage'] ) ) { |
|
| 90 | + if (isset($config['subpackage'])) { |
|
| 91 | 91 | $values['subpackage'] = (string) $config['subpackage']; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if( isset( $config['absoluteUri'] ) ) { |
|
| 94 | + if (isset($config['absoluteUri'])) { |
|
| 95 | 95 | $values['absoluteUri'] = (bool) $config['absoluteUri']; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if( isset( $config['format'] ) ) { |
|
| 98 | + if (isset($config['format'])) { |
|
| 99 | 99 | $values['format'] = (string) $config['format']; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param array $config List of configuration values |
| 32 | 32 | * @param \Neos\Cache\Frontend\FrontendInterface $cache Neos cache object |
| 33 | 33 | */ |
| 34 | - public function __construct( array $config, \Neos\Cache\Frontend\FrontendInterface $cache ) |
|
| 34 | + public function __construct(array $config, \Neos\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 \Traversable|array $keys List of key strings that identify the cache entries |
| 60 | 60 | * that should be removed |
| 61 | 61 | */ |
| 62 | - public function deleteMultiple( $keys ) |
|
| 62 | + public function deleteMultiple($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 clear() |
| 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 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | * will be in the result list |
| 130 | 130 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
| 131 | 131 | */ |
| 132 | - public function getMultiple( $keys, $default = null ) |
|
| 132 | + public function getMultiple($keys, $default = null) |
|
| 133 | 133 | { |
| 134 | 134 | $result = []; |
| 135 | 135 | |
| 136 | - foreach( $keys as $key ) |
|
| 136 | + foreach ($keys as $key) |
|
| 137 | 137 | { |
| 138 | - if( ( $entry = $this->object->get( $this->prefix . $key ) ) !== false ) { |
|
| 138 | + if (($entry = $this->object->get($this->prefix.$key)) !== false) { |
|
| 139 | 139 | $result[$key] = $entry; |
| 140 | 140 | } else { |
| 141 | 141 | $result[$key] = $default; |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | * entries. If a tag isn't associated to any cache entry, nothing is returned |
| 157 | 157 | * for that tag |
| 158 | 158 | */ |
| 159 | - public function getMultipleByTags( array $tags ) |
|
| 159 | + public function getMultipleByTags(array $tags) |
|
| 160 | 160 | { |
| 161 | 161 | $result = []; |
| 162 | - $len = strlen( $this->prefix ); |
|
| 162 | + $len = strlen($this->prefix); |
|
| 163 | 163 | |
| 164 | - foreach( $tags as $tag ) |
|
| 164 | + foreach ($tags as $tag) |
|
| 165 | 165 | { |
| 166 | - foreach( $this->object->getByTag( $this->prefix . $tag ) as $key => $value ) |
|
| 166 | + foreach ($this->object->getByTag($this->prefix.$tag) as $key => $value) |
|
| 167 | 167 | { |
| 168 | - if( strncmp( $key, $this->prefix, $len ) === 0 ) { |
|
| 169 | - $result[ substr( $key, $len ) ] = $value; |
|
| 168 | + if (strncmp($key, $this->prefix, $len) === 0) { |
|
| 169 | + $result[substr($key, $len)] = $value; |
|
| 170 | 170 | } else { |
| 171 | 171 | $result[$key] = $value; |
| 172 | 172 | } |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | * @param array $tags List of tag strings that should be assoicated to the |
| 191 | 191 | * given value in the cache |
| 192 | 192 | */ |
| 193 | - public function set( $key, $value, $expires = null, array $tags = [] ) |
|
| 193 | + public function set($key, $value, $expires = null, array $tags = []) |
|
| 194 | 194 | { |
| 195 | - if( is_string( $expires ) ) { |
|
| 196 | - $expires = date_create( $expires )->getTimestamp() - time(); |
|
| 195 | + if (is_string($expires)) { |
|
| 196 | + $expires = date_create($expires)->getTimestamp() - time(); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $tagList = ( $this->prefix ? array( $this->prefix . 'siteid' ) : [] ); |
|
| 199 | + $tagList = ($this->prefix ? array($this->prefix.'siteid') : []); |
|
| 200 | 200 | |
| 201 | - foreach( $tags as $tag ) { |
|
| 202 | - $tagList[] = $this->prefix . $tag; |
|
| 201 | + foreach ($tags as $tag) { |
|
| 202 | + $tagList[] = $this->prefix.$tag; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - $this->object->set( $this->prefix . $key, $value, $tagList, $expires ); |
|
| 205 | + $this->object->set($this->prefix.$key, $value, $tagList, $expires); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -222,14 +222,14 @@ discard block |
||
| 222 | 222 | * @return null |
| 223 | 223 | * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond |
| 224 | 224 | */ |
| 225 | - public function setMultiple( $pairs, $expires = null, array $tags = [] ) |
|
| 225 | + public function setMultiple($pairs, $expires = null, array $tags = []) |
|
| 226 | 226 | { |
| 227 | - foreach( $pairs as $key => $value ) |
|
| 227 | + foreach ($pairs as $key => $value) |
|
| 228 | 228 | { |
| 229 | - $tagList = ( isset( $tags[$key] ) ? (array) $tags[$key] : [] ); |
|
| 230 | - $keyExpire = ( isset( $expires[$key] ) ? $expires[$key] : $expires ); |
|
| 229 | + $tagList = (isset($tags[$key]) ? (array) $tags[$key] : []); |
|
| 230 | + $keyExpire = (isset($expires[$key]) ? $expires[$key] : $expires); |
|
| 231 | 231 | |
| 232 | - $this->set( $key, $value, $keyExpire, $tagList ); |
|
| 232 | + $this->set($key, $value, $keyExpire, $tagList); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | } |