ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
07-to-new-method.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
7 function toList()
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
toList()
global $DIC
Definition: goto.php:24