Completed
Push — master ( 5e44e2...ae0969 )
by Aimeos
07:40
created
controller/frontend/src/Controller/Frontend/Locale/Decorator/Base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
 	/**
105 105
 	 * Returns the frontend controller
106 106
 	 *
107
-	 * @return \Aimeos\Controller\Frontend\Locale\Iface Frontend controller object
107
+	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
108 108
 	 */
109 109
 	protected function getController()
110 110
 	{
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
32 32
 	 */
33
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
33
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
34 34
 	{
35 35
 		$iface = '\Aimeos\Controller\Frontend\Locale\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
81 81
 	 * @since 2017.03
82 82
 	 */
83
-	public function getItem( $id, array $domains = array() )
83
+	public function getItem($id, array $domains = array())
84 84
 	{
85
-		return $this->controller->getItem( $id, $domains );
85
+		return $this->controller->getItem($id, $domains);
86 86
 	}
87 87
 
88 88
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
96 96
 	 * @since 2017.03
97 97
 	 */
98
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array(), &$total = null )
98
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array(), &$total = null)
99 99
 	{
100
-		return $this->controller->searchItems( $filter, $domains, $total );
100
+		return $this->controller->searchItems($filter, $domains, $total);
101 101
 	}
102 102
 
103 103
 
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Locale/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Locale\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
29
-		\Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
29
+		\Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Locale\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Locale\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Locale/StandardTest.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Locale\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Locale\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32 32
 
33
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
34
-		$this->assertEquals( 1, count( $filter->getSortations() ) );
35
-		$this->assertEquals( 0, $filter->getSliceStart() );
36
-		$this->assertEquals( 100, $filter->getSliceSize() );
33
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
34
+		$this->assertEquals(1, count($filter->getSortations()));
35
+		$this->assertEquals(0, $filter->getSliceStart());
36
+		$this->assertEquals(100, $filter->getSliceSize());
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testGetItem()
41 41
 	{
42
-		$localeManager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'locale' );
42
+		$localeManager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'locale');
43 43
 		$search = $localeManager->createSearch();
44
-		$search->setSortations( [$search->sort( '+', 'locale.position' )] );
45
-		$search->setSlice( 0, 1 );
46
-		$localeItems = $localeManager->searchItems( $search );
44
+		$search->setSortations([$search->sort('+', 'locale.position')]);
45
+		$search->setSlice(0, 1);
46
+		$localeItems = $localeManager->searchItems($search);
47 47
 
48
-		if( ( $localeItem = reset( $localeItems ) ) === false ) {
49
-			throw new \Exception( 'No locale item found' );
48
+		if (($localeItem = reset($localeItems)) === false) {
49
+			throw new \Exception('No locale item found');
50 50
 		}
51 51
 
52 52
 
53
-		$result = $this->object->getItem( $localeItem->getId() );
53
+		$result = $this->object->getItem($localeItem->getId());
54 54
 
55
-		$this->assertInstanceOf( '\Aimeos\MShop\Locale\Item\Iface', $result );
55
+		$this->assertInstanceOf('\Aimeos\MShop\Locale\Item\Iface', $result);
56 56
 	}
57 57
 
58 58
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$total = 0;
62 62
 		$filter = $this->object->createFilter();
63
-		$results = $this->object->searchItems( $filter, [], $total );
63
+		$results = $this->object->searchItems($filter, [], $total);
64 64
 
