PluginProbe
The Innovative Form Builder – IvyForms / 0.3.1
The Innovative Form Builder – IvyForms v0.3.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / vendor / php-di / php-di / src / Definition / InstanceDefinition.php

InstanceDefinition.php in The Innovative Form Builder – IvyForms 0.3.1, at backend/vendor/php-di/php-di/src/Definition/InstanceDefinition.php

70 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace DI\Definition;
6
7 /**
8 * Defines injections on an existing class instance.
9 *
10 * @since 5.0
11 * @author Matthieu Napoli <[email protected]>
12 */
13 class InstanceDefinition implements Definition
14 {
15 /**
16 * Instance on which to inject dependencies.
17 *
18 * @var object
19 */
20 private $instance;
21
22 /**
23 * @var ObjectDefinition
24 */
25 private $objectDefinition;
26
27 /**
28 * @param object $instance
29 */
30 public function __construct($instance, ObjectDefinition $objectDefinition)
31 {
32 $this->instance = $instance;
33 $this->objectDefinition = $objectDefinition;
34 }
35
36 public function getName() : string
37 {
38 // Name are superfluous for instance definitions
39 return '';
40 }
41
42 public function setName(string $name)
43 {
44 // Name are superfluous for instance definitions
45 }
46
47 /**
48 * @return object
49 */
50 public function getInstance()
51 {
52 return $this->instance;
53 }
54
55 public function getObjectDefinition() : ObjectDefinition
56 {
57 return $this->objectDefinition;
58 }
59
60 public function replaceNestedDefinitions(callable $replacer)
61 {
62 $this->objectDefinition->replaceNestedDefinitions($replacer);
63 }
64
65 public function __toString()
66 {
67 return 'Instance';
68 }
69 }
70