1 | <?php |
||
18 | class Factory |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var NetworkInterface |
||
23 | */ |
||
24 | private $network; |
||
25 | |||
26 | /** |
||
27 | * @var LoopInterface |
||
28 | */ |
||
29 | private $loop; |
||
30 | |||
31 | private $messages = null; |
||
32 | |||
33 | /** |
||
34 | * @param NetworkInterface $network |
||
35 | * @param LoopInterface $loop |
||
36 | */ |
||
37 | 24 | public function __construct(LoopInterface $loop, NetworkInterface $network = null) |
|
43 | |||
44 | /** |
||
45 | * @return Dns\Resolver |
||
46 | */ |
||
47 | 16 | public function getDns() |
|
51 | |||
52 | /** |
||
53 | * @param Random|null $random |
||
54 | * @return Messages\Factory |
||
55 | */ |
||
56 | 15 | public function getMessages(Random $random = null) |
|
66 | |||
67 | /** |
||
68 | * @param Settings\NetworkSettings $settings |
||
69 | */ |
||
70 | public function setSettings(Settings\NetworkSettings $settings) |
||
74 | |||
75 | /** |
||
76 | * @return Settings\NetworkSettings |
||
77 | */ |
||
78 | 3 | public function getSettings() |
|
79 | { |
||
80 | 3 | return $this->settings; |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param Peer\ConnectionParams $params |
||
85 | * @return Peer\Connector |
||
86 | */ |
||
87 | 12 | public function getConnector(Peer\ConnectionParams $params) |
|
91 | |||
92 | /** |
||
93 | * @param Peer\Connector $connector |
||
94 | * @return Peer\Manager |
||
95 | */ |
||
96 | 6 | public function getManager(Peer\Connector $connector) |
|
100 | |||
101 | /** |
||
102 | * @return Peer\Locator |
||
103 | */ |
||
104 | 12 | public function getLocator() |
|
108 | |||
109 | /** |
||
110 | * @param ConnectionParams $params |
||
111 | * @param NetworkAddressInterface $serverAddress |
||
112 | * @return Listener |
||
113 | */ |
||
114 | 9 | public function getListener(Peer\ConnectionParams $params, NetworkAddressInterface $serverAddress) |
|
118 | |||
119 | /** |
||
120 | * @param IpInterface $ipAddress |
||
121 | * @param int $port |
||
122 | * @param int $services |
||
123 | * @return NetworkAddress |
||
124 | */ |
||
125 | 9 | public function getAddress(IpInterface $ipAddress, $port = 8333, $services = Services::NONE) |
|
133 | } |
||
134 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: