Skip to content

Commit 73b02f8

Browse files
committed
Rename request parameter and variables to make them more expressive
1 parent fc1c1d2 commit 73b02f8

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

app/code/Magento/Customer/Controller/Section/Load.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ public function execute()
7070
$sectionNames = $this->getRequest()->getParam('sections');
7171
$sectionNames = $sectionNames ? array_unique(\explode(',', $sectionNames)) : null;
7272

73-
$updateSectionId = $this->getRequest()->getParam('update_section_id');
74-
if ('false' === $updateSectionId) {
75-
$updateSectionId = false;
73+
$forceNewSectionTimestamp = $this->getRequest()->getParam('force_new_section_timestamp');
74+
if ('false' === $forceNewSectionTimestamp) {
75+
$forceNewSectionTimestamp = false;
7676
}
77-
$response = $this->sectionPool->getSectionsData($sectionNames, (bool)$updateSectionId);
77+
$response = $this->sectionPool->getSectionsData($sectionNames, (bool)$forceNewSectionTimestamp);
7878
} catch (\Exception $e) {
7979
$resultJson->setStatusHeader(
8080
\Zend\Http\Response::STATUS_CODE_400,

app/code/Magento/Customer/CustomerData/Section/Identifier.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public function __construct(
4343
/**
4444
* Init mark(identifier) for sections
4545
*
46-
* @param bool $forceUpdate
46+
* @param bool $forceNewTimestamp
4747
* @return int
4848
*/
49-
public function initMark($forceUpdate)
49+
public function initMark($forceNewTimestamp)
5050
{
51-
if ($forceUpdate) {
51+
if ($forceNewTimestamp) {
5252
$this->markId = time();
5353
return $this->markId;
5454
}
@@ -68,18 +68,18 @@ public function initMark($forceUpdate)
6868
*
6969
* @param array $sectionsData
7070
* @param null $sectionNames
71-
* @param bool $updateIds
71+
* @param bool $forceNewTimestamp
7272
* @return array
7373
*/
74-
public function markSections(array $sectionsData, $sectionNames = null, $updateIds = false)
74+
public function markSections(array $sectionsData, $sectionNames = null, $forceNewTimestamp = false)
7575
{
7676
if (!$sectionNames) {
7777
$sectionNames = array_keys($sectionsData);
7878
}
79-
$markId = $this->initMark($updateIds);
79+
$markId = $this->initMark($forceNewTimestamp);
8080

8181
foreach ($sectionNames as $name) {
82-
if ($updateIds || !array_key_exists(self::SECTION_KEY, $sectionsData[$name])) {
82+
if ($forceNewTimestamp || !array_key_exists(self::SECTION_KEY, $sectionsData[$name])) {
8383
$sectionsData[$name][self::SECTION_KEY] = $markId;
8484
}
8585
}

app/code/Magento/Customer/CustomerData/SectionPool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ public function __construct(
5555
/**
5656
* {@inheritdoc}
5757
*/
58-
public function getSectionsData(array $sectionNames = null, $updateIds = false)
58+
public function getSectionsData(array $sectionNames = null, $forceNewTimestamp = false)
5959
{
6060
$sectionsData = $sectionNames ? $this->getSectionDataByNames($sectionNames) : $this->getAllSectionData();
61-
$sectionsData = $this->identifier->markSections($sectionsData, $sectionNames, $updateIds);
61+
$sectionsData = $this->identifier->markSections($sectionsData, $sectionNames, $forceNewTimestamp);
6262
return $sectionsData;
6363
}
6464

app/code/Magento/Customer/CustomerData/SectionPoolInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ interface SectionPoolInterface
1414
* Get section data by section names. If $sectionNames is null then return all sections data
1515
*
1616
* @param array $sectionNames
17-
* @param bool $updateIds
17+
* @param bool $forceNewTimestamp
1818
* @return array
1919
*/
20-
public function getSectionsData(array $sectionNames = null, $updateIds = false);
20+
public function getSectionsData(array $sectionNames = null, $forceNewTimestamp = false);
2121
}

app/code/Magento/Customer/Test/Unit/Controller/Section/LoadTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ protected function setUp()
8181
}
8282

8383
/**
84-
* @param $sectionNames
85-
* @param $updateSectionID
86-
* @param $sectionNamesAsArray
87-
* @param $updateIds
84+
* @param string $sectionNames
85+
* @param bool $forceNewSectionTimestamp
86+
* @param string[] $sectionNamesAsArray
87+
* @param bool $forceNewTimestamp
8888
* @dataProvider executeDataProvider
8989
*/
90-
public function testExecute($sectionNames, $updateSectionID, $sectionNamesAsArray, $updateIds)
90+
public function testExecute($sectionNames, $forceNewSectionTimestamp, $sectionNamesAsArray, $forceNewTimestamp)
9191
{
9292
$this->resultJsonFactoryMock->expects($this->once())
9393
->method('create')
@@ -101,12 +101,12 @@ public function testExecute($sectionNames, $updateSectionID, $sectionNamesAsArra
101101

102102
$this->httpRequestMock->expects($this->exactly(2))
103103
->method('getParam')
104-
->withConsecutive(['sections'], ['update_section_id'])
105-
->willReturnOnConsecutiveCalls($sectionNames, $updateSectionID);
104+
->withConsecutive(['sections'], ['force_new_section_timestamp'])
105+
->willReturnOnConsecutiveCalls($sectionNames, $forceNewSectionTimestamp);
106106

107107
$this->sectionPoolMock->expects($this->once())
108108
->method('getSectionsData')
109-
->with($sectionNamesAsArray, $updateIds)
109+
->with($sectionNamesAsArray, $forceNewTimestamp)
110110
->willReturn([
111111
'message' => 'some message',
112112
'someKey' => 'someValue'
@@ -128,15 +128,15 @@ public function executeDataProvider()
128128
return [
129129
[
130130
'sectionNames' => 'sectionName1,sectionName2,sectionName3',
131-
'updateSectionID' => 'updateSectionID',
131+
'forceNewSectionTimestamp' => 'forceNewSectionTimestamp',
132132
'sectionNamesAsArray' => ['sectionName1', 'sectionName2', 'sectionName3'],
133-
'updateIds' => true
133+
'forceNewTimestamp' => true
134134
],
135135
[
136136
'sectionNames' => null,
137-
'updateSectionID' => null,
137+
'forceNewSectionTimestamp' => null,
138138
'sectionNamesAsArray' => null,
139-
'updateIds' => false
139+
'forceNewTimestamp' => false
140140
],
141141
];
142142
}

app/code/Magento/Customer/Test/Unit/CustomerData/SectionPoolTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testGetSectionsDataAllSections()
6363

6464
$this->identifierMock->expects($this->once())
6565
->method('markSections')
66-
//check also default value for $updateIds = false
66+
//check also default value for $forceTimestamp = false
6767
->with($allSectionsData, $sectionNames, false)
6868
->willReturn($identifierResult);
6969
$modelResult = $this->model->getSectionsData($sectionNames);

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ define([
8484
parameters = _.isArray(sectionNames) ? {
8585
sections: sectionNames.join(',')
8686
} : [];
87-
parameters['update_section_id'] = forceNewSectionTimestamp;
87+
parameters['force_new_section_timestamp'] = forceNewSectionTimestamp;
8888

8989
return $.getJSON(options.sectionLoadUrl, parameters).fail(function (jqXHR) {
9090
throw new Error(jqXHR);

0 commit comments

Comments
 (0)