Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use return value instead of reference parameter #1818

Merged
merged 2 commits into from
Oct 6, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$store = $this->storeManager->getStore(
Expand All @@ -64,5 +64,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array &$dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$storeId = $this->context->getFilterParam('store_id');
Expand All @@ -60,5 +60,7 @@ public function prepareDataSource(array &$dataSource)
];
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$fieldName = $this->getData('name');
Expand All @@ -58,6 +58,8 @@ public function prepareDataSource(array & $dataSource)
$item[$fieldName . '_orig_src'] = $origImageHelper->getUrl();
}
}

return $dataSource;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
$websiteNames = [];
foreach ($this->getData('options') as $website) {
Expand All @@ -60,6 +60,8 @@ public function prepareDataSource(array & $dataSource)
$item[$fieldName] = implode(', ', $websites);
}
}

return $dataSource;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testPrepareItemsByPageId()
);

$model->setName($name);
$model->prepareDataSource($items);
$items = $model->prepareDataSource($items);
// Run test
$this->assertEquals($expectedItems, $items['data']['items']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand Down Expand Up @@ -98,5 +98,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand Down Expand Up @@ -92,5 +92,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testPrepareDataSource()
)
->willReturn('http://magento.com/customer/index/edit');

$this->component->prepareDataSource($dataSource);
$dataSource = $this->component->prepareDataSource($dataSource);

$this->assertEquals($expectedDataSource, $dataSource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function testPrepareDataSource()
'is_searchable_in_grid' => true,
]);

$this->component->prepareDataSource($dataSource);
$dataSource = $this->component->prepareDataSource($dataSource);

$this->assertEquals($expectedSource, $dataSource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array &$dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$storeId = $this->context->getFilterParam('store_id');
Expand All @@ -60,5 +60,7 @@ public function prepareDataSource(array &$dataSource)
];
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array &$dataSource)
public function prepareDataSource(array $dataSource)
{
if (!isset($dataSource['data']['items'])) {
return null;
Expand All @@ -60,5 +60,7 @@ public function prepareDataSource(array &$dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Type extends Column
* @param array $dataSource
* @return void
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -28,5 +28,7 @@ public function prepareDataSource(array & $dataSource)
: __('Customer');
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testPrepareDataSource()
];

$this->model->setData('name', $itemName);
$this->model->prepareDataSource($dataSource);
$dataSource = $this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testPrepareDataSource()
->willReturn($group);

$this->model->setData('name', $itemName);
$this->model->prepareDataSource($dataSource);
$dataSource = $this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testPrepareDataSource()
->willReturn($url);

$this->model->setData('name', $itemName);
$this->model->prepareDataSource($dataSource);
$dataSource = $this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testPrepareDataSource()
->willReturn($payment);

$this->model->setData('name', $itemName);
$this->model->prepareDataSource($dataSource);
$dataSource = $this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testPrepareDataSource()
->willReturn($newItemValue);

$this->model->setData('name', $itemName);
$this->model->prepareDataSource($dataSource);
$dataSource = $this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testPrepareDataSource()
['collectionFactory' => $collectionFactoryMock]
);
$model->setData('name', $itemName);
$model->prepareDataSource($dataSource);
$dataSource = $model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ class Address extends Column
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
$item[$this->getData('name')] = str_replace("\n", '<br/>', $item[$this->getData('name')]);
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -55,5 +55,7 @@ public function prepareDataSource(array & $dataSource)
: $item[$this->getData('name')];
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -62,5 +62,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -55,5 +55,7 @@ public function prepareDataSource(array & $dataSource)
: $item[$this->getData('name')];
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -70,5 +70,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -70,5 +70,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
* @return void
* @return array
*/
public function prepareDataSource(array & $dataSource)
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
Expand All @@ -70,5 +70,7 @@ public function prepareDataSource(array & $dataSource)
}
}
}

return $dataSource;
}
}
Loading