Skip to content

Provide method name to TaskInterface - #20

Open
m-hume wants to merge 1 commit into
anorgan:masterfrom
m-hume:patch-2
Open

Provide method name to TaskInterface#20
m-hume wants to merge 1 commit into
anorgan:masterfrom
m-hume:patch-2

Conversation

@m-hume

@m-hume m-hume commented Feb 16, 2017

Copy link
Copy Markdown
Contributor

allows for the task object to take the form

class myTask implements TaskInterface {
    protected $_data;
    public function run($methodName='')
    {
        if(method_exists($this, $methodName)){
            return call_user_func_array(array($this, $methodName), $this->_data);
        }
        return false;
    }

    public function setData(array $data)
    {
        $this->_data = $data;
    }

    protected function myMethodThatReceivesTheDataSetAsParameters($param1, $param2)
    {
        echo "$param1 \n";
        echo "$param2 \n";
    }
}

allows for the task object to take the form
```
class myTask implements TaskInterface {
    protected $_data;
    public function run($methodName='')
    {
        if(method_exists($this, $methodName)){
            return call_user_func_array(array($this, $methodName), $this->_data);
        }
        return false;
    }

    public function setData(array $data)
    {
        $this->_data = $data;
    }

    protected function myMethodThatReceivesTheDataSetAsParameters($param1, $param2)
    {
        echo "$param1 \n";
        echo "$param2 \n";
    }
}
```
@coveralls

coveralls commented Feb 16, 2017

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 56.604% when pulling 0ef9851 on m-hume:patch-2 into 144777b on anorgan:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants