本文整理汇总了PHP中Connection::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::__construct方法的具体用法?PHP Connection::__construct怎么用?PHP Connection::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $origin
* @param string $destination
* @param int $duration
* @param string $mode
* @param int $startTime
* @param int $endTime
*/
public function __construct($origin, $destination, $duration, $mode = parent::WALK, $startTime = 0, $endTime = PHP_INT_MAX)
{
parent::__construct($origin, $destination, $mode);
$this->duration = $duration;
$this->startTime = $startTime;
$this->endTime = $endTime;
}
示例2: __construct
/**
* Constructor.
* @param QueueInterface $queue
* @param bool|true $autoconnect
*/
public function __construct(QueueInterface &$queue, $autoconnect = true)
{
parent::__construct($queue);
if ($autoconnect === true) {
$this->queue->attachEventHandler('onBeforeProcess', [$this, 'open']);
$this->queue->attachEventHandler('onAfterProcess', [$this, 'close']);
}
}
示例3: __construct
/**
* @param string $origin
* @param string $destination
* @param int $departureTime
* @param int $arrivalTime
* @param string $service
* @param string $operator
* @param string $mode
*/
public function __construct($origin, $destination, $departureTime, $arrivalTime, $service, $operator, $mode = parent::TRAIN)
{
parent::__construct($origin, $destination, $mode);
$this->departureTime = $departureTime;
$this->arrivalTime = $arrivalTime;
$this->service = $service;
$this->operator = $operator;
}
示例4:
function __construct($concentrator, $name, $socket, $connected, $address = NULL, $port = NULL)
{
parent::__construct($concentrator, $name, $socket, $connected, $address = NULL, $port = NULL);
$this->state = 'waiting_for_handshake';
$this->mysql_connection = $this->concentrator->mysql_connection;
if ($this->mysql_connection->handshake_init_packet != NULL) {
$this->queue_write_packet($this->mysql_connection->handshake_init_packet);
} else {
$this->mysql_connection->queue($this);
}
$this->savepoint_name = "mysql_conc_{$this->port}";
}
示例5: __construct
public function __construct($options = array())
{
$this->commands = ['MSG' => $this->MSG, '+OK' => $this->OK, '-ERR' => $this->ERR, 'PING' => $this->PING, 'PONG' => $this->PONG, 'INFO' => $this->INFO];
$default_config = (require 'Config.php');
$this->PING_REQUEST = 'PING' . $this->cr_lf;
$this->PONG_RESPONSE = 'PONG' . $this->cr_lf;
$this->pState = $this->AWAITING_CONTROL;
$this->parseOptions($options, $default_config);
// Create connection
parent::__construct($this->options['url'], $this->options['port']);
$this->sendCommand($this->buildConnectCommand());
$this->flushPending();
if ($this->reconnecting) {
$this->sendSubscription();
}
$this->flush();
}
示例6: __construct
public function __construct(&$socket, $handlerID)
{
parent::__construct($socket, $handlerID);
}
示例7: __construct
/**
* class constructor
*
* @param string $dsn CouchDB server data source name (eg. http://localhost:5984)
* @param string $dbname CouchDB database name
* @param array $options Additionnal configuration options
* @throws Exception
*/
public function __construct($dsn, $dbname, $options = array())
{
// in the case of a cookie based authentification we have to remove user and password infos from the DSN
if (array_key_exists("cookie_auth", $options) && $options["cookie_auth"] == "true") {
$parts = parse_url($dsn);
if (!array_key_exists("user", $parts) || !array_key_exists("pass", $parts)) {
throw new Exception("You should provide a user and a password to use cookie based authentification");
}
$user = $parts["user"];
$pass = $parts["pass"];
$dsn = $parts["scheme"] . "://" . $parts["host"];
$dsn .= array_key_exists("port", $parts) ? ":" . $parts["port"] : "";
$dsn .= array_key_exists("path", $parts) ? $parts["path"] : "";
}
$this->useDatabase($dbname);
parent::__construct($dsn, $options);
if (array_key_exists("cookie_auth", $options) && $options["cookie_auth"] == "true") {
$raw_data = $this->query("POST", "/_session", null, http_build_query(array("name" => $user, "password" => $pass)), "application/x-www-form-urlencoded");
list($headers, $body) = explode("\r\n\r\n", $raw_data, 2);
$headers_array = explode("\n", $headers);
foreach ($headers_array as $line) {
if (strpos($line, "Set-Cookie: ") === 0) {
$line = substr($line, 12);
$line = explode("; ", $line, 2);
$this->setSessionCookie(reset($line));
break;
}
}
if (!$this->sessioncookie) {
throw new Exception("Cookie authentification failed");
}
}
}
示例8: __construct
public function __construct(\PDO $pdo = null)
{
parent::__construct($pdo);
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->trigger = $this->_drvlib('Trigger');
}
示例10:
function __construct($merchantObj)
{
// call parent ctor to init members
parent::__construct($merchantObj);
}
示例11: __construct
public function __construct()
{
parent::__construct();
$this->user = $this->_drvlib('User');
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->forge = $this->_drvlib('Forge');
}
示例13: __construct
public function __construct()
{
parent::__construct('http://example.com', 'guest', 'guest');
}
示例14: __construct
/**
* Constructor
*
* @param string $host FTP Server adress
* @param integer $port Port to connect to
* @param integer $timeout Default timeout
*/
public function __construct($host, $port = 21, $timeout = 90)
{
parent::__construct($host, 'anonymous', 'guest', $port, $timeout);
}
示例15: __construct
/**
* Constructor
*
* @param string $address The address to listen on
* @param int $port The port to listen on
*/
public function __construct($address, $port)
{
parent::__construct();
$this->address = $address;
$this->port = $port;
}