-
Notifications
You must be signed in to change notification settings - Fork 159
Extension class
Kirill Nesmeyanov edited this page Apr 30, 2015
·
6 revisions
package org.jphp.mysuperext;
import php.runtime.env.CompileScope;
import php.runtime.ext.support.Extension;
public class MyExtension extends Extension {
/**
* Extension name
* @since 0.3
*/
@Override
public String getName() {
return "MyExtension";
}
/**
* Extension version
* @since 0.3
*/
@Override
public String getVersion() {
return "1.0";
}
/**
* Return extension status
*
* enum Status {
* EXPERIMENTAL,
* BETA,
* STABLE,
* LEGACY,
* ZEND_LEGACY,
* DEPRECATED
* }
*
* @since 0.6
*/
@Override
public Status getStatus() {
return Status.EXPERIMENTAL;
}
/**
* Register extension classes
*/
@Override
public void onRegister(CompileScope scope) {
/**
* Register:
* class php.runtime.lang.BaseObject
* or
* interface php.runtime.lang.IObject
*/
this.registerClass(scope, SomeClass.class);
/**
* Register php.runtime.lang.BaseWrapper class
*/
this.registerWrapperClass(scope, OriginalJavaClass.class, YourWrapperClass.class);
/**
*
*/
this.registerMemoryOperation(MyMemoryOperation.class);
/**
*
*/
this.registerJavaException(scope, OriginalJavaExceptionClass.class, YourExceptionWrapper.class);
/**
* Register a global defines
* container is instance of php.runtime.ext.support.compile.ConstantsContainer
*/
this.registerConstants(container);
/**
* Register a global functions
* container is instance of php.runtime.ext.support.compile.FunctionsContainer
*/
this.registerFunctions(container);
}
}
JPHP Group 2015