repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
yajra/laravel-datatables-buttons
src/Services/DataTable.php
DataTable.csv
public function csv() { $ext = '.' . strtolower($this->csvWriter); return $this->buildExcelFile()->download($this->getFilename() . $ext, $this->csvWriter); }
php
public function csv() { $ext = '.' . strtolower($this->csvWriter); return $this->buildExcelFile()->download($this->getFilename() . $ext, $this->csvWriter); }
[ "public", "function", "csv", "(", ")", "{", "$", "ext", "=", "'.'", ".", "strtolower", "(", "$", "this", "->", "csvWriter", ")", ";", "return", "$", "this", "->", "buildExcelFile", "(", ")", "->", "download", "(", "$", "this", "->", "getFilename", "(...
Export results to CSV file. @return mixed
[ "Export", "results", "to", "CSV", "file", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Services/DataTable.php#L486-L491
yajra/laravel-datatables-buttons
src/Services/DataTable.php
DataTable.pdf
public function pdf() { if ('snappy' == config('datatables-buttons.pdf_generator', 'snappy')) { return $this->snappyPdf(); } return $this->buildExcelFile()->download($this->getFilename() . '.pdf', $this->pdfWriter); }
php
public function pdf() { if ('snappy' == config('datatables-buttons.pdf_generator', 'snappy')) { return $this->snappyPdf(); } return $this->buildExcelFile()->download($this->getFilename() . '.pdf', $this->pdfWriter); }
[ "public", "function", "pdf", "(", ")", "{", "if", "(", "'snappy'", "==", "config", "(", "'datatables-buttons.pdf_generator'", ",", "'snappy'", ")", ")", "{", "return", "$", "this", "->", "snappyPdf", "(", ")", ";", "}", "return", "$", "this", "->", "buil...
Export results to PDF file. @return mixed
[ "Export", "results", "to", "PDF", "file", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Services/DataTable.php#L498-L505
yajra/laravel-datatables-buttons
src/Services/DataTable.php
DataTable.snappyPdf
public function snappyPdf() { /** @var \Barryvdh\Snappy\PdfWrapper $snappy */ $snappy = resolve('snappy.pdf.wrapper'); $options = config('datatables-buttons.snappy.options'); $orientation = config('datatables-buttons.snappy.orientation'); $snappy->setOptions($option...
php
public function snappyPdf() { /** @var \Barryvdh\Snappy\PdfWrapper $snappy */ $snappy = resolve('snappy.pdf.wrapper'); $options = config('datatables-buttons.snappy.options'); $orientation = config('datatables-buttons.snappy.orientation'); $snappy->setOptions($option...
[ "public", "function", "snappyPdf", "(", ")", "{", "/** @var \\Barryvdh\\Snappy\\PdfWrapper $snappy */", "$", "snappy", "=", "resolve", "(", "'snappy.pdf.wrapper'", ")", ";", "$", "options", "=", "config", "(", "'datatables-buttons.snappy.options'", ")", ";", "$", "ori...
PDF version of the table using print preview blade template. @return mixed
[ "PDF", "version", "of", "the", "table", "using", "print", "preview", "blade", "template", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Services/DataTable.php#L512-L522
yajra/laravel-datatables-buttons
src/Services/DataTable.php
DataTable.with
public function with($key, $value = null) { if (is_array($key)) { $this->attributes = array_merge($this->attributes, $key); } else { $this->attributes[$key] = $value; } return $this; }
php
public function with($key, $value = null) { if (is_array($key)) { $this->attributes = array_merge($this->attributes, $key); } else { $this->attributes[$key] = $value; } return $this; }
[ "public", "function", "with", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "$", "this", "->", "attributes", "=", "array_merge", "(", "$", "this", "->", "attributes", ",", "$", "...
Set a custom class attribute. @param mixed $key @param mixed|null $value @return $this
[ "Set", "a", "custom", "class", "attribute", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Services/DataTable.php#L557-L566
yajra/laravel-datatables-buttons
src/Services/DataTable.php
DataTable.applyScopes
protected function applyScopes($query) { foreach ($this->scopes as $scope) { $scope->apply($query); } return $query; }
php
protected function applyScopes($query) { foreach ($this->scopes as $scope) { $scope->apply($query); } return $query; }
[ "protected", "function", "applyScopes", "(", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "scopes", "as", "$", "scope", ")", "{", "$", "scope", "->", "apply", "(", "$", "query", ")", ";", "}", "return", "$", "query", ";", "}" ]
Apply query scopes. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query @return mixed
[ "Apply", "query", "scopes", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Services/DataTable.php#L587-L594
yajra/laravel-datatables-buttons
src/Services/DataTable.php
DataTable.hasScopes
protected function hasScopes(array $scopes, $validateAll = false) { $filteredScopes = array_filter($this->scopes, function ($scope) use ($scopes) { return in_array(get_class($scope), $scopes); }); return $validateAll ? count($filteredScopes) === count($scopes) : ! empty($filtere...
php
protected function hasScopes(array $scopes, $validateAll = false) { $filteredScopes = array_filter($this->scopes, function ($scope) use ($scopes) { return in_array(get_class($scope), $scopes); }); return $validateAll ? count($filteredScopes) === count($scopes) : ! empty($filtere...
[ "protected", "function", "hasScopes", "(", "array", "$", "scopes", ",", "$", "validateAll", "=", "false", ")", "{", "$", "filteredScopes", "=", "array_filter", "(", "$", "this", "->", "scopes", ",", "function", "(", "$", "scope", ")", "use", "(", "$", ...
Determine if the DataTable has scopes. @param array $scopes @param bool $validateAll @return bool
[ "Determine", "if", "the", "DataTable", "has", "scopes", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Services/DataTable.php#L603-L610
yajra/laravel-datatables-buttons
src/Generators/DataTablesMakeCommand.php
DataTablesMakeCommand.buildClass
protected function buildClass($name) { $stub = parent::buildClass($name); return $this->replaceModelImport($stub) ->replaceModel($stub) ->replaceColumns($stub) ->replaceAction($stub) ->replaceFilename($stub); }
php
protected function buildClass($name) { $stub = parent::buildClass($name); return $this->replaceModelImport($stub) ->replaceModel($stub) ->replaceColumns($stub) ->replaceAction($stub) ->replaceFilename($stub); }
[ "protected", "function", "buildClass", "(", "$", "name", ")", "{", "$", "stub", "=", "parent", "::", "buildClass", "(", "$", "name", ")", ";", "return", "$", "this", "->", "replaceModelImport", "(", "$", "stub", ")", "->", "replaceModel", "(", "$", "st...
Build the class with the given name. @param string $name @return string
[ "Build", "the", "class", "with", "the", "given", "name", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Generators/DataTablesMakeCommand.php#L43-L52
yajra/laravel-datatables-buttons
src/Generators/DataTablesMakeCommand.php
DataTablesMakeCommand.getModel
protected function getModel() { $name = $this->getNameInput(); $rootNamespace = $this->laravel->getNamespace(); $model = $this->option('model') || $this->option('model-namespace'); $modelNamespace = $this->option('model-namespace') ? $this->option('model-namespace...
php
protected function getModel() { $name = $this->getNameInput(); $rootNamespace = $this->laravel->getNamespace(); $model = $this->option('model') || $this->option('model-namespace'); $modelNamespace = $this->option('model-namespace') ? $this->option('model-namespace...
[ "protected", "function", "getModel", "(", ")", "{", "$", "name", "=", "$", "this", "->", "getNameInput", "(", ")", ";", "$", "rootNamespace", "=", "$", "this", "->", "laravel", "->", "getNamespace", "(", ")", ";", "$", "model", "=", "$", "this", "->"...
Get model name to use.
[ "Get", "model", "name", "to", "use", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Generators/DataTablesMakeCommand.php#L72-L82
yajra/laravel-datatables-buttons
src/Generators/DataTablesMakeCommand.php
DataTablesMakeCommand.getStub
protected function getStub() { $config = $this->laravel['config']; return $config->get('datatables-buttons.stub') ? base_path() . $config->get('datatables-buttons.stub') . '/datatables.stub' : __DIR__ . '/stubs/datatables.stub'; }
php
protected function getStub() { $config = $this->laravel['config']; return $config->get('datatables-buttons.stub') ? base_path() . $config->get('datatables-buttons.stub') . '/datatables.stub' : __DIR__ . '/stubs/datatables.stub'; }
[ "protected", "function", "getStub", "(", ")", "{", "$", "config", "=", "$", "this", "->", "laravel", "[", "'config'", "]", ";", "return", "$", "config", "->", "get", "(", "'datatables-buttons.stub'", ")", "?", "base_path", "(", ")", ".", "$", "config", ...
Get the stub file for the generator. @return string
[ "Get", "the", "stub", "file", "for", "the", "generator", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Generators/DataTablesMakeCommand.php#L171-L178
yajra/laravel-datatables-buttons
src/ButtonsServiceProvider.php
ButtonsServiceProvider.publishAssets
protected function publishAssets() { $this->publishes([ __DIR__ . '/config/config.php' => config_path('datatables-buttons.php'), ], 'datatables-buttons'); $this->publishes([ __DIR__ . '/resources/assets/buttons.server-side.js' => public_path('vendor/datatables/button...
php
protected function publishAssets() { $this->publishes([ __DIR__ . '/config/config.php' => config_path('datatables-buttons.php'), ], 'datatables-buttons'); $this->publishes([ __DIR__ . '/resources/assets/buttons.server-side.js' => public_path('vendor/datatables/button...
[ "protected", "function", "publishAssets", "(", ")", "{", "$", "this", "->", "publishes", "(", "[", "__DIR__", ".", "'/config/config.php'", "=>", "config_path", "(", "'datatables-buttons.php'", ")", ",", "]", ",", "'datatables-buttons'", ")", ";", "$", "this", ...
Publish datatables assets.
[ "Publish", "datatables", "assets", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/ButtonsServiceProvider.php#L29-L42
yajra/laravel-datatables-buttons
src/ButtonsServiceProvider.php
ButtonsServiceProvider.register
public function register() { $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'datatables-buttons'); $this->app->register(HtmlServiceProvider::class); $this->app->register(ExcelServiceProvider::class); }
php
public function register() { $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'datatables-buttons'); $this->app->register(HtmlServiceProvider::class); $this->app->register(ExcelServiceProvider::class); }
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "mergeConfigFrom", "(", "__DIR__", ".", "'/config/config.php'", ",", "'datatables-buttons'", ")", ";", "$", "this", "->", "app", "->", "register", "(", "HtmlServiceProvider", "::", "class", ")...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/ButtonsServiceProvider.php#L58-L64
yajra/laravel-datatables-buttons
src/Transformers/DataArrayTransformer.php
DataArrayTransformer.transform
public function transform(array $row, $columns, $type = 'printable') { if ($columns instanceof Collection) { return $this->buildColumnByCollection($row, $columns, $type); } return array_only($row, $columns); }
php
public function transform(array $row, $columns, $type = 'printable') { if ($columns instanceof Collection) { return $this->buildColumnByCollection($row, $columns, $type); } return array_only($row, $columns); }
[ "public", "function", "transform", "(", "array", "$", "row", ",", "$", "columns", ",", "$", "type", "=", "'printable'", ")", "{", "if", "(", "$", "columns", "instanceof", "Collection", ")", "{", "return", "$", "this", "->", "buildColumnByCollection", "(", ...
Transform row data by columns definition. @param array $row @param mixed $columns @param string $type @return array
[ "Transform", "row", "data", "by", "columns", "definition", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Transformers/DataArrayTransformer.php#L17-L24
yajra/laravel-datatables-buttons
src/Transformers/DataArrayTransformer.php
DataArrayTransformer.buildColumnByCollection
protected function buildColumnByCollection(array $row, Collection $columns, $type = 'printable') { $results = []; foreach ($columns->all() as $column) { if ($column[$type]) { $title = $column['title']; $data = array_get($row, $column['data']); ...
php
protected function buildColumnByCollection(array $row, Collection $columns, $type = 'printable') { $results = []; foreach ($columns->all() as $column) { if ($column[$type]) { $title = $column['title']; $data = array_get($row, $column['data']); ...
[ "protected", "function", "buildColumnByCollection", "(", "array", "$", "row", ",", "Collection", "$", "columns", ",", "$", "type", "=", "'printable'", ")", "{", "$", "results", "=", "[", "]", ";", "foreach", "(", "$", "columns", "->", "all", "(", ")", ...
Transform row column by collection. @param array $row @param \Illuminate\Support\Collection $columns @param string $type @return array
[ "Transform", "row", "column", "by", "collection", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Transformers/DataArrayTransformer.php#L34-L53
yajra/laravel-datatables-buttons
src/Transformers/DataArrayTransformer.php
DataArrayTransformer.decodeContent
protected function decodeContent($data) { try { $decoded = html_entity_decode(strip_tags($data), ENT_QUOTES, 'UTF-8'); return str_replace("\xc2\xa0", ' ', $decoded); } catch (\Exception $e) { return $data; } }
php
protected function decodeContent($data) { try { $decoded = html_entity_decode(strip_tags($data), ENT_QUOTES, 'UTF-8'); return str_replace("\xc2\xa0", ' ', $decoded); } catch (\Exception $e) { return $data; } }
[ "protected", "function", "decodeContent", "(", "$", "data", ")", "{", "try", "{", "$", "decoded", "=", "html_entity_decode", "(", "strip_tags", "(", "$", "data", ")", ",", "ENT_QUOTES", ",", "'UTF-8'", ")", ";", "return", "str_replace", "(", "\"\\xc2\\xa0\""...
Decode content to a readable text value. @param string $data @return string
[ "Decode", "content", "to", "a", "readable", "text", "value", "." ]
train
https://github.com/yajra/laravel-datatables-buttons/blob/291c129ab9db63e5ec5353336181e8c6a95e3e19/src/Transformers/DataArrayTransformer.php#L61-L70
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php
StreamLaravelServiceProvider.boot
public function boot() { if (method_exists($this, 'publishes')) { $this->loadViewsFrom(__DIR__.'/../../views', 'stream-laravel'); $this->publishes([ __DIR__.'/../../config/config.php' => config_path('stream-laravel.php'), __DIR__.'/../../views' => bas...
php
public function boot() { if (method_exists($this, 'publishes')) { $this->loadViewsFrom(__DIR__.'/../../views', 'stream-laravel'); $this->publishes([ __DIR__.'/../../config/config.php' => config_path('stream-laravel.php'), __DIR__.'/../../views' => bas...
[ "public", "function", "boot", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'publishes'", ")", ")", "{", "$", "this", "->", "loadViewsFrom", "(", "__DIR__", ".", "'/../../views'", ",", "'stream-laravel'", ")", ";", "$", "this", "->",...
Bootstrap the application events. @return void
[ "Bootstrap", "the", "application", "events", "." ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php#L14-L26
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php
StreamLaravelServiceProvider.register
public function register() { if (method_exists($this, 'publishes')) { $this->registerResources(); } $this->app->singleton('feed_manager', function ($app) { $manager_class = $app['config']->get('stream-laravel::feed_manager_class'); $api_key = $app['config...
php
public function register() { if (method_exists($this, 'publishes')) { $this->registerResources(); } $this->app->singleton('feed_manager', function ($app) { $manager_class = $app['config']->get('stream-laravel::feed_manager_class'); $api_key = $app['config...
[ "public", "function", "register", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'publishes'", ")", ")", "{", "$", "this", "->", "registerResources", "(", ")", ";", "}", "$", "this", "->", "app", "->", "singleton", "(", "'feed_manag...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php#L33-L46
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php
StreamLaravelServiceProvider.registerResources
protected function registerResources() { $userConfigFile = $this->app->configPath().'/stream-laravel.php'; $packageConfigFile = __DIR__.'/../../config/config.php'; $config = $this->app['files']->getRequire($packageConfigFile); if (file_exists($userConfigFile)) { $userCon...
php
protected function registerResources() { $userConfigFile = $this->app->configPath().'/stream-laravel.php'; $packageConfigFile = __DIR__.'/../../config/config.php'; $config = $this->app['files']->getRequire($packageConfigFile); if (file_exists($userConfigFile)) { $userCon...
[ "protected", "function", "registerResources", "(", ")", "{", "$", "userConfigFile", "=", "$", "this", "->", "app", "->", "configPath", "(", ")", ".", "'/stream-laravel.php'", ";", "$", "packageConfigFile", "=", "__DIR__", ".", "'/../../config/config.php'", ";", ...
Register the package resources. @return void
[ "Register", "the", "package", "resources", "." ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php#L53-L69
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLumenServiceProvider.php
StreamLumenServiceProvider.boot
public function boot() { if (method_exists($this, 'publishes')) { $this->loadViewsFrom(__DIR__.'/../../views', 'stream-laravel'); $this->publishes([ __DIR__.'/../../config/config.php' => app()->configure('stream-laravel.php'), __DIR__.'/../../views' =...
php
public function boot() { if (method_exists($this, 'publishes')) { $this->loadViewsFrom(__DIR__.'/../../views', 'stream-laravel'); $this->publishes([ __DIR__.'/../../config/config.php' => app()->configure('stream-laravel.php'), __DIR__.'/../../views' =...
[ "public", "function", "boot", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'publishes'", ")", ")", "{", "$", "this", "->", "loadViewsFrom", "(", "__DIR__", ".", "'/../../views'", ",", "'stream-laravel'", ")", ";", "$", "this", "->",...
Bootstrap the application events. @return void
[ "Bootstrap", "the", "application", "events", "." ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLumenServiceProvider.php#L14-L26
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLumenServiceProvider.php
StreamLumenServiceProvider.register
public function register() { if (method_exists($this, 'publishes')) { $this->registerResources(); } $this->app->singleton('feed_manager', function($app) { $manager_class = config('stream-laravel.feed_manager_class'); $api_key = config('stream-laravel.api_...
php
public function register() { if (method_exists($this, 'publishes')) { $this->registerResources(); } $this->app->singleton('feed_manager', function($app) { $manager_class = config('stream-laravel.feed_manager_class'); $api_key = config('stream-laravel.api_...
[ "public", "function", "register", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'publishes'", ")", ")", "{", "$", "this", "->", "registerResources", "(", ")", ";", "}", "$", "this", "->", "app", "->", "singleton", "(", "'feed_manag...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLumenServiceProvider.php#L33-L46
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLaravelManager.php
StreamLaravelManager.getNotificationFeed
public function getNotificationFeed($user_id) { $user_feed = $this->config->get("stream-laravel::notification_feed"); return $this->client->feed($user_feed, $user_id); }
php
public function getNotificationFeed($user_id) { $user_feed = $this->config->get("stream-laravel::notification_feed"); return $this->client->feed($user_feed, $user_id); }
[ "public", "function", "getNotificationFeed", "(", "$", "user_id", ")", "{", "$", "user_feed", "=", "$", "this", "->", "config", "->", "get", "(", "\"stream-laravel::notification_feed\"", ")", ";", "return", "$", "this", "->", "client", "->", "feed", "(", "$"...
@param string $user_id @return \GetStream\Stream\Feed
[ "@param", "string", "$user_id" ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLaravelManager.php#L63-L67
GetStream/stream-laravel
src/GetStream/StreamLaravel/StreamLaravelManager.php
StreamLaravelManager.getNewsFeeds
public function getNewsFeeds($user_id) { $feeds = []; $news_feeds = $this->config->get("stream-laravel::news_feeds"); foreach ($news_feeds as $feed) { $feeds[$feed] = $this->client->feed($feed, $user_id); } return $feeds; }
php
public function getNewsFeeds($user_id) { $feeds = []; $news_feeds = $this->config->get("stream-laravel::news_feeds"); foreach ($news_feeds as $feed) { $feeds[$feed] = $this->client->feed($feed, $user_id); } return $feeds; }
[ "public", "function", "getNewsFeeds", "(", "$", "user_id", ")", "{", "$", "feeds", "=", "[", "]", ";", "$", "news_feeds", "=", "$", "this", "->", "config", "->", "get", "(", "\"stream-laravel::news_feeds\"", ")", ";", "foreach", "(", "$", "news_feeds", "...
@param string $user_id @return array
[ "@param", "string", "$user_id" ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/StreamLaravelManager.php#L74-L82
GetStream/stream-laravel
src/GetStream/StreamLaravel/Eloquent/ActivityTrait.php
ActivityTrait.createActivity
public function createActivity() { $activity = []; $activity['actor'] = $this->activityActor(); $activity['verb'] = $this->activityVerb(); $activity['object'] = $this->activityObject(); $activity['foreign_id'] = $this->activityForeignId(); $activity['time'] = $this->a...
php
public function createActivity() { $activity = []; $activity['actor'] = $this->activityActor(); $activity['verb'] = $this->activityVerb(); $activity['object'] = $this->activityObject(); $activity['foreign_id'] = $this->activityForeignId(); $activity['time'] = $this->a...
[ "public", "function", "createActivity", "(", ")", "{", "$", "activity", "=", "[", "]", ";", "$", "activity", "[", "'actor'", "]", "=", "$", "this", "->", "activityActor", "(", ")", ";", "$", "activity", "[", "'verb'", "]", "=", "$", "this", "->", "...
The activity data for this instance @return array
[ "The", "activity", "data", "for", "this", "instance" ]
train
https://github.com/GetStream/stream-laravel/blob/2756a00a922db49b1ce0cdd572bb6ac31cea2b0e/src/GetStream/StreamLaravel/Eloquent/ActivityTrait.php#L127-L155
voryx/Thruway
src/Authentication/AuthorizationManager.php
AuthorizationManager.isAuthorizedTo
public function isAuthorizedTo(Session $session, ActionMessageInterface $actionMsg) { // authorization $action = $actionMsg->getActionName(); $uri = $actionMsg->getUri(); $authenticationDetails = $session->getAuthenticationDetails(); // admin can do anything - pretty imp...
php
public function isAuthorizedTo(Session $session, ActionMessageInterface $actionMsg) { // authorization $action = $actionMsg->getActionName(); $uri = $actionMsg->getUri(); $authenticationDetails = $session->getAuthenticationDetails(); // admin can do anything - pretty imp...
[ "public", "function", "isAuthorizedTo", "(", "Session", "$", "session", ",", "ActionMessageInterface", "$", "actionMsg", ")", "{", "// authorization", "$", "action", "=", "$", "actionMsg", "->", "getActionName", "(", ")", ";", "$", "uri", "=", "$", "actionMsg"...
Check to see if an action is authorized on a specific uri given the context of the session attempting the action actionMsg should be an instance of: register, call, subscribe, or publish messages @param Session $session @param ActionMessageInterface $actionMsg @throws \Exception @return boolean
[ "Check", "to", "see", "if", "an", "action", "is", "authorized", "on", "a", "specific", "uri", "given", "the", "context", "of", "the", "session", "attempting", "the", "action" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AuthorizationManager.php#L117-L141
voryx/Thruway
src/Authentication/AuthenticationDetails.php
AuthenticationDetails.createAnonymous
static public function createAnonymous() { $authDetails = new AuthenticationDetails(); $authDetails->setAuthId('anonymous'); $authDetails->setAuthMethod('anonymous'); $authDetails->addAuthRole('anonymous'); return $authDetails; }
php
static public function createAnonymous() { $authDetails = new AuthenticationDetails(); $authDetails->setAuthId('anonymous'); $authDetails->setAuthMethod('anonymous'); $authDetails->addAuthRole('anonymous'); return $authDetails; }
[ "static", "public", "function", "createAnonymous", "(", ")", "{", "$", "authDetails", "=", "new", "AuthenticationDetails", "(", ")", ";", "$", "authDetails", "->", "setAuthId", "(", "'anonymous'", ")", ";", "$", "authDetails", "->", "setAuthMethod", "(", "'ano...
Create anonymous @return \Thruway\Authentication\AuthenticationDetails
[ "Create", "anonymous" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AuthenticationDetails.php#L129-L137
voryx/Thruway
src/Subscription/StateHandlerRegistration.php
StateHandlerRegistration.publishState
public function publishState(Subscription $subscription) { //Pause all non-state building event messages $subscription->pauseForState(); $sessionId = $subscription->getSession()->getSessionId(); $this->clientSession->call($this->getProcedureName(), [$subscription->getUr...
php
public function publishState(Subscription $subscription) { //Pause all non-state building event messages $subscription->pauseForState(); $sessionId = $subscription->getSession()->getSessionId(); $this->clientSession->call($this->getProcedureName(), [$subscription->getUr...
[ "public", "function", "publishState", "(", "Subscription", "$", "subscription", ")", "{", "//Pause all non-state building event messages", "$", "subscription", "->", "pauseForState", "(", ")", ";", "$", "sessionId", "=", "$", "subscription", "->", "getSession", "(", ...
Gets and published the topics state to this subscription @param Subscription $subscription @return mixed
[ "Gets", "and", "published", "the", "topics", "state", "to", "this", "subscription" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Subscription/StateHandlerRegistration.php#L51-L73
voryx/Thruway
src/Role/Broker.php
Broker.getFeatures
public function getFeatures() { $features = new \stdClass(); $features->subscriber_blackwhite_listing = true; $features->publisher_exclusion = true; $features->subscriber_metaevents = true; return $features; }
php
public function getFeatures() { $features = new \stdClass(); $features->subscriber_blackwhite_listing = true; $features->publisher_exclusion = true; $features->subscriber_metaevents = true; return $features; }
[ "public", "function", "getFeatures", "(", ")", "{", "$", "features", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "features", "->", "subscriber_blackwhite_listing", "=", "true", ";", "$", "features", "->", "publisher_exclusion", "=", "true", ";", "$", ...
Return supported features @return \stdClass
[ "Return", "supported", "features" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Broker.php#L120-L129
voryx/Thruway
src/Role/Broker.php
Broker.processSubscribe
protected function processSubscribe(Session $session, SubscribeMessage $msg) { // get a subscription group "hash" /** @var MatcherInterface $matcher */ $matcher = $this->getMatcherForMatchType($msg->getMatchType()); if ($matcher === false) { Logger::alert($this, ...
php
protected function processSubscribe(Session $session, SubscribeMessage $msg) { // get a subscription group "hash" /** @var MatcherInterface $matcher */ $matcher = $this->getMatcherForMatchType($msg->getMatchType()); if ($matcher === false) { Logger::alert($this, ...
[ "protected", "function", "processSubscribe", "(", "Session", "$", "session", ",", "SubscribeMessage", "$", "msg", ")", "{", "// get a subscription group \"hash\"", "/** @var MatcherInterface $matcher */", "$", "matcher", "=", "$", "this", "->", "getMatcherForMatchType", "...
Process subscribe message @param \Thruway\Session $session @param \Thruway\Message\SubscribeMessage $msg @throws \Exception
[ "Process", "subscribe", "message" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Broker.php#L138-L171
voryx/Thruway
src/Role/Broker.php
Broker.processPublish
protected function processPublish(Session $session, PublishMessage $msg) { if ($msg->getPublicationId() === null) { $msg->setPublicationId(Utils::getUniqueId()); } /** @var SubscriptionGroup $subscriptionGroup */ foreach ($this->subscriptionGroups as $subscriptionGroup) ...
php
protected function processPublish(Session $session, PublishMessage $msg) { if ($msg->getPublicationId() === null) { $msg->setPublicationId(Utils::getUniqueId()); } /** @var SubscriptionGroup $subscriptionGroup */ foreach ($this->subscriptionGroups as $subscriptionGroup) ...
[ "protected", "function", "processPublish", "(", "Session", "$", "session", ",", "PublishMessage", "$", "msg", ")", "{", "if", "(", "$", "msg", "->", "getPublicationId", "(", ")", "===", "null", ")", "{", "$", "msg", "->", "setPublicationId", "(", "Utils", ...
Process publish message @param \Thruway\Session $session @param \Thruway\Message\PublishMessage $msg
[ "Process", "publish", "message" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Broker.php#L179-L193
voryx/Thruway
src/Role/Broker.php
Broker.processUnsubscribe
protected function processUnsubscribe(Session $session, UnsubscribeMessage $msg) { $subscription = false; // should probably be more efficient about this - maybe later /** @var SubscriptionGroup $subscriptionGroup */ foreach ($this->subscriptionGroups as $subscriptionGroup) { ...
php
protected function processUnsubscribe(Session $session, UnsubscribeMessage $msg) { $subscription = false; // should probably be more efficient about this - maybe later /** @var SubscriptionGroup $subscriptionGroup */ foreach ($this->subscriptionGroups as $subscriptionGroup) { ...
[ "protected", "function", "processUnsubscribe", "(", "Session", "$", "session", ",", "UnsubscribeMessage", "$", "msg", ")", "{", "$", "subscription", "=", "false", ";", "// should probably be more efficient about this - maybe later", "/** @var SubscriptionGroup $subscriptionGrou...
Process Unsubscribe message @param \Thruway\Session $session @param \Thruway\Message\UnsubscribeMessage $msg
[ "Process", "Unsubscribe", "message" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Broker.php#L201-L220
voryx/Thruway
src/Call.php
Call.processYield
public function processYield(Session $session, YieldMessage $msg) { $keepIndex = true; $details = new \stdClass(); $yieldOptions = $msg->getOptions(); if (is_object($yieldOptions) && isset($yieldOptions->progress) && $yieldOptions->progress) { if ($this->isProgressive...
php
public function processYield(Session $session, YieldMessage $msg) { $keepIndex = true; $details = new \stdClass(); $yieldOptions = $msg->getOptions(); if (is_object($yieldOptions) && isset($yieldOptions->progress) && $yieldOptions->progress) { if ($this->isProgressive...
[ "public", "function", "processYield", "(", "Session", "$", "session", ",", "YieldMessage", "$", "msg", ")", "{", "$", "keepIndex", "=", "true", ";", "$", "details", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "yieldOptions", "=", "$", "msg", "->"...
Process Yield message @param \Thruway\Session $session @param \Thruway\Message\YieldMessage $msg @return bool if we need to keep the call indexed
[ "Process", "Yield", "message" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Call.php#L121-L151
voryx/Thruway
src/Call.php
Call.processCancel
public function processCancel(Session $session, CancelMessage $msg) { if ($this->getCallerSession() !== $session) { Logger::warning($this, 'session attempted to cancel call they did not own.'); return false; } if ($this->getCalleeSession() === null) { // ...
php
public function processCancel(Session $session, CancelMessage $msg) { if ($this->getCallerSession() !== $session) { Logger::warning($this, 'session attempted to cancel call they did not own.'); return false; } if ($this->getCalleeSession() === null) { // ...
[ "public", "function", "processCancel", "(", "Session", "$", "session", ",", "CancelMessage", "$", "msg", ")", "{", "if", "(", "$", "this", "->", "getCallerSession", "(", ")", "!==", "$", "session", ")", "{", "Logger", "::", "warning", "(", "$", "this", ...
processCancel processes cancel message from the caller. Return true if the Call should be removed from active calls @param Session $session @param CancelMessage $msg @return bool
[ "processCancel", "processes", "cancel", "message", "from", "the", "caller", ".", "Return", "true", "if", "the", "Call", "should", "be", "removed", "from", "active", "calls" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Call.php#L161-L213
voryx/Thruway
src/Call.php
Call.getInvocationMessage
public function getInvocationMessage() { if ($this->invocationMessage === null) { // try to create one if ($this->registration === null) { throw new \Exception('You must set the registration prior to calling getInvocationMessage'); } if ($this...
php
public function getInvocationMessage() { if ($this->invocationMessage === null) { // try to create one if ($this->registration === null) { throw new \Exception('You must set the registration prior to calling getInvocationMessage'); } if ($this...
[ "public", "function", "getInvocationMessage", "(", ")", "{", "if", "(", "$", "this", "->", "invocationMessage", "===", "null", ")", "{", "// try to create one", "if", "(", "$", "this", "->", "registration", "===", "null", ")", "{", "throw", "new", "\\", "E...
Get InvocationMessage @throws \Exception @return \Thruway\Message\InvocationMessage
[ "Get", "InvocationMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Call.php#L281-L334
voryx/Thruway
src/Procedure.php
Procedure.processRegister
public function processRegister(Session $session, RegisterMessage $msg) { $registration = Registration::createRegistrationFromRegisterMessage($session, $msg); if (count($this->registrations) > 0) { // we already have something registered if ($this->getAllowMultipleRegistrati...
php
public function processRegister(Session $session, RegisterMessage $msg) { $registration = Registration::createRegistrationFromRegisterMessage($session, $msg); if (count($this->registrations) > 0) { // we already have something registered if ($this->getAllowMultipleRegistrati...
[ "public", "function", "processRegister", "(", "Session", "$", "session", ",", "RegisterMessage", "$", "msg", ")", "{", "$", "registration", "=", "Registration", "::", "createRegistrationFromRegisterMessage", "(", "$", "session", ",", "$", "msg", ")", ";", "if", ...
Process register @param Session $session @param \Thruway\Message\RegisterMessage $msg @return bool @throws \Exception
[ "Process", "register" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L76-L127
voryx/Thruway
src/Procedure.php
Procedure.addRegistration
private function addRegistration(Registration $registration, RegisterMessage $msg) { try { // make sure the uri is exactly the same if ($registration->getProcedureName() !== $this->getProcedureName()) { throw new \Exception('Attempt to add registration to procedure wi...
php
private function addRegistration(Registration $registration, RegisterMessage $msg) { try { // make sure the uri is exactly the same if ($registration->getProcedureName() !== $this->getProcedureName()) { throw new \Exception('Attempt to add registration to procedure wi...
[ "private", "function", "addRegistration", "(", "Registration", "$", "registration", ",", "RegisterMessage", "$", "msg", ")", "{", "try", "{", "// make sure the uri is exactly the same", "if", "(", "$", "registration", "->", "getProcedureName", "(", ")", "!==", "$", ...
Add registration @param \Thruway\Registration $registration @return bool @throws \Exception
[ "Add", "registration" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L136-L167
voryx/Thruway
src/Procedure.php
Procedure.getRegistrationById
public function getRegistrationById($registrationId) { /** @var Registration $registration */ foreach ($this->registrations as $registration) { if ($registration->getId() === $registrationId) { return $registration; } } return false; }
php
public function getRegistrationById($registrationId) { /** @var Registration $registration */ foreach ($this->registrations as $registration) { if ($registration->getId() === $registrationId) { return $registration; } } return false; }
[ "public", "function", "getRegistrationById", "(", "$", "registrationId", ")", "{", "/** @var Registration $registration */", "foreach", "(", "$", "this", "->", "registrations", "as", "$", "registration", ")", "{", "if", "(", "$", "registration", "->", "getId", "("...
Get registration by ID @param $registrationId @return bool|Registration
[ "Get", "registration", "by", "ID" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L175-L185
voryx/Thruway
src/Procedure.php
Procedure.processUnregister
public function processUnregister(Session $session, UnregisterMessage $msg) { for ($i = 0; $i < count($this->registrations); $i++) { /** @var Registration $registration */ $registration = $this->registrations[$i]; if ($registration->getId() == $msg->getRegistrationId()) {...
php
public function processUnregister(Session $session, UnregisterMessage $msg) { for ($i = 0; $i < count($this->registrations); $i++) { /** @var Registration $registration */ $registration = $this->registrations[$i]; if ($registration->getId() == $msg->getRegistrationId()) {...
[ "public", "function", "processUnregister", "(", "Session", "$", "session", ",", "UnregisterMessage", "$", "msg", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "this", "->", "registrations", ")", ";", "$", "i", "++",...
process unregister @param \Thruway\Session $session @param \Thruway\Message\UnregisterMessage $msg @return bool
[ "process", "unregister" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L194-L220
voryx/Thruway
src/Procedure.php
Procedure.processCall
public function processCall(Session $session, Call $call) { // find a registration to call if (count($this->registrations) === 0) { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($call->getCallMessage(), 'wamp.error.no_such_procedure')); return false; ...
php
public function processCall(Session $session, Call $call) { // find a registration to call if (count($this->registrations) === 0) { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($call->getCallMessage(), 'wamp.error.no_such_procedure')); return false; ...
[ "public", "function", "processCall", "(", "Session", "$", "session", ",", "Call", "$", "call", ")", "{", "// find a registration to call", "if", "(", "count", "(", "$", "this", "->", "registrations", ")", "===", "0", ")", "{", "$", "session", "->", "sendMe...
Process call @param \Thruway\Session $session @param Call $call @throws \Exception @return bool | Call
[ "Process", "call" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L230-L247
voryx/Thruway
src/Procedure.php
Procedure.processQueue
public function processQueue() { if (!$this->getAllowMultipleRegistrations()) { throw new \Exception('Queuing only allowed when there are multiple registrations'); } // find the best candidate while ($this->callQueue->count() > 0) { $registration = NULL; ...
php
public function processQueue() { if (!$this->getAllowMultipleRegistrations()) { throw new \Exception('Queuing only allowed when there are multiple registrations'); } // find the best candidate while ($this->callQueue->count() > 0) { $registration = NULL; ...
[ "public", "function", "processQueue", "(", ")", "{", "if", "(", "!", "$", "this", "->", "getAllowMultipleRegistrations", "(", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Queuing only allowed when there are multiple registrations'", ")", ";", "}", "// ...
Process the Queue @throws \Exception
[ "Process", "the", "Queue" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L254-L282
voryx/Thruway
src/Procedure.php
Procedure.removeCall
public function removeCall(Call $call) { $newQueue = new \SplQueue(); while (!$this->callQueue->isEmpty()) { $c = $this->callQueue->dequeue(); if ($c === $call) continue; $newQueue->enqueue($c); } $this->callQueue = $newQueue; ...
php
public function removeCall(Call $call) { $newQueue = new \SplQueue(); while (!$this->callQueue->isEmpty()) { $c = $this->callQueue->dequeue(); if ($c === $call) continue; $newQueue->enqueue($c); } $this->callQueue = $newQueue; ...
[ "public", "function", "removeCall", "(", "Call", "$", "call", ")", "{", "$", "newQueue", "=", "new", "\\", "SplQueue", "(", ")", ";", "while", "(", "!", "$", "this", "->", "callQueue", "->", "isEmpty", "(", ")", ")", "{", "$", "c", "=", "$", "thi...
Remove all references to Call to it can be GCed @param Call $call
[ "Remove", "all", "references", "to", "Call", "to", "it", "can", "be", "GCed" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L356-L373
voryx/Thruway
src/Procedure.php
Procedure.getCallByRequestId
public function getCallByRequestId($requestId) { /* @var $registration \Thruway\Registration */ foreach ($this->registrations as $registration) { $call = $registration->getCallByRequestId($requestId); if ($call) { return $call; } } ...
php
public function getCallByRequestId($requestId) { /* @var $registration \Thruway\Registration */ foreach ($this->registrations as $registration) { $call = $registration->getCallByRequestId($requestId); if ($call) { return $call; } } ...
[ "public", "function", "getCallByRequestId", "(", "$", "requestId", ")", "{", "/* @var $registration \\Thruway\\Registration */", "foreach", "(", "$", "this", "->", "registrations", "as", "$", "registration", ")", "{", "$", "call", "=", "$", "registration", "->", "...
Get call by request ID @param int $requestId @return \Thruway\Call|boolean
[ "Get", "call", "by", "request", "ID" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L381-L392
voryx/Thruway
src/Procedure.php
Procedure.leave
public function leave(Session $session) { // remove all registrations that belong to this session /* @var $registration \Thruway\Registration */ foreach ($this->registrations as $i => $registration) { if ($registration->getSession() === $session) { // if this sess...
php
public function leave(Session $session) { // remove all registrations that belong to this session /* @var $registration \Thruway\Registration */ foreach ($this->registrations as $i => $registration) { if ($registration->getSession() === $session) { // if this sess...
[ "public", "function", "leave", "(", "Session", "$", "session", ")", "{", "// remove all registrations that belong to this session", "/* @var $registration \\Thruway\\Registration */", "foreach", "(", "$", "this", "->", "registrations", "as", "$", "i", "=>", "$", "registra...
process session leave @param \Thruway\Session $session
[ "process", "session", "leave" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L487-L498
voryx/Thruway
src/Procedure.php
Procedure.managerGetRegistrations
public function managerGetRegistrations() { $registrations = $this->getRegistrations(); $regInfo = []; /** @var Registration $reg */ foreach ($registrations as $reg) { $regInfo[] = [ 'id' => $reg->getId(), 'invoke' ...
php
public function managerGetRegistrations() { $registrations = $this->getRegistrations(); $regInfo = []; /** @var Registration $reg */ foreach ($registrations as $reg) { $regInfo[] = [ 'id' => $reg->getId(), 'invoke' ...
[ "public", "function", "managerGetRegistrations", "(", ")", "{", "$", "registrations", "=", "$", "this", "->", "getRegistrations", "(", ")", ";", "$", "regInfo", "=", "[", "]", ";", "/** @var Registration $reg */", "foreach", "(", "$", "registrations", "as", "$...
todo: This was part of the manager stuff - but may be used by some tests
[ "todo", ":", "This", "was", "part", "of", "the", "manager", "stuff", "-", "but", "may", "be", "used", "by", "some", "tests" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Procedure.php#L504-L521
voryx/Thruway
Examples/MetaEvent/InternalClient.php
InternalClient.onSessionLeave
public function onSessionLeave($args, $kwArgs, $options) { if (!empty($args[0]['session'])) { foreach ($this->_sessions as $key => $details) { if ($args[0]['session'] == $details['session']) { echo "Session {$details['session']} leaved\n"; ...
php
public function onSessionLeave($args, $kwArgs, $options) { if (!empty($args[0]['session'])) { foreach ($this->_sessions as $key => $details) { if ($args[0]['session'] == $details['session']) { echo "Session {$details['session']} leaved\n"; ...
[ "public", "function", "onSessionLeave", "(", "$", "args", ",", "$", "kwArgs", ",", "$", "options", ")", "{", "if", "(", "!", "empty", "(", "$", "args", "[", "0", "]", "[", "'session'", "]", ")", ")", "{", "foreach", "(", "$", "this", "->", "_sess...
Handle on session leaved @param array $args @param array $kwArgs @param array $options @return void @link https://github.com/crossbario/crossbar/wiki/Session-Metaevents
[ "Handle", "on", "session", "leaved" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/MetaEvent/InternalClient.php#L90-L101
voryx/Thruway
src/RealmManager.php
RealmManager.getRealm
public function getRealm($realmName) { if (!is_scalar($realmName)) { throw new \InvalidArgumentException('Non-string value given for realm name'); } if (!array_key_exists($realmName, $this->realms)) { if ($this->getAllowRealmAutocreate()) { Logger::deb...
php
public function getRealm($realmName) { if (!is_scalar($realmName)) { throw new \InvalidArgumentException('Non-string value given for realm name'); } if (!array_key_exists($realmName, $this->realms)) { if ($this->getAllowRealmAutocreate()) { Logger::deb...
[ "public", "function", "getRealm", "(", "$", "realmName", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "realmName", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Non-string value given for realm name'", ")", ";", "}", "if", "(", ...
Get Realm by realm name @param string $realmName @throws \Thruway\Exception\InvalidRealmNameException @throws \Thruway\Exception\RealmNotFoundException @return \Thruway\Realm
[ "Get", "Realm", "by", "realm", "name" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/RealmManager.php#L117-L134
voryx/Thruway
src/RealmManager.php
RealmManager.addRealm
public function addRealm(Realm $realm) { $realmName = $realm->getRealmName(); if (!static::validRealmName($realm->getRealmName())) { throw new InvalidRealmNameException; } if (array_key_exists($realm->getRealmName(), $this->realms)) { throw new \Exception('T...
php
public function addRealm(Realm $realm) { $realmName = $realm->getRealmName(); if (!static::validRealmName($realm->getRealmName())) { throw new InvalidRealmNameException; } if (array_key_exists($realm->getRealmName(), $this->realms)) { throw new \Exception('T...
[ "public", "function", "addRealm", "(", "Realm", "$", "realm", ")", "{", "$", "realmName", "=", "$", "realm", "->", "getRealmName", "(", ")", ";", "if", "(", "!", "static", "::", "validRealmName", "(", "$", "realm", "->", "getRealmName", "(", ")", ")", ...
Add new realm @param \Thruway\Realm $realm @throws \Thruway\Exception\InvalidRealmNameException @throws \Exception
[ "Add", "new", "realm" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/RealmManager.php#L143-L160
voryx/Thruway
src/Module/RouterModuleClient.php
RouterModuleClient.initModule
public function initModule(RouterInterface $router, LoopInterface $loop) { $this->router = $router; $this->setLoop($loop); $this->router->addInternalClient($this); }
php
public function initModule(RouterInterface $router, LoopInterface $loop) { $this->router = $router; $this->setLoop($loop); $this->router->addInternalClient($this); }
[ "public", "function", "initModule", "(", "RouterInterface", "$", "router", ",", "LoopInterface", "$", "loop", ")", "{", "$", "this", "->", "router", "=", "$", "router", ";", "$", "this", "->", "setLoop", "(", "$", "loop", ")", ";", "$", "this", "->", ...
Called by the router when it is added @param RouterInterface $router @param LoopInterface $loop
[ "Called", "by", "the", "router", "when", "it", "is", "added" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Module/RouterModuleClient.php#L24-L30
voryx/Thruway
src/Role/Dealer.php
Dealer.processRegister
private function processRegister(Session $session, RegisterMessage $msg) { // check for valid URI if (!Utils::uriIsValid($msg->getProcedureName())) { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.invalid_uri')); return; } ...
php
private function processRegister(Session $session, RegisterMessage $msg) { // check for valid URI if (!Utils::uriIsValid($msg->getProcedureName())) { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.invalid_uri')); return; } ...
[ "private", "function", "processRegister", "(", "Session", "$", "session", ",", "RegisterMessage", "$", "msg", ")", "{", "// check for valid URI", "if", "(", "!", "Utils", "::", "uriIsValid", "(", "$", "msg", "->", "getProcedureName", "(", ")", ")", ")", "{",...
process RegisterMessage @param \Thruway\Session $session @param \Thruway\Message\RegisterMessage $msg
[ "process", "RegisterMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L174-L207
voryx/Thruway
src/Role/Dealer.php
Dealer.processUnregister
private function processUnregister(Session $session, UnregisterMessage $msg) { $registration = $this->getRegistrationById($msg->getRegistrationId()); if ($registration && $this->procedures[$registration->getProcedureName()]) { $procedure = $this->procedures[$registration->getProcedureNa...
php
private function processUnregister(Session $session, UnregisterMessage $msg) { $registration = $this->getRegistrationById($msg->getRegistrationId()); if ($registration && $this->procedures[$registration->getProcedureName()]) { $procedure = $this->procedures[$registration->getProcedureNa...
[ "private", "function", "processUnregister", "(", "Session", "$", "session", ",", "UnregisterMessage", "$", "msg", ")", "{", "$", "registration", "=", "$", "this", "->", "getRegistrationById", "(", "$", "msg", "->", "getRegistrationId", "(", ")", ")", ";", "i...
process UnregisterMessage @param \Thruway\Session $session @param \Thruway\Message\UnregisterMessage $msg @throws \Exception
[ "process", "UnregisterMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L216-L240
voryx/Thruway
src/Role/Dealer.php
Dealer.processCall
private function processCall(Session $session, CallMessage $msg) { if (!Utils::uriIsValid($msg->getProcedureName())) { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.invalid_uri')); return; } if (!isset($this->procedures[$msg->ge...
php
private function processCall(Session $session, CallMessage $msg) { if (!Utils::uriIsValid($msg->getProcedureName())) { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.invalid_uri')); return; } if (!isset($this->procedures[$msg->ge...
[ "private", "function", "processCall", "(", "Session", "$", "session", ",", "CallMessage", "$", "msg", ")", "{", "if", "(", "!", "Utils", "::", "uriIsValid", "(", "$", "msg", "->", "getProcedureName", "(", ")", ")", ")", "{", "$", "session", "->", "send...
Process call @param \Thruway\Session $session @param \Thruway\Message\CallMessage $msg @return boolean
[ "Process", "call" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L249-L276
voryx/Thruway
src/Role/Dealer.php
Dealer.processYield
private function processYield(Session $session, YieldMessage $msg) { /* @var $call Call */ $call = isset($this->callInvocationIndex[$msg->getRequestId()]) ? $this->callInvocationIndex[$msg->getRequestId()] : null; if (!$call) { $session->sendMessage(ErrorMessage::createErrorMes...
php
private function processYield(Session $session, YieldMessage $msg) { /* @var $call Call */ $call = isset($this->callInvocationIndex[$msg->getRequestId()]) ? $this->callInvocationIndex[$msg->getRequestId()] : null; if (!$call) { $session->sendMessage(ErrorMessage::createErrorMes...
[ "private", "function", "processYield", "(", "Session", "$", "session", ",", "YieldMessage", "$", "msg", ")", "{", "/* @var $call Call */", "$", "call", "=", "isset", "(", "$", "this", "->", "callInvocationIndex", "[", "$", "msg", "->", "getRequestId", "(", "...
process YieldMessage @param \Thruway\Session $session @param \Thruway\Message\YieldMessage $msg
[ "process", "YieldMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L284-L314
voryx/Thruway
src/Role/Dealer.php
Dealer.processError
private function processError(Session $session, ErrorMessage $msg) { switch ($msg->getErrorMsgCode()) { case Message::MSG_INVOCATION: $this->processInvocationError($session, $msg); break; case Message::MSG_INTERRUPT: $this->processInter...
php
private function processError(Session $session, ErrorMessage $msg) { switch ($msg->getErrorMsgCode()) { case Message::MSG_INVOCATION: $this->processInvocationError($session, $msg); break; case Message::MSG_INTERRUPT: $this->processInter...
[ "private", "function", "processError", "(", "Session", "$", "session", ",", "ErrorMessage", "$", "msg", ")", "{", "switch", "(", "$", "msg", "->", "getErrorMsgCode", "(", ")", ")", "{", "case", "Message", "::", "MSG_INVOCATION", ":", "$", "this", "->", "...
process ErrorMessage @param \Thruway\Session $session @param \Thruway\Message\ErrorMessage $msg
[ "process", "ErrorMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L340-L350
voryx/Thruway
src/Role/Dealer.php
Dealer.processInvocationError
private function processInvocationError(Session $session, ErrorMessage $msg) { //$call = $this->getCallByRequestId($msg->getRequestId()); $call = $this->callInvocationIndex[$msg->getRequestId()]; if (!$call) { $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg); ...
php
private function processInvocationError(Session $session, ErrorMessage $msg) { //$call = $this->getCallByRequestId($msg->getRequestId()); $call = $this->callInvocationIndex[$msg->getRequestId()]; if (!$call) { $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg); ...
[ "private", "function", "processInvocationError", "(", "Session", "$", "session", ",", "ErrorMessage", "$", "msg", ")", "{", "//$call = $this->getCallByRequestId($msg->getRequestId());", "$", "call", "=", "$", "this", "->", "callInvocationIndex", "[", "$", "msg", "->",...
Process InvocationError @param \Thruway\Session $session @param \Thruway\Message\ErrorMessage $msg
[ "Process", "InvocationError" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L398-L433
voryx/Thruway
src/Role/Dealer.php
Dealer.removeCall
protected function removeCall(Call $call) { $call->getProcedure()->removeCall($call); unset($this->callInvocationIndex[$call->getInvocationRequestId()]); unset($this->callRequestIndex[$call->getCallMessage()->getRequestId()]); if ($call->getCancelMessage()) { unset($this-...
php
protected function removeCall(Call $call) { $call->getProcedure()->removeCall($call); unset($this->callInvocationIndex[$call->getInvocationRequestId()]); unset($this->callRequestIndex[$call->getCallMessage()->getRequestId()]); if ($call->getCancelMessage()) { unset($this-...
[ "protected", "function", "removeCall", "(", "Call", "$", "call", ")", "{", "$", "call", "->", "getProcedure", "(", ")", "->", "removeCall", "(", "$", "call", ")", ";", "unset", "(", "$", "this", "->", "callInvocationIndex", "[", "$", "call", "->", "get...
This removes all references to calls so they can be GCed @param Call $call
[ "This", "removes", "all", "references", "to", "calls", "so", "they", "can", "be", "GCed" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L465-L476
voryx/Thruway
src/Role/Dealer.php
Dealer.getCallByRequestId
public function getCallByRequestId($requestId) { $call = isset($this->callRequestIndex[$requestId]) ? $this->callRequestIndex[$requestId] : false; return $call; }
php
public function getCallByRequestId($requestId) { $call = isset($this->callRequestIndex[$requestId]) ? $this->callRequestIndex[$requestId] : false; return $call; }
[ "public", "function", "getCallByRequestId", "(", "$", "requestId", ")", "{", "$", "call", "=", "isset", "(", "$", "this", "->", "callRequestIndex", "[", "$", "requestId", "]", ")", "?", "$", "this", "->", "callRequestIndex", "[", "$", "requestId", "]", "...
Get Call by requestID @param int $requestId @return \Thruway\Call|boolean
[ "Get", "Call", "by", "requestID" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L484-L489
voryx/Thruway
src/Role/Dealer.php
Dealer.handlesMessage
public function handlesMessage(Message $msg) { $handledMsgCodes = [ Message::MSG_CALL, Message::MSG_CANCEL, Message::MSG_REGISTER, Message::MSG_UNREGISTER, Message::MSG_YIELD, Message::MSG_INTERRUPT ]; if (in_array($msg...
php
public function handlesMessage(Message $msg) { $handledMsgCodes = [ Message::MSG_CALL, Message::MSG_CANCEL, Message::MSG_REGISTER, Message::MSG_UNREGISTER, Message::MSG_YIELD, Message::MSG_INTERRUPT ]; if (in_array($msg...
[ "public", "function", "handlesMessage", "(", "Message", "$", "msg", ")", "{", "$", "handledMsgCodes", "=", "[", "Message", "::", "MSG_CALL", ",", "Message", "::", "MSG_CANCEL", ",", "Message", "::", "MSG_REGISTER", ",", "Message", "::", "MSG_UNREGISTER", ",", ...
Returns true if this role handles this message. @param \Thruway\Message\Message $msg @return boolean
[ "Returns", "true", "if", "this", "role", "handles", "this", "message", "." ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L525-L545
voryx/Thruway
src/Role/Dealer.php
Dealer.leave
public function leave(Session $session) { /* @var $procedure \Thruway\Procedure */ foreach ($this->procedures as $procedure) { $procedure->leave($session); } foreach ($this->callInvocationIndex as $call) { if ($session->getSessionId() === $call->getCallerSess...
php
public function leave(Session $session) { /* @var $procedure \Thruway\Procedure */ foreach ($this->procedures as $procedure) { $procedure->leave($session); } foreach ($this->callInvocationIndex as $call) { if ($session->getSessionId() === $call->getCallerSess...
[ "public", "function", "leave", "(", "Session", "$", "session", ")", "{", "/* @var $procedure \\Thruway\\Procedure */", "foreach", "(", "$", "this", "->", "procedures", "as", "$", "procedure", ")", "{", "$", "procedure", "->", "leave", "(", "$", "session", ")",...
process leave session @param \Thruway\Session $session
[ "process", "leave", "session" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L552-L570
voryx/Thruway
src/Role/Dealer.php
Dealer.managerGetRegistrations
public function managerGetRegistrations() { $theRegistrations = []; /* @var $procedure \Thruway\Procedure */ foreach ($this->procedures as $procedure) { /* @var $registration \Thruway\Registration */ foreach ($procedure->getRegistrations() as $registration) { ...
php
public function managerGetRegistrations() { $theRegistrations = []; /* @var $procedure \Thruway\Procedure */ foreach ($this->procedures as $procedure) { /* @var $registration \Thruway\Registration */ foreach ($procedure->getRegistrations() as $registration) { ...
[ "public", "function", "managerGetRegistrations", "(", ")", "{", "$", "theRegistrations", "=", "[", "]", ";", "/* @var $procedure \\Thruway\\Procedure */", "foreach", "(", "$", "this", "->", "procedures", "as", "$", "procedure", ")", "{", "/* @var $registration \\Thruw...
Get list registrations todo: this may be used by testing @return array
[ "Get", "list", "registrations" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Role/Dealer.php#L579-L597
voryx/Thruway
src/Realm.php
Realm.processSendWelcome
private function processSendWelcome(Session $session, WelcomeMessage $msg) { $helloDetails = $session->getHelloMessage()->getDetails(); if (is_object($helloDetails) && isset($helloDetails->roles) && is_object($helloDetails->roles)) { $session->setRoleFeatures($helloDetails->roles); ...
php
private function processSendWelcome(Session $session, WelcomeMessage $msg) { $helloDetails = $session->getHelloMessage()->getDetails(); if (is_object($helloDetails) && isset($helloDetails->roles) && is_object($helloDetails->roles)) { $session->setRoleFeatures($helloDetails->roles); ...
[ "private", "function", "processSendWelcome", "(", "Session", "$", "session", ",", "WelcomeMessage", "$", "msg", ")", "{", "$", "helloDetails", "=", "$", "session", "->", "getHelloMessage", "(", ")", "->", "getDetails", "(", ")", ";", "if", "(", "is_object", ...
Process HelloMessage @param \Thruway\Session $session @param \Thruway\Message\WelcomeMessage $msg @throws InvalidRealmNameException
[ "Process", "HelloMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Realm.php#L157-L177
voryx/Thruway
src/Realm.php
Realm.processAuthenticate
private function processAuthenticate(Session $session, AuthenticateMessage $msg) { $session->abort(new \stdClass(), 'thruway.error.internal'); Logger::error($this, 'Authenticate sent to realm without auth manager.'); }
php
private function processAuthenticate(Session $session, AuthenticateMessage $msg) { $session->abort(new \stdClass(), 'thruway.error.internal'); Logger::error($this, 'Authenticate sent to realm without auth manager.'); }
[ "private", "function", "processAuthenticate", "(", "Session", "$", "session", ",", "AuthenticateMessage", "$", "msg", ")", "{", "$", "session", "->", "abort", "(", "new", "\\", "stdClass", "(", ")", ",", "'thruway.error.internal'", ")", ";", "Logger", "::", ...
Process AuthenticateMessage @param \Thruway\Session $session @param \Thruway\Message\AuthenticateMessage $msg
[ "Process", "AuthenticateMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Realm.php#L186-L190
voryx/Thruway
src/Realm.php
Realm.managerGetSessions
public function managerGetSessions() { $theSessions = []; /* @var $session \Thruway\Session */ foreach ($this->sessions as $session) { $sessionRealm = null; // just in case the session is not in a realm yet if ($session->getRealm() !== null) { ...
php
public function managerGetSessions() { $theSessions = []; /* @var $session \Thruway\Session */ foreach ($this->sessions as $session) { $sessionRealm = null; // just in case the session is not in a realm yet if ($session->getRealm() !== null) { ...
[ "public", "function", "managerGetSessions", "(", ")", "{", "$", "theSessions", "=", "[", "]", ";", "/* @var $session \\Thruway\\Session */", "foreach", "(", "$", "this", "->", "sessions", "as", "$", "session", ")", "{", "$", "sessionRealm", "=", "null", ";", ...
Get list sessions todo: this is used by some tests - is leftover from the old manager stuff @return array
[ "Get", "list", "sessions" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Realm.php#L199-L233
voryx/Thruway
src/Realm.php
Realm.leave
public function leave(Session $session) { Logger::debug($this, "Leaving realm {$session->getRealm()->getRealmName()}"); $key = array_search($session, $this->sessions, true); if ($key !== false) { array_splice($this->sessions, $key, 1); } }
php
public function leave(Session $session) { Logger::debug($this, "Leaving realm {$session->getRealm()->getRealmName()}"); $key = array_search($session, $this->sessions, true); if ($key !== false) { array_splice($this->sessions, $key, 1); } }
[ "public", "function", "leave", "(", "Session", "$", "session", ")", "{", "Logger", "::", "debug", "(", "$", "this", ",", "\"Leaving realm {$session->getRealm()->getRealmName()}\"", ")", ";", "$", "key", "=", "array_search", "(", "$", "session", ",", "$", "this...
Process on session leave @param \Thruway\Session $session
[ "Process", "on", "session", "leave" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Realm.php#L250-L259
voryx/Thruway
src/Realm.php
Realm.publishMeta
public function publishMeta($topicName, $arguments, $argumentsKw = null, $options = null) { if ($this->metaSession === null) { // setup a new metaSession $s = new Session(new DummyTransport()); $this->metaSession = $s; } $messageEvent = ne...
php
public function publishMeta($topicName, $arguments, $argumentsKw = null, $options = null) { if ($this->metaSession === null) { // setup a new metaSession $s = new Session(new DummyTransport()); $this->metaSession = $s; } $messageEvent = ne...
[ "public", "function", "publishMeta", "(", "$", "topicName", ",", "$", "arguments", ",", "$", "argumentsKw", "=", "null", ",", "$", "options", "=", "null", ")", "{", "if", "(", "$", "this", "->", "metaSession", "===", "null", ")", "{", "// setup a new met...
Publish meta @param string $topicName @param mixed $arguments @param mixed $argumentsKw @param mixed $options
[ "Publish", "meta" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Realm.php#L299-L316
voryx/Thruway
src/Subscription/StateHandlerRegistry.php
StateHandlerRegistry.initModule
public function initModule(RouterInterface $router, LoopInterface $loop) { parent::initModule($router, $loop); $this->routerRealm = $router->getRealmManager()->getRealm($this->getRealm()); $this->broker = $this->routerRealm->getBroker(); $this->broker->setStateHandlerRegistry($...
php
public function initModule(RouterInterface $router, LoopInterface $loop) { parent::initModule($router, $loop); $this->routerRealm = $router->getRealmManager()->getRealm($this->getRealm()); $this->broker = $this->routerRealm->getBroker(); $this->broker->setStateHandlerRegistry($...
[ "public", "function", "initModule", "(", "RouterInterface", "$", "router", ",", "LoopInterface", "$", "loop", ")", "{", "parent", "::", "initModule", "(", "$", "router", ",", "$", "loop", ")", ";", "$", "this", "->", "routerRealm", "=", "$", "router", "-...
Gets called when the module is initialized in the router @inheritdoc
[ "Gets", "called", "when", "the", "module", "is", "initialized", "in", "the", "router" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Subscription/StateHandlerRegistry.php#L62-L69
voryx/Thruway
src/Subscription/StateHandlerRegistry.php
StateHandlerRegistry.onSessionStart
public function onSessionStart($session, $transport) { $promises = []; $promises[] = $session->register('add_state_handler', [$this, "addStateHandler"]); $promises[] = $session->register('remove_state_handler', [$this, "removeStateHandler"]); $pAll = \React\Promise\all($promises);...
php
public function onSessionStart($session, $transport) { $promises = []; $promises[] = $session->register('add_state_handler', [$this, "addStateHandler"]); $promises[] = $session->register('remove_state_handler', [$this, "removeStateHandler"]); $pAll = \React\Promise\all($promises);...
[ "public", "function", "onSessionStart", "(", "$", "session", ",", "$", "transport", ")", "{", "$", "promises", "=", "[", "]", ";", "$", "promises", "[", "]", "=", "$", "session", "->", "register", "(", "'add_state_handler'", ",", "[", "$", "this", ",",...
Handles session started @param \Thruway\ClientSession $session @param \Thruway\Transport\TransportProviderInterface $transport
[ "Handles", "session", "started" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Subscription/StateHandlerRegistry.php#L77-L93
voryx/Thruway
src/Subscription/StateHandlerRegistry.php
StateHandlerRegistry.setupStateHandlerRegistration
private function setupStateHandlerRegistration(SubscriptionGroup $subscriptionGroup) { /** @var StateHandlerRegistration $stateHandlerRegistration */ foreach ($this->stateHandlerRegistrations as $stateHandlerRegistration) { if ($stateHandlerRegistration->handlesStateFor($subscriptionGrou...
php
private function setupStateHandlerRegistration(SubscriptionGroup $subscriptionGroup) { /** @var StateHandlerRegistration $stateHandlerRegistration */ foreach ($this->stateHandlerRegistrations as $stateHandlerRegistration) { if ($stateHandlerRegistration->handlesStateFor($subscriptionGrou...
[ "private", "function", "setupStateHandlerRegistration", "(", "SubscriptionGroup", "$", "subscriptionGroup", ")", "{", "/** @var StateHandlerRegistration $stateHandlerRegistration */", "foreach", "(", "$", "this", "->", "stateHandlerRegistrations", "as", "$", "stateHandlerRegistra...
Called when we need to setup a registration If there is a registration that works - then we set the handler Otherwise, we set it to null @param SubscriptionGroup $subscriptionGroup
[ "Called", "when", "we", "need", "to", "setup", "a", "registration", "If", "there", "is", "a", "registration", "that", "works", "-", "then", "we", "set", "the", "handler", "Otherwise", "we", "set", "it", "to", "null" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Subscription/StateHandlerRegistry.php#L180-L190
voryx/Thruway
src/Authentication/AbstractAuthProviderClient.php
AbstractAuthProviderClient.onSessionStart
public function onSessionStart($session, $transport) { $session->register( "thruway.auth.{$this->getMethodName()}.onhello", [$this, 'processHello'], ['replace_orphaned_session' => 'yes'] ) ->then(function () use ($session) { $session->r...
php
public function onSessionStart($session, $transport) { $session->register( "thruway.auth.{$this->getMethodName()}.onhello", [$this, 'processHello'], ['replace_orphaned_session' => 'yes'] ) ->then(function () use ($session) { $session->r...
[ "public", "function", "onSessionStart", "(", "$", "session", ",", "$", "transport", ")", "{", "$", "session", "->", "register", "(", "\"thruway.auth.{$this->getMethodName()}.onhello\"", ",", "[", "$", "this", ",", "'processHello'", "]", ",", "[", "'replace_orphane...
Handles session start @param \Thruway\ClientSession $session @param \Thruway\Transport\TransportProviderInterface $transport
[ "Handles", "session", "start" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AbstractAuthProviderClient.php#L60-L89
voryx/Thruway
src/Authentication/AbstractAuthProviderClient.php
AbstractAuthProviderClient.preProcessAuthenticate
public function preProcessAuthenticate(array $args) { $args = $args[0]; $signature = isset($args->signature) ? $args->signature : null; $extra = isset($args->extra) ? $args->extra : null; if (!$signature) { return ['ERROR']; } return $this->pro...
php
public function preProcessAuthenticate(array $args) { $args = $args[0]; $signature = isset($args->signature) ? $args->signature : null; $extra = isset($args->extra) ? $args->extra : null; if (!$signature) { return ['ERROR']; } return $this->pro...
[ "public", "function", "preProcessAuthenticate", "(", "array", "$", "args", ")", "{", "$", "args", "=", "$", "args", "[", "0", "]", ";", "$", "signature", "=", "isset", "(", "$", "args", "->", "signature", ")", "?", "$", "args", "->", "signature", ":"...
Pre process AuthenticateMessage Extract and validate arguments @param array $args @return array
[ "Pre", "process", "AuthenticateMessage", "Extract", "and", "validate", "arguments" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AbstractAuthProviderClient.php#L98-L110
voryx/Thruway
Examples/Authentication/WampCra/UserDb.php
UserDb.add
function add($userName, $password, $salt = null) { if ($salt !== null) { $key = \Thruway\Common\Utils::getDerivedKey($password, $salt); } else { $key = $password; } $this->users[$userName] = ["authid" => $userName, "key" => $key, "salt" => $salt]; }
php
function add($userName, $password, $salt = null) { if ($salt !== null) { $key = \Thruway\Common\Utils::getDerivedKey($password, $salt); } else { $key = $password; } $this->users[$userName] = ["authid" => $userName, "key" => $key, "salt" => $salt]; }
[ "function", "add", "(", "$", "userName", ",", "$", "password", ",", "$", "salt", "=", "null", ")", "{", "if", "(", "$", "salt", "!==", "null", ")", "{", "$", "key", "=", "\\", "Thruway", "\\", "Common", "\\", "Utils", "::", "getDerivedKey", "(", ...
Add new user @param string $userName @param string $password @param string $salt
[ "Add", "new", "user" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/WampCra/UserDb.php#L30-L39
voryx/Thruway
Examples/Authentication/WampCra/UserDb.php
UserDb.get
function get($authId) { if (isset($this->users[$authId])) { return $this->users[$authId]; } else { return false; } }
php
function get($authId) { if (isset($this->users[$authId])) { return $this->users[$authId]; } else { return false; } }
[ "function", "get", "(", "$", "authId", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "users", "[", "$", "authId", "]", ")", ")", "{", "return", "$", "this", "->", "users", "[", "$", "authId", "]", ";", "}", "else", "{", "return", "false...
Get user by username @param string $authId Username @return boolean
[ "Get", "user", "by", "username" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/WampCra/UserDb.php#L47-L54
voryx/Thruway
src/Subscription/SubscriptionGroup.php
SubscriptionGroup.sendEventMessage
private function sendEventMessage(Session $session, PublishMessage $msg, Subscription $subscription) { $sessionId = $subscription->getSession()->getSessionId(); $authroles = []; $authid = ''; $authenticationDetails = $subscription->getSession()-...
php
private function sendEventMessage(Session $session, PublishMessage $msg, Subscription $subscription) { $sessionId = $subscription->getSession()->getSessionId(); $authroles = []; $authid = ''; $authenticationDetails = $subscription->getSession()-...
[ "private", "function", "sendEventMessage", "(", "Session", "$", "session", ",", "PublishMessage", "$", "msg", ",", "Subscription", "$", "subscription", ")", "{", "$", "sessionId", "=", "$", "subscription", "->", "getSession", "(", ")", "->", "getSessionId", "(...
Send an Event Message for each subscription @param Session $session @param PublishMessage $msg @param Subscription $subscription
[ "Send", "an", "Event", "Message", "for", "each", "subscription" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Subscription/SubscriptionGroup.php#L112-L138
voryx/Thruway
src/Subscription/Subscription.php
Subscription.createSubscriptionFromSubscribeMessage
public static function createSubscriptionFromSubscribeMessage(Session $session, SubscribeMessage $msg) { $options = $msg->getOptions(); $subscription = new Subscription($msg->getTopicName(), $session, $options); if (isset($options->disclose_publisher) && $options->disclose_publisher ==...
php
public static function createSubscriptionFromSubscribeMessage(Session $session, SubscribeMessage $msg) { $options = $msg->getOptions(); $subscription = new Subscription($msg->getTopicName(), $session, $options); if (isset($options->disclose_publisher) && $options->disclose_publisher ==...
[ "public", "static", "function", "createSubscriptionFromSubscribeMessage", "(", "Session", "$", "session", ",", "SubscribeMessage", "$", "msg", ")", "{", "$", "options", "=", "$", "msg", "->", "getOptions", "(", ")", ";", "$", "subscription", "=", "new", "Subsc...
Create Subscription from SubscribeMessage @param Session $session @param SubscribeMessage $msg @return Subscription
[ "Create", "Subscription", "from", "SubscribeMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Subscription/Subscription.php#L81-L91
voryx/Thruway
Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php
GithubCallbackAuthProvider.processAuthenticate
public function processAuthenticate($state, $extra = null) { if (!isset($state)) { return ["FAILURE"]; } //If we don't already have a promise for this state, create one if (!isset($this->promises[$state])) { $deferred = new Deferred(); ...
php
public function processAuthenticate($state, $extra = null) { if (!isset($state)) { return ["FAILURE"]; } //If we don't already have a promise for this state, create one if (!isset($this->promises[$state])) { $deferred = new Deferred(); ...
[ "public", "function", "processAuthenticate", "(", "$", "state", ",", "$", "extra", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "state", ")", ")", "{", "return", "[", "\"FAILURE\"", "]", ";", "}", "//If we don't already have a promise for this s...
Process authenticate @param mixed $state @param mixed $extra @return array
[ "Process", "authenticate" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php#L71-L86
voryx/Thruway
Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php
GithubCallbackAuthProvider.onHttpRequest
public function onHttpRequest(\React\Http\Request $request, $response) { if ($request->getPath() !== "/auth/github/callback") { $response->writeHead(404, ['Content-Type' => 'text/plain']); $response->end("Not Found"); return; } $query = $request->getQuery...
php
public function onHttpRequest(\React\Http\Request $request, $response) { if ($request->getPath() !== "/auth/github/callback") { $response->writeHead(404, ['Content-Type' => 'text/plain']); $response->end("Not Found"); return; } $query = $request->getQuery...
[ "public", "function", "onHttpRequest", "(", "\\", "React", "\\", "Http", "\\", "Request", "$", "request", ",", "$", "response", ")", "{", "if", "(", "$", "request", "->", "getPath", "(", ")", "!==", "\"/auth/github/callback\"", ")", "{", "$", "response", ...
Handle process on http request @param \React\Http\Request $request @param \React\Http\Request $response
[ "Handle", "process", "on", "http", "request" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php#L105-L139
voryx/Thruway
Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php
GithubCallbackAuthProvider.getAccessToken
private function getAccessToken($code) { $data = [ "client_id" => $this->clientId, "client_secret" => $this->clientSecret, "code" => $code ]; $data_string = json_encode($data); //This needs to be replaced with Guzzle or someth...
php
private function getAccessToken($code) { $data = [ "client_id" => $this->clientId, "client_secret" => $this->clientSecret, "code" => $code ]; $data_string = json_encode($data); //This needs to be replaced with Guzzle or someth...
[ "private", "function", "getAccessToken", "(", "$", "code", ")", "{", "$", "data", "=", "[", "\"client_id\"", "=>", "$", "this", "->", "clientId", ",", "\"client_secret\"", "=>", "$", "this", "->", "clientSecret", ",", "\"code\"", "=>", "$", "code", "]", ...
Get access token from code @param string $code @return string|boolean
[ "Get", "access", "token", "from", "code" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php#L147-L179
voryx/Thruway
Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php
GithubCallbackAuthProvider.getEmails
private function getEmails($accessToken) { $ch = curl_init("https://api.github.com/user/emails?access_token={$accessToken}"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( $ch, CURLOPT_HTTPHEADER,...
php
private function getEmails($accessToken) { $ch = curl_init("https://api.github.com/user/emails?access_token={$accessToken}"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( $ch, CURLOPT_HTTPHEADER,...
[ "private", "function", "getEmails", "(", "$", "accessToken", ")", "{", "$", "ch", "=", "curl_init", "(", "\"https://api.github.com/user/emails?access_token={$accessToken}\"", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_CUSTOMREQUEST", ",", "\"GET\"", ")", ...
Get list email from accesstokens @param string $accessToken @return mixed
[ "Get", "list", "email", "from", "accesstokens" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/GithubCallbackServer/GithubCallbackAuthProvider.php#L187-L203
voryx/Thruway
Examples/RawSocket/RawSocketClient.php
RawSocketClient.onSessionStart
public function onSessionStart($session, $transport) { $session->register('com.example.add2', [$this, 'add2']) ->then(function () use ($session) { echo "Registered RPC\n"; $session->call('com.example.add2', [2, 3]) ->then(function ($res) { ...
php
public function onSessionStart($session, $transport) { $session->register('com.example.add2', [$this, 'add2']) ->then(function () use ($session) { echo "Registered RPC\n"; $session->call('com.example.add2', [2, 3]) ->then(function ($res) { ...
[ "public", "function", "onSessionStart", "(", "$", "session", ",", "$", "transport", ")", "{", "$", "session", "->", "register", "(", "'com.example.add2'", ",", "[", "$", "this", ",", "'add2'", "]", ")", "->", "then", "(", "function", "(", ")", "use", "...
Handle on session start @param \Thruway\ClientSession $session @param \Thruway\Transport\TransportInterface $transport
[ "Handle", "on", "session", "start" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/RawSocket/RawSocketClient.php#L14-L28
voryx/Thruway
Examples/100Clients/CallingClient.php
CallingClient.onSessionStart
public function onSessionStart($session, $transport) { $this->thePromise->then(function () use ($session) { $session->call('com.example.thefunction0', []) ->then(function ($res) { echo "Done.\n"; exit; }); }); }
php
public function onSessionStart($session, $transport) { $this->thePromise->then(function () use ($session) { $session->call('com.example.thefunction0', []) ->then(function ($res) { echo "Done.\n"; exit; }); }); }
[ "public", "function", "onSessionStart", "(", "$", "session", ",", "$", "transport", ")", "{", "$", "this", "->", "thePromise", "->", "then", "(", "function", "(", ")", "use", "(", "$", "session", ")", "{", "$", "session", "->", "call", "(", "'com.examp...
Handle on session start @param \Thruway\ClientSession $session @param \Thruway\Transport\TransportInterface $transport
[ "Handle", "on", "session", "start" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/100Clients/CallingClient.php#L33-L42
voryx/Thruway
src/Authentication/WampCraAuthProvider.php
WampCraAuthProvider.processHello
public function processHello(array $args) { $helloMsg = array_shift($args); $sessionInfo = array_shift($args); if (!is_array($helloMsg)) { return ['ERROR']; } if (!is_object($sessionInfo)) { return ['ERROR']; } $helloMsg = Message...
php
public function processHello(array $args) { $helloMsg = array_shift($args); $sessionInfo = array_shift($args); if (!is_array($helloMsg)) { return ['ERROR']; } if (!is_object($sessionInfo)) { return ['ERROR']; } $helloMsg = Message...
[ "public", "function", "processHello", "(", "array", "$", "args", ")", "{", "$", "helloMsg", "=", "array_shift", "(", "$", "args", ")", ";", "$", "sessionInfo", "=", "array_shift", "(", "$", "args", ")", ";", "if", "(", "!", "is_array", "(", "$", "hel...
The arguments given by the server are the actual hello message ($args[0]) and some session information ($args[1]) The session information is an associative array that contains the sessionId and realm @param array $args @return array
[ "The", "arguments", "given", "by", "the", "server", "are", "the", "actual", "hello", "message", "(", "$args", "[", "0", "]", ")", "and", "some", "session", "information", "(", "$args", "[", "1", "]", ")" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/WampCraAuthProvider.php#L38-L110
voryx/Thruway
src/Authentication/WampCraAuthProvider.php
WampCraAuthProvider.processAuthenticate
public function processAuthenticate($signature, $extra = null) { $challenge = $this->getChallengeFromExtra($extra); if (!$challenge || !isset($challenge->authid) || !$this->getUserDb() instanceof WampCraUserDbInterface ) { return ['FAILURE']; } ...
php
public function processAuthenticate($signature, $extra = null) { $challenge = $this->getChallengeFromExtra($extra); if (!$challenge || !isset($challenge->authid) || !$this->getUserDb() instanceof WampCraUserDbInterface ) { return ['FAILURE']; } ...
[ "public", "function", "processAuthenticate", "(", "$", "signature", ",", "$", "extra", "=", "null", ")", "{", "$", "challenge", "=", "$", "this", "->", "getChallengeFromExtra", "(", "$", "extra", ")", ";", "if", "(", "!", "$", "challenge", "||", "!", "...
Process authenticate @param mixed $signature @param mixed $extra @return array
[ "Process", "authenticate" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/WampCraAuthProvider.php#L119-L154
voryx/Thruway
src/Authentication/WampCraAuthProvider.php
WampCraAuthProvider.getChallengeFromExtra
private function getChallengeFromExtra($extra) { return (is_object($extra) && isset($extra->challenge_details) && is_object($extra->challenge_details) && isset($extra->challenge_details->challenge)) ? json_decode($extra->challenge_details->challenge) ...
php
private function getChallengeFromExtra($extra) { return (is_object($extra) && isset($extra->challenge_details) && is_object($extra->challenge_details) && isset($extra->challenge_details->challenge)) ? json_decode($extra->challenge_details->challenge) ...
[ "private", "function", "getChallengeFromExtra", "(", "$", "extra", ")", "{", "return", "(", "is_object", "(", "$", "extra", ")", "&&", "isset", "(", "$", "extra", "->", "challenge_details", ")", "&&", "is_object", "(", "$", "extra", "->", "challenge_details"...
Gets the Challenge Message from the extra object @param $extra @return bool | \stdClass
[ "Gets", "the", "Challenge", "Message", "from", "the", "extra", "object" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/WampCraAuthProvider.php#L181-L189
voryx/Thruway
Examples/Authentication/Facebook/FacebookAuthProvider.php
FacebookAuthProvider.processAuthenticate
public function processAuthenticate($signature, $extra = null) { \Facebook\FacebookSession::setDefaultApplication($this->appId, $this->appSecret); $session = new \Facebook\FacebookSession($signature); $sessionInfo = $session->getSessionInfo(); //Make sure that we received a va...
php
public function processAuthenticate($signature, $extra = null) { \Facebook\FacebookSession::setDefaultApplication($this->appId, $this->appSecret); $session = new \Facebook\FacebookSession($signature); $sessionInfo = $session->getSessionInfo(); //Make sure that we received a va...
[ "public", "function", "processAuthenticate", "(", "$", "signature", ",", "$", "extra", "=", "null", ")", "{", "\\", "Facebook", "\\", "FacebookSession", "::", "setDefaultApplication", "(", "$", "this", "->", "appId", ",", "$", "this", "->", "appSecret", ")",...
process authenticate @param mixed $signature @param mixed $extra @return array
[ "process", "authenticate" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/Examples/Authentication/Facebook/FacebookAuthProvider.php#L56-L70
voryx/Thruway
src/Peer/Router.php
Router.start
public function start($runLoop = true) { Logger::info($this, 'Starting router'); if ($this->loop === null) { throw new \Exception('Loop is null'); } $this->started = true; $this->eventDispatcher->dispatch('router.start', new RouterStartEvent()); if ($ru...
php
public function start($runLoop = true) { Logger::info($this, 'Starting router'); if ($this->loop === null) { throw new \Exception('Loop is null'); } $this->started = true; $this->eventDispatcher->dispatch('router.start', new RouterStartEvent()); if ($ru...
[ "public", "function", "start", "(", "$", "runLoop", "=", "true", ")", "{", "Logger", "::", "info", "(", "$", "this", ",", "'Starting router'", ")", ";", "if", "(", "$", "this", "->", "loop", "===", "null", ")", "{", "throw", "new", "\\", "Exception",...
Start router @param bool $runLoop @throws \Exception
[ "Start", "router" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Peer/Router.php#L118-L133
voryx/Thruway
src/Peer/Router.php
Router.onClose
public function onClose(TransportInterface $transport) { Logger::debug($this, 'onClose from ' . json_encode($transport->getTransportDetails())); $this->sessions->detach($transport); }
php
public function onClose(TransportInterface $transport) { Logger::debug($this, 'onClose from ' . json_encode($transport->getTransportDetails())); $this->sessions->detach($transport); }
[ "public", "function", "onClose", "(", "TransportInterface", "$", "transport", ")", "{", "Logger", "::", "debug", "(", "$", "this", ",", "'onClose from '", ".", "json_encode", "(", "$", "transport", "->", "getTransportDetails", "(", ")", ")", ")", ";", "$", ...
Handle close transport @param \Thruway\Transport\TransportInterface $transport
[ "Handle", "close", "transport" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Peer/Router.php#L148-L153
voryx/Thruway
src/Peer/Router.php
Router.getSessionBySessionId
public function getSessionBySessionId($sessionId) { if (!is_scalar($sessionId)) { return false; } return isset($this->sessions[$sessionId]) ? $this->sessions[$sessionId] : false; }
php
public function getSessionBySessionId($sessionId) { if (!is_scalar($sessionId)) { return false; } return isset($this->sessions[$sessionId]) ? $this->sessions[$sessionId] : false; }
[ "public", "function", "getSessionBySessionId", "(", "$", "sessionId", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "sessionId", ")", ")", "{", "return", "false", ";", "}", "return", "isset", "(", "$", "this", "->", "sessions", "[", "$", "sessionId", ...
Get session by session ID @param int $sessionId @return \Thruway\Session|boolean
[ "Get", "session", "by", "session", "ID" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Peer/Router.php#L216-L223
voryx/Thruway
src/Peer/Router.php
Router.managerGetRealms
public function managerGetRealms() { $theRealms = []; foreach ($this->realmManager->getRealms() as $realm) { /* @var $realm \Thruway\Realm */ $theRealms[] = [ 'name' => $realm->getRealmName() ]; } return [$theRealms]; }
php
public function managerGetRealms() { $theRealms = []; foreach ($this->realmManager->getRealms() as $realm) { /* @var $realm \Thruway\Realm */ $theRealms[] = [ 'name' => $realm->getRealmName() ]; } return [$theRealms]; }
[ "public", "function", "managerGetRealms", "(", ")", "{", "$", "theRealms", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "realmManager", "->", "getRealms", "(", ")", "as", "$", "realm", ")", "{", "/* @var $realm \\Thruway\\Realm */", "$", "theRealms...
Get list realms @return array
[ "Get", "list", "realms" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Peer/Router.php#L302-L314
voryx/Thruway
src/Peer/Router.php
Router.registerModule
public function registerModule(RouterModuleInterface $module) { $module->initModule($this, $this->getLoop()); $this->eventDispatcher->addSubscriber($module); }
php
public function registerModule(RouterModuleInterface $module) { $module->initModule($this, $this->getLoop()); $this->eventDispatcher->addSubscriber($module); }
[ "public", "function", "registerModule", "(", "RouterModuleInterface", "$", "module", ")", "{", "$", "module", "->", "initModule", "(", "$", "this", ",", "$", "this", "->", "getLoop", "(", ")", ")", ";", "$", "this", "->", "eventDispatcher", "->", "addSubsc...
Registers a RouterModule @param RouterModuleInterface $module
[ "Registers", "a", "RouterModule" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Peer/Router.php#L321-L325
voryx/Thruway
src/Registration.php
Registration.createRegistrationFromRegisterMessage
public static function createRegistrationFromRegisterMessage(Session $session, RegisterMessage $msg) { $registration = new self($session, $msg->getProcedureName()); $options = $msg->getOptions(); if (isset($options->disclose_caller) && $options->disclose_caller === true) { ...
php
public static function createRegistrationFromRegisterMessage(Session $session, RegisterMessage $msg) { $registration = new self($session, $msg->getProcedureName()); $options = $msg->getOptions(); if (isset($options->disclose_caller) && $options->disclose_caller === true) { ...
[ "public", "static", "function", "createRegistrationFromRegisterMessage", "(", "Session", "$", "session", ",", "RegisterMessage", "$", "msg", ")", "{", "$", "registration", "=", "new", "self", "(", "$", "session", ",", "$", "msg", "->", "getProcedureName", "(", ...
Create Registration from RegisterMessage @param \Thruway\Session $session @param \Thruway\Message\RegisterMessage $msg @return \Thruway\Registration
[ "Create", "Registration", "from", "RegisterMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Registration.php#L138-L158
voryx/Thruway
src/Registration.php
Registration.processCall
public function processCall(Call $call) { if ($call->getRegistration() !== null) { throw new \Exception('Registration already set when asked to process call'); } $call->setRegistration($this); $this->calls[] = $call; $this->session->incPendingCallCount(); ...
php
public function processCall(Call $call) { if ($call->getRegistration() !== null) { throw new \Exception('Registration already set when asked to process call'); } $call->setRegistration($this); $this->calls[] = $call; $this->session->incPendingCallCount(); ...
[ "public", "function", "processCall", "(", "Call", "$", "call", ")", "{", "if", "(", "$", "call", "->", "getRegistration", "(", ")", "!==", "null", ")", "{", "throw", "new", "\\", "Exception", "(", "'Registration already set when asked to process call'", ")", "...
Process call @param Call $call @throws \Exception
[ "Process", "call" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Registration.php#L225-L247
voryx/Thruway
src/Registration.php
Registration.getCallByRequestId
public function getCallByRequestId($requestId) { /** @var Call $call */ foreach ($this->calls as $call) { if ($call->getInvocationMessage()->getRequestId() === $requestId) { return $call; } } return false; }
php
public function getCallByRequestId($requestId) { /** @var Call $call */ foreach ($this->calls as $call) { if ($call->getInvocationMessage()->getRequestId() === $requestId) { return $call; } } return false; }
[ "public", "function", "getCallByRequestId", "(", "$", "requestId", ")", "{", "/** @var Call $call */", "foreach", "(", "$", "this", "->", "calls", "as", "$", "call", ")", "{", "if", "(", "$", "call", "->", "getInvocationMessage", "(", ")", "->", "getRequestI...
Get call by request ID @param int $requestId @return boolean
[ "Get", "call", "by", "request", "ID" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Registration.php#L255-L265
voryx/Thruway
src/Registration.php
Registration.removeCall
public function removeCall($callToRemove) { /* @var $call \Thruway\Call */ foreach ($this->calls as $i => $call) { if ($callToRemove === $call) { array_splice($this->calls, $i, 1); $this->session->decPendingCallCount(); $callEnd = microtime...
php
public function removeCall($callToRemove) { /* @var $call \Thruway\Call */ foreach ($this->calls as $i => $call) { if ($callToRemove === $call) { array_splice($this->calls, $i, 1); $this->session->decPendingCallCount(); $callEnd = microtime...
[ "public", "function", "removeCall", "(", "$", "callToRemove", ")", "{", "/* @var $call \\Thruway\\Call */", "foreach", "(", "$", "this", "->", "calls", "as", "$", "i", "=>", "$", "call", ")", "{", "if", "(", "$", "callToRemove", "===", "$", "call", ")", ...
Remove call @param \Thruway\Call $callToRemove
[ "Remove", "call" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Registration.php#L272-L298
voryx/Thruway
src/Registration.php
Registration.errorAllPendingCalls
public function errorAllPendingCalls() { foreach ($this->calls as $call) { $call->getCallerSession()->sendMessage(ErrorMessage::createErrorMessageFromMessage($call->getCallMessage(), 'wamp.error.canceled')); } }
php
public function errorAllPendingCalls() { foreach ($this->calls as $call) { $call->getCallerSession()->sendMessage(ErrorMessage::createErrorMessageFromMessage($call->getCallMessage(), 'wamp.error.canceled')); } }
[ "public", "function", "errorAllPendingCalls", "(", ")", "{", "foreach", "(", "$", "this", "->", "calls", "as", "$", "call", ")", "{", "$", "call", "->", "getCallerSession", "(", ")", "->", "sendMessage", "(", "ErrorMessage", "::", "createErrorMessageFromMessag...
This will send error messages on all pending calls This is used when a session disconnects before completing a call
[ "This", "will", "send", "error", "messages", "on", "all", "pending", "calls", "This", "is", "used", "when", "a", "session", "disconnects", "before", "completing", "a", "call" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Registration.php#L364-L369
voryx/Thruway
src/Registration.php
Registration.getStatistics
public function getStatistics() { return [ 'currentCallCount' => count($this->calls), 'registeredAt' => $this->registeredAt, 'invocationCount' => $this->invocationCount, 'invocationAverageTime' => $this->invocationAverageTime, ...
php
public function getStatistics() { return [ 'currentCallCount' => count($this->calls), 'registeredAt' => $this->registeredAt, 'invocationCount' => $this->invocationCount, 'invocationAverageTime' => $this->invocationAverageTime, ...
[ "public", "function", "getStatistics", "(", ")", "{", "return", "[", "'currentCallCount'", "=>", "count", "(", "$", "this", "->", "calls", ")", ",", "'registeredAt'", "=>", "$", "this", "->", "registeredAt", ",", "'invocationCount'", "=>", "$", "this", "->",...
Get registration statistics @return array
[ "Get", "registration", "statistics" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Registration.php#L376-L389
voryx/Thruway
src/Session.php
Session.sendMessage
public function sendMessage(Message $msg) { $this->lastOutboundActivity = microtime(true); $this->dispatchMessage($msg, 'Send'); }
php
public function sendMessage(Message $msg) { $this->lastOutboundActivity = microtime(true); $this->dispatchMessage($msg, 'Send'); }
[ "public", "function", "sendMessage", "(", "Message", "$", "msg", ")", "{", "$", "this", "->", "lastOutboundActivity", "=", "microtime", "(", "true", ")", ";", "$", "this", "->", "dispatchMessage", "(", "$", "msg", ",", "'Send'", ")", ";", "}" ]
Send message @param \Thruway\Message\Message $msg @return mixed|void
[ "Send", "message" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Session.php#L111-L115
voryx/Thruway
src/Session.php
Session.onClose
public function onClose() { if ($this->realm !== null) { // only send the leave metaevent if we actually made it into the realm if ($this->isAuthenticated()) { // metaevent $this->getRealm()->publishMeta('wamp.metaevent.session.on_leave', [$this->getMe...
php
public function onClose() { if ($this->realm !== null) { // only send the leave metaevent if we actually made it into the realm if ($this->isAuthenticated()) { // metaevent $this->getRealm()->publishMeta('wamp.metaevent.session.on_leave', [$this->getMe...
[ "public", "function", "onClose", "(", ")", "{", "if", "(", "$", "this", "->", "realm", "!==", "null", ")", "{", "// only send the leave metaevent if we actually made it into the realm", "if", "(", "$", "this", "->", "isAuthenticated", "(", ")", ")", "{", "// met...
Handle close session
[ "Handle", "close", "session" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Session.php#L129-L141
voryx/Thruway
src/Session.php
Session.setAuthenticated
public function setAuthenticated($authenticated) { // make sure the metaevent is only sent when changing from // not-authenticate to authenticated if ($authenticated && !$this->authenticated) { // metaevent $this->getRealm()->publishMeta('wamp.metaevent.session.on_joi...
php
public function setAuthenticated($authenticated) { // make sure the metaevent is only sent when changing from // not-authenticate to authenticated if ($authenticated && !$this->authenticated) { // metaevent $this->getRealm()->publishMeta('wamp.metaevent.session.on_joi...
[ "public", "function", "setAuthenticated", "(", "$", "authenticated", ")", "{", "// make sure the metaevent is only sent when changing from", "// not-authenticate to authenticated", "if", "(", "$", "authenticated", "&&", "!", "$", "this", "->", "authenticated", ")", "{", "...
Set authenticated state @param boolean $authenticated
[ "Set", "authenticated", "state" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Session.php#L197-L207
voryx/Thruway
src/Session.php
Session.getMetaInfo
public function getMetaInfo() { if ($this->getAuthenticationDetails() instanceof AuthenticationDetails) { $authId = $this->getAuthenticationDetails()->getAuthId(); $authMethod = $this->getAuthenticationDetails()->getAuthMethod(); $authRole = $this->getAuthentication...
php
public function getMetaInfo() { if ($this->getAuthenticationDetails() instanceof AuthenticationDetails) { $authId = $this->getAuthenticationDetails()->getAuthId(); $authMethod = $this->getAuthenticationDetails()->getAuthMethod(); $authRole = $this->getAuthentication...
[ "public", "function", "getMetaInfo", "(", ")", "{", "if", "(", "$", "this", "->", "getAuthenticationDetails", "(", ")", "instanceof", "AuthenticationDetails", ")", "{", "$", "authId", "=", "$", "this", "->", "getAuthenticationDetails", "(", ")", "->", "getAuth...
Get meta info @return array
[ "Get", "meta", "info" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Session.php#L214-L238
voryx/Thruway
src/Authentication/AuthenticationManager.php
AuthenticationManager.onSessionStart
public function onSessionStart($session, $transport) { $session->register('thruway.auth.registermethod', [$this, 'registerAuthMethod'], ['disclose_caller' => true]) ->then( function () { $this->setReady(true); }, function () { ...
php
public function onSessionStart($session, $transport) { $session->register('thruway.auth.registermethod', [$this, 'registerAuthMethod'], ['disclose_caller' => true]) ->then( function () { $this->setReady(true); }, function () { ...
[ "public", "function", "onSessionStart", "(", "$", "session", ",", "$", "transport", ")", "{", "$", "session", "->", "register", "(", "'thruway.auth.registermethod'", ",", "[", "$", "this", ",", "'registerAuthMethod'", "]", ",", "[", "'disclose_caller'", "=>", ...
Handles session started @param \Thruway\ClientSession $session @param \Thruway\Transport\TransportProviderInterface $transport
[ "Handles", "session", "started" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AuthenticationManager.php#L114-L126
voryx/Thruway
src/Authentication/AuthenticationManager.php
AuthenticationManager.processMessage
private function processMessage(Realm $realm, Session $session, Message $msg) { if ($session->isAuthenticated()) { throw new \Exception('Message sent to authentication manager for already authenticated session.'); } // trusted transports do not need any authentication if...
php
private function processMessage(Realm $realm, Session $session, Message $msg) { if ($session->isAuthenticated()) { throw new \Exception('Message sent to authentication manager for already authenticated session.'); } // trusted transports do not need any authentication if...
[ "private", "function", "processMessage", "(", "Realm", "$", "realm", ",", "Session", "$", "session", ",", "Message", "$", "msg", ")", "{", "if", "(", "$", "session", "->", "isAuthenticated", "(", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "...
Handles all messages for authentication (Hello and Authenticate) This is called by the Realm to handle authentication @param \Thruway\Realm $realm @param \Thruway\Session $session @param \Thruway\Message\Message $msg @throws \Exception
[ "Handles", "all", "messages", "for", "authentication", "(", "Hello", "and", "Authenticate", ")", "This", "is", "called", "by", "the", "Realm", "to", "handle", "authentication" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AuthenticationManager.php#L137-L196
voryx/Thruway
src/Authentication/AuthenticationManager.php
AuthenticationManager.handleHelloMessage
public function handleHelloMessage(Realm $realm, Session $session, HelloMessage $msg) { $requestedMethods = $msg->getAuthMethods(); $sentMessage = false; // Go through the authmethods and try to send a response message foreach ($this->authMethods as $authMethod => $authMethodIn...
php
public function handleHelloMessage(Realm $realm, Session $session, HelloMessage $msg) { $requestedMethods = $msg->getAuthMethods(); $sentMessage = false; // Go through the authmethods and try to send a response message foreach ($this->authMethods as $authMethod => $authMethodIn...
[ "public", "function", "handleHelloMessage", "(", "Realm", "$", "realm", ",", "Session", "$", "session", ",", "HelloMessage", "$", "msg", ")", "{", "$", "requestedMethods", "=", "$", "msg", "->", "getAuthMethods", "(", ")", ";", "$", "sentMessage", "=", "fa...
Handle HelloMessage @param \Thruway\Realm $realm @param \Thruway\Session $session @param \Thruway\Message\HelloMessage $msg
[ "Handle", "HelloMessage" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AuthenticationManager.php#L205-L241
voryx/Thruway
src/Authentication/AuthenticationManager.php
AuthenticationManager.onHelloAuthHandler
private function onHelloAuthHandler($authMethod, $authMethodInfo, Realm $realm, Session $session, HelloMessage $msg) { $authDetails = new AuthenticationDetails(); $authDetails->setAuthMethod($authMethod); $helloDetails = $msg->getDetails(); if (isset($helloDetails->authid)) { ...
php
private function onHelloAuthHandler($authMethod, $authMethodInfo, Realm $realm, Session $session, HelloMessage $msg) { $authDetails = new AuthenticationDetails(); $authDetails->setAuthMethod($authMethod); $helloDetails = $msg->getDetails(); if (isset($helloDetails->authid)) { ...
[ "private", "function", "onHelloAuthHandler", "(", "$", "authMethod", ",", "$", "authMethodInfo", ",", "Realm", "$", "realm", ",", "Session", "$", "session", ",", "HelloMessage", "$", "msg", ")", "{", "$", "authDetails", "=", "new", "AuthenticationDetails", "("...
Call the RPC URI that has been registered to handle Authentication Hello Messages @param $authMethod @param $authMethodInfo @param Realm $realm @param Session $session @param HelloMessage $msg
[ "Call", "the", "RPC", "URI", "that", "has", "been", "registered", "to", "handle", "Authentication", "Hello", "Messages" ]
train
https://github.com/voryx/Thruway/blob/b86c0cddbec8fb69ff583e093d4cc169011fcbfb/src/Authentication/AuthenticationManager.php#L252-L319