phpctx

package
v0.0.0-...-271b4c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2018 License: BSD-3-Clause Imports: 20 Imported by: 60

Documentation

Index

Constants

View Source
const (
	BufferWrite = 0
	BufferStart = 1 << iota
	BufferClean
	BufferFlush
	BufferFinal
	BufferCleanable
	BufferFlushable
	BufferRemovable
)

Variables

View Source
var Compile func(parent phpv.Context, t *tokenizer.Lexer) (phpv.Runnable, error)

Functions

func HasExt

func HasExt(name string) bool

func NewBufContext

func NewBufContext(ctx phpv.Context, b io.Writer) phpv.Context

func ParseQueryToArray

func ParseQueryToArray(ctx phpv.Context, q string, a *phpv.ZArray) error

ParseQueryToArray will parse a given query string into a ZArray with PHP parsing rules

func RegisterExt

func RegisterExt(e *Ext)

func WithConfig

func WithConfig(parent phpv.Context, name phpv.ZString, v *phpv.ZVal) phpv.Context

Types

type BufContext

type BufContext struct {
	phpv.Context
	// contains filtered or unexported fields
}

func (*BufContext) Write

func (b *BufContext) Write(d []byte) (int, error)

type Buffer

type Buffer struct {
	ImplicitFlush bool
	ChunkSize     int
	CB            phpv.Callable
	// contains filtered or unexported fields
}

func (*Buffer) Clean

func (b *Buffer) Clean()

func (*Buffer) Close

func (b *Buffer) Close() error

func (*Buffer) Flush

func (b *Buffer) Flush() error

func (*Buffer) Get

func (b *Buffer) Get() []byte

func (*Buffer) Level

func (b *Buffer) Level() int

func (*Buffer) Write

func (b *Buffer) Write(d []byte) (int, error)

type Ext

type Ext struct {
	Name      string
	Version   string
	Functions map[string]*ExtFunction
	Constants map[phpv.ZString]phpv.Val
	Classes   []phpv.ZClass
}

func GetExt

func GetExt(name string) *Ext

type ExtFunction

type ExtFunction struct {
	Func func(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error)
	Args []*ExtFunctionArg
}

func (*ExtFunction) Call

func (e *ExtFunction) Call(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error)

type ExtFunctionArg

type ExtFunctionArg struct {
	ArgName  string // without the $ sign
	Optional bool   // is this argument optional?
}

type Flusher

type Flusher interface {
	Flush() error
}

type FuncContext

type FuncContext struct {
	phpv.Context

	Args []*phpv.ZVal
	// contains filtered or unexported fields
}

func (*FuncContext) AsVal

func (c *FuncContext) AsVal(ctx phpv.Context, t phpv.ZType) (phpv.Val, error)

func (*FuncContext) Count

func (c *FuncContext) Count(ctx phpv.Context) phpv.ZInt

func (*FuncContext) Func

func (c *FuncContext) Func() phpv.FuncContext

func (*FuncContext) GetType

func (c *FuncContext) GetType() phpv.ZType

func (*FuncContext) NewIterator

func (c *FuncContext) NewIterator() phpv.ZIterator

func (*FuncContext) OffsetExists

func (c *FuncContext) OffsetExists(ctx phpv.Context, name phpv.Val) (bool, error)

func (*FuncContext) OffsetGet

func (c *FuncContext) OffsetGet(ctx phpv.Context, name phpv.Val) (*phpv.ZVal, error)

func (*FuncContext) OffsetSet

func (c *FuncContext) OffsetSet(ctx phpv.Context, name phpv.Val, v *phpv.ZVal) error

func (*FuncContext) OffsetUnset

func (c *FuncContext) OffsetUnset(ctx phpv.Context, name phpv.Val) error

func (*FuncContext) Parent

func (ctx *FuncContext) Parent(n int) phpv.Context

func (*FuncContext) This

func (c *FuncContext) This() phpv.ZObject

func (*FuncContext) ZVal

func (c *FuncContext) ZVal() *phpv.ZVal

type Global

type Global struct {
	context.Context
	// contains filtered or unexported fields
}

func NewGlobal

func NewGlobal(ctx context.Context, p *Process) *Global

func NewGlobalReq

func NewGlobalReq(req *http.Request, p *Process) *Global

func (*Global) AppendBuffer

func (g *Global) AppendBuffer() *Buffer

func (*Global) Buffer

func (g *Global) Buffer() *Buffer

func (*Global) Call

func (c *Global) Call(ctx phpv.Context, f phpv.Callable, args []phpv.Runnable, this phpv.ZObject) (*phpv.ZVal, error)

perform call in new context

func (*Global) CallZVal

func (c *Global) CallZVal(ctx phpv.Context, f phpv.Callable, args []*phpv.ZVal, this phpv.ZObject) (*phpv.ZVal, error)

func (*Global) Chdir

func (g *Global) Chdir(d phpv.ZString) error

func (*Global) Close

func (g *Global) Close() error

func (*Global) ConstantGet

func (g *Global) ConstantGet(name phpv.ZString) (phpv.Val, bool)

func (*Global) ConstantSet

func (g *Global) ConstantSet(k phpv.ZString, v phpv.Val) bool

