<?php
class SendTask{

    private $registry;
    private $tasks;


    public function __construct($registry){
        $this->registry = $registry;
        $this->load     = $registry->get('load');
        $this->language = $registry->get('language');
        $this->config   = $registry->get('config');
    }

    public function __get($name) {
      return $this->registry->get($name);
    }

    protected function getInstance($typetask){
        $className = Type_SendTask::getNickFromValue($typetask);
        $this->tasks[$typetask] = new $className($this->registry);
    }

    public function sendTask($typetask, $data_value, $attribute_value){
        try {
            $this->getInstance($typetask);
            return $this->tasks[$typetask]->sendTask($typetask, $data_value, $attribute_value);
        } catch(Exception $e){
            throw $e;
        }
    }


}