This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace bundle; | |
| use io\streams\{InputStream, Streams, StreamTransfer}; | |
| use io\{File, Folder}; | |
| use lang\{Environment, IllegalArgumentException}; | |
| use peer\http\{HttpConnection, HttpRequest}; | |
| use text\json\{Json, FileInput, StreamInput}; | |
| use util\URI; | |
| use util\cmd\Console; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use io\File; | |
| use peer\ServerSocket; | |
| use peer\server\{AsyncServer, ServerProtocol}; | |
| class HttpProtocol implements ServerProtocol { | |
| public function __construct(private array $handlers) { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use com\neo4j\Graph from 'xp-forge/neo4j'; | |
| use text\json\{StreamOutput, Types, Format} from 'xp-forge/json'; | |
| use util\cmd\Console; | |
| $origin= new Graph($argv[1]); | |
| $stream= new StreamOutput(Console::$out->stream(), Format::wrapped(indent: ' ', options: ~Format::ESCAPE_SLASHES)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use peer\{Socket, Sockets, ConnectException}; | |
| use util\profiling\Timer; | |
| function now() { | |
| return (new DateTime())->format('H:i:s.v'); | |
| } | |
| function fetch($url) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use io\OperationTimedOutException; | |
| use peer\{Socket, Sockets, ConnectException}; | |
| use util\Objects; | |
| use util\profiling\Timer; | |
| // Library code | |
| function logger(... $args) { | |
| printf("[%s] %s\n", (new DateTime())->format('H:i:s.v'), implode('', array_map( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Map necessary types, structs and functions from Kernel32 | |
| $ffi= FFI::cdef(' | |
| typedef void VOID, *PVOID, *LPVOID, *HANDLE; | |
| typedef char CHAR; | |
| typedef int BOOL; | |
| typedef const char *LPCSTR; | |
| typedef unsigned long DWORD, *LPDWORD; | |
| typedef unsigned long *ULONG_PTR, **PULONG_PTR; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace mongodb; | |
| use com\mongodb\MongoConnection; | |
| use lang\IllegalArgumentException; | |
| use util\cmd\Console; | |
| use util\profiling\Timer; | |
| $dsn= $argv[1] ?? 'mongodb://localhost'; | |
| $namespace= $argv[2] ?? (function() { throw new IllegalArgumentException('Missing namespace'); })(); | |
| $term= $argv[3] ?? (function() { throw new IllegalArgumentException('Missing search term'); })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports = async function(changeEvent) { | |
| const collection = context.services.get('Cluster0').db('dialog').collection('searchable'); | |
| console.log(changeEvent.operationType, ': ', JSON.stringify(changeEvent)); | |
| const document = {kind: 'ENTRY', 'title': changeEvent.fullDocument.title}; | |
| let result; | |
| switch (changeEvent.operationType) { | |
| case 'insert': | |
| document._id = changeEvent.documentKey._id; | |
| result = await collection.insertOne(document); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/main/php/lang/ast/emit/PHP.class.php b/src/main/php/lang/ast/emit/PHP.class.php | |
| index d7d7728..9657f2b 100755 | |
| --- a/src/main/php/lang/ast/emit/PHP.class.php | |
| +++ b/src/main/php/lang/ast/emit/PHP.class.php | |
| @@ -390,6 +390,7 @@ abstract class PHP extends Emitter { | |
| $result->at($class->declared)->out->write(implode(' ', $class->modifiers).' class '.$this->declaration($class->name)); | |
| $class->parent && $result->out->write(' extends '.$class->parent); | |
| $class->implements && $result->out->write(' implements '.implode(', ', $class->implements)); | |
| + $class->permits && $result->out->write(' permits '.implode(', ', $class->permits)); | |
| $result->out->write('{'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use io\streams\Streams; | |
| use lang\IllegalStateException; | |
| use util\cmd\Console; | |
| use util\UUID; | |
| use peer\http\HttpConnection from 'xp-framework/http'; | |
| /** |