mirror of https://github.com/hauke68/Magallanes
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
762 B
28 lines
762 B
<?php |
|
class Mage_Task_Factory |
|
{ |
|
/** |
|
* |
|
* |
|
* @param string $taskName |
|
* @return Mage_Task_TaskAbstract |
|
*/ |
|
public static function get($taskName, $taskConfig) |
|
{ |
|
$instance = null; |
|
|
|
if (strpos($taskName, '/') === false) { |
|
Mage_Autoload::loadUserTask($taskName); |
|
$className = 'Task_' . ucfirst($taskName); |
|
$instance = new $className($taskConfig); |
|
|
|
} else { |
|
$taskName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $taskName))); |
|
$className = 'Mage_Task_BuiltIn_' . $taskName; |
|
$instance = new $className($taskConfig); |
|
} |
|
|
|
assert($instance instanceOf Mage_Task_TaskAbstract); |
|
return $instance; |
|
} |
|
} |