[SOLVED] Chain of command where valid return may be empty
Posted: Sun Apr 13, 2008 7:01 am
I think this would be classified as chain of command, although it's kind of like the strategy too.
That works well when you expect a return value, but what if you don't expect a return value and the chain still has to be broken?
EDIT | Sorry, having a blonde moment; I should be using a filter chain.
Code: Select all
interface Command {
public function execute($data);
}
...
public function whatever($data) {
foreach ($this->_commands as $command) {
if ($ret = $command->execute($data)) {
return $ret;
}
}
}EDIT | Sorry, having a blonde moment; I should be using a filter chain.