Factory for server stub classes.
Stub
Stub
()
Clones a class' interface and creates a stub version that can have return values set.
void
generate
(string $class, [string $stub_class = false], [array $methods = false])
-
string
$class: Class to clone.
-
string
$stub_class: New class name. Default is the old name with "Stub" prepended.
-
array
$methods: Additional methods to add beyond those in th cloned class. Use this to emulate the dynamic addition of methods in the cloned class or when the class hasn't been written yet.
The new server stub class code in string form.
void
_createClassCode
(string $class, mixed $stub_class, array $methods, string $mock_class)
-
string
$class: Class to clone.
-
string
$mock_class: New class name.
-
array
$methods: Additional methods.
Creates code within a class to generate replaced methods. All methods call the _invoke() handler with the method name and the arguments in an array.
void
_createHandlerCode
(string $class, string $base, array $methods)
-
string
$class: Class to clone.
-
string
$base: Base class with methods that cannot be cloned.
-
array
$methods: Additional methods.