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 |
|---|---|---|---|---|---|---|---|---|---|---|
laravel/envoy | src/Console/RunCommand.php | RunCommand.fire | protected function fire()
{
$container = $this->loadTaskContainer();
$exitCode = 0;
foreach ($this->getTasks($container) as $task) {
$thisCode = $this->runTask($container, $task);
if (0 !== $thisCode) {
$exitCode = $thisCode;
}
... | php | protected function fire()
{
$container = $this->loadTaskContainer();
$exitCode = 0;
foreach ($this->getTasks($container) as $task) {
$thisCode = $this->runTask($container, $task);
if (0 !== $thisCode) {
$exitCode = $thisCode;
}
... | [
"protected",
"function",
"fire",
"(",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"loadTaskContainer",
"(",
")",
";",
"$",
"exitCode",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getTasks",
"(",
"$",
"container",
")",
"as",
"$",
"task"... | Execute the command.
@return int | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L58-L83 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.getTasks | protected function getTasks($container)
{
$tasks = [$task = $this->argument('task')];
if ($macro = $container->getMacro($task)) {
$tasks = $macro;
}
return $tasks;
} | php | protected function getTasks($container)
{
$tasks = [$task = $this->argument('task')];
if ($macro = $container->getMacro($task)) {
$tasks = $macro;
}
return $tasks;
} | [
"protected",
"function",
"getTasks",
"(",
"$",
"container",
")",
"{",
"$",
"tasks",
"=",
"[",
"$",
"task",
"=",
"$",
"this",
"->",
"argument",
"(",
"'task'",
")",
"]",
";",
"if",
"(",
"$",
"macro",
"=",
"$",
"container",
"->",
"getMacro",
"(",
"$",... | Get the tasks from the container based on user input.
@param \Laravel\Envoy\TaskContainer $container
@return array | [
"Get",
"the",
"tasks",
"from",
"the",
"container",
"based",
"on",
"user",
"input",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L91-L100 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.runTask | protected function runTask($container, $task)
{
$macroOptions = $container->getMacroOptions($this->argument('task'));
$confirm = $container->getTask($task, $macroOptions)->confirm;
if ($confirm && ! $this->confirmTaskWithUser($task, $confirm)) {
return;
}
if ((... | php | protected function runTask($container, $task)
{
$macroOptions = $container->getMacroOptions($this->argument('task'));
$confirm = $container->getTask($task, $macroOptions)->confirm;
if ($confirm && ! $this->confirmTaskWithUser($task, $confirm)) {
return;
}
if ((... | [
"protected",
"function",
"runTask",
"(",
"$",
"container",
",",
"$",
"task",
")",
"{",
"$",
"macroOptions",
"=",
"$",
"container",
"->",
"getMacroOptions",
"(",
"$",
"this",
"->",
"argument",
"(",
"'task'",
")",
")",
";",
"$",
"confirm",
"=",
"$",
"con... | Run the given task out of the container.
@param \Laravel\Envoy\TaskContainer $container
@param string $task
@return null|int|void | [
"Run",
"the",
"given",
"task",
"out",
"of",
"the",
"container",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L109-L130 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.runTaskOverSSH | protected function runTaskOverSSH(Task $task)
{
// If the pretending option has been set, we'll simply dump the script out to the command
// line so the developer can inspect it which is useful for just inspecting the script
// before it is actually run against these servers. Allows checking... | php | protected function runTaskOverSSH(Task $task)
{
// If the pretending option has been set, we'll simply dump the script out to the command
// line so the developer can inspect it which is useful for just inspecting the script
// before it is actually run against these servers. Allows checking... | [
"protected",
"function",
"runTaskOverSSH",
"(",
"Task",
"$",
"task",
")",
"{",
"// If the pretending option has been set, we'll simply dump the script out to the command",
"// line so the developer can inspect it which is useful for just inspecting the script",
"// before it is actually run ag... | Run the given task and return the exit code.
@param \Laravel\Envoy\Task $task
@return int | [
"Run",
"the",
"given",
"task",
"and",
"return",
"the",
"exit",
"code",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L138-L150 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.passToRemoteProcessor | protected function passToRemoteProcessor(Task $task)
{
return $this->getRemoteProcessor($task)->run($task, function ($type, $host, $line) {
if (starts_with($line, 'Warning: Permanently added ')) {
return;
}
$this->displayOutput($type, $host, $line);
... | php | protected function passToRemoteProcessor(Task $task)
{
return $this->getRemoteProcessor($task)->run($task, function ($type, $host, $line) {
if (starts_with($line, 'Warning: Permanently added ')) {
return;
}
$this->displayOutput($type, $host, $line);
... | [
"protected",
"function",
"passToRemoteProcessor",
"(",
"Task",
"$",
"task",
")",
"{",
"return",
"$",
"this",
"->",
"getRemoteProcessor",
"(",
"$",
"task",
")",
"->",
"run",
"(",
"$",
"task",
",",
"function",
"(",
"$",
"type",
",",
"$",
"host",
",",
"$"... | Run the given task and return the exit code.
@param \Laravel\Envoy\Task $task
@return int | [
"Run",
"the",
"given",
"task",
"and",
"return",
"the",
"exit",
"code",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L158-L167 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.displayOutput | protected function displayOutput($type, $host, $line)
{
$lines = explode("\n", $line);
foreach ($lines as $line) {
if (strlen(trim($line)) === 0) {
continue;
}
if ($type == Process::OUT) {
$this->output->write('<comment>['.$host.'... | php | protected function displayOutput($type, $host, $line)
{
$lines = explode("\n", $line);
foreach ($lines as $line) {
if (strlen(trim($line)) === 0) {
continue;
}
if ($type == Process::OUT) {
$this->output->write('<comment>['.$host.'... | [
"protected",
"function",
"displayOutput",
"(",
"$",
"type",
",",
"$",
"host",
",",
"$",
"line",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"line",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"... | Display the given output line.
@param int $type
@param string $host
@param string $line
@return void | [
"Display",
"the",
"given",
"output",
"line",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L177-L192 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.loadTaskContainer | protected function loadTaskContainer()
{
$path = $this->input->getOption('path');
$file = $this->input->getOption('conf');
if (! file_exists($envoyFile = $path)
&& ! file_exists($envoyFile = getcwd().'/'.$file)
&& ! file_exists($envoyFile .= '.blade.php')
) ... | php | protected function loadTaskContainer()
{
$path = $this->input->getOption('path');
$file = $this->input->getOption('conf');
if (! file_exists($envoyFile = $path)
&& ! file_exists($envoyFile = getcwd().'/'.$file)
&& ! file_exists($envoyFile .= '.blade.php')
) ... | [
"protected",
"function",
"loadTaskContainer",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"input",
"->",
"getOption",
"(",
"'path'",
")",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"input",
"->",
"getOption",
"(",
"'conf'",
")",
";",
"if",
"("... | Load the task container instance with the Envoy file.
@return \Laravel\Envoy\TaskContainer | [
"Load",
"the",
"task",
"container",
"instance",
"with",
"the",
"Envoy",
"file",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L199-L219 |
laravel/envoy | src/Console/RunCommand.php | RunCommand.getOptions | protected function getOptions()
{
$options = [];
// Here we will gather all of the command line options that have been specified with
// the double hyphens in front of their name. We will make these available to the
// Blade task file so they can be used in echo statements and other... | php | protected function getOptions()
{
$options = [];
// Here we will gather all of the command line options that have been specified with
// the double hyphens in front of their name. We will make these available to the
// Blade task file so they can be used in echo statements and other... | [
"protected",
"function",
"getOptions",
"(",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"// Here we will gather all of the command line options that have been specified with",
"// the double hyphens in front of their name. We will make these available to the",
"// Blade task file so th... | Gather the dynamic options for the command.
@return array | [
"Gather",
"the",
"dynamic",
"options",
"for",
"the",
"command",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/RunCommand.php#L226-L248 |
laravel/envoy | src/ConfigurationParser.php | ConfigurationParser.getConfiguredServer | protected function getConfiguredServer($host)
{
if ($config = $this->getSshConfig($this->getSystemUser())) {
return $config->findConfiguredHost($host);
}
} | php | protected function getConfiguredServer($host)
{
if ($config = $this->getSshConfig($this->getSystemUser())) {
return $config->findConfiguredHost($host);
}
} | [
"protected",
"function",
"getConfiguredServer",
"(",
"$",
"host",
")",
"{",
"if",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"getSshConfig",
"(",
"$",
"this",
"->",
"getSystemUser",
"(",
")",
")",
")",
"{",
"return",
"$",
"config",
"->",
"findConfigured... | Get the configured server from the SSH config.
@param string $host
@return string|null | [
"Get",
"the",
"configured",
"server",
"from",
"the",
"SSH",
"config",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/ConfigurationParser.php#L15-L20 |
laravel/envoy | src/ConfigurationParser.php | ConfigurationParser.getSshConfig | protected function getSshConfig($user)
{
if (file_exists($path = $this->getHomeDirectory($user).'/.ssh/config')) {
return SSHConfigFile::parse($path);
}
} | php | protected function getSshConfig($user)
{
if (file_exists($path = $this->getHomeDirectory($user).'/.ssh/config')) {
return SSHConfigFile::parse($path);
}
} | [
"protected",
"function",
"getSshConfig",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
"=",
"$",
"this",
"->",
"getHomeDirectory",
"(",
"$",
"user",
")",
".",
"'/.ssh/config'",
")",
")",
"{",
"return",
"SSHConfigFile",
"::",
"pa... | Get the SSH configuration file instance.
@param string $user
@return \Laravel\Envoy\SSHConfigFile|null | [
"Get",
"the",
"SSH",
"configuration",
"file",
"instance",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/ConfigurationParser.php#L28-L33 |
laravel/envoy | src/ConfigurationParser.php | ConfigurationParser.getHomeDirectory | protected function getHomeDirectory($user)
{
$system = strtolower(php_uname());
if (Str::contains($system, 'darwin')) {
return "/Users/{$user}";
} elseif (Str::contains($system, 'windows')) {
return "C:\\Users\\{$user}";
} elseif (Str::contains($system, 'linu... | php | protected function getHomeDirectory($user)
{
$system = strtolower(php_uname());
if (Str::contains($system, 'darwin')) {
return "/Users/{$user}";
} elseif (Str::contains($system, 'windows')) {
return "C:\\Users\\{$user}";
} elseif (Str::contains($system, 'linu... | [
"protected",
"function",
"getHomeDirectory",
"(",
"$",
"user",
")",
"{",
"$",
"system",
"=",
"strtolower",
"(",
"php_uname",
"(",
")",
")",
";",
"if",
"(",
"Str",
"::",
"contains",
"(",
"$",
"system",
",",
"'darwin'",
")",
")",
"{",
"return",
"\"/Users... | Get the home directory for the user based on OS.
@param string $user
@return string|null | [
"Get",
"the",
"home",
"directory",
"for",
"the",
"user",
"based",
"on",
"OS",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/ConfigurationParser.php#L41-L52 |
laravel/envoy | src/Slack.php | Slack.make | public static function make($hook, $channel = '', $message = null, $options = [])
{
return new static($hook, $channel, $message, $options);
} | php | public static function make($hook, $channel = '', $message = null, $options = [])
{
return new static($hook, $channel, $message, $options);
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"hook",
",",
"$",
"channel",
"=",
"''",
",",
"$",
"message",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"static",
"(",
"$",
"hook",
",",
"$",
"channel",
",",
"$",
... | Create a new Slack message instance.
@param string $hook
@param mixed $channel
@param string $message
@param array $options
@return \Laravel\Envoy\Slack | [
"Create",
"a",
"new",
"Slack",
"message",
"instance",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Slack.php#L44-L47 |
laravel/envoy | src/Slack.php | Slack.send | public function send()
{
$message = $this->message ?: ($this->task ? ucwords($this->getSystemUser()).' ran the ['.$this->task.'] task.' : ucwords($this->getSystemUser()).' ran a task.');
$payload = array_merge(['text' => $message, 'channel' => $this->channel], $this->options);
Request::pos... | php | public function send()
{
$message = $this->message ?: ($this->task ? ucwords($this->getSystemUser()).' ran the ['.$this->task.'] task.' : ucwords($this->getSystemUser()).' ran a task.');
$payload = array_merge(['text' => $message, 'channel' => $this->channel], $this->options);
Request::pos... | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"message",
"?",
":",
"(",
"$",
"this",
"->",
"task",
"?",
"ucwords",
"(",
"$",
"this",
"->",
"getSystemUser",
"(",
")",
")",
".",
"' ran the ['",
".",
"$",
"this",... | Send the Slack message.
@return void | [
"Send",
"the",
"Slack",
"message",
"."
] | train | https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Slack.php#L54-L61 |
googleapis/gax-php | src/RequestBuilder.php | RequestBuilder.getConfigsForUriTemplates | private function getConfigsForUriTemplates($config)
{
$configs = [$config];
if ($config['additionalBindings']) {
foreach ($config['additionalBindings'] as $additionalBinding) {
$configs[] = $additionalBinding + $config;
}
}
return $configs;
... | php | private function getConfigsForUriTemplates($config)
{
$configs = [$config];
if ($config['additionalBindings']) {
foreach ($config['additionalBindings'] as $additionalBinding) {
$configs[] = $additionalBinding + $config;
}
}
return $configs;
... | [
"private",
"function",
"getConfigsForUriTemplates",
"(",
"$",
"config",
")",
"{",
"$",
"configs",
"=",
"[",
"$",
"config",
"]",
";",
"if",
"(",
"$",
"config",
"[",
"'additionalBindings'",
"]",
")",
"{",
"foreach",
"(",
"$",
"config",
"[",
"'additionalBindi... | Create a list of all possible configs using the additionalBindings
@param array $config
@return array[] An array of configs | [
"Create",
"a",
"list",
"of",
"all",
"possible",
"configs",
"using",
"the",
"additionalBindings"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/RequestBuilder.php#L128-L139 |
googleapis/gax-php | src/RequestBuilder.php | RequestBuilder.tryRenderPathTemplate | private function tryRenderPathTemplate($uriTemplate, array $bindings)
{
$template = new AbsoluteResourceTemplate($uriTemplate);
try {
return $template->render($bindings);
} catch (ValidationException $e) {
return null;
}
} | php | private function tryRenderPathTemplate($uriTemplate, array $bindings)
{
$template = new AbsoluteResourceTemplate($uriTemplate);
try {
return $template->render($bindings);
} catch (ValidationException $e) {
return null;
}
} | [
"private",
"function",
"tryRenderPathTemplate",
"(",
"$",
"uriTemplate",
",",
"array",
"$",
"bindings",
")",
"{",
"$",
"template",
"=",
"new",
"AbsoluteResourceTemplate",
"(",
"$",
"uriTemplate",
")",
";",
"try",
"{",
"return",
"$",
"template",
"->",
"render",... | Try to render the resource name. The rendered resource name will always contain a leading '/'
@param $uriTemplate
@param array $bindings
@return null|string
@throws ValidationException | [
"Try",
"to",
"render",
"the",
"resource",
"name",
".",
"The",
"rendered",
"resource",
"name",
"will",
"always",
"contain",
"a",
"leading",
"/"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/RequestBuilder.php#L215-L224 |
googleapis/gax-php | src/CredentialsWrapper.php | CredentialsWrapper.build | public static function build(array $args = [])
{
$args += [
'keyFile' => null,
'scopes' => null,
'authHttpHandler' => null,
'enableCaching' => true,
'authCache' => null,
'authCacheOptions' => [],
... | php | public static function build(array $args = [])
{
$args += [
'keyFile' => null,
'scopes' => null,
'authHttpHandler' => null,
'enableCaching' => true,
'authCache' => null,
'authCacheOptions' => [],
... | [
"public",
"static",
"function",
"build",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"+=",
"[",
"'keyFile'",
"=>",
"null",
",",
"'scopes'",
"=>",
"null",
",",
"'authHttpHandler'",
"=>",
"null",
",",
"'enableCaching'",
"=>",
"true",
... | Factory method to create a CredentialsWrapper from an array of options.
@param array $args {
An array of optional arguments.
@type string|array $keyFile
Credentials to be used. Accepts either a path to a credentials file, or a decoded
credentials file as a PHP array. If this is not specified, application default
cred... | [
"Factory",
"method",
"to",
"create",
"a",
"CredentialsWrapper",
"from",
"an",
"array",
"of",
"options",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/CredentialsWrapper.php#L98-L137 |
googleapis/gax-php | src/Middleware/RetryMiddleware.php | RetryMiddleware.retry | private function retry(Call $call, array $options, $status)
{
$delayMult = $this->retrySettings->getRetryDelayMultiplier();
$maxDelayMs = $this->retrySettings->getMaxRetryDelayMillis();
$timeoutMult = $this->retrySettings->getRpcTimeoutMultiplier();
$maxTimeoutMs = $this->retrySettin... | php | private function retry(Call $call, array $options, $status)
{
$delayMult = $this->retrySettings->getRetryDelayMultiplier();
$maxDelayMs = $this->retrySettings->getMaxRetryDelayMillis();
$timeoutMult = $this->retrySettings->getRpcTimeoutMultiplier();
$maxTimeoutMs = $this->retrySettin... | [
"private",
"function",
"retry",
"(",
"Call",
"$",
"call",
",",
"array",
"$",
"options",
",",
"$",
"status",
")",
"{",
"$",
"delayMult",
"=",
"$",
"this",
"->",
"retrySettings",
"->",
"getRetryDelayMultiplier",
"(",
")",
";",
"$",
"maxDelayMs",
"=",
"$",
... | @param Call $call
@param array $options
@param string $status
@return PromiseInterface
@throws ApiException | [
"@param",
"Call",
"$call",
"@param",
"array",
"$options",
"@param",
"string",
"$status"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Middleware/RetryMiddleware.php#L109-L156 |
googleapis/gax-php | src/PageStreamingDescriptor.php | PageStreamingDescriptor.createFromFields | public static function createFromFields($fields)
{
$requestPageToken = $fields['requestPageTokenField'];
$responsePageToken = $fields['responsePageTokenField'];
$resources = $fields['resourceField'];
$descriptor = [
'requestPageTokenGetMethod' => PageStreamingDescriptor:... | php | public static function createFromFields($fields)
{
$requestPageToken = $fields['requestPageTokenField'];
$responsePageToken = $fields['responsePageTokenField'];
$resources = $fields['resourceField'];
$descriptor = [
'requestPageTokenGetMethod' => PageStreamingDescriptor:... | [
"public",
"static",
"function",
"createFromFields",
"(",
"$",
"fields",
")",
"{",
"$",
"requestPageToken",
"=",
"$",
"fields",
"[",
"'requestPageTokenField'",
"]",
";",
"$",
"responsePageToken",
"=",
"$",
"fields",
"[",
"'responsePageTokenField'",
"]",
";",
"$",... | @param array $fields {
Required.
@type string $requestPageTokenField the page token field in the request object.
@type string $responsePageTokenField the page token field in the response object.
@type string $resourceField the resource field in the response object.
Optional.
@type string $requestPageSizeField the pag... | [
"@param",
"array",
"$fields",
"{",
"Required",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/PageStreamingDescriptor.php#L74-L94 |
googleapis/gax-php | src/ClientStream.php | ClientStream.readResponse | public function readResponse()
{
list($response, $status) = $this->call->wait();
if ($status->code == Code::OK) {
return $response;
} else {
throw ApiException::createFromStdClass($status);
}
} | php | public function readResponse()
{
list($response, $status) = $this->call->wait();
if ($status->code == Code::OK) {
return $response;
} else {
throw ApiException::createFromStdClass($status);
}
} | [
"public",
"function",
"readResponse",
"(",
")",
"{",
"list",
"(",
"$",
"response",
",",
"$",
"status",
")",
"=",
"$",
"this",
"->",
"call",
"->",
"wait",
"(",
")",
";",
"if",
"(",
"$",
"status",
"->",
"code",
"==",
"Code",
"::",
"OK",
")",
"{",
... | Read the response from the server, completing the streaming call.
@throws ApiException
@return mixed The response object from the server | [
"Read",
"the",
"response",
"from",
"the",
"server",
"completing",
"the",
"streaming",
"call",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/ClientStream.php#L70-L78 |
googleapis/gax-php | src/ClientStream.php | ClientStream.writeAllAndReadResponse | public function writeAllAndReadResponse($requests)
{
foreach ($requests as $request) {
$this->write($request);
}
return $this->readResponse();
} | php | public function writeAllAndReadResponse($requests)
{
foreach ($requests as $request) {
$this->write($request);
}
return $this->readResponse();
} | [
"public",
"function",
"writeAllAndReadResponse",
"(",
"$",
"requests",
")",
"{",
"foreach",
"(",
"$",
"requests",
"as",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"write",
"(",
"$",
"request",
")",
";",
"}",
"return",
"$",
"this",
"->",
"readResponse",... | Write all data in $dataArray and read the response from the server, completing the streaming
call.
@param mixed[] $requests An iterator of request objects to write to the server
@return mixed The response object from the server | [
"Write",
"all",
"data",
"in",
"$dataArray",
"and",
"read",
"the",
"response",
"from",
"the",
"server",
"completing",
"the",
"streaming",
"call",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/ClientStream.php#L87-L93 |
googleapis/gax-php | src/ServerStream.php | ServerStream.readAll | public function readAll()
{
$resourcesGetMethod = $this->resourcesGetMethod;
if (!is_null($resourcesGetMethod)) {
foreach ($this->call->responses() as $response) {
foreach ($response->$resourcesGetMethod() as $resource) {
yield $resource;
... | php | public function readAll()
{
$resourcesGetMethod = $this->resourcesGetMethod;
if (!is_null($resourcesGetMethod)) {
foreach ($this->call->responses() as $response) {
foreach ($response->$resourcesGetMethod() as $resource) {
yield $resource;
... | [
"public",
"function",
"readAll",
"(",
")",
"{",
"$",
"resourcesGetMethod",
"=",
"$",
"this",
"->",
"resourcesGetMethod",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"resourcesGetMethod",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"call",
"->",
"resp... | A generator which yields results from the server until the streaming call
completes. Throws an ApiException if the streaming call failed.
@throws ApiException
@return \Generator|mixed | [
"A",
"generator",
"which",
"yields",
"results",
"from",
"the",
"server",
"until",
"the",
"streaming",
"call",
"completes",
".",
"Throws",
"an",
"ApiException",
"if",
"the",
"streaming",
"call",
"failed",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/ServerStream.php#L65-L83 |
googleapis/gax-php | src/RetrySettings.php | RetrySettings.load | public static function load(
$serviceName,
$clientConfig,
$disableRetries = false
) {
$serviceRetrySettings = [];
$serviceConfig = $clientConfig['interfaces'][$serviceName];
$retryCodes = $serviceConfig['retry_codes'];
$retryParams = $serviceConfig['retry_par... | php | public static function load(
$serviceName,
$clientConfig,
$disableRetries = false
) {
$serviceRetrySettings = [];
$serviceConfig = $clientConfig['interfaces'][$serviceName];
$retryCodes = $serviceConfig['retry_codes'];
$retryParams = $serviceConfig['retry_par... | [
"public",
"static",
"function",
"load",
"(",
"$",
"serviceName",
",",
"$",
"clientConfig",
",",
"$",
"disableRetries",
"=",
"false",
")",
"{",
"$",
"serviceRetrySettings",
"=",
"[",
"]",
";",
"$",
"serviceConfig",
"=",
"$",
"clientConfig",
"[",
"'interfaces'... | Constructs an array mapping method names to CallSettings.
@param string $serviceName
The fully-qualified name of this service, used as a key into
the client config file.
@param array $clientConfig
An array parsed from the standard API client config file.
@param bool $disableRetries
Disable retries in all loaded RetryS... | [
"Constructs",
"an",
"array",
"mapping",
"method",
"names",
"to",
"CallSettings",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/RetrySettings.php#L257-L307 |
googleapis/gax-php | src/RetrySettings.php | RetrySettings.with | public function with(array $settings)
{
$existingSettings = [
'initialRetryDelayMillis' => $this->getInitialRetryDelayMillis(),
'retryDelayMultiplier' => $this->getRetryDelayMultiplier(),
'maxRetryDelayMillis' => $this->getMaxRetryDelayMillis(),
'initialRpcTim... | php | public function with(array $settings)
{
$existingSettings = [
'initialRetryDelayMillis' => $this->getInitialRetryDelayMillis(),
'retryDelayMultiplier' => $this->getRetryDelayMultiplier(),
'maxRetryDelayMillis' => $this->getMaxRetryDelayMillis(),
'initialRpcTim... | [
"public",
"function",
"with",
"(",
"array",
"$",
"settings",
")",
"{",
"$",
"existingSettings",
"=",
"[",
"'initialRetryDelayMillis'",
"=>",
"$",
"this",
"->",
"getInitialRetryDelayMillis",
"(",
")",
",",
"'retryDelayMultiplier'",
"=>",
"$",
"this",
"->",
"getRe... | Creates a new instance of RetrySettings that updates the settings in the existing instance
with the settings specified in the $settings parameter.
@param array $settings {
Settings for configuring the retry behavior. Supports all of the options supported by
the constructor; see {@see \Google\ApiCore\RetrySettings::__c... | [
"Creates",
"a",
"new",
"instance",
"of",
"RetrySettings",
"that",
"updates",
"the",
"settings",
"in",
"the",
"existing",
"instance",
"with",
"the",
"settings",
"specified",
"in",
"the",
"$settings",
"parameter",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/RetrySettings.php#L335-L350 |
googleapis/gax-php | src/ApiStatus.php | ApiStatus.rpcCodeFromHttpStatusCode | public static function rpcCodeFromHttpStatusCode($httpStatusCode)
{
if (array_key_exists($httpStatusCode, self::$httpStatusCodeToRpcCodeMap)) {
return self::$httpStatusCodeToRpcCodeMap[$httpStatusCode];
}
return ApiStatus::UNRECOGNIZED_CODE;
} | php | public static function rpcCodeFromHttpStatusCode($httpStatusCode)
{
if (array_key_exists($httpStatusCode, self::$httpStatusCodeToRpcCodeMap)) {
return self::$httpStatusCodeToRpcCodeMap[$httpStatusCode];
}
return ApiStatus::UNRECOGNIZED_CODE;
} | [
"public",
"static",
"function",
"rpcCodeFromHttpStatusCode",
"(",
"$",
"httpStatusCode",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"httpStatusCode",
",",
"self",
"::",
"$",
"httpStatusCodeToRpcCodeMap",
")",
")",
"{",
"return",
"self",
"::",
"$",
"httpS... | Maps HTTP status codes to Google\Rpc\Code codes.
Only map codes which do not map to multiple gRPC codes (e.g. excludes
400, 409, and 500).
@param int $httpStatusCode
@return int | [
"Maps",
"HTTP",
"status",
"codes",
"to",
"Google",
"\\",
"Rpc",
"\\",
"Code",
"codes",
".",
"Only",
"map",
"codes",
"which",
"do",
"not",
"map",
"to",
"multiple",
"gRPC",
"codes",
"(",
"e",
".",
"g",
".",
"excludes",
"400",
"409",
"and",
"500",
")",
... | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/ApiStatus.php#L149-L155 |
googleapis/gax-php | src/ResourceTemplate/Parser.php | Parser.parseSegments | public static function parseSegments($path)
{
if (empty($path)) {
throw new ValidationException("Cannot parse empty path");
}
$segments = [];
$index = 0;
$segments[] = self::parseSegmentFromPath($path, $index);
while ($index < strlen($path)) {
... | php | public static function parseSegments($path)
{
if (empty($path)) {
throw new ValidationException("Cannot parse empty path");
}
$segments = [];
$index = 0;
$segments[] = self::parseSegmentFromPath($path, $index);
while ($index < strlen($path)) {
... | [
"public",
"static",
"function",
"parseSegments",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"Cannot parse empty path\"",
")",
";",
"}",
"$",
"segments",
"=",
"[",
"]",
";... | Parses a path into an array of segments.
@param string $path
@return array
@throws ValidationException | [
"Parses",
"a",
"path",
"into",
"an",
"array",
"of",
"segments",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/ResourceTemplate/Parser.php#L49-L62 |
googleapis/gax-php | src/ResourceTemplate/Parser.php | Parser.parseSegmentFromPath | private static function parseSegmentFromPath($path, &$index)
{
if ($index >= strlen($path)) {
// A trailing '/' has caused the index to exceed the bounds
// of the string - provide a helpful error message.
throw self::parseError($path, strlen($path) - 1, "invalid trailing... | php | private static function parseSegmentFromPath($path, &$index)
{
if ($index >= strlen($path)) {
// A trailing '/' has caused the index to exceed the bounds
// of the string - provide a helpful error message.
throw self::parseError($path, strlen($path) - 1, "invalid trailing... | [
"private",
"static",
"function",
"parseSegmentFromPath",
"(",
"$",
"path",
",",
"&",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
">=",
"strlen",
"(",
"$",
"path",
")",
")",
"{",
"// A trailing '/' has caused the index to exceed the bounds",
"// of the string ... | Given a path and an index, reads a Segment from the path and updates
the index.
@param string $path
@param int $index
@return Segment
@throws ValidationException | [
"Given",
"a",
"path",
"and",
"an",
"index",
"reads",
"a",
"Segment",
"from",
"the",
"path",
"and",
"updates",
"the",
"index",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/ResourceTemplate/Parser.php#L73-L104 |
googleapis/gax-php | src/Transport/GrpcFallbackTransport.php | GrpcFallbackTransport.build | public static function build($serviceAddress, array $config = [])
{
$config += [
'httpHandler' => null,
];
list($baseUri, $port) = self::normalizeServiceAddress($serviceAddress);
$httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync();
return new G... | php | public static function build($serviceAddress, array $config = [])
{
$config += [
'httpHandler' => null,
];
list($baseUri, $port) = self::normalizeServiceAddress($serviceAddress);
$httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync();
return new G... | [
"public",
"static",
"function",
"build",
"(",
"$",
"serviceAddress",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"+=",
"[",
"'httpHandler'",
"=>",
"null",
",",
"]",
";",
"list",
"(",
"$",
"baseUri",
",",
"$",
"port",
")",
"... | Builds a GrpcFallbackTransport.
@param string $serviceAddress
The address of the API remote host, for example "example.googleapis.com".
@param array $config {
Config options used to construct the grpc-fallback transport.
@type callable $httpHandler A handler used to deliver PSR-7 requests.
}
@return GrpcFallbackTrans... | [
"Builds",
"a",
"GrpcFallbackTransport",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Transport/GrpcFallbackTransport.php#L85-L93 |
googleapis/gax-php | src/Transport/GrpcFallbackTransport.php | GrpcFallbackTransport.startUnaryCall | public function startUnaryCall(Call $call, array $options)
{
$httpHandler = $this->httpHandler;
return $httpHandler(
$this->buildRequest($call, $options),
$this->getCallOptions($options)
)->then(
function (ResponseInterface $response) use ($options) {
... | php | public function startUnaryCall(Call $call, array $options)
{
$httpHandler = $this->httpHandler;
return $httpHandler(
$this->buildRequest($call, $options),
$this->getCallOptions($options)
)->then(
function (ResponseInterface $response) use ($options) {
... | [
"public",
"function",
"startUnaryCall",
"(",
"Call",
"$",
"call",
",",
"array",
"$",
"options",
")",
"{",
"$",
"httpHandler",
"=",
"$",
"this",
"->",
"httpHandler",
";",
"return",
"$",
"httpHandler",
"(",
"$",
"this",
"->",
"buildRequest",
"(",
"$",
"cal... | {@inheritdoc} | [
"{"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Transport/GrpcFallbackTransport.php#L98-L120 |
googleapis/gax-php | src/Serializer.php | Serializer.encodeMessage | public function encodeMessage($message)
{
// Get message descriptor
$pool = DescriptorPool::getGeneratedPool();
$messageType = $pool->getDescriptorByClassName(get_class($message));
try {
return $this->encodeMessageImpl($message, $messageType);
} catch (\Exception ... | php | public function encodeMessage($message)
{
// Get message descriptor
$pool = DescriptorPool::getGeneratedPool();
$messageType = $pool->getDescriptorByClassName(get_class($message));
try {
return $this->encodeMessageImpl($message, $messageType);
} catch (\Exception ... | [
"public",
"function",
"encodeMessage",
"(",
"$",
"message",
")",
"{",
"// Get message descriptor",
"$",
"pool",
"=",
"DescriptorPool",
"::",
"getGeneratedPool",
"(",
")",
";",
"$",
"messageType",
"=",
"$",
"pool",
"->",
"getDescriptorByClassName",
"(",
"get_class"... | Encode protobuf message as a PHP array
@param mixed $message
@return array
@throws ValidationException | [
"Encode",
"protobuf",
"message",
"as",
"a",
"PHP",
"array"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Serializer.php#L96-L110 |
googleapis/gax-php | src/Serializer.php | Serializer.decodeMessage | public function decodeMessage($message, $data)
{
// Get message descriptor
$pool = DescriptorPool::getGeneratedPool();
$messageType = $pool->getDescriptorByClassName(get_class($message));
try {
return $this->decodeMessageImpl($message, $messageType, $data);
} catc... | php | public function decodeMessage($message, $data)
{
// Get message descriptor
$pool = DescriptorPool::getGeneratedPool();
$messageType = $pool->getDescriptorByClassName(get_class($message));
try {
return $this->decodeMessageImpl($message, $messageType, $data);
} catc... | [
"public",
"function",
"decodeMessage",
"(",
"$",
"message",
",",
"$",
"data",
")",
"{",
"// Get message descriptor",
"$",
"pool",
"=",
"DescriptorPool",
"::",
"getGeneratedPool",
"(",
")",
";",
"$",
"messageType",
"=",
"$",
"pool",
"->",
"getDescriptorByClassNam... | Decode PHP array into the specified protobuf message
@param mixed $message
@param array $data
@return mixed
@throws ValidationException | [
"Decode",
"PHP",
"array",
"into",
"the",
"specified",
"protobuf",
"message"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Serializer.php#L120-L134 |
googleapis/gax-php | src/Serializer.php | Serializer.decodeMetadata | public static function decodeMetadata($metadata)
{
if (is_null($metadata) || count($metadata) == 0) {
return [];
}
$result = [];
foreach ($metadata as $key => $values) {
foreach ($values as $value) {
$decodedValue = [
'@type... | php | public static function decodeMetadata($metadata)
{
if (is_null($metadata) || count($metadata) == 0) {
return [];
}
$result = [];
foreach ($metadata as $key => $values) {
foreach ($values as $value) {
$decodedValue = [
'@type... | [
"public",
"static",
"function",
"decodeMetadata",
"(",
"$",
"metadata",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"metadata",
")",
"||",
"count",
"(",
"$",
"metadata",
")",
"==",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"result",
"=",
"[",... | Decode metadata received from gRPC status object
@param array $metadata
@return array | [
"Decode",
"metadata",
"received",
"from",
"gRPC",
"status",
"object"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Serializer.php#L162-L202 |
googleapis/gax-php | src/Serializer.php | Serializer.decodeAnyMessages | public static function decodeAnyMessages($anyArray)
{
$results = [];
foreach ($anyArray as $any) {
try {
/** @var Any $any */
/** @var Message $unpacked */
$unpacked = $any->unpack();
$results[] = self::serializeToPhpArray($... | php | public static function decodeAnyMessages($anyArray)
{
$results = [];
foreach ($anyArray as $any) {
try {
/** @var Any $any */
/** @var Message $unpacked */
$unpacked = $any->unpack();
$results[] = self::serializeToPhpArray($... | [
"public",
"static",
"function",
"decodeAnyMessages",
"(",
"$",
"anyArray",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"anyArray",
"as",
"$",
"any",
")",
"{",
"try",
"{",
"/** @var Any $any */",
"/** @var Message $unpacked */",
"$",
"u... | Decode an array of Any messages into a printable PHP array.
@param $anyArray
@return array | [
"Decode",
"an",
"array",
"of",
"Any",
"messages",
"into",
"a",
"printable",
"PHP",
"array",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Serializer.php#L210-L229 |
googleapis/gax-php | src/Page.php | Page.getNextPage | public function getNextPage($pageSize = null)
{
if (!$this->hasNextPage()) {
throw new ValidationException(
'Could not complete getNextPage operation: ' .
'there are no more pages to retrieve.'
);
}
$newRequest = clone $this->getReques... | php | public function getNextPage($pageSize = null)
{
if (!$this->hasNextPage()) {
throw new ValidationException(
'Could not complete getNextPage operation: ' .
'there are no more pages to retrieve.'
);
}
$newRequest = clone $this->getReques... | [
"public",
"function",
"getNextPage",
"(",
"$",
"pageSize",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasNextPage",
"(",
")",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"'Could not complete getNextPage operation: '",
".",
"'there are n... | Retrieves the next Page object using the next page token.
@param int|null $pageSize
@throws ValidationException if there are no pages remaining, or if pageSize is supplied but
is not supported by the API
@throws ApiException if the call to fetch the next page fails.
@return Page | [
"Retrieves",
"the",
"next",
"Page",
"object",
"using",
"the",
"next",
"page",
"token",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Page.php#L112-L151 |
googleapis/gax-php | src/Page.php | Page.getIterator | public function getIterator()
{
$resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod();
foreach ($this->getResponseObject()->$resourcesGetMethod() as $element) {
yield $element;
}
} | php | public function getIterator()
{
$resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod();
foreach ($this->getResponseObject()->$resourcesGetMethod() as $element) {
yield $element;
}
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"$",
"resourcesGetMethod",
"=",
"$",
"this",
"->",
"pageStreamingDescriptor",
"->",
"getResourcesGetMethod",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getResponseObject",
"(",
")",
"->",
"$",
"resour... | Return an iterator over the elements in the response.
@return Generator | [
"Return",
"an",
"iterator",
"over",
"the",
"elements",
"in",
"the",
"response",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Page.php#L169-L175 |
googleapis/gax-php | src/Page.php | Page.iteratePages | public function iteratePages()
{
$currentPage = $this;
yield $this;
while ($currentPage->hasNextPage()) {
$currentPage = $currentPage->getNextPage();
yield $currentPage;
}
} | php | public function iteratePages()
{
$currentPage = $this;
yield $this;
while ($currentPage->hasNextPage()) {
$currentPage = $currentPage->getNextPage();
yield $currentPage;
}
} | [
"public",
"function",
"iteratePages",
"(",
")",
"{",
"$",
"currentPage",
"=",
"$",
"this",
";",
"yield",
"$",
"this",
";",
"while",
"(",
"$",
"currentPage",
"->",
"hasNextPage",
"(",
")",
")",
"{",
"$",
"currentPage",
"=",
"$",
"currentPage",
"->",
"ge... | Return an iterator over Page objects, beginning with this object.
Additional Page objects are retrieved lazily via API calls until
all elements have been retrieved.
@return Generator|Page[]
@throws ValidationException
@throws ApiException | [
"Return",
"an",
"iterator",
"over",
"Page",
"objects",
"beginning",
"with",
"this",
"object",
".",
"Additional",
"Page",
"objects",
"are",
"retrieved",
"lazily",
"via",
"API",
"calls",
"until",
"all",
"elements",
"have",
"been",
"retrieved",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Page.php#L186-L194 |
googleapis/gax-php | src/Page.php | Page.expandToFixedSizeCollection | public function expandToFixedSizeCollection($collectionSize)
{
if (!$this->pageStreamingDescriptor->requestHasPageSizeField()) {
throw new ValidationException(
"FixedSizeCollection is not supported for this method, because " .
"the method does not support an optio... | php | public function expandToFixedSizeCollection($collectionSize)
{
if (!$this->pageStreamingDescriptor->requestHasPageSizeField()) {
throw new ValidationException(
"FixedSizeCollection is not supported for this method, because " .
"the method does not support an optio... | [
"public",
"function",
"expandToFixedSizeCollection",
"(",
"$",
"collectionSize",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"pageStreamingDescriptor",
"->",
"requestHasPageSizeField",
"(",
")",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"FixedSizeColl... | Returns a collection of elements with a fixed size set by
the collectionSize parameter. The collection will only contain
fewer than collectionSize elements if there are no more
pages to be retrieved from the server.
NOTE: it is an error to call this method if an optional parameter
to set the page size is not supported... | [
"Returns",
"a",
"collection",
"of",
"elements",
"with",
"a",
"fixed",
"size",
"set",
"by",
"the",
"collectionSize",
"parameter",
".",
"The",
"collection",
"will",
"only",
"contain",
"fewer",
"than",
"collectionSize",
"elements",
"if",
"there",
"are",
"no",
"mo... | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/Page.php#L232-L260 |
googleapis/gax-php | src/BidiStream.php | BidiStream.write | public function write($request)
{
if ($this->isComplete) {
throw new ValidationException("Cannot call write() after streaming call is complete.");
}
if ($this->writesClosed) {
throw new ValidationException("Cannot call write() after calling closeWrite().");
}
... | php | public function write($request)
{
if ($this->isComplete) {
throw new ValidationException("Cannot call write() after streaming call is complete.");
}
if ($this->writesClosed) {
throw new ValidationException("Cannot call write() after calling closeWrite().");
}
... | [
"public",
"function",
"write",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isComplete",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"Cannot call write() after streaming call is complete.\"",
")",
";",
"}",
"if",
"(",
"$",
"this",
... | Write request to the server.
@param mixed $request The request to write
@throws ValidationException | [
"Write",
"request",
"to",
"the",
"server",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/BidiStream.php#L67-L76 |
googleapis/gax-php | src/BidiStream.php | BidiStream.closeWrite | public function closeWrite()
{
if ($this->isComplete) {
throw new ValidationException(
"Cannot call closeWrite() after streaming call is complete."
);
}
if (!$this->writesClosed) {
$this->call->writesDone();
$this->writesClosed ... | php | public function closeWrite()
{
if ($this->isComplete) {
throw new ValidationException(
"Cannot call closeWrite() after streaming call is complete."
);
}
if (!$this->writesClosed) {
$this->call->writesDone();
$this->writesClosed ... | [
"public",
"function",
"closeWrite",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isComplete",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"Cannot call closeWrite() after streaming call is complete.\"",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->... | Inform the server that no more requests will be written. The write() function cannot be
called after closeWrite() is called.
@throws ValidationException | [
"Inform",
"the",
"server",
"that",
"no",
"more",
"requests",
"will",
"be",
"written",
".",
"The",
"write",
"()",
"function",
"cannot",
"be",
"called",
"after",
"closeWrite",
"()",
"is",
"called",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/BidiStream.php#L97-L108 |
googleapis/gax-php | src/BidiStream.php | BidiStream.read | public function read()
{
if ($this->isComplete) {
throw new ValidationException("Cannot call read() after streaming call is complete.");
}
$resourcesGetMethod = $this->resourcesGetMethod;
if (!is_null($resourcesGetMethod)) {
if (count($this->pendingResources) ... | php | public function read()
{
if ($this->isComplete) {
throw new ValidationException("Cannot call read() after streaming call is complete.");
}
$resourcesGetMethod = $this->resourcesGetMethod;
if (!is_null($resourcesGetMethod)) {
if (count($this->pendingResources) ... | [
"public",
"function",
"read",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isComplete",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"Cannot call read() after streaming call is complete.\"",
")",
";",
"}",
"$",
"resourcesGetMethod",
"=",
"$",
"this",
... | Read the next response from the server. Returns null if the streaming call completed
successfully. Throws an ApiException if the streaming call failed.
@throws ValidationException
@throws ApiException
@return mixed | [
"Read",
"the",
"next",
"response",
"from",
"the",
"server",
".",
"Returns",
"null",
"if",
"the",
"streaming",
"call",
"completed",
"successfully",
".",
"Throws",
"an",
"ApiException",
"if",
"the",
"streaming",
"call",
"failed",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/BidiStream.php#L118-L147 |
googleapis/gax-php | src/BidiStream.php | BidiStream.closeWriteAndReadAll | public function closeWriteAndReadAll()
{
$this->closeWrite();
$response = $this->read();
while (!is_null($response)) {
yield $response;
$response = $this->read();
}
} | php | public function closeWriteAndReadAll()
{
$this->closeWrite();
$response = $this->read();
while (!is_null($response)) {
yield $response;
$response = $this->read();
}
} | [
"public",
"function",
"closeWriteAndReadAll",
"(",
")",
"{",
"$",
"this",
"->",
"closeWrite",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"read",
"(",
")",
";",
"while",
"(",
"!",
"is_null",
"(",
"$",
"response",
")",
")",
"{",
"yield",
... | Call closeWrite(), and read all responses from the server, until the streaming call is
completed. Throws an ApiException if the streaming call failed.
@throws ValidationException
@throws ApiException
@return \Generator|mixed[] | [
"Call",
"closeWrite",
"()",
"and",
"read",
"all",
"responses",
"from",
"the",
"server",
"until",
"the",
"streaming",
"call",
"is",
"completed",
".",
"Throws",
"an",
"ApiException",
"if",
"the",
"streaming",
"call",
"failed",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/BidiStream.php#L157-L165 |
googleapis/gax-php | src/PollingTrait.php | PollingTrait.poll | private function poll(callable $pollCallable, array $options)
{
$currentPollDelayMillis = $options['initialPollDelayMillis'];
$pollDelayMultiplier = $options['pollDelayMultiplier'];
$maxPollDelayMillis = $options['maxPollDelayMillis'];
$totalPollTimeoutMillis = $options['totalPollTim... | php | private function poll(callable $pollCallable, array $options)
{
$currentPollDelayMillis = $options['initialPollDelayMillis'];
$pollDelayMultiplier = $options['pollDelayMultiplier'];
$maxPollDelayMillis = $options['maxPollDelayMillis'];
$totalPollTimeoutMillis = $options['totalPollTim... | [
"private",
"function",
"poll",
"(",
"callable",
"$",
"pollCallable",
",",
"array",
"$",
"options",
")",
"{",
"$",
"currentPollDelayMillis",
"=",
"$",
"options",
"[",
"'initialPollDelayMillis'",
"]",
";",
"$",
"pollDelayMultiplier",
"=",
"$",
"options",
"[",
"'... | @param callable $pollCallable The call to poll. Must return a boolean indicating whether the
operation has completed, and the polling loop can be terminated.
@param array $options {
Options for configuring the polling behaviour.
@type int $initialPollDelayMillis The initial polling interval to use, in milliseconds.
@t... | [
"@param",
"callable",
"$pollCallable",
"The",
"call",
"to",
"poll",
".",
"Must",
"return",
"a",
"boolean",
"indicating",
"whether",
"the",
"operation",
"has",
"completed",
"and",
"the",
"polling",
"loop",
"can",
"be",
"terminated",
".",
"@param",
"array",
"$op... | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/PollingTrait.php#L50-L73 |
googleapis/gax-php | src/GapicClientTrait.php | GapicClientTrait.setClientOptions | private function setClientOptions(array $options)
{
$this->validateNotNull($options, [
'serviceAddress',
'serviceName',
'descriptorsConfigPath',
'clientConfig',
'disableRetries',
'credentialsConfig',
'transportConfig',
... | php | private function setClientOptions(array $options)
{
$this->validateNotNull($options, [
'serviceAddress',
'serviceName',
'descriptorsConfigPath',
'clientConfig',
'disableRetries',
'credentialsConfig',
'transportConfig',
... | [
"private",
"function",
"setClientOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"validateNotNull",
"(",
"$",
"options",
",",
"[",
"'serviceAddress'",
",",
"'serviceName'",
",",
"'descriptorsConfigPath'",
",",
"'clientConfig'",
",",
"'disableR... | Configures the GAPIC client based on an array of options.
@param array $options {
An array of required and optional arguments.
@type string $serviceAddress
The address of the API remote host, for example "example.googleapis.com. May also
include the port, for example "example.googleapis.com:443"
@type bool $disableRe... | [
"Configures",
"the",
"GAPIC",
"client",
"based",
"on",
"an",
"array",
"of",
"options",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/GapicClientTrait.php#L266-L315 |
googleapis/gax-php | src/GapicClientTrait.php | GapicClientTrait.startCall | private function startCall(
$methodName,
$decodeType,
array $optionalArgs = [],
Message $request = null,
$callType = Call::UNARY_CALL,
$interfaceName = null
) {
$callStack = $this->createCallStack(
$this->configureCallConstructionOptions($methodNam... | php | private function startCall(
$methodName,
$decodeType,
array $optionalArgs = [],
Message $request = null,
$callType = Call::UNARY_CALL,
$interfaceName = null
) {
$callStack = $this->createCallStack(
$this->configureCallConstructionOptions($methodNam... | [
"private",
"function",
"startCall",
"(",
"$",
"methodName",
",",
"$",
"decodeType",
",",
"array",
"$",
"optionalArgs",
"=",
"[",
"]",
",",
"Message",
"$",
"request",
"=",
"null",
",",
"$",
"callType",
"=",
"Call",
"::",
"UNARY_CALL",
",",
"$",
"interface... | @param string $methodName
@param string $decodeType
@param array $optionalArgs {
Call Options
@type array $headers [optional] key-value array containing headers
@type int $timeoutMillis [optional] the timeout in milliseconds for the call
@type array $transportOptions [optional] transport-specific call options
@type Re... | [
"@param",
"string",
"$methodName",
"@param",
"string",
"$decodeType",
"@param",
"array",
"$optionalArgs",
"{",
"Call",
"Options"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/GapicClientTrait.php#L427-L462 |
googleapis/gax-php | src/GapicClientTrait.php | GapicClientTrait.createCallStack | private function createCallStack(array $callConstructionOptions)
{
$callStack = function (Call $call, array $options) {
$startCallMethod = $this->transportCallMethods[$call->getCallType()];
return $this->transport->$startCallMethod($call, $options);
};
$callStack = ne... | php | private function createCallStack(array $callConstructionOptions)
{
$callStack = function (Call $call, array $options) {
$startCallMethod = $this->transportCallMethods[$call->getCallType()];
return $this->transport->$startCallMethod($call, $options);
};
$callStack = ne... | [
"private",
"function",
"createCallStack",
"(",
"array",
"$",
"callConstructionOptions",
")",
"{",
"$",
"callStack",
"=",
"function",
"(",
"Call",
"$",
"call",
",",
"array",
"$",
"options",
")",
"{",
"$",
"startCallMethod",
"=",
"$",
"this",
"->",
"transportC... | @param array $callConstructionOptions {
Call Construction Options
@type RetrySettings $retrySettings [optional] A retry settings override
For the call.
}
@return callable | [
"@param",
"array",
"$callConstructionOptions",
"{",
"Call",
"Construction",
"Options"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/GapicClientTrait.php#L474-L491 |
googleapis/gax-php | src/GapicClientTrait.php | GapicClientTrait.configureCallConstructionOptions | private function configureCallConstructionOptions($methodName, array $optionalArgs)
{
$retrySettings = $this->retrySettings[$methodName];
// Allow for retry settings to be changed at call time
if (isset($optionalArgs['retrySettings'])) {
$retrySettings = $retrySettings->with(
... | php | private function configureCallConstructionOptions($methodName, array $optionalArgs)
{
$retrySettings = $this->retrySettings[$methodName];
// Allow for retry settings to be changed at call time
if (isset($optionalArgs['retrySettings'])) {
$retrySettings = $retrySettings->with(
... | [
"private",
"function",
"configureCallConstructionOptions",
"(",
"$",
"methodName",
",",
"array",
"$",
"optionalArgs",
")",
"{",
"$",
"retrySettings",
"=",
"$",
"this",
"->",
"retrySettings",
"[",
"$",
"methodName",
"]",
";",
"// Allow for retry settings to be changed ... | @param string $methodName
@param array $optionalArgs {
Optional arguments
@type RetrySettings $retrySettings [optional] A retry settings override
For the call.
}
@return array | [
"@param",
"string",
"$methodName",
"@param",
"array",
"$optionalArgs",
"{",
"Optional",
"arguments"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/GapicClientTrait.php#L504-L516 |
googleapis/gax-php | src/GapicClientTrait.php | GapicClientTrait.startOperationsCall | private function startOperationsCall(
$methodName,
array $optionalArgs,
Message $request,
OperationsClient $client,
$interfaceName = null
) {
$callStack = $this->createCallStack(
$this->configureCallConstructionOptions($methodName, $optionalArgs)
)... | php | private function startOperationsCall(
$methodName,
array $optionalArgs,
Message $request,
OperationsClient $client,
$interfaceName = null
) {
$callStack = $this->createCallStack(
$this->configureCallConstructionOptions($methodName, $optionalArgs)
)... | [
"private",
"function",
"startOperationsCall",
"(",
"$",
"methodName",
",",
"array",
"$",
"optionalArgs",
",",
"Message",
"$",
"request",
",",
"OperationsClient",
"$",
"client",
",",
"$",
"interfaceName",
"=",
"null",
")",
"{",
"$",
"callStack",
"=",
"$",
"th... | @param string $methodName
@param array $optionalArgs {
Call Options
@type array $headers [optional] key-value array containing headers
@type int $timeoutMillis [optional] the timeout in milliseconds for the call
@type array $transportOptions [optional] transport-specific call options
}
@param Message $request
@param O... | [
"@param",
"string",
"$methodName",
"@param",
"array",
"$optionalArgs",
"{",
"Call",
"Options"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/GapicClientTrait.php#L533-L556 |
googleapis/gax-php | src/GapicClientTrait.php | GapicClientTrait.getPagedListResponse | private function getPagedListResponse(
$methodName,
array $optionalArgs,
$decodeType,
Message $request,
$interfaceName = null
) {
$callStack = $this->createCallStack(
$this->configureCallConstructionOptions($methodName, $optionalArgs)
);
$d... | php | private function getPagedListResponse(
$methodName,
array $optionalArgs,
$decodeType,
Message $request,
$interfaceName = null
) {
$callStack = $this->createCallStack(
$this->configureCallConstructionOptions($methodName, $optionalArgs)
);
$d... | [
"private",
"function",
"getPagedListResponse",
"(",
"$",
"methodName",
",",
"array",
"$",
"optionalArgs",
",",
"$",
"decodeType",
",",
"Message",
"$",
"request",
",",
"$",
"interfaceName",
"=",
"null",
")",
"{",
"$",
"callStack",
"=",
"$",
"this",
"->",
"c... | @param string $methodName
@param array $optionalArgs
@param string $decodeType
@param Message $request
@param string $interfaceName
@return PagedListResponse | [
"@param",
"string",
"$methodName",
"@param",
"array",
"$optionalArgs",
"@param",
"string",
"$decodeType",
"@param",
"Message",
"$request",
"@param",
"string",
"$interfaceName"
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/GapicClientTrait.php#L567-L592 |
googleapis/gax-php | src/OperationResponse.php | OperationResponse.isDone | public function isDone()
{
return (is_null($this->lastProtoResponse) || is_null($this->lastProtoResponse->getDone()))
? false
: $this->lastProtoResponse->getDone();
} | php | public function isDone()
{
return (is_null($this->lastProtoResponse) || is_null($this->lastProtoResponse->getDone()))
? false
: $this->lastProtoResponse->getDone();
} | [
"public",
"function",
"isDone",
"(",
")",
"{",
"return",
"(",
"is_null",
"(",
"$",
"this",
"->",
"lastProtoResponse",
")",
"||",
"is_null",
"(",
"$",
"this",
"->",
"lastProtoResponse",
"->",
"getDone",
"(",
")",
")",
")",
"?",
"false",
":",
"$",
"this"... | Check whether the operation has completed.
@return bool | [
"Check",
"whether",
"the",
"operation",
"has",
"completed",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/OperationResponse.php#L128-L133 |
googleapis/gax-php | src/OperationResponse.php | OperationResponse.pollUntilComplete | public function pollUntilComplete($options = [])
{
if ($this->isDone()) {
return true;
}
$pollSettings = array_merge($this->defaultPollSettings, $options);
return $this->poll(function () {
$this->reload();
return $this->isDone();
}, $pollS... | php | public function pollUntilComplete($options = [])
{
if ($this->isDone()) {
return true;
}
$pollSettings = array_merge($this->defaultPollSettings, $options);
return $this->poll(function () {
$this->reload();
return $this->isDone();
}, $pollS... | [
"public",
"function",
"pollUntilComplete",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDone",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"pollSettings",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"default... | Poll the server in a loop until the operation is complete.
Return true if the operation completed, otherwise return false. If the
$options['totalPollTimeoutMillis'] setting is not set (or set <= 0) then
pollUntilComplete will continue polling until the operation completes,
and therefore will always return true.
@para... | [
"Poll",
"the",
"server",
"in",
"a",
"loop",
"until",
"the",
"operation",
"is",
"complete",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/OperationResponse.php#L187-L198 |
googleapis/gax-php | src/OperationResponse.php | OperationResponse.reload | public function reload()
{
if ($this->deleted) {
throw new ValidationException("Cannot call reload() on a deleted operation");
}
$name = $this->getName();
$this->lastProtoResponse = $this->operationsClient->getOperation($name);
} | php | public function reload()
{
if ($this->deleted) {
throw new ValidationException("Cannot call reload() on a deleted operation");
}
$name = $this->getName();
$this->lastProtoResponse = $this->operationsClient->getOperation($name);
} | [
"public",
"function",
"reload",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"deleted",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"Cannot call reload() on a deleted operation\"",
")",
";",
"}",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(... | Reload the status of the operation with a request to the service.
@throws ApiException If the API call fails.
@throws ValidationException If called on a deleted operation. | [
"Reload",
"the",
"status",
"of",
"the",
"operation",
"with",
"a",
"request",
"to",
"the",
"service",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/OperationResponse.php#L206-L213 |
googleapis/gax-php | src/OperationResponse.php | OperationResponse.getResult | public function getResult()
{
if (!$this->isDone() || is_null($this->lastProtoResponse->getResponse())) {
return null;
}
/** @var Any $anyResponse */
$anyResponse = $this->lastProtoResponse->getResponse();
if (is_null($this->operationReturnType)) {
re... | php | public function getResult()
{
if (!$this->isDone() || is_null($this->lastProtoResponse->getResponse())) {
return null;
}
/** @var Any $anyResponse */
$anyResponse = $this->lastProtoResponse->getResponse();
if (is_null($this->operationReturnType)) {
re... | [
"public",
"function",
"getResult",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isDone",
"(",
")",
"||",
"is_null",
"(",
"$",
"this",
"->",
"lastProtoResponse",
"->",
"getResponse",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"/** @var... | Return the result of the operation. If operationSucceeded() is false, return null.
@return mixed|null The result of the operation, or null if operationSucceeded() is false | [
"Return",
"the",
"result",
"of",
"the",
"operation",
".",
"If",
"operationSucceeded",
"()",
"is",
"false",
"return",
"null",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/OperationResponse.php#L220-L236 |
googleapis/gax-php | src/OperationResponse.php | OperationResponse.getError | public function getError()
{
if (!$this->isDone() || is_null($this->lastProtoResponse->getError())) {
return null;
}
return $this->lastProtoResponse->getError();
} | php | public function getError()
{
if (!$this->isDone() || is_null($this->lastProtoResponse->getError())) {
return null;
}
return $this->lastProtoResponse->getError();
} | [
"public",
"function",
"getError",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isDone",
"(",
")",
"||",
"is_null",
"(",
"$",
"this",
"->",
"lastProtoResponse",
"->",
"getError",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"... | If the operation failed, return the status. If operationFailed() is false, return null.
@return Status|null The status of the operation in case of failure, or null if
operationFailed() is false. | [
"If",
"the",
"operation",
"failed",
"return",
"the",
"status",
".",
"If",
"operationFailed",
"()",
"is",
"false",
"return",
"null",
"."
] | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/OperationResponse.php#L244-L250 |
googleapis/gax-php | src/OperationResponse.php | OperationResponse.getMetadata | public function getMetadata()
{
if (is_null($this->lastProtoResponse)) {
return null;
}
/** @var Any $any */
$any = $this->lastProtoResponse->getMetadata();
if (is_null($this->metadataReturnType)) {
return $any;
}
if (is_null($any) || i... | php | public function getMetadata()
{
if (is_null($this->lastProtoResponse)) {
return null;
}
/** @var Any $any */
$any = $this->lastProtoResponse->getMetadata();
if (is_null($this->metadataReturnType)) {
return $any;
}
if (is_null($any) || i... | [
"public",
"function",
"getMetadata",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"lastProtoResponse",
")",
")",
"{",
"return",
"null",
";",
"}",
"/** @var Any $any */",
"$",
"any",
"=",
"$",
"this",
"->",
"lastProtoResponse",
"->",
"getMet... | Get the metadata returned with the last proto response. If a metadata type was provided, then
the return value will be of that type - otherwise, the return value will be of type Any. If
no metadata object is available, returns null.
@return mixed The metadata returned from the server in the last response. | [
"Get",
"the",
"metadata",
"returned",
"with",
"the",
"last",
"proto",
"response",
".",
"If",
"a",
"metadata",
"type",
"was",
"provided",
"then",
"the",
"return",
"value",
"will",
"be",
"of",
"that",
"type",
"-",
"otherwise",
"the",
"return",
"value",
"will... | train | https://github.com/googleapis/gax-php/blob/48387fb818c6882296710a2302a0aa973b99afb2/src/OperationResponse.php#L324-L342 |
cpliakas/search-framework | src/Search/Framework/QueueConsumer.php | QueueConsumer.valid | public function valid()
{
if ($this->timedOut() || $this->limitExceeded()) {
return false;
}
$this->_currentMessage = $this->_agent->getQueue()->consume();
return $this->_currentMessage !== false;
} | php | public function valid()
{
if ($this->timedOut() || $this->limitExceeded()) {
return false;
}
$this->_currentMessage = $this->_agent->getQueue()->consume();
return $this->_currentMessage !== false;
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"timedOut",
"(",
")",
"||",
"$",
"this",
"->",
"limitExceeded",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"_currentMessage",
"=",
"$",
"this",
"->... | Implements \Iterator::valid().
Fetch a message from the queue if we are still within the timeout and
limit thresholds specified in the SearchCollectionAbstract instance.
@todo Store queue as a class property to eliminate method calls? | [
"Implements",
"\\",
"Iterator",
"::",
"valid",
"()",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/QueueConsumer.php#L51-L58 |
mimmi20/Wurfl | src/Configuration/Config.php | Config.initialize | protected function initialize(array $configuration)
{
if (array_key_exists(self::WURFL, $configuration)) {
$this->setWurflConfiguration($configuration[self::WURFL]);
}
if (array_key_exists(self::PERSISTENCE, $configuration)) {
$this->persistence = $this->buildPersist... | php | protected function initialize(array $configuration)
{
if (array_key_exists(self::WURFL, $configuration)) {
$this->setWurflConfiguration($configuration[self::WURFL]);
}
if (array_key_exists(self::PERSISTENCE, $configuration)) {
$this->persistence = $this->buildPersist... | [
"protected",
"function",
"initialize",
"(",
"array",
"$",
"configuration",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"WURFL",
",",
"$",
"configuration",
")",
")",
"{",
"$",
"this",
"->",
"setWurflConfiguration",
"(",
"$",
"configuration",
"... | Initialize Configuration
@param array $configuration | [
"Initialize",
"Configuration"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/Config.php#L130-L160 |
mimmi20/Wurfl | src/Configuration/Config.php | Config.buildPersistenceConfiguration | protected function buildPersistenceConfiguration(array $persistenceConfig)
{
$persistence = array();
if (!array_key_exists(self::PROVIDER, $persistenceConfig)) {
$persistence[self::PROVIDER] = 'null';
} else {
$persistence[self::PROVIDER] = $persistenceConfig[self::P... | php | protected function buildPersistenceConfiguration(array $persistenceConfig)
{
$persistence = array();
if (!array_key_exists(self::PROVIDER, $persistenceConfig)) {
$persistence[self::PROVIDER] = 'null';
} else {
$persistence[self::PROVIDER] = $persistenceConfig[self::P... | [
"protected",
"function",
"buildPersistenceConfiguration",
"(",
"array",
"$",
"persistenceConfig",
")",
"{",
"$",
"persistence",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"self",
"::",
"PROVIDER",
",",
"$",
"persistenceConfig",
")",
... | @param array $persistenceConfig
@return array | [
"@param",
"array",
"$persistenceConfig"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/Config.php#L193-L216 |
mimmi20/Wurfl | src/Configuration/Config.php | Config.toArray | private function toArray($params)
{
$paramsArray = array();
foreach (explode(',', $params) as $param) {
$paramNameValue = explode('=', $param);
if (count($paramNameValue) > 1) {
if (strcmp(self::DIR, $paramNameValue[0]) === 0) {
$paramName... | php | private function toArray($params)
{
$paramsArray = array();
foreach (explode(',', $params) as $param) {
$paramNameValue = explode('=', $param);
if (count($paramNameValue) > 1) {
if (strcmp(self::DIR, $paramNameValue[0]) === 0) {
$paramName... | [
"private",
"function",
"toArray",
"(",
"$",
"params",
")",
"{",
"$",
"paramsArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"params",
")",
"as",
"$",
"param",
")",
"{",
"$",
"paramNameValue",
"=",
"explode",
"(",... | Converts given CSV $params to array of parameters
@param string $params Comma-seperated list of parameters
@return array Parameters | [
"Converts",
"given",
"CSV",
"$params",
"to",
"array",
"of",
"parameters"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/Config.php#L225-L240 |
mimmi20/Wurfl | src/Configuration/Config.php | Config.getFullPath | protected function getFullPath($fileName)
{
if (!is_string($fileName)) {
throw new \InvalidArgumentException('the given path is invalid');
}
$fileName = trim($fileName);
if (realpath($fileName) && !(basename($fileName) === $fileName)) {
return realpath($file... | php | protected function getFullPath($fileName)
{
if (!is_string($fileName)) {
throw new \InvalidArgumentException('the given path is invalid');
}
$fileName = trim($fileName);
if (realpath($fileName) && !(basename($fileName) === $fileName)) {
return realpath($file... | [
"protected",
"function",
"getFullPath",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"fileName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'the given path is invalid'",
")",
";",
"}",
"$",
"fileName",
"=... | Return the full path
@param string $fileName
@throws \InvalidArgumentException The configuration file does not exist
@return string File name including full path | [
"Return",
"the",
"full",
"path"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/Config.php#L372-L391 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/Input/File.php | File.validate | public function validate()
{
if (($_FILES) && (isset($_FILES[$this->name]['name']))) {
$value = $_FILES[$this->name]['name'];
$size = $_FILES[$this->name]['size'];
} else {
$value = null;
$size = null;
}
// Check if the element is req... | php | public function validate()
{
if (($_FILES) && (isset($_FILES[$this->name]['name']))) {
$value = $_FILES[$this->name]['name'];
$size = $_FILES[$this->name]['size'];
} else {
$value = null;
$size = null;
}
// Check if the element is req... | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"_FILES",
")",
"&&",
"(",
"isset",
"(",
"$",
"_FILES",
"[",
"$",
"this",
"->",
"name",
"]",
"[",
"'name'",
"]",
")",
")",
")",
"{",
"$",
"value",
"=",
"$",
"_FILES",
"[",
"... | Validate the form element object
@return boolean | [
"Validate",
"the",
"form",
"element",
"object"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/File.php#L38-L76 |
unimapper/unimapper | src/Entity/Reflection/Annotation.php | Annotation.registerOption | public static function registerOption($key, $class)
{
if (empty($key)) {
throw new Exception\AnnotationException(
"Option key can not be empty!"
);
}
if (!class_exists($class)) {
throw new Exception\AnnotationException(
"Cla... | php | public static function registerOption($key, $class)
{
if (empty($key)) {
throw new Exception\AnnotationException(
"Option key can not be empty!"
);
}
if (!class_exists($class)) {
throw new Exception\AnnotationException(
"Cla... | [
"public",
"static",
"function",
"registerOption",
"(",
"$",
"key",
",",
"$",
"class",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"AnnotationException",
"(",
"\"Option key can not be empty!\"",
")",
";",
... | Register new property option
@param string $key
@param string $class
@throws Exception\AnnotationException | [
"Register",
"new",
"property",
"option"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Annotation.php#L32-L51 |
unimapper/unimapper | src/Entity/Reflection/Annotation.php | Annotation.parseAdapter | public static function parseAdapter($definition)
{
preg_match_all('/\s*@adapter\s+([a-z-]+)(?:\(\s*([^)\s]+)\s*\))?/i', $definition, $matched);
if (empty($matched[0])) {
return false;
}
if (count($matched[0]) > 1) {
throw new Exception\AnnotationException(
... | php | public static function parseAdapter($definition)
{
preg_match_all('/\s*@adapter\s+([a-z-]+)(?:\(\s*([^)\s]+)\s*\))?/i', $definition, $matched);
if (empty($matched[0])) {
return false;
}
if (count($matched[0]) > 1) {
throw new Exception\AnnotationException(
... | [
"public",
"static",
"function",
"parseAdapter",
"(",
"$",
"definition",
")",
"{",
"preg_match_all",
"(",
"'/\\s*@adapter\\s+([a-z-]+)(?:\\(\\s*([^)\\s]+)\\s*\\))?/i'",
",",
"$",
"definition",
",",
"$",
"matched",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"matched",
... | Find adapter
@param string $definition
@return array|false [name, resource]
@throws Exception\AnnotationException | [
"Find",
"adapter"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Annotation.php#L67-L83 |
unimapper/unimapper | src/Entity/Reflection/Annotation.php | Annotation.parseOptions | public static function parseOptions($definition)
{
preg_match_all('/m:([a-z-]+)(?:\(([^)]*)\))?/i', $definition, $matched, PREG_SET_ORDER);
$result = [];
foreach ($matched as $match) {
if (array_key_exists($match[1], $result)) {
throw new Exception\AnnotationExc... | php | public static function parseOptions($definition)
{
preg_match_all('/m:([a-z-]+)(?:\(([^)]*)\))?/i', $definition, $matched, PREG_SET_ORDER);
$result = [];
foreach ($matched as $match) {
if (array_key_exists($match[1], $result)) {
throw new Exception\AnnotationExc... | [
"public",
"static",
"function",
"parseOptions",
"(",
"$",
"definition",
")",
"{",
"preg_match_all",
"(",
"'/m:([a-z-]+)(?:\\(([^)]*)\\))?/i'",
",",
"$",
"definition",
",",
"$",
"matched",
",",
"PREG_SET_ORDER",
")",
";",
"$",
"result",
"=",
"[",
"]",
";",
"for... | Find all property options
@param string $definition
@return array
@throws Exception\AnnotationException | [
"Find",
"all",
"property",
"options"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Annotation.php#L112-L128 |
liuguangw/mvc | src/Application.php | Application.startCommon | private function startCommon(): void
{
if (self::$app !== null) {
return;
}
self::$app = $this;
// 加载框架配置文件
$config = DataMap::loadFromPhpFile($this->mvcSourcePath . '/../config.inc.php');
// 应用配置
if ($this->config === null) {
$appConfi... | php | private function startCommon(): void
{
if (self::$app !== null) {
return;
}
self::$app = $this;
// 加载框架配置文件
$config = DataMap::loadFromPhpFile($this->mvcSourcePath . '/../config.inc.php');
// 应用配置
if ($this->config === null) {
$appConfi... | [
"private",
"function",
"startCommon",
"(",
")",
":",
"void",
"{",
"if",
"(",
"self",
"::",
"$",
"app",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"self",
"::",
"$",
"app",
"=",
"$",
"this",
";",
"// 加载框架配置文件",
"$",
"config",
"=",
"DataMap",
"::",... | 启动基本组件
@return void | [
"启动基本组件"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L103-L123 |
liuguangw/mvc | src/Application.php | Application.loadContainer | private function loadContainer(): void
{
$loaderClass = $this->config->getValue('SERVICE_LOADER');
$this->container = new Container();
$serviceLoader = new $loaderClass();
$serviceLoader->loadContainerService($this->container);
// 错误处理器
$this->loadErrorHandler($this->... | php | private function loadContainer(): void
{
$loaderClass = $this->config->getValue('SERVICE_LOADER');
$this->container = new Container();
$serviceLoader = new $loaderClass();
$serviceLoader->loadContainerService($this->container);
// 错误处理器
$this->loadErrorHandler($this->... | [
"private",
"function",
"loadContainer",
"(",
")",
":",
"void",
"{",
"$",
"loaderClass",
"=",
"$",
"this",
"->",
"config",
"->",
"getValue",
"(",
"'SERVICE_LOADER'",
")",
";",
"$",
"this",
"->",
"container",
"=",
"new",
"Container",
"(",
")",
";",
"$",
... | 加载容器
@return void | [
"加载容器"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L163-L174 |
liuguangw/mvc | src/Application.php | Application.loadErrorHandler | private function loadErrorHandler(IErrorHandler $errorHandler): void
{
// 添加错误事件处理
$this->addEventListener(ApplicationErrorEvent::class, [
$errorHandler,
'handleError'
]);
// 当发生错误或者异常时,发送事件
set_exception_handler(function ($exception) {
if ... | php | private function loadErrorHandler(IErrorHandler $errorHandler): void
{
// 添加错误事件处理
$this->addEventListener(ApplicationErrorEvent::class, [
$errorHandler,
'handleError'
]);
// 当发生错误或者异常时,发送事件
set_exception_handler(function ($exception) {
if ... | [
"private",
"function",
"loadErrorHandler",
"(",
"IErrorHandler",
"$",
"errorHandler",
")",
":",
"void",
"{",
"// 添加错误事件处理",
"$",
"this",
"->",
"addEventListener",
"(",
"ApplicationErrorEvent",
"::",
"class",
",",
"[",
"$",
"errorHandler",
",",
"'handleError'",
"]"... | 加载错误处理器
@param IErrorHandler $errorHandler
错误处理器
@return void | [
"加载错误处理器"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L183-L201 |
liuguangw/mvc | src/Application.php | Application.loadRouteHandler | private function loadRouteHandler(RouteHandler $routeHandler): void
{
// 解析URL
$url = '/';
if (isset($_SERVER['REQUEST_URI'])) {
$url = $_SERVER['REQUEST_URI'];
}
$this->routeInfo = $routeHandler->getRouteInfo($url);
$this->url = new UrlHelper($routeHandle... | php | private function loadRouteHandler(RouteHandler $routeHandler): void
{
// 解析URL
$url = '/';
if (isset($_SERVER['REQUEST_URI'])) {
$url = $_SERVER['REQUEST_URI'];
}
$this->routeInfo = $routeHandler->getRouteInfo($url);
$this->url = new UrlHelper($routeHandle... | [
"private",
"function",
"loadRouteHandler",
"(",
"RouteHandler",
"$",
"routeHandler",
")",
":",
"void",
"{",
"// 解析URL",
"$",
"url",
"=",
"'/'",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"$",
"url",
"=",
"$"... | 加载路由
@return void | [
"加载路由"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L223-L232 |
liuguangw/mvc | src/Application.php | Application.invokeRoute | private function invokeRoute(): void
{
$moduleName = $this->routeInfo->moduleName;
$controllerName = $this->routeInfo->controllerName;
$actionName = $this->routeInfo->actionName;
$controllerClass = $this->config->getValue('CONTROLLER_NAMESPACE') . '\\' . str_replace('.', '\\', $modul... | php | private function invokeRoute(): void
{
$moduleName = $this->routeInfo->moduleName;
$controllerName = $this->routeInfo->controllerName;
$actionName = $this->routeInfo->actionName;
$controllerClass = $this->config->getValue('CONTROLLER_NAMESPACE') . '\\' . str_replace('.', '\\', $modul... | [
"private",
"function",
"invokeRoute",
"(",
")",
":",
"void",
"{",
"$",
"moduleName",
"=",
"$",
"this",
"->",
"routeInfo",
"->",
"moduleName",
";",
"$",
"controllerName",
"=",
"$",
"this",
"->",
"routeInfo",
"->",
"controllerName",
";",
"$",
"actionName",
"... | 执行路由
@return void | [
"执行路由"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L239-L253 |
liuguangw/mvc | src/Application.php | Application.invokeAction | private function invokeAction(Controller $controller, string $actionName): void
{
// 获取操作结果
$actionMethodName = $actionName;
$actionMethodPrefix = $this->config->getValue('ACTION_METHOD_PREFIX');
if (! empty($actionMethodPrefix)) {
$actionMethodName = $actionMethodPrefix ... | php | private function invokeAction(Controller $controller, string $actionName): void
{
// 获取操作结果
$actionMethodName = $actionName;
$actionMethodPrefix = $this->config->getValue('ACTION_METHOD_PREFIX');
if (! empty($actionMethodPrefix)) {
$actionMethodName = $actionMethodPrefix ... | [
"private",
"function",
"invokeAction",
"(",
"Controller",
"$",
"controller",
",",
"string",
"$",
"actionName",
")",
":",
"void",
"{",
"// 获取操作结果",
"$",
"actionMethodName",
"=",
"$",
"actionName",
";",
"$",
"actionMethodPrefix",
"=",
"$",
"this",
"->",
"config"... | 执行操作
@param Controller $controller
@param string $actionName | [
"执行操作"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L261-L276 |
liuguangw/mvc | src/Application.php | Application.callAction | public function callAction(string $action, ?DataMap $params = null): void
{
list ($moduleName, $controllerName, $actionName) = $this->getFullAction($action);
$this->routeInfo->moduleName = $moduleName;
$this->routeInfo->controllerName = $controllerName;
$this->routeInfo->actionName =... | php | public function callAction(string $action, ?DataMap $params = null): void
{
list ($moduleName, $controllerName, $actionName) = $this->getFullAction($action);
$this->routeInfo->moduleName = $moduleName;
$this->routeInfo->controllerName = $controllerName;
$this->routeInfo->actionName =... | [
"public",
"function",
"callAction",
"(",
"string",
"$",
"action",
",",
"?",
"DataMap",
"$",
"params",
"=",
"null",
")",
":",
"void",
"{",
"list",
"(",
"$",
"moduleName",
",",
"$",
"controllerName",
",",
"$",
"actionName",
")",
"=",
"$",
"this",
"->",
... | 调用操作
@param string $action
缺省操作
@param DataMap $params
路由参数(当为空时,使用当前的路由参数)
@return void | [
"调用操作"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L287-L297 |
liuguangw/mvc | src/Application.php | Application.getFullAction | public function getFullAction(string $action = ''): array
{
// 初始化默认值
$moduleName = $this->routeInfo->moduleName;
$controllerName = $this->routeInfo->controllerName;
$actionName = $this->routeInfo->actionName;
// 分割
if ($action != '') {
$arr = explode('/',... | php | public function getFullAction(string $action = ''): array
{
// 初始化默认值
$moduleName = $this->routeInfo->moduleName;
$controllerName = $this->routeInfo->controllerName;
$actionName = $this->routeInfo->actionName;
// 分割
if ($action != '') {
$arr = explode('/',... | [
"public",
"function",
"getFullAction",
"(",
"string",
"$",
"action",
"=",
"''",
")",
":",
"array",
"{",
"// 初始化默认值",
"$",
"moduleName",
"=",
"$",
"this",
"->",
"routeInfo",
"->",
"moduleName",
";",
"$",
"controllerName",
"=",
"$",
"this",
"->",
"routeInfo"... | 获取完整的module/controller/action
@param string $action
@return array | [
"获取完整的module",
"/",
"controller",
"/",
"action"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/Application.php#L316-L339 |
vardius/crud-bundle | Actions/Action/UpdateAction.php | UpdateAction.call | public function call(ActionEvent $event, string $format):Response
{
$controller = $event->getController();
$dataProvider = $event->getDataProvider();
$request = $event->getRequest();
$data = $dataProvider->get($request->get('id'));
$this->checkRole($controller, $data);
... | php | public function call(ActionEvent $event, string $format):Response
{
$controller = $event->getController();
$dataProvider = $event->getDataProvider();
$request = $event->getRequest();
$data = $dataProvider->get($request->get('id'));
$this->checkRole($controller, $data);
... | [
"public",
"function",
"call",
"(",
"ActionEvent",
"$",
"event",
",",
"string",
"$",
"format",
")",
":",
"Response",
"{",
"$",
"controller",
"=",
"$",
"event",
"->",
"getController",
"(",
")",
";",
"$",
"dataProvider",
"=",
"$",
"event",
"->",
"getDataPro... | {@inheritdoc} | [
"{"
] | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Actions/Action/UpdateAction.php#L33-L78 |
vi-kon/laravel-parser | src/ViKon/Parser/renderer/AbstractRenderer.php | AbstractRenderer.registerTokenRenderer | protected function registerTokenRenderer($tokenName, $callbackName, Renderer $renderer) {
$renderer->registerTokenRenderer($tokenName, [$this, $callbackName], $this->set->getName());
} | php | protected function registerTokenRenderer($tokenName, $callbackName, Renderer $renderer) {
$renderer->registerTokenRenderer($tokenName, [$this, $callbackName], $this->set->getName());
} | [
"protected",
"function",
"registerTokenRenderer",
"(",
"$",
"tokenName",
",",
"$",
"callbackName",
",",
"Renderer",
"$",
"renderer",
")",
"{",
"$",
"renderer",
"->",
"registerTokenRenderer",
"(",
"$",
"tokenName",
",",
"[",
"$",
"this",
",",
"$",
"callbackName... | Register token renderer
@param string $tokenName token name
@param string $callbackName callback function in class
@param \ViKon\Parser\Renderer\Renderer $renderer | [
"Register",
"token",
"renderer"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/renderer/AbstractRenderer.php#L50-L52 |
nyeholt/silverstripe-simplewiki | code/SimpleWikiUtils.php | SimpleWikiUtils.quote | function quote($filter = array(), $join = " AND ") {
$QUOTE_CHAR = defined('DB::USE_ANSI_SQL') ? '"' : '';
$string = '';
$sep = '';
foreach ($filter as $field => $value) {
// first break the field up into its two components
$operator = '';
if (is_string($field)) {
list($field, $operator) = explod... | php | function quote($filter = array(), $join = " AND ") {
$QUOTE_CHAR = defined('DB::USE_ANSI_SQL') ? '"' : '';
$string = '';
$sep = '';
foreach ($filter as $field => $value) {
// first break the field up into its two components
$operator = '';
if (is_string($field)) {
list($field, $operator) = explod... | [
"function",
"quote",
"(",
"$",
"filter",
"=",
"array",
"(",
")",
",",
"$",
"join",
"=",
"\" AND \"",
")",
"{",
"$",
"QUOTE_CHAR",
"=",
"defined",
"(",
"'DB::USE_ANSI_SQL'",
")",
"?",
"'\"'",
":",
"''",
";",
"$",
"string",
"=",
"''",
";",
"$",
"sep"... | Quote up a filter of the form
array ("ParentID =" => 1)
@param unknown_type $filter
@return unknown_type | [
"Quote",
"up",
"a",
"filter",
"of",
"the",
"form"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/SimpleWikiUtils.php#L37-L80 |
pantera-digital/yii2-seo | models/SeoReplacementSearch.php | SeoReplacementSearch.search | public function search($params)
{
$query = SeoReplacement::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment ... | php | public function search($params)
{
$query = SeoReplacement::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment ... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"SeoReplacement",
"::",
"find",
"(",
")",
";",
"// add conditions that should always apply here",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoReplacementSearch.php#L42-L69 |
mamuz/MamuzBlog | src/MamuzBlog/Controller/AbstractQueryControllerFactory.php | AbstractQueryControllerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
/** @var ServiceLocatorInterface $domainManager */
$domainManager = $serviceL... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
/** @var ServiceLocatorInterface $domainManager */
$domainManager = $serviceL... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"if",
"(",
"$",
"serviceLocator",
"instanceof",
"ServiceLocatorAwareInterface",
")",
"{",
"$",
"serviceLocator",
"=",
"$",
"serviceLocator",
"->",
"getServiceLocator"... | {@inheritdoc}
@return AbstractController | [
"{"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/Controller/AbstractQueryControllerFactory.php#L19-L30 |
sifophp/sifo-common-instance | controllers/manager/findi18n.php | ManagerFindi18nController.getFileSystemFiles | public function getFileSystemFiles( $relative_path, $only_dirs = false )
{
$files = array();
// Extract directories:
$iterator = new \DirectoryIterator( ROOT_PATH . "/$relative_path" );
foreach ( $iterator as $file_info )
{
$file = $file_info->getFilename();
// Exclude .svn, .cache and any other fil... | php | public function getFileSystemFiles( $relative_path, $only_dirs = false )
{
$files = array();
// Extract directories:
$iterator = new \DirectoryIterator( ROOT_PATH . "/$relative_path" );
foreach ( $iterator as $file_info )
{
$file = $file_info->getFilename();
// Exclude .svn, .cache and any other fil... | [
"public",
"function",
"getFileSystemFiles",
"(",
"$",
"relative_path",
",",
"$",
"only_dirs",
"=",
"false",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"// Extract directories:",
"$",
"iterator",
"=",
"new",
"\\",
"DirectoryIterator",
"(",
"ROOT_PATH"... | Extracts from the filesystem all the files under a path.
If the flag only_dirs is set to true returns only the directories names.
@param string $relative_path
@param bool $only_dirs
@return array | [
"Extracts",
"from",
"the",
"filesystem",
"all",
"the",
"files",
"under",
"a",
"path",
".",
"If",
"the",
"flag",
"only_dirs",
"is",
"set",
"to",
"true",
"returns",
"only",
"the",
"directories",
"names",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/findi18n.php#L50-L72 |
sifophp/sifo-common-instance | controllers/manager/findi18n.php | ManagerFindi18nController.getI18nStats | private function getI18nStats()
{
$selected_instance = $this->filter_post->getString( 'instance' );
$selected_raw_locale = $this->filter_post->getString( 'locale' );
list( $file_type, $language_code, $country_code_and_extension ) = explode( '_', $selected_raw_locale );
$this->assign( 'language', $language_c... | php | private function getI18nStats()
{
$selected_instance = $this->filter_post->getString( 'instance' );
$selected_raw_locale = $this->filter_post->getString( 'locale' );
list( $file_type, $language_code, $country_code_and_extension ) = explode( '_', $selected_raw_locale );
$this->assign( 'language', $language_c... | [
"private",
"function",
"getI18nStats",
"(",
")",
"{",
"$",
"selected_instance",
"=",
"$",
"this",
"->",
"filter_post",
"->",
"getString",
"(",
"'instance'",
")",
";",
"$",
"selected_raw_locale",
"=",
"$",
"this",
"->",
"filter_post",
"->",
"getString",
"(",
... | Gets the selected parameters (instance, locale and charset), parses all literals (message used in translation method) inside this instance
and computes which of them exists in the materialized translations file in order to assign them to the view. | [
"Gets",
"the",
"selected",
"parameters",
"(",
"instance",
"locale",
"and",
"charset",
")",
"parses",
"all",
"literals",
"(",
"message",
"used",
"in",
"translation",
"method",
")",
"inside",
"this",
"instance",
"and",
"computes",
"which",
"of",
"them",
"exists"... | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/findi18n.php#L78-L108 |
sifophp/sifo-common-instance | controllers/manager/findi18n.php | ManagerFindi18nController.getLiterals | public function getLiterals( $instance )
{
$path = \Sifo\Bootstrap::$application . "/$instance";
// Parse all templates
$literals_groups['tpl'] = $this->extractStringsForTranslation( "$path/templates", $instance, true );
// Parse all models:
$literals_groups['models'] = $this->extractStringsForTranslation(... | php | public function getLiterals( $instance )
{
$path = \Sifo\Bootstrap::$application . "/$instance";
// Parse all templates
$literals_groups['tpl'] = $this->extractStringsForTranslation( "$path/templates", $instance, true );
// Parse all models:
$literals_groups['models'] = $this->extractStringsForTranslation(... | [
"public",
"function",
"getLiterals",
"(",
"$",
"instance",
")",
"{",
"$",
"path",
"=",
"\\",
"Sifo",
"\\",
"Bootstrap",
"::",
"$",
"application",
".",
"\"/$instance\"",
";",
"// Parse all templates",
"$",
"literals_groups",
"[",
"'tpl'",
"]",
"=",
"$",
"this... | Parses all templates, models, controllers, configs and Smarty plugins searching for strings used inside translation methods and returns them structured in an array.
@param string $instance Sifo instance to search in
@return array structured array where:
array key: The string to be translated (message).
array value: Th... | [
"Parses",
"all",
"templates",
"models",
"controllers",
"configs",
"and",
"Smarty",
"plugins",
"searching",
"for",
"strings",
"used",
"inside",
"translation",
"methods",
"and",
"returns",
"them",
"structured",
"in",
"an",
"array",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/findi18n.php#L118-L163 |
sifophp/sifo-common-instance | controllers/manager/findi18n.php | ManagerFindi18nController.extractStringsForTranslation | private function extractStringsForTranslation( $path, $instance, $in_templates = false )
{
// Parse .php files:
$literals = array();
$file_list = array();
if ( !$in_templates )
{
exec( "find * $path |grep .php$", $file_list );
}
else
{
exec( "find * $path |grep .tpl$", $file_list );
}
fore... | php | private function extractStringsForTranslation( $path, $instance, $in_templates = false )
{
// Parse .php files:
$literals = array();
$file_list = array();
if ( !$in_templates )
{
exec( "find * $path |grep .php$", $file_list );
}
else
{
exec( "find * $path |grep .tpl$", $file_list );
}
fore... | [
"private",
"function",
"extractStringsForTranslation",
"(",
"$",
"path",
",",
"$",
"instance",
",",
"$",
"in_templates",
"=",
"false",
")",
"{",
"// Parse .php files:",
"$",
"literals",
"=",
"array",
"(",
")",
";",
"$",
"file_list",
"=",
"array",
"(",
")",
... | Search for all literals/strings used in translation methods inside a $path
@param string $path
@param string $instance
@param bool $in_templates
@return array structured array where:
array key: The string to be translated (message).
array value: The different files which uses this message separated by commas. | [
"Search",
"for",
"all",
"literals",
"/",
"strings",
"used",
"in",
"translation",
"methods",
"inside",
"a",
"$path"
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/findi18n.php#L175-L242 |
eleven-lab/php-ogc | src/DataTypes/Polygon.php | Polygon.fromArray | public static function fromArray(array $linestrings)
{
$parsed_linestrings = array_map(function($linestring){
return LineString::fromArray($linestring);
}, $linestrings);
return new static($parsed_linestrings);
} | php | public static function fromArray(array $linestrings)
{
$parsed_linestrings = array_map(function($linestring){
return LineString::fromArray($linestring);
}, $linestrings);
return new static($parsed_linestrings);
} | [
"public",
"static",
"function",
"fromArray",
"(",
"array",
"$",
"linestrings",
")",
"{",
"$",
"parsed_linestrings",
"=",
"array_map",
"(",
"function",
"(",
"$",
"linestring",
")",
"{",
"return",
"LineString",
"::",
"fromArray",
"(",
"$",
"linestring",
")",
"... | A Polygon could be instantiated with an array like that:
[ [[x,y],[x,y],[x,y]], [[x,y],[x,y],[x,y]], ..., [[x,y],[x,y],[x,y]] ]
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
external linestring 1st internal linest i-th internal linest
@param array $linestrings
@return Polygon | [
"A",
"Polygon",
"could",
"be",
"instantiated",
"with",
"an",
"array",
"like",
"that",
":"
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/Polygon.php#L37-L43 |
eleven-lab/php-ogc | src/DataTypes/Polygon.php | Polygon.fromString | public static function fromString($linestrings, $linestrings_separator = ";", $points_separator = ",", $coords_separator = " ")
{
$separators = [$linestrings_separator, $points_separator, $coords_separator];
if(sizeof($separators) != sizeof(array_unique($separators)))
throw new GeoSpatia... | php | public static function fromString($linestrings, $linestrings_separator = ";", $points_separator = ",", $coords_separator = " ")
{
$separators = [$linestrings_separator, $points_separator, $coords_separator];
if(sizeof($separators) != sizeof(array_unique($separators)))
throw new GeoSpatia... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"linestrings",
",",
"$",
"linestrings_separator",
"=",
"\";\"",
",",
"$",
"points_separator",
"=",
"\",\"",
",",
"$",
"coords_separator",
"=",
"\" \"",
")",
"{",
"$",
"separators",
"=",
"[",
"$",
"lines... | A Polygon could be instantiated using a string containing linestrings.
es. "lat lon, lat lon; lat lon, lat lon; lat lon, lat lon"
@param $linestrings
@param $linestrings_separator
@param $points_separator
@param $coords_separator
@return Polygon
@throws GeoSpatialException | [
"A",
"Polygon",
"could",
"be",
"instantiated",
"using",
"a",
"string",
"containing",
"linestrings",
".",
"es",
".",
"lat",
"lon",
"lat",
"lon",
";",
"lat",
"lon",
"lat",
"lon",
";",
"lat",
"lon",
"lat",
"lon"
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/Polygon.php#L56-L67 |
venta/framework | src/Adr/src/AbstractResponder.php | AbstractResponder.html | protected function html(string $html, int $status = 200, array $headers = []): ResponseInterface
{
return $this->responseFactory->createHtmlResponse($html, $status, $headers);
} | php | protected function html(string $html, int $status = 200, array $headers = []): ResponseInterface
{
return $this->responseFactory->createHtmlResponse($html, $status, $headers);
} | [
"protected",
"function",
"html",
"(",
"string",
"$",
"html",
",",
"int",
"$",
"status",
"=",
"200",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"responseFactory",
"->",
"createHtmlResponse",... | Creates html response.
@param string $html
@param int $status
@param array $headers
@return ResponseInterface | [
"Creates",
"html",
"response",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Adr/src/AbstractResponder.php#L45-L48 |
venta/framework | src/Adr/src/AbstractResponder.php | AbstractResponder.json | protected function json(
$data,
int $status = 200,
array $headers = [],
int $encodingOptions = JsonResponse::DEFAULT_JSON_FLAGS
): ResponseInterface {
return $this->responseFactory->createJsonResponse($data, $status, $headers, $encodingOptions);
} | php | protected function json(
$data,
int $status = 200,
array $headers = [],
int $encodingOptions = JsonResponse::DEFAULT_JSON_FLAGS
): ResponseInterface {
return $this->responseFactory->createJsonResponse($data, $status, $headers, $encodingOptions);
} | [
"protected",
"function",
"json",
"(",
"$",
"data",
",",
"int",
"$",
"status",
"=",
"200",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"int",
"$",
"encodingOptions",
"=",
"JsonResponse",
"::",
"DEFAULT_JSON_FLAGS",
")",
":",
"ResponseInterface",
"{",
... | Creates HTTP response with JSON content type header and JSON encoded $data.
@param mixed $data Data to convert to JSON.
@param int $status Integer status code for the response; 200 by default.
@param array $headers Array of headers to use at initialization.
@param int $encodingOptions
@return ResponseInterface | [
"Creates",
"HTTP",
"response",
"with",
"JSON",
"content",
"type",
"header",
"and",
"JSON",
"encoded",
"$data",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Adr/src/AbstractResponder.php#L59-L66 |
venta/framework | src/Adr/src/AbstractResponder.php | AbstractResponder.redirect | protected function redirect($uri, $status = 302, array $headers = []): ResponseInterface
{
return $this->responseFactory->createRedirectResponse($uri, $status, $headers);
} | php | protected function redirect($uri, $status = 302, array $headers = []): ResponseInterface
{
return $this->responseFactory->createRedirectResponse($uri, $status, $headers);
} | [
"protected",
"function",
"redirect",
"(",
"$",
"uri",
",",
"$",
"status",
"=",
"302",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"responseFactory",
"->",
"createRedirectResponse",
"(",
"$",... | Creates HTTP redirect response with $uri used as Location header.
@param string|UriInterface $uri
@param int $status
@param array $headers
@return ResponseInterface | [
"Creates",
"HTTP",
"redirect",
"response",
"with",
"$uri",
"used",
"as",
"Location",
"header",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Adr/src/AbstractResponder.php#L76-L79 |
venta/framework | src/Adr/src/AbstractResponder.php | AbstractResponder.response | protected function response($bodyStream = 'php://memory', int $status = 200, array $headers = []): ResponseInterface
{
return $this->responseFactory->createResponse($bodyStream, $status, $headers);
} | php | protected function response($bodyStream = 'php://memory', int $status = 200, array $headers = []): ResponseInterface
{
return $this->responseFactory->createResponse($bodyStream, $status, $headers);
} | [
"protected",
"function",
"response",
"(",
"$",
"bodyStream",
"=",
"'php://memory'",
",",
"int",
"$",
"status",
"=",
"200",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"responseFactory",
"->"... | Creates HTTP response.
@param string $bodyStream Stream to use as response body.
@param int $status
@param array $headers
@return ResponseInterface | [
"Creates",
"HTTP",
"response",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Adr/src/AbstractResponder.php#L89-L92 |
pyaesone17/sms-poh | src/SmsPoh.php | SmsPoh.send | public function send($to, $message, $test=false, $callback=null)
{
return $this->client->send([
'to' => $to,
'message' => $message,
'test' => $test,
'callback' => null
]);
} | php | public function send($to, $message, $test=false, $callback=null)
{
return $this->client->send([
'to' => $to,
'message' => $message,
'test' => $test,
'callback' => null
]);
} | [
"public",
"function",
"send",
"(",
"$",
"to",
",",
"$",
"message",
",",
"$",
"test",
"=",
"false",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"[",
"'to'",
"=>",
"$",
"to",
",",
"'message... | Send the given notification.
@param mixed $notifiable
@param \Illuminate\Notifications\Notification $notification
@return void | [
"Send",
"the",
"given",
"notification",
"."
] | train | https://github.com/pyaesone17/sms-poh/blob/c5ee88c47da886f1209b08b48c28852a90e916f4/src/SmsPoh.php#L21-L29 |
venta/framework | src/Debug/src/ErrorHandler.php | ErrorHandler.handleShutdown | public function handleShutdown()
{
$this->canThrowException = false;
$error = error_get_last();
if (!empty($error) && ($error['type'] & self::FATAL)) {
// Fatal error is not passed to handleError, we need to pass it manually.
$this->handleError($error['type'], $error[... | php | public function handleShutdown()
{
$this->canThrowException = false;
$error = error_get_last();
if (!empty($error) && ($error['type'] & self::FATAL)) {
// Fatal error is not passed to handleError, we need to pass it manually.
$this->handleError($error['type'], $error[... | [
"public",
"function",
"handleShutdown",
"(",
")",
"{",
"$",
"this",
"->",
"canThrowException",
"=",
"false",
";",
"$",
"error",
"=",
"error_get_last",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"error",
")",
"&&",
"(",
"$",
"error",
"[",
"'typ... | {@inheritDoc} | [
"{"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Debug/src/ErrorHandler.php#L76-L84 |
venta/framework | src/Debug/src/ErrorHandler.php | ErrorHandler.handleThrowable | public function handleThrowable(Throwable $e)
{
$this->reporters->report($e);
$this->renderer->render($e);
} | php | public function handleThrowable(Throwable $e)
{
$this->reporters->report($e);
$this->renderer->render($e);
} | [
"public",
"function",
"handleThrowable",
"(",
"Throwable",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"reporters",
"->",
"report",
"(",
"$",
"e",
")",
";",
"$",
"this",
"->",
"renderer",
"->",
"render",
"(",
"$",
"e",
")",
";",
"}"
] | {@inheritDoc} | [
"{"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Debug/src/ErrorHandler.php#L89-L93 |
euro-ix/ixf-client-php | lib/IXF/Object.php | Object.scopedConstructFrom | public static function scopedConstructFrom($class, $values)
{
if( isset( $values[ 'pk' ] ) )
$values[ 'id' ] = $values[ 'pk' ];
$obj = new $class(isset($values['id']) ? $values['id'] : null);
$obj->refreshFrom($values);
return $obj;
} | php | public static function scopedConstructFrom($class, $values)
{
if( isset( $values[ 'pk' ] ) )
$values[ 'id' ] = $values[ 'pk' ];
$obj = new $class(isset($values['id']) ? $values['id'] : null);
$obj->refreshFrom($values);
return $obj;
} | [
"public",
"static",
"function",
"scopedConstructFrom",
"(",
"$",
"class",
",",
"$",
"values",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"values",
"[",
"'pk'",
"]",
")",
")",
"$",
"values",
"[",
"'id'",
"]",
"=",
"$",
"values",
"[",
"'pk'",
"]",
";",
... | This unfortunately needs to be public to be used in Util.php
@param Object $class
@param array $values
@return Object The object constructed from the given values. | [
"This",
"unfortunately",
"needs",
"to",
"be",
"public",
"to",
"be",
"used",
"in",
"Util",
".",
"php"
] | train | https://github.com/euro-ix/ixf-client-php/blob/dd39f5c17dc2d3795fcacf5d06793ca28886f3c1/lib/IXF/Object.php#L80-L88 |
euro-ix/ixf-client-php | lib/IXF/Object.php | Object.refreshFrom | public function refreshFrom( $values )
{
$removed = array_diff( array_keys( $this->_values ), array_keys( $values ) );
foreach( $removed as $k )
unset( $this->$k );
foreach( $values as $k => $v )
$this->_values[$k] = Util::convertToIxfObject( $v );
} | php | public function refreshFrom( $values )
{
$removed = array_diff( array_keys( $this->_values ), array_keys( $values ) );
foreach( $removed as $k )
unset( $this->$k );
foreach( $values as $k => $v )
$this->_values[$k] = Util::convertToIxfObject( $v );
} | [
"public",
"function",
"refreshFrom",
"(",
"$",
"values",
")",
"{",
"$",
"removed",
"=",
"array_diff",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"_values",
")",
",",
"array_keys",
"(",
"$",
"values",
")",
")",
";",
"foreach",
"(",
"$",
"removed",
"as",... | Refreshes this object using the provided values.
@param array $values
@param boolean $partial Defaults to false. | [
"Refreshes",
"this",
"object",
"using",
"the",
"provided",
"values",
"."
] | train | https://github.com/euro-ix/ixf-client-php/blob/dd39f5c17dc2d3795fcacf5d06793ca28886f3c1/lib/IXF/Object.php#L109-L118 |
DevGroup-ru/yii2-data-structure-tools | src/migrations/m150923_140300_properties.php | m150923_140300_properties.up | public function up()
{
mb_internal_encoding("UTF-8");
$tableOptions = $this->db->driverName === 'mysql'
? 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'
: null;
$this->createTable('{{%property}}', [
'id' => $this->primaryKey(),
'ap... | php | public function up()
{
mb_internal_encoding("UTF-8");
$tableOptions = $this->db->driverName === 'mysql'
? 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'
: null;
$this->createTable('{{%property}}', [
'id' => $this->primaryKey(),
'ap... | [
"public",
"function",
"up",
"(",
")",
"{",
"mb_internal_encoding",
"(",
"\"UTF-8\"",
")",
";",
"$",
"tableOptions",
"=",
"$",
"this",
"->",
"db",
"->",
"driverName",
"===",
"'mysql'",
"?",
"'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'",
":",
"null",
... | Applies migrations | [
"Applies",
"migrations"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/migrations/m150923_140300_properties.php#L14-L172 |
DevGroup-ru/yii2-data-structure-tools | src/migrations/m150923_140300_properties.php | m150923_140300_properties.down | public function down()
{
$this->db->createCommand("SET foreign_key_checks = 0")->execute();
$this->dropTable('{{%property_property_group}}');
$this->dropTable('{{%property_translation}}');
$this->dropTable('{{%property}}');
$this->dropTable('{{%property_group_translation}}')... | php | public function down()
{
$this->db->createCommand("SET foreign_key_checks = 0")->execute();
$this->dropTable('{{%property_property_group}}');
$this->dropTable('{{%property_translation}}');
$this->dropTable('{{%property}}');
$this->dropTable('{{%property_group_translation}}')... | [
"public",
"function",
"down",
"(",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"createCommand",
"(",
"\"SET foreign_key_checks = 0\"",
")",
"->",
"execute",
"(",
")",
";",
"$",
"this",
"->",
"dropTable",
"(",
"'{{%property_property_group}}'",
")",
";",
"$",
"th... | Removes all properties related tables | [
"Removes",
"all",
"properties",
"related",
"tables"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/migrations/m150923_140300_properties.php#L177-L195 |
bariew/yii2-rbac-cms-module | components/EventHandlers.php | EventHandlers.afterViewRenderLinkRemove | public static function afterViewRenderLinkRemove($event)
{
if (get_class(Yii::$app) == Application::className()) {
return true;
}
if (in_array(Yii::$app->controller->module->id, ['gii', 'debug'])) {
return true;
}
$event->output = ViewAccess::denyLinks... | php | public static function afterViewRenderLinkRemove($event)
{
if (get_class(Yii::$app) == Application::className()) {
return true;
}
if (in_array(Yii::$app->controller->module->id, ['gii', 'debug'])) {
return true;
}
$event->output = ViewAccess::denyLinks... | [
"public",
"static",
"function",
"afterViewRenderLinkRemove",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"get_class",
"(",
"Yii",
"::",
"$",
"app",
")",
"==",
"Application",
"::",
"className",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"in_... | Runs access methods for view event.
@param ViewEvent $event view event.
@return bool | [
"Runs",
"access",
"methods",
"for",
"view",
"event",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/EventHandlers.php#L28-L37 |
bariew/yii2-rbac-cms-module | components/EventHandlers.php | EventHandlers.beforeActionAccess | public static function beforeActionAccess($event)
{
$controller = $event->sender;
$permissionName = AuthItem::createPermissionName([$controller->module->id, $controller->id, $controller->action->id]);
if (!AuthItem::checkAccess($permissionName, Yii::$app->user)) {
throw new HttpE... | php | public static function beforeActionAccess($event)
{
$controller = $event->sender;
$permissionName = AuthItem::createPermissionName([$controller->module->id, $controller->id, $controller->action->id]);
if (!AuthItem::checkAccess($permissionName, Yii::$app->user)) {
throw new HttpE... | [
"public",
"static",
"function",
"beforeActionAccess",
"(",
"$",
"event",
")",
"{",
"$",
"controller",
"=",
"$",
"event",
"->",
"sender",
";",
"$",
"permissionName",
"=",
"AuthItem",
"::",
"createPermissionName",
"(",
"[",
"$",
"controller",
"->",
"module",
"... | Checks whether current user has access to current controller action.
@param Event $event controller beforeAction event.
@throws \yii\web\HttpException | [
"Checks",
"whether",
"current",
"user",
"has",
"access",
"to",
"current",
"controller",
"action",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/EventHandlers.php#L53-L60 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Alerts.php | Alerts.create | public function create($alert, $recipients, $wait, $repeat){
$alert['recipients'] = json_encode($recipients);
$alert['wait'] = json_encode($wait);
$alert['repeat'] = json_encode($repeat);
return $this->post('alerts/configs/', $alert);
} | php | public function create($alert, $recipients, $wait, $repeat){
$alert['recipients'] = json_encode($recipients);
$alert['wait'] = json_encode($wait);
$alert['repeat'] = json_encode($repeat);
return $this->post('alerts/configs/', $alert);
} | [
"public",
"function",
"create",
"(",
"$",
"alert",
",",
"$",
"recipients",
",",
"$",
"wait",
",",
"$",
"repeat",
")",
"{",
"$",
"alert",
"[",
"'recipients'",
"]",
"=",
"json_encode",
"(",
"$",
"recipients",
")",
";",
"$",
"alert",
"[",
"'wait'",
"]",... | Create an alert
@link https://developer.serverdensity.com/docs/creating-an-alert
@param array $alert with the basic attributes
@param array $recipients with all its recipients
@param array $wait with seconds, enabled and displayunit
@param array $repeat with seconds, enabled and d... | [
"Create",
"an",
"alert"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Alerts.php#L16-L22 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Alerts.php | Alerts.update | public function update($id, $fields, $other=array()){
if(array_key_exists('wait', $other)){
$fields['wait'] = json_encode($other['wait']);
}
if(array_key_exists('recipients', $other)){
$fields['recipients'] = json_encode($other['recipients']);
}
if(array_k... | php | public function update($id, $fields, $other=array()){
if(array_key_exists('wait', $other)){
$fields['wait'] = json_encode($other['wait']);
}
if(array_key_exists('recipients', $other)){
$fields['recipients'] = json_encode($other['recipients']);
}
if(array_k... | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"$",
"fields",
",",
"$",
"other",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'wait'",
",",
"$",
"other",
")",
")",
"{",
"$",
"fields",
"[",
"'wait'",
"]",
"=",
"json... | Update alert
@link https://developer.serverdensity.com/docs/updating-alerts
@param string $id the id of the alert
@param array $fields the fields to updated in the alert.
@param array $other an array that optionally consists of wait, repeat etc.
@return an array of arrays with devices. | [
"Update",
"alert"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Alerts.php#L51-L64 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Alerts.php | Alerts.bySubject | public function bySubject($subjectId, $subjectType){
$type = array('subjectType' => $subjectType);
return $this->get('alerts/configs/'.rawurlencode($subjectId), $type);
} | php | public function bySubject($subjectId, $subjectType){
$type = array('subjectType' => $subjectType);
return $this->get('alerts/configs/'.rawurlencode($subjectId), $type);
} | [
"public",
"function",
"bySubject",
"(",
"$",
"subjectId",
",",
"$",
"subjectType",
")",
"{",
"$",
"type",
"=",
"array",
"(",
"'subjectType'",
"=>",
"$",
"subjectType",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"'alerts/configs/'",
".",
"rawurlenco... | Get all alerts by subjectId
@link https://developer.serverdensity.com/docs/listing-alerts-by-subject
@param string $subjectId Id of the subject tied to alert
@param string $subjectType either device or service
@return an array of arrays with devices. | [
"Get",
"all",
"alerts",
"by",
"subjectId"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Alerts.php#L74-L78 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Alerts.php | Alerts.triggered | public function triggered($closed='', $subjectType='', $subjectId=''){
$fields = array();
if(!empty($closed)){
$fields['closed'] = $closed;
}
if (!empty($subjectType)) {
$fields['subjectType'] = $subjectType;
}
return $this->get('alerts/triggered/... | php | public function triggered($closed='', $subjectType='', $subjectId=''){
$fields = array();
if(!empty($closed)){
$fields['closed'] = $closed;
}
if (!empty($subjectType)) {
$fields['subjectType'] = $subjectType;
}
return $this->get('alerts/triggered/... | [
"public",
"function",
"triggered",
"(",
"$",
"closed",
"=",
"''",
",",
"$",
"subjectType",
"=",
"''",
",",
"$",
"subjectId",
"=",
"''",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"closed",
")",
")",
... | Get triggered alerts
@link https://developer.serverdensity.com/docs/triggered-alerts
@param bool $closed whether alert is closed or open
@param string $subjectType the subjecttype to filter on
@param string $subjectId optional subjectID to filter on.
@return an array of arrays with d... | [
"Get",
"triggered",
"alerts"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Alerts.php#L99-L109 |
ikwattro/guzzle-stereo | src/RecorderMiddleware.php | RecorderMiddleware.record | public static function record(Recorder $recorder)
{
return function (callable $handler) use ($recorder) {
return function ($request, array $options) use ($handler, $recorder) {
return $handler($request, $options)->then(
function ($response) use ($request, $recor... | php | public static function record(Recorder $recorder)
{
return function (callable $handler) use ($recorder) {
return function ($request, array $options) use ($handler, $recorder) {
return $handler($request, $options)->then(
function ($response) use ($request, $recor... | [
"public",
"static",
"function",
"record",
"(",
"Recorder",
"$",
"recorder",
")",
"{",
"return",
"function",
"(",
"callable",
"$",
"handler",
")",
"use",
"(",
"$",
"recorder",
")",
"{",
"return",
"function",
"(",
"$",
"request",
",",
"array",
"$",
"option... | @param \Ikwattro\GuzzleStereo\Recorder
@return callable | [
"@param",
"\\",
"Ikwattro",
"\\",
"GuzzleStereo",
"\\",
"Recorder"
] | train | https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/RecorderMiddleware.php#L23-L46 |
fuelphp/filesystem | src/File.php | File.append | public function append($data)
{
$bites = file_put_contents($this->path, $data, FILE_APPEND | LOCK_EX);
return $bites !== false;
} | php | public function append($data)
{
$bites = file_put_contents($this->path, $data, FILE_APPEND | LOCK_EX);
return $bites !== false;
} | [
"public",
"function",
"append",
"(",
"$",
"data",
")",
"{",
"$",
"bites",
"=",
"file_put_contents",
"(",
"$",
"this",
"->",
"path",
",",
"$",
"data",
",",
"FILE_APPEND",
"|",
"LOCK_EX",
")",
";",
"return",
"$",
"bites",
"!==",
"false",
";",
"}"
] | Appends data to a file
@param string $data
@return boolean | [
"Appends",
"data",
"to",
"a",
"file"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/File.php#L32-L37 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.