Documentation
¶
Overview ¶
Package phpv contains all required types and interfaces for storing Goro values, context or compiled PHP code.
Index ¶
- Constants
- Variables
- func DebugDump(v Runnable) string
- func ExitError(retcode ZInt) error
- func FilterError(err error) error
- type Callable
- type Compilable
- type CompileDelayed
- type Context
- type FuncArg
- type FuncContext
- type FuncGetArgs
- type FuncUse
- type GlobalContext
- type Loc
- type ObjectCallable
- type PhpError
- type PhpErrorType
- type PhpExit
- type RunNull
- type Runnable
- type Runnables
- type TypeHint
- type Val
- type Writable
- type ZArray
- func (a *ZArray) AsVal(ctx Context, t ZType) (Val, error)
- func (a *ZArray) Count(ctx Context) ZInt
- func (a *ZArray) Dup() *ZArray
- func (a *ZArray) GetType() ZType
- func (a *ZArray) HasStringKeys() bool
- func (a *ZArray) HashTable() *ZHashTable
- func (a *ZArray) MergeArray(b *ZArray) error
- func (a *ZArray) MergeTable(h *ZHashTable) error
- func (a *ZArray) NewIterator() ZIterator
- func (a *ZArray) OffsetExists(ctx Context, key Val) (bool, error)
- func (a *ZArray) OffsetGet(ctx Context, key Val) (*ZVal, error)
- func (a *ZArray) OffsetSet(ctx Context, key Val, value *ZVal) error
- func (a *ZArray) OffsetUnset(ctx Context, key Val) error
- func (a *ZArray) String() string
- func (a *ZArray) Value() Val
- func (a *ZArray) ZVal() *ZVal
- type ZArrayAccess
- type ZBool
- type ZClass
- type ZClassAttr
- type ZClassHandlers
- type ZClassMethod
- type ZClassProp
- type ZClassType
- type ZClosure
- type ZCountable
- type ZFloat
- type ZHashTable
- func (z *ZHashTable) Append(v *ZVal) error
- func (z *ZHashTable) Array() *ZArray
- func (z *ZHashTable) Count() ZInt
- func (z *ZHashTable) Dup() *ZHashTable
- func (z *ZHashTable) GetInt(k ZInt) *ZVal
- func (z *ZHashTable) GetString(k ZString) *ZVal
- func (z *ZHashTable) GetStringB(k ZString) (*ZVal, bool)
- func (z *ZHashTable) HasInt(k ZInt) bool
- func (z *ZHashTable) HasString(k ZString) bool
- func (z ZHashTable) HasStringKeys() bool
- func (z *ZHashTable) MergeTable(b *ZHashTable) error
- func (z *ZHashTable) NewIterator() ZIterator
- func (z *ZHashTable) SetInt(k ZInt, v *ZVal) error
- func (z *ZHashTable) SetString(k ZString, v *ZVal) error
- func (z *ZHashTable) UnsetInt(k ZInt) error
- func (z *ZHashTable) UnsetString(k ZString) error
- type ZInt
- type ZIterable
- type ZIterator
- type ZNull
- type ZObject
- type ZObjectAccess
- type ZObjectAttr
- type ZString
- func (z ZString) AsNumeric() (Val, error)
- func (z ZString) AsVal(ctx Context, t ZType) (Val, error)
- func (z ZString) GetType() ZType
- func (s ZString) IsNumeric() bool
- func (s ZString) LooksInt() bool
- func (v ZString) String() string
- func (s ZString) ToLower() ZString
- func (v ZString) Value() Val
- func (z ZString) ZVal() *ZVal
- type ZType
- type ZVal
- func (z *ZVal) Array() ZArrayAccess
- func (z *ZVal) As(ctx Context, t ZType) (*ZVal, error)
- func (z *ZVal) AsBool(ctx Context) ZBool
- func (z *ZVal) AsFloat(ctx Context) ZFloat
- func (z *ZVal) AsInt(ctx Context) ZInt
- func (z *ZVal) AsNumeric(ctx Context) (*ZVal, error)
- func (z *ZVal) AsString(ctx Context) ZString
- func (z *ZVal) AsVal(ctx Context, t ZType) (Val, error)
- func (z *ZVal) CastTo(ctx Context, t ZType) error
- func (z *ZVal) Dup() *ZVal
- func (z *ZVal) GetType() ZType
- func (z *ZVal) HashTable() *ZHashTable
- func (z *ZVal) IsNull() bool
- func (z *ZVal) IsRef() bool
- func (z *ZVal) NewIterator() ZIterator
- func (z *ZVal) Nude() *ZVal
- func (z *ZVal) Ref() *ZVal
- func (z *ZVal) Set(nz *ZVal)
- func (z *ZVal) String() string
- func (z *ZVal) Value() Val
- func (z *ZVal) ZVal() *ZVal
Constants ¶
View Source
const ( // would use 1 << iota but those values come from php, so making them constants is more appropriate ZClassStatic ZClassAttr = 0x001 ZClassAbstract = 0x002 ZClassImplAbstract = 0x008 // an abstract method which has been implemented ZClassImplicitAbstract = 0x010 // for classes ZClassExplicitAbstract = 0x020 // for classes ZClassFinal = 0x040 // class attribute (not method) ZClassTrait = 0x80 ZClassAnon = 0x100 ZClassAnonBound = 0x200 ZClassInherited = 0x400 ZClassTypeImplicitAbstract ZClassType = 0x10 ZClassTypeExplicitAbstract = 0x20 ZClassTypeInterface = 0x40 ZClassTypeTrait = 0x80 ZClassTypeAnon = 0x100 ZAttrStatic ZObjectAttr = ZObjectAttr(ZClassStatic) ZAttrAbstract = ZObjectAttr(ZClassAbstract) ZAttrFinal = 0x004 // final method, not the same value as ZClassFinal ZAttrPublic = 0x100 ZAttrProtected = 0x200 ZAttrPrivate = 0x400 ZAttrAccess = ZAttrPublic | ZAttrProtected | ZAttrPrivate ZAttrImplicitPublic = 0x1000 // method without flag ZAttrCtor = 0x2000 ZAttrDtor = 0x4000 ZAttrUserArgInfo = 0x80 // method flag used by Closure::__invoke() ZAttrAllowStatic = 0x10000 // method flag (bc only), any method that has this flag can be used statically and non statically. ZAttrShadow = 0x20000 // shadow of parent's private method/property ZAttrDeprecated = 0x40000 // deprecation flag ZAttrClosure = 0x100000 ZAttrFakeClosure = 0x40 ZAttrGenerator = 0x800000 ZAttrViaTrampoline = 0x200000 // call through user function trampoline. e.g. __call, __callstatic ZAttrViaHandler = ZAttrViaTrampoline // call through internal function handler. e.g. Closure::invoke() ZAttrVariadic = 0x1000000 ZAttrReturnRef = 0x4000000 ZAttrUseGuard = 0x1000000 // class has magic methods __get/__set/__unset/__isset that use guards ZAttrHasTypeHints = 0x10000000 // function has typed arguments ZAttrHasReturnType = 0x40000000 // Function has a return type (or class has such non-private function) )
Variables ¶
View Source
var ZNULL = ZNull{}
global NULL for easy call
Functions ¶
func FilterError ¶
Types ¶
type Compilable ¶
type CompileDelayed ¶
type CompileDelayed struct {
V Runnable
}
func (*CompileDelayed) GetType ¶
func (c *CompileDelayed) GetType() ZType
func (*CompileDelayed) String ¶
func (c *CompileDelayed) String() string
func (*CompileDelayed) Value ¶
func (c *CompileDelayed) Value() Val
func (*CompileDelayed) ZVal ¶
func (c *CompileDelayed) ZVal() *ZVal
type Context ¶
type Context interface { context.Context ZArrayAccess ZCountable ZIterable io.Writer Global() GlobalContext Func() FuncContext Parent(n int) Context This() ZObject Loc() *Loc Tick(ctx Context, l *Loc) error MemAlloc(ctx Context, s uint64) error GetConfig(name ZString, def *ZVal) *ZVal Call(ctx Context, f Callable, args []Runnable, this ZObject) (*ZVal, error) CallZVal(ctx Context, f Callable, args []*ZVal, this ZObject) (*ZVal, error) }
type FuncContext ¶
type FuncContext interface { Context }
type FuncGetArgs ¶
type FuncGetArgs interface {
GetArgs() []*FuncArg
}
type GlobalContext ¶
type GlobalContext interface { Context Flush() RegisterFunction(name ZString, f Callable) error GetFunction(ctx Context, name ZString) (Callable, error) RegisterClass(name ZString, c ZClass) error GetClass(ctx Context, name ZString, autoload bool) (ZClass, error) SetLocalConfig(name ZString, val *ZVal) error ConstantSet(k ZString, v Val) bool ConstantGet(k ZString) (Val, bool) RegisterLazyFunc(name ZString, r Runnables, p int) RegisterLazyClass(name ZString, r Runnables, p int) Open(fn ZString, isInclude bool) (*stream.Stream, error) Exists(fn ZString) (bool, error) Chdir(d ZString) error Getwd() ZString Getenv(key string) (string, bool) Setenv(key, value string) error Unsetenv(key string) error Include(ctx Context, fn ZString) (*ZVal, error) Require(ctx Context, fn ZString) (*ZVal, error) IncludeOnce(ctx Context, fn ZString) (*ZVal, error) RequireOnce(ctx Context, fn ZString) (*ZVal, error) }
type Loc ¶
type ObjectCallable ¶
type PhpError ¶
type PhpError struct { Err error Code PhpErrorType // contains filtered or unexported fields }
type PhpErrorType ¶
type PhpErrorType int
const ( E_ERROR PhpErrorType = 1 << iota E_WARNING E_PARSE E_NOTICE E_CORE_ERROR E_CORE_WARNING E_COMPILE_ERROR E_COMPILE_WARNING E_USER_ERROR E_USER_WARNING E_USER_NOTICE E_STRICT E_RECOVERABLE_ERROR E_DEPRECATED E_USER_DEPRECATED E_ALL PhpErrorType = (1 << iota) - 1 )
type TypeHint ¶
type TypeHint struct {
// contains filtered or unexported fields
}
func ParseTypeHint ¶
type Val ¶
type Val interface { GetType() ZType // GetType returns the type of the value ZVal() *ZVal // ZVal returns a ZVal pointing to this value Value() Val // Value returns the raw value, in case it was in a ZVal AsVal(ctx Context, t ZType) (Val, error) // AsVal converts the value to another type String() string // String should only be used on ZtString values }
Val is a basic value of any PHP kind: null, bool, int, float, string, array, resource or object.
type ZArray ¶
type ZArray struct {
// contains filtered or unexported fields
}
func (*ZArray) HasStringKeys ¶
func (*ZArray) HashTable ¶
func (a *ZArray) HashTable() *ZHashTable
func (*ZArray) MergeArray ¶
func (*ZArray) MergeTable ¶
func (a *ZArray) MergeTable(h *ZHashTable) error
func (*ZArray) NewIterator ¶
type ZArrayAccess ¶
type ZClass ¶
type ZClass interface { GetName() ZString InstanceOf(subc ZClass) bool BaseName() ZString GetStaticProps(ctx Context) (*ZHashTable, error) GetMethod(name ZString) (*ZClassMethod, bool) Handlers() *ZClassHandlers GetParent() ZClass }
type ZClassAttr ¶
type ZClassAttr int
func (ZClassAttr) Has ¶
func (a ZClassAttr) Has(c ZClassAttr) bool
func (ZClassAttr) String ¶
func (a ZClassAttr) String() string
type ZClassHandlers ¶
type ZClassMethod ¶
type ZClassMethod struct { Name ZString Modifiers ZObjectAttr Method Callable }
type ZClassProp ¶
type ZClassProp struct { VarName ZString Default Val Modifiers ZObjectAttr }
type ZClassType ¶
type ZClassType int
func (ZClassType) Has ¶
func (a ZClassType) Has(c ZClassType) bool
func (ZClassType) IsInterface ¶
func (a ZClassType) IsInterface() bool
type ZCountable ¶
type ZHashTable ¶
type ZHashTable struct {
// contains filtered or unexported fields
}
func NewHashTable ¶
func NewHashTable() *ZHashTable
func (*ZHashTable) Append ¶
func (z *ZHashTable) Append(v *ZVal) error
func (*ZHashTable) Array ¶
func (z *ZHashTable) Array() *ZArray
func (*ZHashTable) Count ¶
func (z *ZHashTable) Count() ZInt
func (*ZHashTable) Dup ¶
func (z *ZHashTable) Dup() *ZHashTable
func (*ZHashTable) GetInt ¶
func (z *ZHashTable) GetInt(k ZInt) *ZVal
func (*ZHashTable) GetString ¶
func (z *ZHashTable) GetString(k ZString) *ZVal
func (*ZHashTable) GetStringB ¶
func (z *ZHashTable) GetStringB(k ZString) (*ZVal, bool)
func (*ZHashTable) HasInt ¶
func (z *ZHashTable) HasInt(k ZInt) bool
func (*ZHashTable) HasString ¶
func (z *ZHashTable) HasString(k ZString) bool
func (ZHashTable) HasStringKeys ¶
func (z ZHashTable) HasStringKeys() bool
func (*ZHashTable) MergeTable ¶
func (z *ZHashTable) MergeTable(b *ZHashTable) error
func (*ZHashTable) NewIterator ¶
func (z *ZHashTable) NewIterator() ZIterator
func (*ZHashTable) UnsetInt ¶
func (z *ZHashTable) UnsetInt(k ZInt) error
func (*ZHashTable) UnsetString ¶
func (z *ZHashTable) UnsetString(k ZString) error
type ZObject ¶
type ZObject interface { ZObjectAccess Val GetOpaque(c ZClass) interface{} SetOpaque(c ZClass, v interface{}) GetClass() ZClass NewIterator() ZIterator HashTable() *ZHashTable Clone() (ZObject, error) }
type ZObjectAccess ¶
type ZObjectAttr ¶
type ZObjectAttr int
func (ZObjectAttr) Access ¶
func (a ZObjectAttr) Access() ZObjectAttr
func (ZObjectAttr) Has ¶
func (a ZObjectAttr) Has(c ZObjectAttr) bool
func (ZObjectAttr) IsPrivate ¶
func (a ZObjectAttr) IsPrivate() bool
func (ZObjectAttr) IsProtected ¶
func (a ZObjectAttr) IsProtected() bool
func (ZObjectAttr) IsPublic ¶
func (a ZObjectAttr) IsPublic() bool
func (ZObjectAttr) IsStatic ¶
func (a ZObjectAttr) IsStatic() bool
type ZVal ¶
type ZVal struct {
// contains filtered or unexported fields
}
ZVal is a pointer to a value, that can be used as a Val, a reference, etc.
Eventually, ZVal will only be used for references.
func (*ZVal) Array ¶
func (z *ZVal) Array() ZArrayAccess
func (*ZVal) HashTable ¶
func (z *ZVal) HashTable() *ZHashTable
func (*ZVal) NewIterator ¶
Click to show internal directories.
Click to hide internal directories.