First I want to say Thanks for the help.
Here’s the ConnectPDO class:
<?php
namespace website_project\database;
use PDO;
class ConnectPDO {
private $pdo_options = [
/* important! use actual prepared statements (default: emulate prepared statements) */
PDO::ATTR_EMULATE_PREPARES => false
/* throw exceptions on errors (default: stay silent) */
, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
/* fetch associative arrays (default: mixed arrays) */
, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
];
public $connection = \NULL;
public function __construct() {
$this->connection = new PDO('mysql:host=' . \DATABASE_HOST . ';dbname=' . \DATABASE_NAME . ';charset=utf8', \DATABASE_USERNAME, \DATABASE_PASSWORD, $this->pdo_options);
}
public function getDatabase() {
return $this->connection;
}
}
would throwing the following into ConnectPDO prevent duplication?
// Empty clone magic method to prevent duplication:
private function __clone() {
}