Skip to content

Commit f29eef7

Browse files
turbopixelturbopixel
authored andcommitted
CHANGE: update
1 parent ecc477a commit f29eef7

File tree

3 files changed

+22
-281
lines changed

3 files changed

+22
-281
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"homepage": "http://phpdo.hemk.es/",
55
"type": "framework",
66
"license": "MIT",
7+
"version": "1.1.4",
78
"keywords": [
89
"database",
910
"lightweight",
@@ -26,7 +27,7 @@
2627
}
2728
],
2829
"require": {
29-
"php": ">=7.0",
30+
"php": ">=7.2",
3031
"ext-pdo": "*"
3132
},
3233
"suggest": {
@@ -37,4 +38,4 @@
3738
"PHPDO\\": "/lib"
3839
}
3940
}
40-
}
41+
}

docs/index.html

Lines changed: 0 additions & 277 deletions
This file was deleted.

lib/PHPDO.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ public function getPdo() : \PDO {
5757
* @param string $password Database password
5858
* @param int $port MySQL port
5959
* @param array $options PDO attributes (http://php.net/manual/de/pdo.setattribute.php)
60+
*
61+
* @throws Exception
6062
*/
6163
public function connect(string $host, string $database, string $user, string $password, int $port = 3306, array $options = []) {
64+
$this->checkPhpVersion();
6265

6366
// custom options
6467
if (!empty($options)) {
@@ -151,9 +154,9 @@ public function query(string $query) {
151154
* @param string $query MySQL Query
152155
* @param array $mapping Data mapping
153156
*
157+
* @return PDOStatement
154158
* @link http://php.net/manual/de/pdo.prepare.php
155159
*
156-
* @return PDOStatement
157160
*/
158161
public function prepare(string $query, array $mapping = []) : PDOStatement {
159162

@@ -222,12 +225,26 @@ public function isTable(string $table) : bool {
222225
*
223226
* @param string $message
224227
*/
225-
private function logError(string $message){
228+
private function logError(string $message) {
226229

227230
if (function_exists('error_log')) {
228231
error_log($message);
229232
}
230233

231234
}
232235

236+
/**
237+
* PHP version check
238+
*
239+
* @throws Exception
240+
*/
241+
private function checkPhpVersion() {
242+
243+
if (PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 2 !== true) {
244+
$this->logError('php version must be 7.2 or higher');
245+
throw new Exception('php version must be 7.2 or higher');
246+
}
247+
248+
}
249+
233250
}

0 commit comments

Comments
 (0)