Skip to content

Commit 63749af

Browse files
author
Bryant Luk
committed
MAGETWO-36063: Update REST and SOAP controllers to filter out attributes based on ACL
- Fix static analysis
1 parent 665ca1f commit 63749af

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

app/code/Magento/Webapi/Test/Unit/Model/DataObjectProcessorTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ class DataObjectProcessorTest extends \PHPUnit_Framework_TestCase
2323
protected function setup()
2424
{
2525
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
26-
$methodsMapProcessor = $objectManager->getObject('Magento\Framework\Reflection\MethodsMap',
26+
$methodsMapProcessor = $objectManager->getObject(
27+
'Magento\Framework\Reflection\MethodsMap',
2728
[
2829
'fieldNamer' => $objectManager->getObject('Magento\Framework\Reflection\FieldNamer'),
2930
'typeProcessor' => $objectManager->getObject('Magento\Framework\Reflection\TypeProcessor'),
3031
]
3132
);
32-
$this->dataObjectProcessor = $objectManager->getObject('Magento\Framework\Reflection\DataObjectProcessor',
33+
$this->dataObjectProcessor = $objectManager->getObject(
34+
'Magento\Framework\Reflection\DataObjectProcessor',
3335
[
3436
'methodsMapProcessor' => $methodsMapProcessor,
3537
'typeCaster' => $objectManager->getObject('Magento\Framework\Reflection\TypeCaster'),

lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function buildOutputDataArray($dataObject, $dataObjectType)
7878
$outputData = [];
7979

8080
/** @var MethodReflection $method */
81-
foreach ($methods as $methodName => $methodReflectionData) {
81+
foreach (array_keys($methods) as $methodName) {
8282
if (!$this->methodsMapProcessor->isMethodValidForDataField($dataObjectType, $methodName)) {
8383
continue;
8484
}

lib/internal/Magento/Framework/Reflection/ExtensionAttributesProcessor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ public function __construct(
8888
* @param ExtensionAttributeInterface $dataObject
8989
* @param string $dataObjectType
9090
* @return array
91+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
9192
*/
9293
public function buildOutputDataArray(ExtensionAttributesInterface $dataObject, $dataObjectType)
9394
{
9495
$methods = $this->methodsMapProcessor->getMethodsMap($dataObjectType);
9596
$outputData = [];
9697

9798
/** @var MethodReflection $method */
98-
foreach ($methods as $methodName => $methodReflectionData) {
99+
foreach (array_keys($methods) as $methodName) {
99100
if (!$this->methodsMapProcessor->isMethodValidForDataField($dataObjectType, $methodName)) {
100101
continue;
101102
}

lib/internal/Magento/Framework/Reflection/FieldNamer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FieldNamer
2323
const GETTER_PREFIX = 'get';
2424

2525
/**
26-
* @param string
26+
* @param string $methodName
2727
* @return string|null
2828
*/
2929
public function getFieldNameForMethodName($methodName)

0 commit comments

Comments
 (0)