Alex Palaistras
e993cd069e
Context: Do not return error on write if writer is unavailable
2015-12-02 20:28:40 +00:00
Alex Palaistras
51b02c241d
Fix docblock for context.New() method
2015-12-01 22:23:51 +00:00
Alex Palaistras
2446664f3f
Make sure README example actually runs
2015-12-01 22:10:28 +00:00
Alex Palaistras
f35b0d95ec
Fix README for context writer changes
2015-12-01 22:08:05 +00:00
Alex Palaistras
ffee742483
Add debug and error logging for contexts
2015-12-01 22:05:44 +00:00
Alex Palaistras
14dc9c2331
Change context output write API for consistency
...
Contexts now write to the Context.Output field (if set to a valid
io.Writer) instead of using an io.Writer passed in via Context.New().
This simplifies and matches the API for exec.Cmd.
2015-12-01 21:28:09 +00:00
Alex Palaistras
a4e8575180
More robust testing for reverse value bindings
...
Reverse value bindings are now checked against all possible value types,
instead of just their natural type.
2015-12-01 17:46:54 +00:00
Alex Palaistras
f48bac2609
Make header include guards a bit more unique.
2015-12-01 17:46:03 +00:00
Alex Palaistras
0350503bc4
Value: Fix bugs, make slice generation faster and more robust.
...
Slices are now generated from values by iterating on the underlying,
array (if any) instead of fetching values based on their numeric index.
2015-12-01 17:45:26 +00:00
Alex Palaistras
fa5781997f
Return plain `interface{}` types for value methods
...
Methods for `Interface`, `Slice`, and `Map` now return `interface{}`,
`[]interface{}` and `map[string]interface{}` respectively, making use
of values returned simpler in these cases.
The `Interface` method no longer returns a second error value, and
coerces PHP object values to map types. For extracting to a struct,
use the `Struct` method directly (not yet implemented).
Also fixed some instances of memory leaks.
2015-11-13 00:35:14 +00:00
Alex Palaistras
52fe38b1e0
Add reverse bindings for associative array types
...
Associative arrays can now be passed from PHP to Go contexts, with a
natural type of `map[string]*Value` via the `Value.Map()` method.
2015-11-12 20:24:06 +00:00
Alex Palaistras
e031953f3b
Destroy methods now clear internal fields correctly
2015-11-11 13:17:36 +00:00
Alex Palaistras
008eccb290
Add reverse value bindings for indexed arrays
...
Indexed arrays can now be returned as slices of `value.Value` types.
2015-11-11 13:16:42 +00:00
Alex Palaistras
1715752635
Add seperate tests for `engine` package
2015-11-10 18:17:46 +00:00
Alex Palaistras
5ca334aabf
Fix issues caught by `go vet` among others
2015-11-10 14:59:17 +00:00
Alex Palaistras
e4701073a4
Pass header through from PHP to Go context
...
Calls to `header()` in PHP now set `http.Header` fields in the calling
context, retrievable using the `Header` method.
2015-11-07 00:43:58 +00:00
Alex Palaistras
df950b1784
Move methods around for clarity
2015-11-06 20:11:20 +00:00
Alex Palaistras
80f16f537f
Return error for `value.Interface()` on failure
...
Previously, failure to return PHP value as `interface{}` value would
return a `nil` interface. We now additionally return an error, to
distinguish between genuine `nil` returns and errors.
2015-11-03 20:31:13 +00:00
Alex Palaistras
d1807e8489
Merge pull request #3 from deuill/feature/reverse-bind
...
Add reverse value bindings
2015-10-18 18:34:00 +01:00
Alex Palaistras
081d7a133f
Return values as copies when converting
...
Previously, value conversions were made on the original value, and thus,
calling methods like `Value.Int` had the side-effect of changing the
value's type for subsequent calls to `Value.Interface`. Any conversion
required happens on value copies, which are automatically destroyed
after use.
2015-10-18 01:13:28 +01:00
Alex Palaistras
2381ebcc6c
Return value kind from internal struct field
2015-10-18 00:34:08 +01:00
Alex Palaistras
3542780c5e
Add reverse value bindings
...
Expressions executed in the `Context.Eval` method can now return a
value, which will be passed to the Go caller, and can be used as a
regular Go value.
2015-10-18 00:26:09 +01:00
Alex Palaistras
e0a9a57256
Add docs and license badges for README
2015-10-17 19:53:26 +01:00
Alex Palaistras
acc2b7a9bd
Fix README example for NewContext restructuring
2015-10-17 16:01:46 +01:00
Alex Palaistras
6a3fd786ea
Add struct-to-object value bindings
2015-10-17 16:00:16 +01:00
Alex Palaistras
7ed2c81ec6
Move `NewContext` function to `engine` package
...
Call order is now enforced when using the root `php` package by moving
the `NewContext` function in the `engine` package, as a method of the
`Engine` method receiver. Further clean-ups have been made to the code
as a result of this change.
2015-10-16 14:42:15 +01:00
Alex Palaistras
0523266e32
Move write method to `context` package.
2015-10-09 17:06:04 +01:00
Alex Palaistras
9e046ba882
Added support for script evaluation from string
2015-10-04 19:55:45 +01:00
Alex Palaistras
6da50279b2
Add license statement in README
2015-10-04 19:34:37 +01:00
Alex Palaistras
c4f899dcd6
Added `Destroy` calls in README example
2015-10-04 19:31:43 +01:00
Alex Palaistras
8a2ce468e2
Add documentation blocks.
...
Added documentation blocks and licence headers to all files.
2015-10-04 19:28:44 +01:00
Alex Palaistras
1ab4c5c474
Merge pull request #1 from deuill/feature/split-directories
...
Split code into seperate directories
2015-10-02 18:17:12 +01:00
Alex Palaistras
acfb165d75
Fix incorrect `TSRMLS_FETCH` call
2015-10-02 18:12:42 +01:00
Alex Palaistras
4e1e8b09aa
Remove extraneous coverage file
2015-10-02 18:09:25 +01:00
Alex Palaistras
f451d6b291
Re-organize and merge test files
2015-10-02 18:07:57 +01:00
Alex Palaistras
7f797605e9
Split code into seperate directories.
2015-10-02 00:48:33 +01:00
Alex Palaistras
48a7c537a3
Add array binding support for context.
2015-10-01 22:57:17 +01:00
Alex Palaistras
c19061affc
Rename PHP engine internal name.
2015-09-26 20:41:02 +01:00
Alex Palaistras
00679900c9
Rename value methods.
2015-09-26 20:40:41 +01:00
Alex Palaistras
81e82bfd1e
Add boolean value bindings to context.
2015-09-22 22:14:51 +01:00
Alex Palaistras
0c5c6675a4
Fix incorrect reference in README.
2015-09-22 22:07:26 +01:00
Alex Palaistras
9429925cdb
Move tests to hidden folder.
2015-09-22 22:06:35 +01:00
Alex Palaistras
b410005a91
Remove extraneous includes.
2015-09-22 21:57:10 +01:00
Alex Palaistras
41abcbc629
Organize tests for clarity.
2015-09-22 21:55:36 +01:00
Alex Palaistras
6cfc1c2302
Move value-related code to own file.
2015-09-22 21:54:58 +01:00
Alex Palaistras
7c4bcb9847
Simplify README example.y
2015-09-22 21:33:33 +01:00
Alex Palaistras
6fa93f5160
First version of variable bindings to context.
...
This commit contains an initial version of variable bindings
to a context, along with tests. Currently supported types are
integers, floating point numbers, and strings.
2015-09-20 01:16:43 +01:00
Alex Palaistras
ee779b3698
Rename `tests` directory to `test.
2015-09-19 22:20:48 +01:00
Alex Palaistras
44909ebb7f
Remove deprecated `value` bindings.
2015-09-19 22:19:27 +01:00
Alex Palaistras
403a114ef2
Move context write method to `context.c`.
2015-09-19 21:12:32 +01:00