| 1 | <?php |
||
| 14 | class DataBaseConnection extends PDO |
||
| 15 | { |
||
| 16 | public $servername; |
||
| 17 | public $username; |
||
| 18 | public $password; |
||
| 19 | public $driver; |
||
| 20 | public $dbname; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * This is a constructor; a default method that will be called automatically during class instantiation. |
||
| 24 | */ |
||
| 25 | 57 | public function __construct($path = null) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * This method determines the driver to be used for appropriate database server. |
||
| 45 | * |
||
| 46 | * |
||
| 47 | * @return string dsn |
||
| 48 | */ |
||
| 49 | 3 | public function getDataBaseDriver() |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Load Dotenv to grant getenv() access to environment variables in .env file. |
||
| 58 | */ |
||
| 59 | 57 | public function loadEnv($path = null) |
|
| 65 | } |
||
| 66 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.