ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $DIC, and $result.

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
$DIC
Definition: xapitoken.php:46