Skip to content

Commit 8d2c280

Browse files
author
Shawn Abramson
committed
Added copyright notices, end blank lines, extension attributes getter/setter, and method descriptions in GroupedItemQtyInterface, GroupedItemQty, and CartItemProcessor
1 parent de1f626 commit 8d2c280

File tree

3 files changed

+91
-10
lines changed

3 files changed

+91
-10
lines changed
Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,60 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
namespace Magento\GroupedProduct\Api\Data;
48

9+
/**
10+
* Object that contains quantity information for a single associated product of a Grouped Product
11+
*
12+
* Interface \Magento\GroupedProduct\Api\Data\GroupedItemQtyInterface
13+
*/
514
interface GroupedItemQtyInterface extends \Magento\Framework\Api\ExtensibleDataInterface
615
{
716
const PRODUCT_ID = 'product_id';
817
const QTY = 'qty';
918

1019
/**
11-
* Associated product id
20+
* Set associated product id
1221
*
1322
* @param int|string $value
1423
*/
1524
public function setProductId($value);
1625

1726
/**
18-
* Associated product id
27+
* Get associated product id
1928
*
2029
* @return int|string
2130
*/
2231
public function getProductId();
2332

2433
/**
34+
* Set associated product qty
35+
*
2536
* @param int|string $qty
2637
*/
2738
public function setQty($qty);
2839

2940
/**
41+
* Get associated product qty
42+
*
3043
* @return int
3144
*/
3245
public function getQty();
33-
}
46+
47+
/**
48+
* @param \Magento\GroupedProduct\Api\Data\GroupedItemQtyExtensionInterface $extensionAttributes
49+
*
50+
* @return $this
51+
*/
52+
public function setExtensionAttributes(
53+
\Magento\GroupedProduct\Api\Data\GroupedItemQtyExtensionInterface $extensionAttributes
54+
);
55+
56+
/**
57+
* @return \Magento\GroupedProduct\Api\Data\GroupedItemQtyExtensionInterface|null
58+
*/
59+
public function getExtensionAttributes();
60+
}

app/code/Magento/GroupedProduct/Model/Quote/Item/CartItemProcessor.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
namespace Magento\GroupedProduct\Model\Quote\Item;
48

@@ -8,7 +12,9 @@
812
use Magento\Quote\Model\Quote\Item\CartItemProcessorInterface;
913

1014
/**
11-
* Class CartItemProcessor
15+
* A class that converts the Grouped Product super group, as received over RESTful API, into the format needed within the buy request
16+
*
17+
* Class \Magento\GroupedProduct\Model\Quote\Item\CartItemProcessor
1218
*/
1319
class CartItemProcessor implements CartItemProcessorInterface
1420
{
@@ -28,6 +34,9 @@ public function __construct(ObjectFactory $objectFactory)
2834
}
2935

3036
/**
37+
*
38+
* Converts the super_group request data into the same format as native frontend add-to-cart
39+
*
3140
* @param CartItemInterface $cartItem
3241
*
3342
* @return \Magento\Framework\DataObject|null
@@ -59,6 +68,8 @@ public function convertToBuyRequest(CartItemInterface $cartItem)
5968
}
6069

6170
/**
71+
* Option processor
72+
*
6273
* @param CartItemInterface $cartItem
6374
*
6475
* @return CartItemInterface
Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
namespace Magento\GroupedProduct\Model\Quote\Item;
48

59
use Magento\Framework\Model\AbstractExtensibleModel;
610
use Magento\GroupedProduct\Api\Data\GroupedItemQtyInterface;
11+
use Magento\GroupedProduct\Api\Data\GroupedItemQtyExtensionInterface;
712

813
/**
9-
* Class GroupedItemQty
14+
* Object that contains quantity information for a single associated product of a Grouped Product
15+
*
16+
* Class \Magento\GroupedProduct\Model\Quote\Item\GroupedItemQty
1017
*/
1118
class GroupedItemQty extends AbstractExtensibleModel implements GroupedItemQtyInterface
1219
{
1320
/**
14-
* {@inheritdoc}
21+
* Set associated product id
22+
*
23+
* @param int|string $value
24+
*
25+
* @return $this
1526
*/
1627
public function setProductId($value)
1728
{
@@ -21,15 +32,21 @@ public function setProductId($value)
2132
}
2233

2334
/**
24-
* {@inheritdoc}
35+
* Get associated product id
36+
*
37+
* @return int|string
2538
*/
2639
public function getProductId()
2740
{
2841
return $this->getData(self::PRODUCT_ID);
2942
}
3043

3144
/**
32-
* {@inheritdoc}
45+
* Set associated product qty
46+
*
47+
* @param int|string $qty
48+
*
49+
* @return $this
3350
*/
3451
public function setQty($qty)
3552
{
@@ -39,10 +56,36 @@ public function setQty($qty)
3956
}
4057

4158
/**
42-
* {@inheritdoc}
59+
* Get associated product qty
60+
*
61+
* @return int
4362
*/
4463
public function getQty()
4564
{
4665
return (int)$this->getData(self::QTY);
4766
}
48-
}
67+
68+
/**
69+
* Set extension attributes
70+
*
71+
* @param GroupedItemQtyExtensionInterface $extensionAttributes
72+
*
73+
* @return $this
74+
*/
75+
public function setExtensionAttributes(GroupedItemQtyExtensionInterface $extensionAttributes)
76+
{
77+
$this->_setExtensionAttributes($extensionAttributes);
78+
79+
return $this;
80+
}
81+
82+
/**
83+
* Get extension attributes
84+
*
85+
* @return GroupedItemQtyExtensionInterface|null
86+
*/
87+
public function getExtensionAttributes()
88+
{
89+
return $this->_getExtensionAttributes();
90+
}
91+
}

0 commit comments

Comments
 (0)