Skip to content

Commit 4b0fdfc

Browse files
committed
Minor Refactor
1 parent 4930963 commit 4b0fdfc

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

app/code/Magento/Quote/Model/ChangeQuoteControl.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\Quote\Model;
@@ -12,13 +11,10 @@
1211
use Magento\Quote\Api\ChangeQuoteControlInterface;
1312
use Magento\Quote\Api\Data\CartInterface;
1413

15-
/**
16-
* {@inheritdoc}
17-
*/
1814
class ChangeQuoteControl implements ChangeQuoteControlInterface
1915
{
2016
/**
21-
* @var UserContextInterface $userContext
17+
* @var UserContextInterface
2218
*/
2319
private $userContext;
2420

@@ -31,25 +27,20 @@ public function __construct(UserContextInterface $userContext)
3127
}
3228

3329
/**
34-
* {@inheritdoc}
30+
* @inheritdoc
3531
*/
3632
public function isAllowed(CartInterface $quote): bool
3733
{
3834
switch ($this->userContext->getUserType()) {
3935
case UserContextInterface::USER_TYPE_CUSTOMER:
40-
$isAllowed = ($quote->getCustomerId() == $this->userContext->getUserId());
41-
break;
36+
return ($quote->getCustomerId() == $this->userContext->getUserId());
4237
case UserContextInterface::USER_TYPE_GUEST:
43-
$isAllowed = ($quote->getCustomerId() === null);
44-
break;
38+
return ($quote->getCustomerId() === null);
4539
case UserContextInterface::USER_TYPE_ADMIN:
4640
case UserContextInterface::USER_TYPE_INTEGRATION:
47-
$isAllowed = true;
48-
break;
49-
default:
50-
$isAllowed = false;
41+
return true;
5142
}
5243

53-
return $isAllowed;
44+
return false;
5445
}
5546
}

0 commit comments

Comments
 (0)