Beispiel #1
0
/**
 * callbackParams
 * @param mixed $mCallback
 * @return mixed
 */
function callbackParams($mCallback)
{
    if (is_string($mCallback)) {
        if (!matchesIn($mCallback, '::')) {
            // function
            return ref(new ReflectionFunction($mCallback))->getParameters();
        } else {
            // static method
            return ref(new ReflectionMethod($mCallback))->getParameters();
        }
    } else {
        if (is_array($mCallback)) {
            $mFunc = $mCallback[0];
            if (is_string($mFunc)) {
                // function or static method
                return callbackParams($mFunc);
            } else {
                if (is_object($mFunc)) {
                    if ($mFunc instanceof Curry) {
                        // curry object
                        return $mFunc->getParams();
                    } else {
                        // instance method
                        return ref(new ReflectionMethod(get_class($mFunc), $mCallback[1]))->getParameters();
                    }
                }
            }
        }
    }
    return false;
}
Beispiel #2
0
 public function getParams()
 {
     return array_slice(callbackParams($this->callback), count($this->bind));
 }