Skip to content

Commit 147e077

Browse files
authored
Merge pull request #9770 from magento-gl/blth-del10131-commdashpr
[Bluetooth] Community Pull Requests delivery dashprs
2 parents dc71c49 + c98da8e commit 147e077

File tree

11 files changed

+79
-131
lines changed

11 files changed

+79
-131
lines changed

app/code/Magento/Customer/Api/AddressRepositoryInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
22
/**
3-
*
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
65
*/
76
namespace Magento\Customer\Api;
87

@@ -28,6 +27,7 @@ public function save(\Magento\Customer\Api\Data\AddressInterface $address);
2827
* @param int $addressId
2928
* @return \Magento\Customer\Api\Data\AddressInterface
3029
* @throws \Magento\Framework\Exception\LocalizedException
30+
* @throws \Magento\Framework\Exception\NoSuchEntityException
3131
*/
3232
public function getById($addressId);
3333

app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Customer\Model\ResourceModel;
77

@@ -164,6 +164,7 @@ private function updateAddressCollection(CustomerModel $customer, CustomerAddres
164164
* @param int $addressId
165165
* @return \Magento\Customer\Api\Data\AddressInterface
166166
* @throws \Magento\Framework\Exception\LocalizedException
167+
* @throws \Magento\Framework\Exception\NoSuchEntityException
167168
*/
168169
public function getById($addressId)
169170
{

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

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\Quote\Model;
99

1010
use Magento\Customer\Api\AddressRepositoryInterface;
1111
use Magento\Customer\Api\CustomerRepositoryInterface;
12+
use Magento\Customer\Api\Data\AddressInterface as CustomerAddress;
1213
use Magento\Customer\Model\Session;
1314
use Magento\Framework\Exception\InputException;
1415
use Magento\Framework\Exception\LocalizedException;
@@ -68,39 +69,28 @@ public function __construct(
6869
*/
6970
private function doValidate(AddressInterface $address, ?int $customerId): void
7071
{
71-
//validate customer id
72-
if ($customerId) {
73-
$customer = $this->customerRepository->getById($customerId);
74-
if (!$customer->getId()) {
75-
throw new NoSuchEntityException(
76-
__('Invalid customer id %1', $customerId)
77-
);
78-
}
79-
}
80-
81-
if ($address->getCustomerAddressId()) {
72+
$customerAddressId = $address->getCustomerAddressId();
73+
if ($customerAddressId) {
8274
//Existing address cannot belong to a guest
8375
if (!$customerId) {
8476
throw new NoSuchEntityException(
85-
__('Invalid customer address id %1', $address->getCustomerAddressId())
77+
__('Invalid customer address id %1', $customerAddressId)
8678
);
8779
}
80+
81+
$customer = $this->customerRepository->getById($customerId);
82+
8883
//Validating address ID
89-
try {
90-
$this->addressRepository->getById($address->getCustomerAddressId());
91-
} catch (NoSuchEntityException $e) {
92-
throw new NoSuchEntityException(
93-
__('Invalid address id %1', $address->getId())
94-
);
95-
}
84+
$this->addressRepository->getById($customerAddressId);
85+
9686
//Finding available customer's addresses
97-
$applicableAddressIds = array_map(function ($address) {
98-
/** @var \Magento\Customer\Api\Data\AddressInterface $address */
87+
$applicableAddressIds = array_map(function (CustomerAddress $address) {
9988
return $address->getId();
100-
}, $this->customerRepository->getById($customerId)->getAddresses());
101-
if (!in_array($address->getCustomerAddressId(), $applicableAddressIds)) {
89+
}, $customer->getAddresses());
90+
91+
if (!in_array($customerAddressId, $applicableAddressIds)) {
10292
throw new NoSuchEntityException(
103-
__('Invalid customer address id %1', $address->getCustomerAddressId())
93+
__('Invalid customer address id %1', $customerAddressId)
10494
);
10595
}
10696
}

app/code/Magento/SendFriendGraphQl/Model/Provider/GetVisibleProduct.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -18,22 +18,14 @@
1818
*/
1919
class GetVisibleProduct
2020
{
21-
/** @var ProductRepositoryInterface */
22-
private $productRepository;
23-
24-
/** @var Visibility */
25-
private $visibility;
26-
2721
/**
2822
* @param ProductRepositoryInterface $productRepository
2923
* @param Visibility $visibility
3024
*/
3125
public function __construct(
32-
ProductRepositoryInterface $productRepository,
33-
Visibility $visibility
26+
private readonly ProductRepositoryInterface $productRepository,
27+
private readonly Visibility $visibility
3428
) {
35-
$this->productRepository = $productRepository;
36-
$this->visibility = $visibility;
3729
}
3830

3931
/**

app/code/Magento/SendFriendGraphQl/Model/Resolver/SendEmailToFriend.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -21,26 +21,14 @@
2121
*/
2222
class SendEmailToFriend implements ResolverInterface
2323
{
24-
/**
25-
* @var SendFriendHelper
26-
*/
27-
private $sendFriendHelper;
28-
29-
/**
30-
* @var SendEmail
31-
*/
32-
private $sendEmail;
33-
3424
/**
3525
* @param SendEmail $sendEmail
3626
* @param SendFriendHelper $sendFriendHelper
3727
*/
3828
public function __construct(
39-
SendEmail $sendEmail,
40-
SendFriendHelper $sendFriendHelper
29+
private readonly SendEmail $sendEmail,
30+
private readonly SendFriendHelper $sendFriendHelper
4131
) {
42-
$this->sendEmail = $sendEmail;
43-
$this->sendFriendHelper = $sendFriendHelper;
4432
}
4533

4634
/**

app/code/Magento/SendFriendGraphQl/Model/Resolver/SendFriendConfiguration.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2020 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -17,17 +17,12 @@
1717
*/
1818
class SendFriendConfiguration implements ResolverInterface
1919
{
20-
/**
21-
* @var SendFriendHelper
22-
*/
23-
private $sendFriendHelper;
24-
2520
/**
2621
* @param SendFriendHelper $sendFriendHelper
2722
*/
28-
public function __construct(SendFriendHelper $sendFriendHelper)
29-
{
30-
$this->sendFriendHelper = $sendFriendHelper;
23+
public function __construct(
24+
private readonly SendFriendHelper $sendFriendHelper
25+
) {
3126
}
3227

3328
/**

app/code/Magento/SendFriendGraphQl/Model/SendFriend/SendEmail.php

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Api\ProductRepositoryInterface;
1212
use Magento\Framework\DataObjectFactory;
1313
use Magento\Framework\Event\ManagerInterface;
14+
use Magento\Framework\Exception\LocalizedException;
1415
use Magento\Framework\Exception\NoSuchEntityException;
1516
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1617
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
@@ -23,31 +24,6 @@
2324
*/
2425
class SendEmail
2526
{
26-
/**
27-
* @var DataObjectFactory
28-
*/
29-
private $dataObjectFactory;
30-
31-
/**
32-
* @var ProductRepositoryInterface
33-
*/
34-
private $productRepository;
35-
36-
/**
37-
* @var SendFriendFactory
38-
*/
39-
private $sendFriendFactory;
40-
41-
/**
42-
* @var ManagerInterface
43-
*/
44-
private $eventManager;
45-
46-
/**
47-
* @var GetVisibleProduct
48-
*/
49-
private $visibleProductProvider;
50-
5127
/**
5228
* SendEmail constructor.
5329
* @param DataObjectFactory $dataObjectFactory
@@ -57,17 +33,12 @@ class SendEmail
5733
* @param GetVisibleProduct $visibleProductProvider
5834
*/
5935
public function __construct(
60-
DataObjectFactory $dataObjectFactory,
61-
ProductRepositoryInterface $productRepository,
62-
SendFriendFactory $sendFriendFactory,
63-
ManagerInterface $eventManager,
64-
GetVisibleProduct $visibleProductProvider
36+
private readonly DataObjectFactory $dataObjectFactory,
37+
private readonly ProductRepositoryInterface $productRepository,
38+
private readonly SendFriendFactory $sendFriendFactory,
39+
private readonly ManagerInterface $eventManager,
40+
private readonly GetVisibleProduct $visibleProductProvider
6541
) {
66-
$this->dataObjectFactory = $dataObjectFactory;
67-
$this->productRepository = $productRepository;
68-
$this->sendFriendFactory = $sendFriendFactory;
69-
$this->eventManager = $eventManager;
70-
$this->visibleProductProvider = $visibleProductProvider;
7142
}
7243

7344
/**
@@ -78,7 +49,7 @@ public function __construct(
7849
* @param array $recipientsData
7950
* @throws GraphQlInputException
8051
* @throws GraphQlNoSuchEntityException
81-
* @throws \Magento\Framework\Exception\LocalizedException
52+
* @throws LocalizedException
8253
*/
8354
public function execute(int $productId, array $senderData, array $recipientsData): void
8455
{
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
use Magento\Framework\Component\ComponentRegistrar;
99

10-
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SendFriendGraphQl', __DIR__);
10+
ComponentRegistrar::register(
11+
ComponentRegistrar::MODULE,
12+
'Magento_SendFriendGraphQl',
13+
__DIR__
14+
);

app/code/Magento/Store/Model/Argument/Interpreter/ServiceUrl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2017 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Store\Model\Argument\Interpreter;
77

@@ -65,7 +65,7 @@ public function __construct(
6565
*
6666
* @return string
6767
*/
68-
private function getServiceUrl()
68+
public function getServiceUrl()
6969
{
7070
$store = $this->storeRepository->getById($this->storeManager->getStore()->getId());
7171
return $this->url->getUrl(

0 commit comments

Comments
 (0)