33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6+
67namespace Magento \Quote \Model \Quote \Item ;
78
8- use Magento \Quote \Model \Quote \ Item ;
9+ use Magento \Catalog \Model \Product \ Configuration \ Item \ Option \ OptionInterface ;
910use Magento \Framework \Api \AttributeValueFactory ;
11+ use Magento \Quote \Model \Quote \Item ;
1012
1113/**
1214 * Quote item abstract model
4749 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
4850 * @since 100.0.2
4951 */
50- abstract class AbstractItem extends \Magento \Framework \Model \AbstractExtensibleModel implements
51- \Magento \Catalog \Model \Product \Configuration \Item \ItemInterface
52+ abstract class AbstractItem extends \Magento \Framework \Model \AbstractExtensibleModel
53+ implements \Magento \Catalog \Model \Product \Configuration \Item \ItemInterface
5254{
5355 /**
5456 * @var Item|null
@@ -68,7 +70,7 @@ abstract class AbstractItem extends \Magento\Framework\Model\AbstractExtensibleM
6870 /**
6971 * List of custom options
7072 *
71- * @var array
73+ * @var OptionInterface[]
7274 */
7375 protected $ _optionsByCode ;
7476
@@ -187,7 +189,7 @@ public function beforeSave()
187189 /**
188190 * Set parent item
189191 *
190- * @param Item $parentItem
192+ * @param Item $parentItem
191193 * @return $this
192194 */
193195 public function setParentItem ($ parentItem )
@@ -222,7 +224,7 @@ public function getChildren()
222224 /**
223225 * Add child item
224226 *
225- * @param \Magento\Quote\Model\Quote\Item\AbstractItem $child
227+ * @param \Magento\Quote\Model\Quote\Item\AbstractItem $child
226228 * @return $this
227229 */
228230 public function addChild ($ child )
@@ -235,7 +237,7 @@ public function addChild($child)
235237 /**
236238 * Adds message(s) for quote item. Duplicated messages are not added.
237239 *
238- * @param mixed $messages
240+ * @param mixed $messages
239241 * @return $this
240242 */
241243 public function setMessage ($ messages )
@@ -255,7 +257,7 @@ public function setMessage($messages)
255257 /**
256258 * Add message of quote item to array of messages
257259 *
258- * @param string $message
260+ * @param string $message
259261 * @return $this
260262 */
261263 public function addMessage ($ message )
@@ -267,7 +269,7 @@ public function addMessage($message)
267269 /**
268270 * Get messages array of quote item
269271 *
270- * @param bool $string flag for converting messages to string
272+ * @param bool $string flag for converting messages to string
271273 * @return array|string
272274 */
273275 public function getMessage ($ string = true )
@@ -624,18 +626,12 @@ public function __clone()
624626 */
625627 public function isChildrenCalculated ()
626628 {
627- if ($ this ->getParentItem ()) {
628- $ calculate = $ this ->getParentItem ()->getProduct ()->getPriceType ();
629- } else {
630- $ calculate = $ this ->getProduct ()->getPriceType ();
631- }
629+ $ calculate = $ this ->getParentItem ()
630+ ? $ this ->getParentItem ()->getProduct ()->getPriceType ()
631+ : $ this ->getProduct ()->getPriceType ();
632632
633- if (null !== $ calculate &&
634- (int )$ calculate === \Magento \Catalog \Model \Product \Type \AbstractType::CALCULATE_CHILD
635- ) {
636- return true ;
637- }
638- return false ;
633+ return $ calculate !== null
634+ && (int )$ calculate === \Magento \Catalog \Model \Product \Type \AbstractType::CALCULATE_CHILD ;
639635 }
640636
641637 /**
@@ -648,18 +644,12 @@ public function isChildrenCalculated()
648644 */
649645 public function isShipSeparately ()
650646 {
651- if ($ this ->getParentItem ()) {
652- $ shipmentType = $ this ->getParentItem ()->getProduct ()->getShipmentType ();
653- } else {
654- $ shipmentType = $ this ->getProduct ()->getShipmentType ();
655- }
647+ $ shipmentType = $ this ->getParentItem ()
648+ ? $ this ->getParentItem ()->getProduct ()->getShipmentType ()
649+ : $ this ->getProduct ()->getShipmentType ();
656650
657- if (null !== $ shipmentType &&
658- (int )$ shipmentType === \Magento \Catalog \Model \Product \Type \AbstractType::SHIPMENT_SEPARATELY
659- ) {
660- return true ;
661- }
662- return false ;
651+ return null !== $ shipmentType &&
652+ (int )$ shipmentType === \Magento \Catalog \Model \Product \Type \AbstractType::SHIPMENT_SEPARATELY ;
663653 }
664654
665655 /**
0 commit comments