Description
Attempt to create a reflection function / reflection method for this APIWhen using opcache with comment stripping we have to use oikai_load_and_reflect(). When using shared libraries we may also need to use oikai_load_and_reflect(). Otherwise processing depends on whether or not the function or method is already defined
| classname | class_exists | function or method exists | Reflect using? |
|---|---|---|---|
| null | n/a | yes | oikai_reflect() |
| null | n/a | no | oikai_load_and_reflect() |
| set | no | n/a | oikai_load_and_reflect() |
| set | yes | no | oikai_load_and_reflect() |
| set | yes | yes | oikai_reflect_method() |
Usage
$object = oikai_pseudo_reflect( $funcname, $sourcefile, $plugin, $classname );Parameters
- $funcname
- ( string ) required – the API name
- $sourcefile
- ( string ) required – the full file name for this API
- $plugin
- ( string ) required – the plugin/theme name
- $classname
- ( string ) optional – the classname if not part of $funcname
Returns
object a refFunc objectSource
File name: oik-shortcodes/shortcodes/oik-api-importer.phpLines:
1 to 33 of 33
function oikai_pseudo_reflect( $funcname, $sourcefile, $plugin, $classname=null ) { bw_trace2( null, null, true, BW_TRACE_DEBUG ); $refFunc = null; $using_opcache = oikai_using_opcache(); if ( !$using_opcache ) { $using_oik_libs = oikai_using_libs(); } if ( $using_opcache || $using_oik_libs ) { $refFunc = oikai_load_and_reflect( $funcname, $sourcefile, $plugin, $classname ); } else { if ( $classname ) { if ( class_exists( $classname ) ) { if ( method_exists( $classname, $funcname ) ) { $refFunc = oikai_reflect_method( $classname, $funcname ); } else { $refFunc = oikai_load_and_reflect( $funcname, $sourcefile, $plugin, $classname ); } } else { $refFunc = oikai_load_and_reflect( $funcname, $sourcefile, $plugin, $classname ); } } else { if ( function_exists( $funcname ) ) { $refFunc = oikai_reflect( $funcname ); //bw_trace2( $refFunc, "refFunc", true, BW_TRACE_VERBOSE ); } else { $refFunc = oikai_load_and_reflect( $funcname, $sourcefile, $plugin, $classname ); //bw_trace2( $refFunc, "refFunc", true, BW_TRACE_VERBOSE ); } } } bw_trace2( $refFunc, "refFunc", true, BW_TRACE_VERBOSE ); return( $refFunc ); }View on GitHub
Invoked by
Calls
1 to 6 of 6
- bw_trace2() – Trace $value to the trace log file if tracing is active
- oikai_load_and_reflect() – Create a dummy reflection object for the API
- oikai_reflect() – Return the ReflectionFunction for a function
- oikai_reflect_method() – Return the ReflectionFunction for a method
- oikai_using_libs() – Determine if we’re using oik-lib
- oikai_using_opcache() – Check to see if opcache is being used
