for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BeyondCode\LaravelWebSockets\Server;
use Ratchet\ConnectionInterface;
use stdClass;
class MockableConnection implements ConnectionInterface
{
/**
* Create a new Mockable connection.
*
* @param string|int $appId
* @param string $socketId
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
*/
public function __construct($appId, string $socketId)
$this->app = new stdClass;
app
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->app->id = $appId;
$this->socketId = $socketId;
socketId
}
* Send data to the connection.
* @param string $data
* @return \Ratchet\ConnectionInterface
public function send($data)
//
* Close the connection.
public function close()
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.