|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* AppserverIo\Server\Configuration\Extension\AbstractInjector |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Bernhard Wick <[email protected]> |
|
15
|
|
|
* @copyright 2015 TechDivision GmbH - <[email protected]> |
|
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
17
|
|
|
* @link https://www.github.com/appserver-io/server |
|
18
|
|
|
* @link http://www.appserver.io |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppserverIo\Server\Configuration\Extension; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* This class allows to inject a configuration based in a database |
|
25
|
|
|
* |
|
26
|
|
|
* @author Bernhard Wick <[email protected]> |
|
27
|
|
|
* @copyright 2015 TechDivision GmbH - <[email protected]> |
|
28
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
29
|
|
|
* @link https://www.github.com/appserver-io/server |
|
30
|
|
|
* @link http://www.appserver.io |
|
31
|
|
|
*/ |
|
32
|
|
|
abstract class AbstractInjector implements InjectorInterface |
|
33
|
|
|
{ |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* The PDO database connection object |
|
37
|
|
|
* |
|
38
|
|
|
* @var \PDO $dbResource |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $pdoString; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* The PDO database connection object |
|
44
|
|
|
* |
|
45
|
|
|
* @var \PDO $dbResource |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $user; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* The PDO database connection object |
|
51
|
|
|
* |
|
52
|
|
|
* @var \PDO $dbResource |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $password; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Default constructor |
|
58
|
|
|
* |
|
59
|
|
|
* @param string $pdoString The PDO connection string |
|
60
|
|
|
* @param string $user The user used to connect to the DB |
|
61
|
|
|
* @param string $password The needed password |
|
62
|
|
|
*/ |
|
63
|
|
|
public function __construct($pdoString, $user = '', $password = '') |
|
64
|
|
|
{ |
|
65
|
|
|
$this->pdoString = $pdoString; |
|
|
|
|
|
|
66
|
|
|
$this->user = $user; |
|
|
|
|
|
|
67
|
|
|
$this->password = $password; |
|
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Getter for the database resource |
|
72
|
|
|
* |
|
73
|
|
|
* @return \PDO |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getDbResource() |
|
76
|
|
|
{ |
|
77
|
|
|
return new \PDO($this->pdoString, $this->user, $this->password); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..