for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPDaemon\Examples;
use PHPDaemon\HTTPRequest\Generic;
class ExampleDNSClientRequest extends Generic
{
public $job;
/**
* Constructor.
* @return void
*/
public function init()
$req = $this;
$job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done
$req->wakeup(); // wake up the request immediately
});
$job('query', function ($name, $job) { // registering job named 'showvar'
\PHPDaemon\Clients\DNS\Pool::getInstance()->get('phpdaemon.net', function ($response) use ($name, $job) {
$job->setResult($name, $response);
$job('resolve', function ($name, $job) { // registering job named 'showvar'
\PHPDaemon\Clients\DNS\Pool::getInstance()->resolve('phpdaemon.net', function ($ip) use ($name, $job) {
$job->setResult($name, ['phpdaemon.net resolved to' => $ip]);
$job(); // let the fun begin
$this->sleep(5, true); // setting timeout
}
* Called when request iterated.
* @return integer Status.
integer|null
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function run()
try {
$this->header('Content-Type: text/plain');
} catch (\Exception $e) {
var_dump($this->job->getResult('query'));
var_dump($this->job->getResult('resolve'));
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.