Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide method name to TaskInterface #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m-hume
Copy link
Contributor

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

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
Copy link

coveralls commented Feb 16, 2017

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