Completed
Push — master ( 6c75b7...90deda )
by Aimeos
15:40 queued 12:37
created
src/Controller/Common/Subscription/Process/Processor/Cgroup/Standard.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
42 42
 	 */
43
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
43
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
44 44
 	{
45
-		parent::__construct( $context );
45
+		parent::__construct($context);
46 46
 
47 47
 		$config = $context->getConfig();
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @since 2018.04
58 58
 		 * @category Developer
59 59
 		 */
60
-		$this->groupIds = (array) $config->get( 'controller/common/subscription/process/processor/cgroup/groupids', [] );
60
+		$this->groupIds = (array) $config->get('controller/common/subscription/process/processor/cgroup/groupids', []);
61 61
 	}
62 62
 
63 63
 
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
68 68
 	 */
69
-	public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription )
69
+	public function begin(\Aimeos\MShop\Subscription\Item\Iface $subscription)
70 70
 	{
71
-		if( empty( $this->groupIds ) ) {
71
+		if (empty($this->groupIds)) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		$context = $this->getContext();
76 76
 
77
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
78
-		$baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
77
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
78
+		$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
79 79
 
80
-		$baseItem = $baseManager->getItem( $subscription->getOrderBaseId() );
81
-		$item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
80
+		$baseItem = $baseManager->getItem($subscription->getOrderBaseId());
81
+		$item = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
82 82
 
83
-		$item->setGroups( array_unique( array_merge( $item->getGroups(), $this->groupIds ) ) );
84
-		$manager->saveItem( $item );
83
+		$item->setGroups(array_unique(array_merge($item->getGroups(), $this->groupIds)));
84
+		$manager->saveItem($item);
85 85
 	}
86 86
 
87 87
 
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
92 92
 	 */
93
-	public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
93
+	public function end(\Aimeos\MShop\Subscription\Item\Iface $subscription)
94 94
 	{
95
-		if( empty( $this->groupIds ) ) {
95
+		if (empty($this->groupIds)) {
96 96
 			return;
97 97
 		}
98 98
 
99 99
 		$context = $this->getContext();
100 100
 
101
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
102
-		$baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
101
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
102
+		$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
103 103
 
104
-		$baseItem = $baseManager->getItem( $subscription->getOrderBaseId() );
105
-		$item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
104
+		$baseItem = $baseManager->getItem($subscription->getOrderBaseId());
105
+		$item = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
106 106
 
107
-		$item->setGroups( array_diff( $item->getGroups(), $this->groupIds ) );
108
-		$manager->saveItem( $item );
107
+		$item->setGroups(array_diff($item->getGroups(), $this->groupIds));
108
+		$manager->saveItem($item);
109 109
 	}
110 110
 }
Please login to merge, or discard this patch.
common/src/Controller/Common/Subscription/Process/Processor/Base.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
29 29
 	 */
30
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
30
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
31 31
 	{
32 32
 		$this->context = $context;
33 33
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
51 51
 	 */
52
-	public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription )
52
+	public function begin(\Aimeos\MShop\Subscription\Item\Iface $subscription)
53 53
 	{
54 54
 	}
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
61 61
 	 */
62
-	public function renew( \Aimeos\MShop\Subscription\Item\Iface $subscription )
62
+	public function renew(\Aimeos\MShop\Subscription\Item\Iface $subscription)
63 63
 	{
64 64
 	}
65 65
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
71 71
 	 */
72
-	public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
72
+	public function end(\Aimeos\MShop\Subscription\Item\Iface $subscription)
73 73
 	{
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Begin/StanardTest.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,30 +20,30 @@  discard block
 block discarded – undo
20 20
 		$aimeos = \TestHelperJobs::getAimeos();
21 21
 		$this->context = \TestHelperJobs::getContext();
22 22
 
23
-		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard( $this->context, $aimeos );
23
+		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard($this->context, $aimeos);
24 24
 
25
-		\Aimeos\MShop\Factory::setCache( true );
25
+		\Aimeos\MShop\Factory::setCache(true);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31
-		\Aimeos\MShop\Factory::setCache( false );
31
+		\Aimeos\MShop\Factory::setCache(false);
32 32
 		\Aimeos\MShop\Factory::clear();
33 33
 
34
-		unset( $this->object, $this->context );
34
+		unset($this->object, $this->context);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetName()
39 39
 	{
40
-		$this->assertEquals( 'Subscription process start', $this->object->getName() );
40
+		$this->assertEquals('Subscription process start', $this->object->getName());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetDescription()
45 45
 	{
46
-		$this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() );
46
+		$this->assertEquals('Process subscriptions initially', $this->object->getDescription());
47 47
 	}
48 48
 
49 49
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 	{
52 52
 		$item = $this->getSubscription();
53 53
 
54
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
55
-			->setConstructorArgs( [$this->context] )
56
-			->setMethods( ['searchItems', 'saveItem'] )
54
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
55
+			->setConstructorArgs([$this->context])
56
+			->setMethods(['searchItems', 'saveItem'])
57 57
 			->getMock();
58 58
 
59
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
59
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
60 60
 
61
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
62
-			->will( $this->returnValue( [$item] ) );
61
+		$managerStub->expects($this->once())->method('searchItems')
62
+			->will($this->returnValue([$item]));
63 63
 
64
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
64
+		$managerStub->expects($this->once())->method('saveItem');
65 65
 
66 66
 		$this->object->run();
67 67
 	}
@@ -71,18 +71,18 @@  discard block
 block discarded – undo
71 71
 	{
72 72
 		$item = $this->getSubscription();
73 73
 
74
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
75
-			->setConstructorArgs( [$this->context] )
76
-			->setMethods( ['searchItems', 'saveItem'] )
74
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
75
+			->setConstructorArgs([$this->context])
76
+			->setMethods(['searchItems', 'saveItem'])
77 77
 			->getMock();
78 78
 
79
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
79
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
80 80
 
81
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
82
-			->will( $this->returnValue( [$item] ) );
81
+		$managerStub->expects($this->once())->method('searchItems')
82
+			->will($this->returnValue([$item]));
83 83
 
84
-		$managerStub->expects( $this->once() )->method( 'saveItem' )
85
-			->will( $this->throwException( new \Exception() ) );
84
+		$managerStub->expects($this->once())->method('saveItem')
85
+			->will($this->throwException(new \Exception()));
86 86
 
87 87
 		$this->object->run();
88 88
 	}
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 
91 91
 	protected function getSubscription()
92 92
 	{
93
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
93
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
94 94
 
95 95
 		$search = $manager->createSearch();
96
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
96
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
97 97
 
98
-		$items = $manager->searchItems( $search );
98
+		$items = $manager->searchItems($search);
99 99
 
100
-		if( ( $item = reset( $items ) ) !== false ) {
100
+		if (($item = reset($items)) !== false) {
101 101
 			return $item;
102 102
 		}
103 103
 
104
-		throw new \Exception( 'No subscription item found' );
104
+		throw new \Exception('No subscription item found');
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Begin/FactoryTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJobs::getContext();
17 17
 		$aimeos = \TestHelperJobs::getAimeos();
18 18
 
19
-		$obj = \Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController( $context, $aimeos );
20
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
19
+		$obj = \Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController($context, $aimeos);
20
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJobs::getContext();
27 27
 		$aimeos = \TestHelperJobs::getAimeos();
28 28
 
29
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
30
-		\Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController( $context, $aimeos, 'Wrong$$$Name' );
29
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
30
+		\Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController($context, $aimeos, 'Wrong$$$Name');
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJobs::getContext();
37 37
 		$aimeos = \TestHelperJobs::getAimeos();
38 38
 
39
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
40
-		\Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController( $context, $aimeos, 'WrongClass' );
39
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
40
+		\Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController($context, $aimeos, 'WrongClass');
41 41
 	}
42 42
 
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJobs::getContext();
47 47
 		$aimeos = \TestHelperJobs::getAimeos();
48 48
 
49
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
50
-		\Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController( $context, $aimeos, 'Factory' );
49
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
50
+		\Aimeos\Controller\Jobs\Subscription\Process\Begin\Factory::createController($context, $aimeos, 'Factory');
51 51
 	}
52 52
 
53 53
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Begin/Factory.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string|null $name Name of the controller or "Standard" if null
30 30
 	 * @return \Aimeos\Controller\Jobs\Iface New controller object
31 31
 	 */
32
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
32
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null)
33 33
 	{
34 34
 		/** controller/jobs/subscription/process/begin/name
35 35
 		 * Class name of the used subscription suggestions scheduler controller implementation
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 		 * @since 2018.04
65 65
 		 * @category Developer
66 66
 		 */
67
-		if ( $name === null ) {
67
+		if ($name === null) {
68 68
 			$name = $context->getConfig()->get('controller/jobs/subscription/process/begin/name', 'Standard');
69 69
 		}
70 70
 
71
-		if ( ctype_alnum($name) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73 73
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Begin\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Controller\\Jobs\\Iface';
78 78
 		$classname = '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Begin\\' . $name;
79 79
 
80
-		$controller = self::createControllerBase( $context, $aimeos, $classname, $iface );
80
+		$controller = self::createControllerBase($context, $aimeos, $classname, $iface);
81 81
 
82 82
 		/** controller/jobs/subscription/process/begin/decorators/excludes
83 83
 		 * Excludes decorators added by the "common" option from the subscription process CSV job controller
@@ -154,6 +154,6 @@  discard block
 block discarded – undo
154 154
 		 * @see controller/jobs/subscription/process/begin/decorators/excludes
155 155
 		 * @see controller/jobs/subscription/process/begin/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'subscription/process/begin' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'subscription/process/begin');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Base.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,39 +27,39 @@
 block discarded – undo
27 27
 	 * @param array $pnames List of processor names
28 28
 	 * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object
29 29
 	 */
30
-	protected function getProcessors( array $pnames )
30
+	protected function getProcessors(array $pnames)
31 31
 	{
32 32
 		$list = [];
33 33
 		$context = $this->getContext();
34 34
 		$config = $context->getConfig();
35 35
 		$iface = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface';
36 36
 
37
-		foreach( $pnames as $pname )
37
+		foreach ($pnames as $pname)
38 38
 		{
39
-			if( ctype_alnum( $pname ) === false )
39
+			if (ctype_alnum($pname) === false)
40 40
 			{
41 41
 				$classname = is_string($pname) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname : '<not a string>';
42
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
42
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
43 43
 			}
44 44
 
45
-			$name = $config->get( 'controller/common/subscription/process/processor/' . $pname . '/name', 'Standard' );
45
+			$name = $config->get('controller/common/subscription/process/processor/' . $pname . '/name', 'Standard');
46 46
 
47
-			if( ctype_alnum( $name ) === false )
47
+			if (ctype_alnum($name) === false)
48 48
 			{
49 49
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname . '\\' . $name : '<not a string>';
50
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
50
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
51 51
 			}
52 52
 
53
-			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst( $pname ) . '\\' . $name;
53
+			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst($pname) . '\\' . $name;
54 54
 
55
-			if( class_exists( $classname ) === false ) {
56
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
55
+			if (class_exists($classname) === false) {
56
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
57 57
 			}
58 58
 
59
-			$object = new $classname( $context );
59
+			$object = new $classname($context);
60 60
 
61
-			if( !( $object instanceof $iface ) ) {
62
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) );
61
+			if (!($object instanceof $iface)) {
62
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface));
63 63
 			}
64 64
 
65 65
 			$list[$pname] = $object;
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Begin/Standard.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process start' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process start');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process subscriptions initially' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Process subscriptions initially');
43 43
 	}
44 44
 
45 45
 
@@ -65,49 +65,49 @@  discard block
 block discarded – undo
65 65
 		 * @since 2018.04
66 66
 		 * @category Developer
67 67
 		 */
68
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
68
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
69 69
 
70
-		$processors = $this->getProcessors( $names );
71
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
70
+		$processors = $this->getProcessors($names);
71
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
72 72
 
73
-		$search = $manager->createSearch( true );
73
+		$search = $manager->createSearch(true);
74 74
 		$expr = [
75
-			$search->compare( '==', 'subscription.datenext', null ),
75
+			$search->compare('==', 'subscription.datenext', null),
76 76
 			$search->getConditions(),
77 77
 		];
78
-		$search->setConditions( $search->combine( '&&', $expr ) );
79
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
78
+		$search->setConditions($search->combine('&&', $expr));
79
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
80 80
 
81 81
 		$start = 0;
82 82
 
83 83
 		do
84 84
 		{
85
-			$search->setSlice( $start, 100 );
86
-			$items = $manager->searchItems( $search );
85
+			$search->setSlice($start, 100);
86
+			$items = $manager->searchItems($search);
87 87
 
88
-			foreach( $items as $item )
88
+			foreach ($items as $item)
89 89
 			{
90 90
 				try
91 91
 				{
92
-					foreach( $processors as $processor ) {
93
-						$processor->begin( $item );
92
+					foreach ($processors as $processor) {
93
+						$processor->begin($item);
94 94
 					}
95 95
 
96
-					$interval = \DateInterval::createFromDateString( $item->getInterval() );
97
-					$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
96
+					$interval = \DateInterval::createFromDateString($item->getInterval());
97
+					$item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d'));
98 98
 
99
-					$manager->saveItem( $item );
99
+					$manager->saveItem($item);
100 100
 				}
101
-				catch( \Exception $e )
101
+				catch (\Exception $e)
102 102
 				{
103 103
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
104
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
104
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
105 105
 				}
106 106
 			}
107 107
 
108
-			$count = count( $items );
108
+			$count = count($items);
109 109
 			$start += $count;
110 110
 		}
111
-		while( $count === $search->getSliceSize() );
111
+		while ($count === $search->getSliceSize());
112 112
 	}
113 113
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@
 block discarded – undo
97 97
 					$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
98 98
 
99 99
 					$manager->saveItem( $item );
100
-				}
101
-				catch( \Exception $e )
100
+				} catch( \Exception $e )
102 101
 				{
103 102
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
104 103
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
Please login to merge, or discard this patch.
Controller/Common/Subscription/Process/Processor/Cgroup/StandardTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 {
13 13
 	protected function setUp()
14 14
 	{
15
-		\Aimeos\MShop\Factory::setCache( true );
15
+		\Aimeos\MShop\Factory::setCache(true);
16 16
 	}
17 17
 
18 18
 
19 19
 	protected function tearDown()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( false );
21
+		\Aimeos\MShop\Factory::setCache(false);
22 22
 	}
23 23
 
24 24
 
@@ -26,27 +26,27 @@  discard block
 block discarded – undo
26 26
 	{
27 27
 		$context = \TestHelperCntl::getContext();
28 28
 
29
-		$context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1', '2'] );
29
+		$context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1', '2']);
30 30
 
31
-		$customerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Customer\\Manager\\Standard' )
32
-			->setConstructorArgs( [$context] )
33
-			->setMethods( ['getItem', 'saveItem'] )
31
+		$customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')
32
+			->setConstructorArgs([$context])
33
+			->setMethods(['getItem', 'saveItem'])
34 34
 			->getMock();
35 35
 
36
-		\Aimeos\MShop\Factory::injectManager( $context, 'customer', $customerStub );
36
+		\Aimeos\MShop\Factory::injectManager($context, 'customer', $customerStub);
37 37
 
38 38
 		$customerItem = $customerStub->createItem();
39 39
 
40
-		$customerStub->expects( $this->once() )->method( 'getItem' )
41
-			->will( $this->returnValue( $customerItem ) );
40
+		$customerStub->expects($this->once())->method('getItem')
41
+			->will($this->returnValue($customerItem));
42 42
 
43
-		$customerStub->expects( $this->once() )->method( 'saveItem' )
44
-			->with( $this->callback( function( $subject ){
43
+		$customerStub->expects($this->once())->method('saveItem')
44
+			->with($this->callback(function($subject) {
45 45
 				return $subject->getGroups() === ['1', '2'];
46
-			} ) );
46
+			} ));
47 47
 
48
-		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard( $context );
49
-		$object->begin( $this->getSubscription( $context ) );
48
+		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard($context);
49
+		$object->begin($this->getSubscription($context));
50 50
 	}
51 51
 
52 52
 
@@ -54,43 +54,43 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$context = \TestHelperCntl::getContext();
56 56
 
57
-		$context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1', '2'] );
57
+		$context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1', '2']);
58 58
 
59
-		$customerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Customer\\Manager\\Standard' )
60
-			->setConstructorArgs( [$context] )
61
-			->setMethods( ['getItem', 'saveItem'] )
59
+		$customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')
60
+			->setConstructorArgs([$context])
61
+			->setMethods(['getItem', 'saveItem'])
62 62
 			->getMock();
63 63
 
64
-		\Aimeos\MShop\Factory::injectManager( $context, 'customer', $customerStub );
64
+		\Aimeos\MShop\Factory::injectManager($context, 'customer', $customerStub);
65 65
 
66
-		$customerItem = $customerStub->createItem()->setGroups( ['1', '2'] );
66
+		$customerItem = $customerStub->createItem()->setGroups(['1', '2']);
67 67
 
68
-		$customerStub->expects( $this->once() )->method( 'getItem' )
69
-			->will( $this->returnValue( $customerItem ) );
68
+		$customerStub->expects($this->once())->method('getItem')
69
+			->will($this->returnValue($customerItem));
70 70
 
71
-		$customerStub->expects( $this->once() )->method( 'saveItem' )
72
-			->with( $this->callback( function( $subject ){
71
+		$customerStub->expects($this->once())->method('saveItem')
72
+			->with($this->callback(function($subject) {
73 73
 				return $subject->getGroups() === [];
74
-			} ) );
74
+			} ));
75 75
 
76
-		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard( $context );
77
-		$object->end( $this->getSubscription( $context ) );
76
+		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard($context);
77
+		$object->end($this->getSubscription($context));
78 78
 	}
79 79
 
80 80
 
81
-	protected function getSubscription( $context )
81
+	protected function getSubscription($context)
82 82
 	{
83
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
83
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
84 84
 
85 85
 		$search = $manager->createSearch();
86
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
86
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
87 87
 
88
-		$items = $manager->searchItems( $search );
88
+		$items = $manager->searchItems($search);
89 89
 
90
-		if( ( $item = reset( $items ) ) !== false ) {
90
+		if (($item = reset($items)) !== false) {
91 91
 			return $item;
92 92
 		}
93 93
 
94
-		throw new \Exception( 'No subscription item found' );
94
+		throw new \Exception('No subscription item found');
95 95
 	}
96 96
 }
Please login to merge, or discard this patch.