Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F10843474
BrokerFactory.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
BrokerFactory.php
View Options
<?php
namespace
Keruald\Broker
;
class
BrokerFactory
{
/**
* Gets the map drivers <--> class
*
* @return array
*/
public
static
function
getDrivers
()
{
return
require
'drivers.php'
;
}
/**
* Makes a new broker instance
*
* @param array $params The parameters
* @return Keruald\Broker\Broker
*
* @throws InvalidArgumentException when $params doesn't contain a valid
* driver entry
*/
public
static
function
make
(
$params
)
{
if
(!
array_key_exists
(
'driver'
,
$params
))
{
throw
new
\InvalidArgumentException
(
"Required parameter missing: driver"
);
}
$driver
=
$params
[
'driver'
];
$drivers
=
self
::
getDrivers
();
if
(!
array_key_exists
(
$driver
,
$drivers
))
{
throw
new
\InvalidArgumentException
(
"Broker driver not found: $driver"
);
}
$class
=
'Keruald
\B
roker
\\
'
.
$drivers
[
$driver
];
return
$class
::
makeFromConfig
(
$params
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Jul 31, 12:53 (17 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2855306
Default Alt Text
BrokerFactory.php (1 KB)
Attached To
Mode
rKBROKER Keruald Broker
Attached
Detach File
Event Timeline
Log In to Comment