text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|> <|fim_prefix|>//go:build windows package webview2 import ( "golang.org/x/sys/windows" "syscall" "unsafe" ) type ICoreWebView2_4Vtbl struct { IUnknownVtbl AddFrameCreated ComProc RemoveFrameCreated ComProc AddDownloadStarting ComProc RemoveDownloadStarting ComProc } type ICoreWeb...
fim
wailsapp/wails
go
<|fim_prefix|>//go:build windows package webview2 import ( "golang.org/x/sys/windows" "syscall" "unsafe" ) type ICoreWebView2_5Vtbl struct { IUnknownVtbl AddClientCertificateRequested ComProc RemoveClientCertificateRequested ComProc } type ICoreWebView2_5 struct { Vtbl *ICoreWebView2_5Vtbl } func (i *ICo...
fim
wailsapp/wails
go
<|fim_prefix|>//go:build windows package webview2 import ( "golang.org/x/sys/windows" "syscall" "unsafe" ) type ICoreWebView2_6Vtbl struct { IUnknownVtbl OpenTaskManagerWindow ComProc } type ICoreWebView2_6 struct { Vtbl *ICoreWebView2_6Vtbl } func (i *ICoreWebView2_6) AddRef() uintptr { refCounter, _, _ :=...
fim
wailsapp/wails
go
<|fim_suffix|>fe.Pointer(i)), uintptr(unsafe.Pointer(iidICoreWebView2_7)), uintptr(unsafe.Pointer(&result))) return result } func (i *ICoreWebView2_7) PrintToPdf(ResultFilePath string, printSettings *ICoreWebView2PrintSettings, handler *ICoreWebView2PrintToPdfCompletedHandler) error { // Convert string 'Result...
fim
wailsapp/wails
go
<|fim_suffix|>)), uintptr(unsafe.Pointer(&token)), ) if windows.Handle(hr) != windows.S_OK { return syscall.Errno(hr) } return nil } func (i *ICoreWebView2_8) GetIsDocumentPlayingAudio() (bool, error) { // Create int32 to hold bool result var _value int32 hr, _, _ := i.Vtbl.GetIsDocumentPlayingAudio.Call( ...
fim
wailsapp/wails
go
<|fim_suffix|> hr, _, _ := i.Vtbl.GetDefaultDownloadDialogMargin.Call( uintptr(unsafe.Pointer(i)), uintptr(unsafe.Pointer(&value)), ) if windows.Handle(hr) != windows.S_OK { return POINT{}, syscall.Errno(hr) } return value, nil } func (i *ICoreWebView2_9) PutDefaultDownloadDialogMargin(value POINT) error { ...
fim
wailsapp/wails
go
<|fim_suffix|>2(b2) << 16) | (uint32(b3) << 8) | uint32(b4) ok = ok1 && ok2 && ok3 && ok4 return } func decodeHexUint16(src []byte) (value uint16, ok bool) { var b1, b2 byte var ok1, ok2 bool b1, ok1 = decodeHexByte(src[0], src[1]) b2, ok2 = decodeHexByte(src[2], src[3]) value = (uint16(b1) << 8) | uint16(b2) ...
fim
wailsapp/wails
go
<|fim_prefix|>package generator import ( "bytes" "embed" _ "embed" "github.com/matryer/is" "github.com/stretchr/testify/require" "strings" "testing" "updater/generator/types" ) //go:embed testfiles/* var testfiles embed.FS func testfile(path string) *bytes.Buffer { f, err := testfiles.ReadFile("testfiles/" ...
fim
wailsapp/wails
go
<|fim_prefix|>package generator import ( "bytes" _ "embed" "github.com/matryer/is" "github.com/stretchr/testify/require" "testing" "updater/generator/types" ) var interfaceTestData = []byte(` [uuid(26d34152-879f-4065-bea2-3daa2cfadfb8), version(1.0)] library WebView2 { [uuid(A0D6DF20-3B92-416D-AA0C-437A9C7278...
fim
wailsapp/wails
go
<|fim_suffix|>e files { // os.WriteFile("testfiles/"+file.FileName+".txt", file.Content.Bytes(), 0644) //} expected := []*types.GeneratedFile{ { FileName: "COREWEBVIEW2_KEY_EVENT_KIND.go", Package: "webview2", Content: testfile("COREWEBVIEW2_KEY_EVENT_KIND.go.txt"), }, { FileName: "ICoreWebView2...
fim
wailsapp/wails
go
<|fim_prefix|>package generator import ( "bytes" _ "embed" "github.com/matryer/is" "github.com/stretchr/testify/require" "testing" "updater/generator/types" ) func TestInterfaceInt(t *testing.T) { i := is.New(t) var buf bytes.Buffer buf.Write([]byte(` [uuid(26d34152-879f-4065-bea2-3daa2cfadfb8), version(1....
fim
wailsapp/wails
go
package generator import ( "bytes" _ "embed" "github.com/matryer/is" "github.com/stretchr/testify/require" "testing" "updater/generator/types" ) func TestInterfaceDoublePointer(t *testing.T) { i := is.New(t) var buf bytes.Buffer buf.Write([]byte(` [uuid(26d34152-879f-4065-bea2-3daa2cfadfb8), version(1.0)] ...
fim
wailsapp/wails
go
<|fim_prefix|>package generator import ( "bytes" _ "e<|fim_suffix|>tsMatch(t, expected, files) } /* [uuid(76eceacb-0462-4d94-ac83-423a6793775e), object, pointer_default(unique)] interface ICoreWebView2 : IUnknown { /// The `ICoreWebView2Settings` object contains various modifiable settings /// for the running...
fim
wailsapp/wails
go
<|fim_suffix|>bject, pointer_default(unique)] interface ICoreWebView2 : IUnknown { /// The `ICoreWebView2Settings` object contains various modifiable settings /// for the running WebView. [propget] HRESULT Settings([out, retval] ICoreWebView2Settings** settings); */<|fim_prefix|>package generator import ( "...
fim
wailsapp/wails
go
<|fim_prefix|>package generator import ( "github.com/alecthomas/participle/v2" "github.com/alecthomas/participle/v2/lexer" "updater/generator/types" ) var ( idlLexer = lexer.MustSimple([]lexer.SimpleRule{ {"Comment", `(?:#|//)[^<|fim_suffix|>Hex", `0x[a-fA-F0-9]+`}, {"Int", `[0-9]+`}, {"Ident", `[a-zA-Z]\w*...
fim
wailsapp/wails
go
<|fim_prefix|>packa<|fim_suffix|>es []string) error { *b = values[0] == "true" return nil } <|fim_middle|>ge types type Boolean bool func (b *Boolean) Capture(valu<|endoftext|>
fim
wailsapp/wails
go
package types import ( "io" "log" "strconv" "text/template" ) type EnumDeclaration struct { Name string `parser:"'typedef' 'enum' @Ident '{'"` Values []*EnumValue `parser:" (@@)+ '}' Ident ';'"` // private decl *Declaration } type EnumValue struct { Key string `parser:"@Ident"` Value *En...
fim
wailsapp/wails
go
<|fim_suffix|>Fatal(err) } err = tmpl.Execute(&buf, &data) if err != nil { log.Fatal(err) } result = append(result, &GeneratedFile{ FileName: "com.go", Package: l.packageName, Content: &buf, }) return result } type Declaration struct { InterfaceForewardDecl string `parser:"'interfac...
fim
wailsapp/wails
go
<|fim_prefix|>package types import ( "bytes" "github.com/leaanthony/slicer" "io" "log" "strings" "text/template" ) type InterfaceDeclaration struct { Header *InterfaceHeader `parser:"'[' @@ ']'"` Name string `parser:"'interface' @Ident"` BaseClass string `parser:" ':' @Ident...
fim
wailsapp/wails
go
<|fim_suffix|> "string", "HRESULT": "uintptr", "UINT64": "uint64", "UINT32": "uint32", "UINT": "uint", "INT": "int", "INT32": "int32", "INT64": "int64", "BOOL": "bool"...
fim
wailsapp/wails
go
package types import ( "io" "strings" ) type Param struct { Direction *Direction `parser:"@@?"` Type string `parser:"@Ident"` Const string `parser:"@('const')?"` Pointer string `parser:"@('*')*"` Name string `parser:"@Ident ','?"` // Processed GoType string InputGoType...
fim
wailsapp/wails
go
<|fim_prefix|>package types import ( "io" "log" "text/template" ) type StructDeclaration struct { Name string `parser:"'typedef' 'struct' @Ident '{' "` Fields []*StructField `parser:" (@@)+ '}' Ident ';'"` // private decl *Declaration } func (d *StructDeclaration) Process(decl *Declaration) error {...
fim
wailsapp/wails
go
<|fim_prefix|>package types <|fim_suffix|>ed.FS <|fim_middle|>import "embed" //go:embed templates/* var templates emb<|endoftext|>
fim
wailsapp/wails
go
<|fim_suffix|> UUID(values[0]) return nil } <|fim_prefix|>package types type UUID string func (u *UUID) Capture(values []string) error { //println("UUID =", values[0]<|fim_middle|>) *u =<|endoftext|>
fim
wailsapp/wails
go
<|fim_suffix|> io.ReadAll(r) if err != nil { return nil, err } } } // Write IDL to disk err = os.WriteFile("WebView2."+version+".idl", idlData, 0755) if err != nil { return nil, err } return idlData, nil } // CompareBrowserVersions will compare the 2 given versions and return: // // -1 = v1 < v2 //...
fim
wailsapp/wails
go
<|fim_suffix|>"WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "") os.Setenv("WEBVIEW2_RELEASE_CHANNEL_PREFERENCE", "0") // The following seems not be be required because those are only used by the webview2loader which // in this case is implemented on our own. But nevertheless set them to empty to be consistent. os.Seten...
fim
wailsapp/wails
go
<|fim_suffix|>n, iCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler]( "{4e8a3389-c9d8-4bd2-b6b5-124fee6cc14d}", _iCoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerInvoke, ) } func _iCoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerInvoke(this uintptr, errorCode HRESULT, env *combridge.IUnk...
fim
wailsapp/wails
go
<|fim_suffix|> "{ff85c98a-1ba7-4a6b-90c8-2b752c89e9e2}", _iCoreWebView2EnvironmentOptions2ExclusiveUserDataFolderAccess, _iCoreWebView2EnvironmentOptionsNOP, ) } func _iCoreWebView2EnvironmentOptionsNOP(this uintptr) uintptr { return uintptr(windows.S_FALSE) } func _iCoreWebView2EnvironmentOptionsAdditionalBro...
fim
wailsapp/wails
go
<|fim_suffix|>r = filepath.Join(filepath.Dir(exe), embeddedEdgeSubFolder) } return findClientDllInFolder(embeddedEdgeSubFolder) } func findClientDllInFolder(folder string) (string, error) { arch := "" switch runtime.GOARCH { case "arm64": arch = "arm64" case "amd64": arch = "x64" case "386": arch = "x86"...
fim
wailsapp/wails
go
<|fim_suffix|>l) (clientPath string, clientVersion *version, err error) { key := registry.LOCAL_MACHINE if !system { key = registry.CURRENT_USER } regKey, err := registry.OpenKey(key, subKey, registry.READ|registry.WOW64_32KEY) if err != nil { return "", nil, mapFindErr(err) } defer regKey.Close() embedde...
fim
wailsapp/wails
go
<|fim_suffix|>reate.Call( uint64(uintptr(unsafe.Pointer(browserExecutableFolder))), uint64(uintptr(unsafe.Pointer(userDataFolder))), 0, uint64(environmentCompletedHandle), ) return uintptr(res), nil } func loadFromMemory() error { var err error // DLL is not available natively. Try loading embedded copy. ...
fim
wailsapp/wails
go
<|fim_prefix|>//go:build windows && native_webview2loader package webviewloader import _ "embed" //go:embed x86/Web<|fim_suffix|>r WebView2Loader []byte <|fim_middle|>View2Loader.dll va<|endoftext|>
fim
wailsapp/wails
go
<|fim_suffix|> x64/WebView2Loader.dll var WebView2Loader []byte <|fim_prefix|>//go:build windows && native_w<|fim_middle|>ebview2loader package webviewloader import _ "embed" //go:embed<|endoftext|>
fim
wailsapp/wails
go
<|fim_suffix|>ort _ "embed" //go:embed arm64/WebView2Loader.dll var WebView2Loader []byte <|fim_prefix|>//go:build windows && native_webvie<|fim_middle|>w2loader package webviewloader imp<|endoftext|>
fim
wailsapp/wails
go
<|fim_prefix|>//go:build windows package webviewloader import ( "fmt" "syscall" "unicode/utf16" "unsafe" "golang.org/x/sys/windows" ) var ( modkernel32 = windows.NewLazySystemDLL("kernel32.dll") procGlobalAlloc = modkernel32.NewProc("GlobalAlloc") procGlobalFree = modkernel32.NewProc("GlobalFree") mo...
fim
wailsapp/wails
go
<|fim_suffix|>rconv.ParseInt(v[0], 10, 32) if err != nil { return nil, 0, err } return v[1:], int(p), nil } func compareInt(v1, v2 int) int { if v1 == v2 { return 0 } if v1 < v2 { return -1 } else { return +1 } } <|fim_prefix|>//go:build windows && !native_webview2loader package webviewloader import ...
fim
wailsapp/wails
go
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<w<|fim_suffix|> if ($address = stream_socket_get_na...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_suffix|> = null; /** * Emitted when the other end of the socket sends a FIN packet. * * @var ?callable */ public $onClose = null; /** * Emitted when an error occurs with connection. * * @var ?callable */ public $onError = null; /** * @var ?EventI...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_suffix|>n int */ public function getRemotePort(): int { if ($this->remoteAddress) { return (int)substr(strrchr($this->remoteAddress, ':'), 1); } return 0; } /** * Get remote address. * * @return string */ public function getRemoteAd...
fim
walkor/workerman
php
<|fim_suffix|>array<int, \EvIo> */ private array $writeEvents = []; /** * Event listeners of signal. * * @var array<int, \EvSignal> */ private array $eventSignal = []; /** * All timer event listeners. * * @var array<int, \EvTimer> */ private array $even...
fim
walkor/workerman
php
<|fim_suffix|> } $this->eventTimer[$timerId] = $event; return $timerId; } /** * {@inheritdoc} */ public function onReadable($stream, callable $func): void { $className = $this->eventClassName; $fdKey = (int)$stream; $event = new $className($this->eventB...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @link http://www.workerman.net/ * @li...
fim
walkor/workerman
php
<|fim_suffix|> $this->offReadable($stream); break; } // Under Windows, setting a timeout is necessary; otherwise, the accept cannot be listened to. // Setting it to 1000ms will result in a 1-second delay for the first accept under Wi...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and <|fim_suffix|> } $unpackData = unpack('Ntotal_length', $buffer); return $unpackData['total_length']; } /** * Decode. * * @param string $buffer * @re...
fim
walkor/workerman
php
<?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@workerman.net> * ...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_suffix|>setModifyTime; } /** * {@inheritdoc} */ public function close(): bool { return true; } /** * {@inheritdoc} */ public function destroy(string $sessionId): bool { $sessionFile = static::sessionFile($sessionId); if (is_file($sessio...
fim
walkor/workerman
php
<|fim_suffix|>tp\Session; use Redis; use RedisCluster; use RedisClusterException; use RedisException; class RedisClusterSessionHandler extends RedisSessionHandler { /** * @param array $config * @throws RedisClusterException * @throws RedisException */ public function __construct(array $con...
fim
walkor/workerman
php
<|fim_suffix|>elay($this->config['pool']['heartbeat_interval'] ?? 55, function () { $this->connection->ping(); }); } return $this->connection; } $key = 'session.redis.connection'; /** @var Redis|null $connection */ $con...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_suffix|> Determining If An Item Exists In The Session. * * @param string $name * @return bool */ public function has(string $name): bool { return isset($this->data[$name]); } /** * To determine if an item is present in the session, even if its value is null. ...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_prefix|><?php /** * This file is part of workerman. * * Licensed under The MIT License * For full copyright and license information, please see the MIT-LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @author walkor<walkor@workerman.net> * @copyright walkor<walkor@work...
fim
walkor/workerman
php
<|fim_suffix|> $suspension->suspend(); return; // Swoole case Swoole::class: System::sleep($delay); return; } usleep((int)($delay * 1000 * 1000)); } /** * Tick. * * @return void */ protected stat...
fim
walkor/workerman
php
<|fim_suffix|>IGUSR2, SIGIOT, SIGIO]; foreach ($signals as $signal) { pcntl_signal($signal, static::signalHandler(...), false); } // ignore pcntl_signal(SIGPIPE, SIG_IGN, false); } /** * Reinstall signal handler. * * @return void */ protected ...
fim
walkor/workerman
php
<|fim_prefix|><?php t<|fim_suffix|>expect(true)->toBeTrue(); }); <|fim_middle|>est('example', function () { <|endoftext|>
fim
walkor/workerman
php
<?php use GuzzleHttp\Client; use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Psr7\Utils; use Symfony\Component\Process\PhpProcess; $process = null; beforeAll(function () use (&$process) { $process = new PhpProcess(file_get_contents(__DIR__ . '/Stub/HttpServer.php')); $process->start(); usleep(250000); });...
fim
walkor/workerman
php
<|fim_prefix|><?php declare(strict_types=1); use Workerman\Connection\Tc<|fim_suffix|>end('Hello Chance'), '/get' => $connection->send(json_encode($request->get())), '/post' => $connection->send(json_encode($request->post())), '/header' => $connection->send($request->header('foo')), '/...
fim
walkor/workerman
php
<|fim_suffix|>printf('%s/test-udp-server.pid', sys_get_temp_dir()); Worker::$logFile = sprintf('%s/test-udp-server.log', sys_get_temp_dir()); Worker::$command = 'start'; Worker::runAll(); <|fim_prefix|><?php declare(strict_types=1); use Workerman\Worker; require './vendor/autoload.php'; if(!defined('STDIN')) define...
fim
walkor/workerman
php
<|fim_prefix|><?php declare(strict_types=1); use Workerman\Connection\AsyncTcpConnection; use Workerman\Worker; require_once __DIR__ . '/vendor/autoload.php'; if (!defined('STDIN')) define('STDIN', fopen('php://stdin', 'r')); if (!defined('STDOUT')) define('STDOUT', fopen('php://stdout', 'w')); if (!defined('STDERR...
fim
walkor/workerman
php
<|fim_prefix|><?php declare(strict_types=1); use Workerman\Connection\TcpConnection; use Workerman\Protocols\Http\R<|fim_suffix|>%action% Worker::$pidFile = sprintf('%s/test-websocket-server.pid', sys_get_temp_dir()); Worker::$logFile = sprintf('%s/test-websocket-server.log', sys_get_temp_dir()); Worker::$command = ...
fim
walkor/workerman
php
<|fim_prefix|><?php<|fim_suffix|>rrstr, 1); expect($errno)->toBeInt()->toBe(0); stream_set_timeout($socket, 1); fwrite($socket, 'xiami'); // 使用 recvfrom 读取,循环等待最多 ~1s $data = ''; $start = microtime(true); do { $peer = null; $chunk = @stream_socket_recvfrom($socket, 1024, 0, ...
fim
walkor/workerman
php
<|fim_prefix|><?php use Symfony\Component\Process\PhpProcess; $serverCode = file_get_contents(__DIR__ . '/Stub/WebsocketServer.php'); $clientCode = file_get_contents(__DIR__ . '/Stub/WebsocketClient.php'); it('tests websocket connection', function () use ($serverCode, $clientCode) { $serverProcess = new PhpProce...
fim
walkor/workerman
php
<|fim_suffix|>ry powerful out-of-the-box, you may have some testing code specific to your | project that you don't want to repeat in every file. Here you can also expose helpers as | global functions to help you to reduce the number of lines of code in your test files. | */ function something() { // .. } function...
fim
walkor/workerman
php
<|fim_prefix|><?php namespace Tests; use PHPUnit\Framework\TestCase as BaseTestCase; ab<|fim_suffix|>t class TestCase extends BaseTestCase { // } <|fim_middle|>strac<|endoftext|>
fim
walkor/workerman
php
<|fim_prefix|><?php use Workerman\Connection\TcpConnection; use Workerman\Events\Select; use Workerman\Protocols\Http; use Workerman\Protocols\Http\Request; use Workerman\Timer; it('fires onMessage once per request when two HTTP/1.1 requests arrive in one TCP read', function () { $event = new Select(); Timer:...
fim
walkor/workerman
php
<|fim_suffix|>: void { $calls++; if ($msg === 'a') { // Simulate app deciding to end() while there is another pipelined message in buffer. $c->end(); } }; fwrite($client, "a\nb\n"); $event->delay(0.03, static fn () => $event->stop()); $event->run(); ...
fim
walkor/workerman
php
<|fim_prefix|><?php use Wo<|fim_suffix|>'tcp://127.0.0.1:0', $errno, $errstr); expect($server)->not->toBeFalse(); $serverName = stream_socket_get_name($server, false); expect($serverName)->not->toBeFalse(); $client = stream_socket_client('tcp://' . $serverName, $errno, $errstr, 1); expect($client...
fim
walkor/workerman
php
<|fim_prefix|><?php use Workerman\Connection\UdpConnection; use Symfony\Component\Process\PhpProcess; use Workerman\Protocols\Text; $remoteAddress = '127.0.0.1:8082'; $process = null; beforeAll(function () use ($remoteAddress, &$process) { $process = new PhpProcess(<<<PHP <?php \$socketServer = st...
fim
walkor/workerman
php
<|fim_suffix|> ->toBe(pack('N', 9) . 'jhdxr'); });<|fim_prefix|><?php use Workerman\Protocols\Frame; it('tests ::input', function () { expect(Frame::input('foo'))->toBe(0) ->and(Frame::input("\0\0\0*foobar")) ->toBe(42); }); it('tests ::decode', function () { $buffer = pack('N', 5) . 'jhdxr'...
fim
walkor/workerman
php
<|fim_suffix|>get('key'))->toBe('value'); }); }); it('destroys old session in storage when deleteOldSession is true', function () { withSessionRequest(function (Request $request) { $oldSid = $request->sessionId(); $request->session()->set('key', 'value'); $re...
fim
walkor/workerman
php
<|fim_suffix|> ->toContain('Last-Modified: '); }); <|fim_prefix|><?php use Workerman\Protocols\Http\Response; it('test some simple case', function () { $response = new Response(201, ['X-foo' => 'bar'], 'hello, xiami'); expect($response->getStatusCode())->toBe(201) ->and($response->getHeaders()...
fim
walkor/workerman
php
<|fim_prefix|><?php use Workerman\Protocols\Http\ServerSentEvents; it('tests ' . ServerSentEvents::class, fu<|fim_suffix|> 'retry' => 5000, ]; $sse = new ServerSentEvents($data); $expected = "event: {$data['event']}\nid: {$data['id']}\nretry: {$data['retry']}\ndata: {$data['data']}\n\n"; expec...
fim
walkor/workerman
php
<|fim_prefix|><?php use Workerman\Connection\TcpConnection; use Workerman\Protocols\Http; use Workerman\Protocols\Http\Request; use Workerman\Protocols\Http\Response; const HTTP_400 = "HTTP/1.1 400 Bad Request\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"; it('customizes request class', function () { //back...
fim
walkor/workerman
php
<|fim_suffix|>n) { $connection->maxPackageSize = 5; expect(Text::input('abcdefgh', $connection)) ->toBe(0); }); //input without "\n" expect(Text::input('jhdxr', $connection)) ->toBe(0) //input with "\n" ->and(Text::input("jhdxr\n", $connection)) ->...
fim
walkor/workerman
php
<|fim_prefix|><?php use Workerman\Connection\TcpConnection; use Workerman\Protocols\Websocket; use Workerman\Worker; beforeEach(function () { if (Worker::$outputStream === null) { Worker::$outputStream = fopen('php://memory', 'w+'); } }); /** * Build permessage-deflate payload the same way as Websoc...
fim
walkor/workerman
php
<|fim_suffix|>ion->shouldReceive('send')->with('queued-frame-bytes', true)->once(); expect(Ws::dealHandshake($buffer, $connection))->toBe(0) ->and($connection->context->tmpWebsocketData)->toBe(''); }); it('dealHandshake closes when Sec-WebSocket-Accept header is missing', function () { $buffer = "HTTP...
fim
walkor/workerman
php
<|fim_prefix|><?php $config = new PhpCsFixer\Config(); return $config ->setRiskyAllowed(true) ->setRules([ '@Symfony' => true, '@Symfony:risky' => true, 'array_syntax' => [ 'syntax' => 'short', ], 'combine_consecutive_unsets' => true, 'heredoc_to_now...
fim
wallabag/wallabag
php
<|fim_prefix|><<|fim_suffix|>che { } <|fim_middle|>?php use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; class AppCache extends HttpCa<|endoftext|>
fim
wallabag/wallabag
php
<|fim_suffix|> 'wallabag/wallabag', '2.x', 'Loading configuration from "app/config/parameters.yml" is deprecated and will be removed in wallabag 3.0. Configure wallabag with environment variables instead.' ); } private function loadLegacyParametersIfPresent(LoaderInterface $loa...
fim
wallabag/wallabag
php
<|fim_prefix|>import { startStimulusApp } from '@symfony/stimulus-bridge'; // Registers Stimulus controllers from controllers.json and in the controllers/ directory export default startStimulusApp(require.context( '@symfony/stimulus-bridge/lazy-con<|fim_suffix|>er('some_controller_name', SomeImportedController); <|f...
fim
wallabag/wallabag
javascript
<|fim_prefix|>import { Controller } from '@hotwired/stimulus'; export default class extends Controller { static targets = ['input']; toggle() { this<|fim_suffix|>ent.classList.contains('hidden')) { this.inputTarget.focus(); } } } <|fim_middle|>.element.classList.toggle('hidden'); if (!this.el...
fim
wallabag/wallabag
javascript
<|fim_suffix|>this.searchUrlValue, }, entryId: this.entryIdValue, onError(msg, xhr) { if (!Object.prototype.hasOwnProperty.call(xhr, 'responseJSON')) { annotator.notification.banner('An error occurred', 'error'); return; } Object.values(xhr.responseJSON.chil...
fim
wallabag/wallabag
javascript
<|fim_prefix|>import { Controller } from '@hotwired/stimulus'; export default class extends Controller { static targets = ['item', 'tagAction']; toggleSelection(e) { this.itemTargets.forEach((item) => { item.checked = e.currentTarget.checked; // eslint-disable<|fim_suffix|>} <|fim_middle|>-line no-param...
fim
wallabag/wallabag
javascript
<|fim_suffix|>ller { connect() { this.clipboard = new ClipboardJS(this.element); this.clipboard.on('success', (e) => { e.clearSelection(); }); } disconnect() { this.clipboard.destroy(); } } <|fim_prefix|>import { Controller } from '@hotwired/stimulus'; import C<|fim_middle|>lipboardJS fr...
fim
wallabag/wallabag
javascript
<|fim_prefix|>import { Controller } from '@hotwired/stimulus'; <|fim_suffix|>this.fontSizeTarget.value}em`; this.previewContentTarget.style.lineHeight = `${this.lineHeightTarget.value}em`; } } <|fim_middle|>export default class extends Controller { static targets = ['previewArticle', 'previewContent', 'font', ...
fim
wallabag/wallabag
javascript
<|fim_suffix|>; } useAuto() { document.cookie = 'theme=auto;samesite=Lax;path=/;max-age=0'; this.#choose(); } #choose() { const themeCookieExists = document.cookie.split(';').some((cookie) => cookie.trim().startsWith('theme=')); if (themeCookieExists) { return; } if (this.mql.m...
fim
wallabag/wallabag
javascript
<|fim_suffix|>${this.pagination.querySelector('a[rel="prev"]').href}#prev`; } } selectCurrentCard() { const url = this.currentCard.querySelector('a.card-title').href; if (url) { window.location.href = url; } } } <|fim_prefix|>import { Controller } from '@hotwired/stimulus'; export default ...
fim
wallabag/wallabag
javascript
<|fim_suffix|>= false; } } <|fim_prefix|>import { Controller } from '@hotwired/stimulus'; export default class extends Controller { sta<|fim_middle|>tic targets = ['emailTwoFactor', 'googleTwoFactor']; uncheckGoogle() { this.googleTwoFactorTarget.checked = false; } uncheckEmail() { this.emailTwoFac...
fim
wallabag/wallabag
javascript
<|fim_suffix|>forEach((element) => { hljs.highlightElement(element); }); } } <|fim_prefix|>import { Controller } from '@hotwired/stimulus'; import 'highlight.js/styles/atom-one-light.css'; import hljs from 'highlight.js'; export default class extends Controller <|fim_middle|>{ connect() { this.elemen...
fim
wallabag/wallabag
javascript