public function __call($sName, $aArg) { if (startsWith($sName, '_')) { return Curry::make(array($this, '__force'), array(substr($sName, 1), $aArg)); } return call_user_func_array(array($this->__obj->{$this->__name}, $sName), $aArg); }
public function prepareIngredient() { echo "準備「馬鈴薯」、「蘿蔔」、「洋蔥」、「肉」\n"; } // 烹煮食材 public function cooking() { echo "下鍋炒肉,等肉熟之後,將「馬鈴薯」、「蘿蔔」、「洋蔥」加到鍋裡並加滿水,等水滾加入咖哩塊悶熟即可\n"; } // 上菜 public function serve() { echo "盤子放上白飯,將咖哩淋在白飯周圍即可\n"; } } $curry = new Curry(); $curry->prepareIngredient(); $curry->cooking(); $curry->serve(); /** * 三明治 */ class Sandwich extends Cook { // 準備食材 public function prepareIngredient() { echo "準備「吐司」、「生菜」、「小黃瓜」、「蛋」、「肉」\n"; } // 烹煮食材 public function cooking()
function around($mCallback, $mAround) { return Curry::makeWithFilter($mCallback, null, null, $mAround); }
function __call($name, $args) { return Curry::make($this->{$name}, $args); }
public function __call($sName, $aArg) { if (startsWith($sName, '_')) { return Curry::make(array($this, substr($sName, 1)), $aArg); } }