ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
06-to-new-object.php File Reference

Go to the source code of this file.

Functions

 toNewObject ()
 

Function Documentation

◆ toNewObject()

toNewObject ( )
Author
Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de

Definition at line 7 of file 06-to-new-object.php.

References $DIC, $result, and ILIAS\GlobalScreen\Provider\__construct().

8 {
9  class SomeClass
10  {
11  private $firstParameter;
12  private $secondParameter;
13  private $thirdParameter;
14 
15  public function __construct(
16  string $firstParameter,
17  int $secondParameter,
18  string $thirdParameter
19  ) {
20  $this->firstParameter = $firstParameter;
21  $this->secondParameter = $secondParameter;
22  $this->thirdParameter = $thirdParameter;
23  }
24 
25  public function say()
26  {
27  return $this->firstParameter;
28  }
29  }
30 
31  global $DIC;
32 
33  $refinery = $DIC->refinery();
34 
35  $transformation = $refinery->to()->toNew(
36  'SomeClass'
37  );
38 
39  $result = $transformation->transform(array('firstParameter', 2, 'thirdParameter'));
40 
41  return assert('firstParameter' === $result->say());
42 }
$result
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function: