本文整理汇总了PHP中lang\XPClass::getMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP XPClass::getMethod方法的具体用法?PHP XPClass::getMethod怎么用?PHP XPClass::getMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lang\XPClass
的用法示例。
在下文中一共展示了XPClass::getMethod方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: permutationOf
/**
* Add a measurable class
*
* @param lang.XPClass $class
* @param lang.reflect.Method $method
* @param var $source
* @return util.data.Sequence
*/
private function permutationOf($class, $method, $source)
{
if (is_array($source)) {
$seq = Sequence::of($source);
} else {
$seq = Sequence::of($class->getMethod($source)->setAccessible(true)->invoke(null));
}
return $seq->map(function ($args) use($class, $method) {
return $class->newInstance($method, (array) $args);
});
}
示例2: afterTestClass
/**
* Shuts down server
*
* @param lang.XPClass $c
* @return void
*/
public function afterTestClass(\lang\XPClass $c)
{
// Tell the server to shut down
try {
$c->getMethod($this->shutdown)->invoke(null, []);
} catch (\lang\Throwable $ignored) {
// Fall through, below should terminate the process anyway
}
$status = $this->serverProcess->out->readLine();
if (!strlen($status) || '+' != $status[0]) {
while ($l = $this->serverProcess->out->readLine()) {
$status .= $l;
}
while ($l = $this->serverProcess->err->readLine()) {
$status .= $l;
}
$this->serverProcess->close();
throw new IllegalStateException($status);
}
$this->serverProcess->close();
}
示例3: invokeStatic
/**
* Entry point: Invoke staticTarget method
*
* @param lang.XPClass
* @return string
*/
public static function invokeStatic(\lang\XPClass $class)
{
return $class->getMethod('staticTarget')->invoke(null);
}
示例4: valuesFor
/**
* Returns values
*
* @param unittest.TestCase test
* @param var annotation
* @return var values a traversable structure
*/
protected function valuesFor($test, $annotation)
{
if (!is_array($annotation)) {
// values("source")
$source = $annotation;
$args = [];
} else {
if (isset($annotation['source'])) {
// values(source= "src" [, args= ...])
$source = $annotation['source'];
$args = isset($annotation['args']) ? $annotation['args'] : [];
} else {
// values([1, 2, 3])
return $annotation;
}
}
// Route "ClassName::methodName" -> static method of the given class,
// "self::method" -> static method of the test class, and "method"
// -> the run test's instance method
if (false === ($p = strpos($source, '::'))) {
return $test->getClass()->getMethod($source)->setAccessible(true)->invoke($test, $args);
}
$ref = substr($source, 0, $p);
if ('self' === $ref) {
$class = $test->getClass();
} else {
if (strstr($ref, '.')) {
$class = XPClass::forName($ref);
} else {
$class = new XPClass($ref);
}
}
return $class->getMethod(substr($source, $p + 2))->invoke(null, $args);
}