public function AuthcacheP13nTestStubObserver::boundMethodName in Authenticated User Page Caching (Authcache) 7.2
Compute the name for a bound method.
2 calls to AuthcacheP13nTestStubObserver::boundMethodName()
- AuthcacheP13nTestStubObserver::method in modules/
authcache_p13n/ tests/ authcache_p13n.stub.inc - Setup invocation verifier and return-value for a method.
- AuthcacheP13nTestStubObserver::record in modules/
authcache_p13n/ tests/ authcache_p13n.stub.inc - Record one method invocation.
File
- modules/
authcache_p13n/ tests/ authcache_p13n.stub.inc, line 67 - Stub classes for testing.
Class
- AuthcacheP13nTestStubObserver
- Simple invocation recorder class.
Code
public function boundMethodName($object, $method) {
$id = spl_object_hash($object);
if (isset($this->objects[$id])) {
$instance_name = $this->objects[$id]['name'];
}
else {
$class_name = get_class($object);
if (!isset($this->classes[$class_name])) {
$this->classes[$class_name] = 0;
}
$instance_counter = $this->classes[$class_name]++;
$instance_name = $class_name . '_' . $instance_counter;
$this->objects[$id] = array(
'instance' => $object,
'name' => $instance_name,
);
}
return $instance_name . '::' . $method;
}