ILIAS  release_7 Revision v7.30-3-g800a261c036
07-to-new-method.php File Reference

Go to the source code of this file.

Functions

 toList ()
 

Function Documentation

◆ toList()

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
17 global $DIC;
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}
$result
global $DIC
Definition: goto.php:24

References $DIC, and $result.