65
-		$this->assertEquals( 1, $total );
66
-		$this->assertEquals( 1, count( $results ) );
65
+		$this->assertEquals(1, $total);
66
+		$this->assertEquals(1, count($results));
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Locale/Decorator/BaseTest.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,97 +20,97 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Locale\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCreateFilter()
69 69
 	{
70
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createSearch();
70
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createSearch();
71 71
 
72
-		$this->stub->expects( $this->once() )->method( 'createFilter' )
73
-			->will( $this->returnValue( $search ) );
72
+		$this->stub->expects($this->once())->method('createFilter')
73
+			->will($this->returnValue($search));
74 74
 
75
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
75
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testGetItem()
80 80
 	{
81
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createItem();
81
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createItem();
82 82
 
83
-		$this->stub->expects( $this->once() )->method( 'getItem' )
84
-			->will( $this->returnValue( $item ) );
83
+		$this->stub->expects($this->once())->method('getItem')
84
+			->will($this->returnValue($item));
85 85
 
86
-		$this->assertInstanceOf( '\Aimeos\MShop\Locale\Item\Iface', $this->object->getItem( -1 ) );
86
+		$this->assertInstanceOf('\Aimeos\MShop\Locale\Item\Iface', $this->object->getItem( -1 ));
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testSearchItems()
91 91
 	{
92
-		$filter = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' )->createSearch();
92
+		$filter = \Aimeos\MShop\Factory::createManager($this->context, 'locale')->createSearch();
93 93
 
94
-		$this->stub->expects( $this->once() )->method( 'searchItems' )
95
-			->will( $this->returnValue( [] ) );
94
+		$this->stub->expects($this->once())->method('searchItems')
95
+			->will($this->returnValue([]));
96 96
 
97
-		$this->assertEquals( [], $this->object->searchItems( $filter, ['media'] ) );
97
+		$this->assertEquals([], $this->object->searchItems($filter, ['media']));
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testGetController()
102 102
 	{
103
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
103
+		$result = $this->access('getController')->invokeArgs($this->object, []);
104 104
 
105
-		$this->assertSame( $this->stub, $result );
105
+		$this->assertSame($this->stub, $result);
106 106
 	}
107 107
 
108 108
 
109
-	protected function access( $name )
109
+	protected function access($name)
110 110
 	{
111
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Locale\Decorator\Base' );
112
-		$method = $class->getMethod( $name );
113
-		$method->setAccessible( true );
111
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Locale\Decorator\Base');
112
+		$method = $class->getMethod($name);
113
+		$method->setAccessible(true);
114 114
 
115 115
 		return $method;
116 116
 	}
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
37 37
 	 * @since 2017.03
38 38
 	 */
39
-	public function getItem( $id, array $domains = array() );
39
+	public function getItem($id, array $domains = array());
40 40
 
41 41
 
42 42
 	/**
@@ -48,5 +48,5 @@  discard block
 block discarded – undo
48 48
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
49 49
 	 * @since 2017.03
50 50
 	 */
51
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array(), &$total = null );
51
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array(), &$total = null);
52 52
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string|null $name Name of the controller implementaton (default: "Standard")
29 29
 	 * @return \Aimeos\Controller\Frontend\Locale\Iface Controller object
30 30
 	 */
31
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
31
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
32 32
 	{
33 33
 		/** controller/frontend/locale/name
34 34
 		 * Class name of the used locale frontend controller implementation
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 		 * @since 2014.03
64 64
 		 * @category Developer
65 65
 		 */
66
-		if( $name === null ) {
67
-			$name = $context->getConfig()->get( 'controller/frontend/locale/name', 'Standard' );
66
+		if ($name === null) {
67
+			$name = $context->getConfig()->get('controller/frontend/locale/name', 'Standard');
68 68
 		}
69 69
 
70
-		if( ctype_alnum( $name ) === false )
70
+		if (ctype_alnum($name) === false)
71 71
 		{
72
-			$classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Locale\\' . $name : '<not a string>';
73
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
72
+			$classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Locale\\' . $name : '<not a string>';
73
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
74 74
 		}
75 75
 
76 76
 		$iface = '\\Aimeos\\Controller\\Frontend\\Locale\\Iface';
77 77
 		$classname = '\\Aimeos\\Controller\\Frontend\\Locale\\' . $name;
78 78
 
79
-		$manager = self::createControllerBase( $context, $classname, $iface );
79
+		$manager = self::createControllerBase($context, $classname, $iface);
80 80
 
81 81
 		/** controller/frontend/locale/decorators/excludes
82 82
 		 * Excludes decorators added by the "common" option from the locale frontend controllers
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * @see controller/frontend/locale/decorators/excludes
153 153
 		 * @see controller/frontend/locale/decorators/global
154 154
 		 */
155
-		return self::addControllerDecorators( $context, $manager, 'locale' );
155
+		return self::addControllerDecorators($context, $manager, 'locale');
156 156
 	}
157 157
 
158 158
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Standard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 	public function createFilter()
32 32
 	{
33 33
 		$context = $this->getContext();
34
-		$filter = \Aimeos\MShop\Factory::createManager( $context, 'locale' )->createSearch( true );
34
+		$filter = \Aimeos\MShop\Factory::createManager($context, 'locale')->createSearch(true);
35 35
 
36 36
 		$expr = array(
37
-			$filter->compare( '==', 'locale.siteid', $context->getLocale()->getSitePath() ),
37
+			$filter->compare('==', 'locale.siteid', $context->getLocale()->getSitePath()),
38 38
 			$filter->getConditions(),
39 39
 		);
40 40
 
41
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
42
-		$filter->setSortations( array( $filter->sort( '+', 'locale.position' ) ) );
41
+		$filter->setConditions($filter->combine('&&', $expr));
42
+		$filter->setSortations(array($filter->sort('+', 'locale.position')));
43 43
 
44 44
 		return $filter;
45 45
 	}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
54 54
 	 * @since 2017.03
55 55
 	 */
56
-	public function getItem( $id, array $domains = array() )
56
+	public function getItem($id, array $domains = array())
57 57
 	{
58
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->getItem( $id );
58
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->getItem($id);
59 59
 	}
60 60
 
61 61
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
69 69
 	 * @since 2017.03
70 70
 	 */
71
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array(), &$total = null )
71
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array(), &$total = null)
72 72
 	{
73
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->searchItems( $filter, [], $total );
73
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->searchItems($filter, [], $total);
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.