1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- class sfCallable
- {
- protected
- $callable = null;
-
- public function __construct($callable)
- {
- $this->callable = $callable;
- }
-
- public function getCallable()
- {
- return $this->callable;
- }
-
- public function call()
- {
- if (!is_callable($this->callable))
- {
- throw new sfException(sprintf('"%s" is not a valid callable.', is_array($this->callable) ? sprintf('%s:%s', is_object($this->callable[0]) ? get_class($this->callable[0]) : $this->callable[0], $this->callable[1]) : (is_object($this->callable) ? sprintf('Object(%s)', get_class($this->callable)) : var_export($this->callable, true))));
- }
- $arguments = func_get_args();
- return call_user_func_array($this->callable, $arguments);
- }
- }
|