2014-11-14 02:47:39 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Administrator
|
|
|
|
* Date: 2014/11/10
|
|
|
|
* Time: 13:36
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Westdc\EventModel;
|
|
|
|
|
|
|
|
use Westdc\EventModel\Handles;
|
2014-11-14 10:02:49 +00:00
|
|
|
use Westdc\Service\AbstractServiceManager;
|
2014-11-14 02:47:39 +00:00
|
|
|
|
2014-11-14 10:02:49 +00:00
|
|
|
class HandleFactory extends AbstractServiceManager{
|
2014-11-14 02:47:39 +00:00
|
|
|
|
2014-11-14 10:02:49 +00:00
|
|
|
public function get($handleName)
|
2014-11-14 02:47:39 +00:00
|
|
|
{
|
2014-11-14 10:02:49 +00:00
|
|
|
$config = $this->getServiceManager()->get('Config');
|
|
|
|
|
|
|
|
$handleName = $config->get('application.ini')->HandlesNamespace . "\\" . $handleName;
|
|
|
|
|
|
|
|
if(class_exists($handleName))
|
|
|
|
{
|
|
|
|
return new $handleName();
|
|
|
|
}
|
|
|
|
|
2014-11-14 02:47:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|