FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DesignPatternsPHP/DependencyInjection/Connection.php at master · monkeymonk/DesignPatternsPHP · GitHub
monkeymonk
/
DesignPatternsPHP
Public
forked from
DesignPatternsPHP/DesignPatternsPHP
Notifications
You must be signed in to change notification settings
Fork
2
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
DesignPatternsPHP
/
DependencyInjection
/
Connection.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (31 loc) · 756 Bytes
Breadcrumbs
DesignPatternsPHP
/
DependencyInjection
/
Connection.php
Copy path
File metadata and controls
35 lines (31 loc) · 756 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace
DesignPatterns
\
DependencyInjection
;
/**
* Class Connection
*/
class
Connection
{
/**
* @var Configuration
*/
protected
$
configuration
;
/**
* here, Configuration gets injected and Connection will get all that it needs from Configuration
* without DI, the configuration would be created directly in Connection, which is not very good
* for testing and extending Connection
*
* @param Configuration $config
*/
public
function
__construct
(
Configuration
$
config
)
{
$
this
->
configuration
=
$
config
;
}
/**
* connection using the injected config
*/
public
function
connect
()
{
$
host
=
$
this
->
configuration
->
getHost
();
// ...
}
}
Back
|
FazBrowse Home
|
New Git URL