Go to the source code of this file.
◆ toList()
- Author
- Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de
Definition at line 7 of file 07-to-new-method.php.
8{
9 class SomeClass
10 {
11 public function say(string $firstWord, string $secondWord)
12 {
13 return $firstWord . $secondWord;
14 }
15 }
16
18
19 $instance = new SomeClass();
20
21 $refinery =
$DIC->refinery();
22
23 $transformation = $refinery->to()->toNew(
24 array($instance, 'say')
25 );
26
27 $result = $transformation->transform(array(
'Hello',
' World!'));
28
29 return assert(
'Hello World!' ===
$result);
30}
References $DIC, and $result.