__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @author Slavko Babic
* @date 2017-08-21
*/
namespace AmeliaBooking\Infrastructure;
use mysqli;
use PDO;
/**
* Class Connection
*
* @package Infrastructure
*/
abstract class Connection
{
/** @var string $username */
protected $username;
/** @var string $password */
protected $password;
/** @var string $charset */
protected $charset;
/** @var PDO|mysqli $handler */
protected $handler;
/** @var int port */
protected $port;
/** @var string $host */
protected $host;
/** @var string $name */
protected $database;
/** @var string $socket */
protected $socket;
/** @var string $socketPath */
protected $socketPath;
/**
* Connection constructor.
*
* @param string $database
* @param string $username
* @param string $password
* @param string $host
* @param int $port
* @param string $charset
*/
public function __construct(
$host,
$database,
$username,
$password,
$charset = 'utf8',
$port = 3306
) {
$this->database = (string)$database;
$this->username = (string)$username;
$this->password = (string)$password;
$this->host = $this->socket = (string)$host;
$this->port = (int)$port;
$this->charset = (string)$charset;
}
/**
* @return PDO|mysqli
*/
public function __invoke()
{
return $this->handler;
}
/**
*
*/
protected function socketHandler()
{
if (strpos($this->socket, ':') === false) {
$this->host = $this->socket;
return;
}
$data = explode(':', $this->socket);
$this->host = $data[0];
if (isset($data[1]) && is_numeric($data[1]) && (int)$data[1]) {
$this->port = $data[1];
} elseif (isset($data[1]) && strpos($data[1], '/') !== false) {
$position = strpos($data[1], '/');
if ($position === 0) {
$this->socketPath = $data[1];
} else {
$this->port = substr($data[1], 0, $position);
$this->socketPath = substr($data[1], $position);
}
} elseif (isset($data[1]) && (int)$data[1]) {
$this->port = $data[1];
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Common | Folder | 0750 |
|
|
| ContainerConfig | Folder | 0750 |
|
|
| DB | Folder | 0750 |
|
|
| Licence | Folder | 0750 |
|
|
| Repository | Folder | 0750 |
|
|
| Routes | Folder | 0750 |
|
|
| Services | Folder | 0750 |
|
|
| WP | Folder | 0750 |
|
|
| Connection.php | File | 2.31 KB | 0640 |
|