Skip to content

Commit fb31788

Browse files
author
Paul
committed
Removed Translate strategy and accompanying test.
Renamed Copy* strategy invoke parameters data -> record.
1 parent b0a28a0 commit fb31788

File tree

6 files changed

+7
-84
lines changed

6 files changed

+7
-84
lines changed

src/Strategy/Copy.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ class Copy extends Delegate
1111
const PATH_SEPARATOR = '->';
1212

1313
/**
14-
* @param mixed $data
14+
* @param mixed $record
1515
* @param mixed $context
1616
*
1717
* @return mixed
1818
*/
19-
public function __invoke($data, $context = null)
19+
public function __invoke($record, $context = null)
2020
{
21-
if (!is_array($data)) {
21+
if (!is_array($record)) {
2222
return null;
2323
}
2424

25-
if (!is_array($path = parent::__invoke($data, $context))) {
25+
if (!is_array($path = parent::__invoke($record, $context))) {
2626
$path = explode(self::PATH_SEPARATOR, $path);
2727
}
2828

29-
return $path ? ArrayWalker::walk($data, $path) : null;
29+
return $path ? ArrayWalker::walk($record, $path) : null;
3030
}
3131
}

src/Strategy/CopyContext.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct($path = null)
2323
$this->walk = (bool)$path;
2424
}
2525

26-
public function __invoke($data, $context = null)
26+
public function __invoke($record, $context = null)
2727
{
2828
if ($this->walk) {
2929
return parent::__invoke($context);

src/Strategy/CopyKey.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CopyKey implements Strategy, KeyAware
1111
{
1212
use KeyAwareTrait;
1313

14-
public function __invoke($data, $context = null)
14+
public function __invoke($record, $context = null)
1515
{
1616
return $this->key;
1717
}

src/Strategy/Translate.php

-37
This file was deleted.

test/Functional/DocumentationTest.php

-14
Original file line numberDiff line numberDiff line change
@@ -312,20 +312,6 @@ public function testToList()
312312
);
313313
}
314314

315-
public function testTranslate()
316-
{
317-
self::assertSame(
318-
'bar',
319-
(new Mapper)->map(
320-
['foo' => 'foo'],
321-
new Translate(
322-
new Copy('foo'),
323-
['foo' => 'bar']
324-
)
325-
)
326-
);
327-
}
328-
329315
public function testTryCatch()
330316
{
331317
self::assertSame(

test/Integration/Mapper/Strategy/TranslateTest.php

-26
This file was deleted.

0 commit comments

Comments
 (0)