1- ## The Configuration Instance
1+ # The Config Instance
22
33The configuration instance, ` Config ` , is the core of this library. Upon instantiation of, either a model or ` Scripting ` ,
44an instance of ` Config ` gets created.
@@ -7,7 +7,7 @@ an instance of `Config` gets created.
77Due to the usage of this pattern you typically would not ` new ` the ` Config ` object directly. However, if you feel
88you need to access the ` Config ` directly you should do so using the ` ::instance() ` static method.
99
10- ### Defaults
10+ ## Defaults
1111
1212The only default that is currently expected to be used is the default ` Connection ` . This is set to the local machine
1313that ` PHP ` is running on.
@@ -75,10 +75,11 @@ allows you to make global changes.
7575$config = Config::instance();
7676```
7777
78- ### Config Methods
78+ ## Config Methods
7979
8080While not all of the ` Config ` methods are outlined here below are the ones that may be most useful to you.
8181
82+ ### instance
8283#### ` Config::instance(array $items = [], Resolver $resolver = null) `
8384
8485If called without any arguments this will either return the currently instantiated instance or return a new instance
@@ -89,6 +90,7 @@ If called with the `$items` array set this will merge the given configuration in
8990If called with ` $resolver ` set then it will replace the current ` Resolver ` instance with the one given. You shouldn't
9091need to override this, but it could be useful when testing.
9192
93+ ### newInstance
9294#### ` Config::newInstance(array $items = [], Resolver $resolver = null) `
9395
9496Operates the same as above with the exception that this will always return a brand new instance. This is also useful
@@ -107,26 +109,32 @@ class FeatureTest extends TestCase
107109}
108110```
109111
112+ ### getConnection
110113#### ` $config->getConnection(string $name = null) `
111114
112115Returns a connection from the ` Config ` container by name. If ` $name ` is not provided or set to ` 'default' ` then it will
113116return the default connection.
114117
115118If a connection is not found it will simply return ` null ` .
116119
120+ ### addConnection
117121#### ` $config->addConnection(string $name, Connection $connection) `
118122
119123Add a connection to the ` Config ` instance.
120124
125+ ### setDefaultConnection
121126#### ` $config->setDefaultConnection(string $name) `
122127
123128This will set the default connection by its name. If the connection name does not exist then it will throw an
124129` InvalidConnectionException ` .
125130
126- #### ` $config->getDefaultConnection() `
127-
128- Returns the currently set default connection.
129131
132+ ### getDefaultConnectionName
130133#### ` $config->getDefaultConnectionName() `
131134
132135Returns the currently set default connection name.
136+
137+ ### getDefaultConnection
138+ #### ` $config->getDefaultConnection() `
139+
140+ Returns the currently set default connection.
0 commit comments