Skip to content

Commit 18ca5f0

Browse files
committed
Rework without method's contract modification for BW compatibility
1 parent 1c9ce84 commit 18ca5f0

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

app/code/Magento/Sales/Model/Order.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,11 +982,10 @@ public function setState($state)
982982
* Retrieve frontend label of order status
983983
*
984984
* @return string
985-
* @throws LocalizedException
986985
*/
987986
public function getFrontendStatusLabel()
988987
{
989-
return $this->getConfig()->getStatusLabel($this->getStatus(), \Magento\Framework\App\Area::AREA_FRONTEND);
988+
return $this->getConfig()->getStatusFrontendLabel($this->getStatus());
990989
}
991990

992991
/**

app/code/Magento/Sales/Model/Order/Config.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,14 @@ public function getStateDefaultStatus($state)
117117
}
118118

119119
/**
120-
* Retrieve status label
120+
* Get status label for a specified area
121121
*
122122
* @param string $code
123-
* @param string|null $forceArea
123+
* @param string $area
124124
* @return string
125-
* @throws LocalizedException
126125
*/
127-
public function getStatusLabel($code, $forceArea = null)
126+
private function getStatusLabelForArea(string $code, string $area): string
128127
{
129-
$area = $forceArea ?: $this->state->getAreaCode();
130128
$code = $this->maskStatusForArea($area, $code);
131129
$status = $this->orderStatusFactory->create()->load($code);
132130

@@ -137,6 +135,29 @@ public function getStatusLabel($code, $forceArea = null)
137135
return $status->getStoreLabel();
138136
}
139137

138+
/**
139+
* Retrieve status label for detected area
140+
*
141+
* @param string $code
142+
* @return string
143+
* @throws LocalizedException
144+
*/
145+
public function getStatusLabel($code)
146+
{
147+
return $this->getStatusLabelForArea($code, $this->state->getAreaCode());
148+
}
149+
150+
/**
151+
* Retrieve status label for area
152+
*
153+
* @param string $code
154+
* @return string
155+
*/
156+
public function getStatusFrontendLabel(string $code): string
157+
{
158+
return $this->getStatusLabelForArea($code, \Magento\Framework\App\Area::AREA_FRONTEND);
159+
}
160+
140161
/**
141162
* Mask status for order for specified area
142163
*

0 commit comments

Comments
 (0)