Skip to content

Commit ef724a6

Browse files
author
Julian Wundrak
committed
[#19908] add requested code style changes
1 parent 5abd330 commit ef724a6

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

app/code/Magento/Webapi/Controller/PathProcessor.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
namespace Magento\Webapi\Controller;
88

9+
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Exception\NoSuchEntityException;
1011

1112
/**
@@ -32,10 +33,12 @@ class PathProcessor
3233
*/
3334
public function __construct(
3435
\Magento\Store\Model\StoreManagerInterface $storeManager,
35-
\Magento\Framework\Locale\ResolverInterface $localeResolver
36+
\Magento\Framework\Locale\ResolverInterface $localeResolver = null
3637
) {
3738
$this->storeManager = $storeManager;
38-
$this->localeResolver = $localeResolver;
39+
$this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(
40+
\Magento\Framework\Locale\ResolverInterface::class
41+
);
3942
}
4043

4144
/**

app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected function setUp()
5454
*/
5555
public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentStoreCallCtr = 1)
5656
{
57-
$storeCodeInPath = !$storeCodeInPath ? : '/' . $storeCodeInPath; // add leading slash if store code not empty
58-
$inPath = 'rest' . $storeCodeInPath . $this->endpointPath;
57+
$storeCodeInPath = !$storeCodeInPath ?: '/' . $storeCodeInPath; // add leading slash if store code not empty
58+
$inPath = 'rest' . $storeCodeInPath . $this->endpointPath;
5959
$this->storeManagerMock->expects($this->exactly($setCurrentStoreCallCtr))
6060
->method('setCurrentStore')
6161
->with($storeCodeSet);
@@ -73,9 +73,9 @@ public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentSto
7373
public function processPathDataProvider()
7474
{
7575
return [
76-
'All store code' => ['all', Store::ADMIN_CODE],
77-
'Default store code' => ['', 'default', 0],
78-
'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode],
76+
'All store code' => ['all', Store::ADMIN_CODE],
77+
'Default store code' => ['', 'default', 0],
78+
'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode],
7979
'Explicit default store code' => ['default', 'default'],
8080
];
8181
}

dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase
1818
/**
1919
* @var \Magento\Framework\Locale\ResolverInterface::class
2020
*/
21-
protected $localeResolver;
21+
private $localeResolver;
2222

2323
/**
2424
* @var \Magento\Webapi\Controller\PathProcessor

0 commit comments

Comments
 (0)