php: Move server code into new phpx package

This commit is contained in:
Tom Wiesing 2022-10-19 13:52:24 +02:00
parent 4df5f6387c
commit 2e47626900
No known key found for this signature in database
13 changed files with 134 additions and 86 deletions

View file

@ -3,6 +3,7 @@ package extras
import (
_ "embed"
"github.com/FAU-CDI/wisski-distillery/internal/phpx"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/php"
"golang.org/x/exp/slices"
@ -20,7 +21,7 @@ var pathbuilderPHP string
// All returns the ids of all pathbuilders in consistent order.
//
// server is the server to fetch the pathbuilders from, any may be nil.
func (pathbuilder *Pathbuilder) All(server *php.Server) (ids []string, err error) {
func (pathbuilder *Pathbuilder) All(server *phpx.Server) (ids []string, err error) {
err = pathbuilder.PHP.ExecScript(server, &ids, pathbuilderPHP, "all_list")
slices.Sort(ids)
return
@ -30,7 +31,7 @@ func (pathbuilder *Pathbuilder) All(server *php.Server) (ids []string, err error
// If it does not exist, it returns the empty string and nil error.
//
// server is the server to fetch the pathbuilders from, any may be nil.
func (pathbuilder *Pathbuilder) Get(server *php.Server, id string) (xml string, err error) {
func (pathbuilder *Pathbuilder) Get(server *phpx.Server, id string) (xml string, err error) {
err = pathbuilder.PHP.ExecScript(server, &xml, pathbuilderPHP, "one_xml", id)
return
}
@ -38,7 +39,7 @@ func (pathbuilder *Pathbuilder) Get(server *php.Server, id string) (xml string,
// GetAll returns all pathbuilders serialized as xml
//
// server is the server to fetch the pathbuilders from, any may be nil.
func (pathbuilder *Pathbuilder) GetAll(server *php.Server) (pathbuilders map[string]string, err error) {
func (pathbuilder *Pathbuilder) GetAll(server *phpx.Server) (pathbuilders map[string]string, err error) {
err = pathbuilder.PHP.ExecScript(server, &pathbuilders, pathbuilderPHP, "all_xml")
return
}