@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | * @param string $id Unique subscription ID |
| 28 | 28 | * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item |
| 29 | 29 | */ |
| 30 | - public function cancel( $id ) |
|
| 30 | + public function cancel($id) |
|
| 31 | 31 | { |
| 32 | - $item = $this->getItem( $id ); |
|
| 33 | - $item->setDateEnd( $item->getDateNext() ); |
|
| 34 | - $item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL ); |
|
| 32 | + $item = $this->getItem($id); |
|
| 33 | + $item->setDateEnd($item->getDateNext()); |
|
| 34 | + $item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL); |
|
| 35 | 35 | |
| 36 | - return $this->saveItem( $item ); |
|
| 36 | + return $this->saveItem($item); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function createFilter() |
| 46 | 46 | { |
| 47 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->createSearch(); |
|
| 47 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->createSearch(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -54,25 +54,25 @@ discard block |
||
| 54 | 54 | * @param string $id Unique subscription ID |
| 55 | 55 | * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object |
| 56 | 56 | */ |
| 57 | - public function getItem( $id ) |
|
| 57 | + public function getItem($id) |
|
| 58 | 58 | { |
| 59 | 59 | $context = $this->getContext(); |
| 60 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
| 60 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
| 61 | 61 | |
| 62 | 62 | $filter = $manager->createSearch(); |
| 63 | 63 | $expr = [ |
| 64 | - $filter->compare( '==', 'subscription.id', $id ), |
|
| 65 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 64 | + $filter->compare('==', 'subscription.id', $id), |
|
| 65 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 66 | 66 | $filter->getConditions(), |
| 67 | 67 | ]; |
| 68 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 68 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 69 | 69 | |
| 70 | - $items = $this->searchItems( $filter ); |
|
| 70 | + $items = $this->searchItems($filter); |
|
| 71 | 71 | |
| 72 | - if( ( $item = reset( $items ) ) === false ) |
|
| 72 | + if (($item = reset($items)) === false) |
|
| 73 | 73 | { |
| 74 | 74 | $msg = 'Invalid subscription ID "%1$s" for customer ID "%2$s"'; |
| 75 | - throw new \Aimeos\Controller\Frontend\Subscription\Exception( sprintf( $msg, $id, $context->getUserId() ) ); |
|
| 75 | + throw new \Aimeos\Controller\Frontend\Subscription\Exception(sprintf($msg, $id, $context->getUserId())); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $item; |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | public function getIntervals() |
| 88 | 88 | { |
| 89 | 89 | $intervals = []; |
| 90 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
| 90 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
| 91 | 91 | |
| 92 | - $search = $manager->createSearch( true ); |
|
| 92 | + $search = $manager->createSearch(true); |
|
| 93 | 93 | $expr = array( |
| 94 | 94 | $search->getConditions(), |
| 95 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
| 96 | - $search->compare( '==', 'attribute.type.code', 'interval' ), |
|
| 95 | + $search->compare('==', 'attribute.domain', 'product'), |
|
| 96 | + $search->compare('==', 'attribute.type.code', 'interval'), |
|
| 97 | 97 | ); |
| 98 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 99 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 98 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 99 | + $search->setSlice(0, 0x7fffffff); |
|
| 100 | 100 | |
| 101 | - foreach( $manager->searchItems( $search, ['text'] ) as $attrItem ) { |
|
| 101 | + foreach ($manager->searchItems($search, ['text']) as $attrItem) { |
|
| 102 | 102 | $intervals[$attrItem->getCode()] = $attrItem; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object |
| 112 | 112 | * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item |
| 113 | 113 | */ |
| 114 | - public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item ) |
|
| 114 | + public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item) |
|
| 115 | 115 | { |
| 116 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->saveItem( $item ); |
|
| 116 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->saveItem($item); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -124,17 +124,17 @@ discard block |
||
| 124 | 124 | * @param integer &$total|null Variable that will contain the total number of available items |
| 125 | 125 | * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values |
| 126 | 126 | */ |
| 127 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
| 127 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
| 128 | 128 | { |
| 129 | 129 | $context = $this->getContext(); |
| 130 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
| 130 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
| 131 | 131 | |
| 132 | 132 | $expr = [ |
| 133 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 133 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 134 | 134 | $filter->getConditions(), |
| 135 | 135 | ]; |
| 136 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 136 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 137 | 137 | |
| 138 | - return $manager->searchItems( $filter, [], $total ); |
|
| 138 | + return $manager->searchItems($filter, [], $total); |
|
| 139 | 139 | } |
| 140 | 140 | } |