Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Swoole\Async; use Swoole; class Redis extends Pool { const DEFAULT_P..
Decoded Output download
<?php
namespace Swoole\Async;
use Swoole;
class Redis extends Pool
{
const DEFAULT_PORT = 6379;
function __construct($config = array(), $poolSize = 100)
{
if (empty($config['host']))
{
throw new Swoole\Exception\InvalidParam("require redis host option.");
}
if (empty($config['port']))
{
$config = self::DEFAULT_PORT;
}
parent::__construct($config, $poolSize);
$this->create(array($this, 'connect'));
}
protected function connect()
{
$redis = new \swoole_redis();
$redis->on('close', function ($redis)
{
$this->remove($redis);
});
return $redis->connect($this->config['host'], $this->config['port'], function ($redis, $result)
{
if ($result)
{
$this->join($redis);
}
else
{
$this->failure();
trigger_error("connect to redis server[{$this->config['host']}:{$this->config['port']}] failed. Error: {$redis->errMsg}[{$redis->errCode}].");
}
});
}
function __call($call, $params)
{
return $this->request(function (\swoole_redis $redis) use ($call, $params)
{
call_user_func_array(array($redis, $call), $params);
//
$this->release($redis);
});
}
} ?>
Did this file decode correctly?
Original Code
<?php
namespace Swoole\Async;
use Swoole;
class Redis extends Pool
{
const DEFAULT_PORT = 6379;
function __construct($config = array(), $poolSize = 100)
{
if (empty($config['host']))
{
throw new Swoole\Exception\InvalidParam("require redis host option.");
}
if (empty($config['port']))
{
$config = self::DEFAULT_PORT;
}
parent::__construct($config, $poolSize);
$this->create(array($this, 'connect'));
}
protected function connect()
{
$redis = new \swoole_redis();
$redis->on('close', function ($redis)
{
$this->remove($redis);
});
return $redis->connect($this->config['host'], $this->config['port'], function ($redis, $result)
{
if ($result)
{
$this->join($redis);
}
else
{
$this->failure();
trigger_error("connect to redis server[{$this->config['host']}:{$this->config['port']}] failed. Error: {$redis->errMsg}[{$redis->errCode}].");
}
});
}
function __call($call, $params)
{
return $this->request(function (\swoole_redis $redis) use ($call, $params)
{
call_user_func_array(array($redis, $call), $params);
//
$this->release($redis);
});
}
}
Function Calls
None |
Stats
MD5 | e853b39ac143cb6f730c22eef2ea7858 |
Eval Count | 0 |
Decode Time | 83 ms |