func (*Global) Count

func (c *Global) Count(ctx phpv.Context) phpv.ZInt

func (*Global) Deadline

func (g *Global) Deadline() (deadline time.Time, ok bool)

func (*Global) Exists

func (g *Global) Exists(fn phpv.ZString) (bool, error)

func (*Global) Flush

func (g *Global) Flush()

func (*Global) Func

func (g *Global) Func() phpv.FuncContext

func (*Global) GetClass

func (g *Global) GetClass(ctx phpv.Context, name phpv.ZString, autoload bool) (phpv.ZClass, error)

func (*Global) GetConfig

func (g *Global) GetConfig(name phpv.ZString, def *phpv.ZVal) *phpv.ZVal

func (*Global) GetFunction

func (g *Global) GetFunction(ctx phpv.Context, name phpv.ZString) (phpv.Callable, error)

func (*Global) Getenv

func (g *Global) Getenv(key string) (string, bool)

func (*Global) Getwd

func (g *Global) Getwd() phpv.ZString

func (*Global) Global

func (g *Global) Global() phpv.GlobalContext

func (*Global) Include

func (c *Global) Include(ctx phpv.Context, fn phpv.ZString) (*phpv.ZVal, error)

func (*Global) IncludeOnce

func (c *Global) IncludeOnce(ctx phpv.Context, fn phpv.ZString) (*phpv.ZVal, error)

func (*Global) Loc

func (g *Global) Loc() *phpv.Loc

func (*Global) MemAlloc

func (g *Global) MemAlloc(ctx phpv.Context, s uint64) error

func (*Global) NewIterator

func (c *Global) NewIterator() phpv.ZIterator

func (*Global) OffsetExists

func (c *Global) OffsetExists(ctx phpv.Context, name phpv.Val) (bool, error)

func (*Global) OffsetGet

func (c *Global) OffsetGet(ctx phpv.Context, name phpv.Val) (*phpv.ZVal, error)

func (*Global) OffsetSet

func (c *Global) OffsetSet(ctx phpv.Context, name phpv.Val, v *phpv.ZVal) error

func (*Global) OffsetUnset

func (c *Global) OffsetUnset(ctx phpv.Context, name phpv.Val) error

func (*Global) Open

func (g *Global) Open(fn phpv.ZString, isInclude bool) (*stream.Stream, error)

Open opens a file using PHP stream wrappers and returns a handler to said file.

func (*Global) Parent

func (c *Global) Parent(n int) phpv.Context

func (*Global) RegisterClass

func (g *Global) RegisterClass(name phpv.ZString, c phpv.ZClass) error

func (*Global) RegisterFunction

func (g *Global) RegisterFunction(name phpv.ZString, f phpv.Callable) error

func (*Global) RegisterLazyClass

func (g *Global) RegisterLazyClass(name phpv.ZString, r phpv.Runnables, p int)

func (*Global) RegisterLazyFunc

func (g *Global) RegisterLazyFunc(name phpv.ZString, r phpv.Runnables, p int)

func (*Global) Require

func (c *Global) Require(ctx phpv.Context, fn phpv.ZString) (*phpv.ZVal, error)

func (*Global) RequireOnce

func (c *Global) RequireOnce(ctx phpv.Context, fn phpv.ZString) (*phpv.ZVal, error)

func (*Global) RunFile

func (g *Global) RunFile(fn string) error

func (*Global) SetDeadline

func (g *Global) SetDeadline(t time.Time)

func (*Global) SetLocalConfig

func (g *Global) SetLocalConfig(name phpv.ZString, val *phpv.ZVal) error

func (*Global) SetOutput

func (g *Global) SetOutput(w io.Writer)

func (*Global) Setenv

func (g *Global) Setenv(key, value string) error

func (*Global) This

func (g *Global) This() phpv.ZObject

func (*Global) Tick

func (g *Global) Tick(ctx phpv.Context, l *phpv.Loc) error

func (*Global) Unsetenv

func (g *Global) Unsetenv(key string) error

func (*Global) Write

func (g *Global) Write(v []byte) (int, error)

type MemMgr

type MemMgr struct {
	// contains filtered or unexported fields
}

func NewMemMgr

func NewMemMgr(limit uint64) *MemMgr

func (*MemMgr) Alloc

func (m *MemMgr) Alloc(ctx phpv.Context, s uint64) error

func (*MemMgr) Copy

func (m *MemMgr) Copy(dst io.Writer, src io.Reader) (written int64, err error)

type OpenContext

type OpenContext int

type Process

type Process struct {
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(sapi string) *Process

NewProcess instanciates a new instance of Process, which represents a running PHP process.

func (*Process) CommandLine

func (p *Process) CommandLine(args []string) error

CommandLine will parse arguments from the command line and configure the process accordingly. If nil is passed, then the actual command line will be parsed. In case of error, messages will be sent to stderr by default.

func (*Process) Handler

func (p *Process) Handler(docroot string) http.Handler

Hander returns a http.Handler object suitable for use with golang standard http servers and similar.

func (*Process) SetConstant

func (p *Process) SetConstant(name, value phpv.ZString)

SetConstant sets a global constant, typically used to set PHP_SAPI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL