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