<?php
class Catcher
{
public function __call($arg0, $arg1)
{
if ($arg0 === 'doX')
{
return $this->doX;
}
throw new ErrorException('Method not found!');
}
private $doX;
public function __construct()
{
$this->doX = new DoX();
}
}
class DoX
{
public function __call($arg0, $arg1)
{
return print_r([$arg0, $arg1], TRUE);
}
}
function dbg()
{
$args = func_get_args();
foreach($args as $arg)
{
echo strtr('<pre>:text</pre>', array(
':text' => print_r($arg, TRUE),
));
}
}
echo (new Catcher)->doX()->doY();
Но сам View пустой, никаие свойсва объекта не передались.
class Sockets
{
public static event MessageAppearsHandler OnMessageAppears;
***
public static void ServerSocetStart()
{
while (true)
{
...
message = builder.ToString(); //builder - переменная получаемая в ходе неких манипуляций в цикле while
OnMessageAppears?.Inkove(null, new MessageAppearsEventArgs(message));
}
}
}
delegate void MessageAppearsHandler(object sender, MessageAppearsEventArgs eventArgs);
class MessageAppearsEventArgs: EventArgs
{
public string Message { get; }
public MessageAppearsEventArgs(string message)
{
Message = message;
}
}