DataSift\Storyplayer\ProvisioningLib::getProvisioner PHP Method

getProvisioner() public static method

public static getProvisioner ( StoryTeller $st, $type )
$st DataSift\Storyplayer\PlayerLib\StoryTeller
    public static function getProvisioner($st, $type)
    {
        // what are we looking for?
        $className = 'DataSift\\Storyplayer\\ProvisioningLib\\Provisioners\\' . ucfirst($type) . 'Provisioner';
        // does it exist?
        if (!class_exists($className)) {
            throw new E5xx_ActionFailed(__METHOD__, "cannot find class '{$className}' to use for provisioning via '{$type}'");
        }
        // create the adapter
        $adapter = new $className($st);
        // all done
        return $adapter;
    }

Usage Example

 public function __construct(StoryTeller $st, $args)
 {
     // call our parent
     parent::__construct($st, $args);
     // $args[0] should contain the name of a valid provisioning helper
     if (!isset($args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "Param #0 must be the name of the provisioning engine you want to use");
     }
     // remember the provisioner for later
     $this->adapter = ProvisioningLib::getProvisioner($st, $args[0]);
 }
All Usage Examples Of DataSift\Storyplayer\ProvisioningLib::getProvisioner
ProvisioningLib