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 |
|---|---|---|---|---|---|---|---|---|---|---|
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.ProcessExifDir | function ProcessExifDir($DirStart, $OffsetBase, $ExifLength)
{
$NumDirEntries = 0;
$ValuePtr = array();
$NumDirEntries = $this->Get16u($DirStart[0], $DirStart[1]);
$this->debug("<br>Directory with $NumDirEntries entries\n");
for ($de = 0; $de < $NumDirEntries; $de++)
... | php | function ProcessExifDir($DirStart, $OffsetBase, $ExifLength)
{
$NumDirEntries = 0;
$ValuePtr = array();
$NumDirEntries = $this->Get16u($DirStart[0], $DirStart[1]);
$this->debug("<br>Directory with $NumDirEntries entries\n");
for ($de = 0; $de < $NumDirEntries; $de++)
... | [
"function",
"ProcessExifDir",
"(",
"$",
"DirStart",
",",
"$",
"OffsetBase",
",",
"$",
"ExifLength",
")",
"{",
"$",
"NumDirEntries",
"=",
"0",
";",
"$",
"ValuePtr",
"=",
"array",
"(",
")",
";",
"$",
"NumDirEntries",
"=",
"$",
"this",
"->",
"Get16u",
"("... | Process one of the nested EXIF directories.
@param string $DirStart All directory information
@param string $OffsetBase whole Section
@param int $ExifLength Length of exif section | [
"Process",
"one",
"of",
"the",
"nested",
"EXIF",
"directories",
".",
"@param",
"string",
"$DirStart",
"All",
"directory",
"information",
"@param",
"string",
"$OffsetBase",
"whole",
"Section",
"@param",
"int",
"$ExifLength",
"Length",
"of",
"exif",
"section"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L768-L1559 |
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.process_EXIF | function process_EXIF($data, $length)
{
$this->debug("Exif header $length bytes long\n");
if (($data[2] . $data[3] . $data[4] . $data[5]) != "Exif")
{
$this->errno = 52;
$this->errstr = "NOT EXIF FORMAT";
$this->debug($this->errstr, 1);
}
... | php | function process_EXIF($data, $length)
{
$this->debug("Exif header $length bytes long\n");
if (($data[2] . $data[3] . $data[4] . $data[5]) != "Exif")
{
$this->errno = 52;
$this->errstr = "NOT EXIF FORMAT";
$this->debug($this->errstr, 1);
}
... | [
"function",
"process_EXIF",
"(",
"$",
"data",
",",
"$",
"length",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"Exif header $length bytes long\\n\"",
")",
";",
"if",
"(",
"(",
"$",
"data",
"[",
"2",
"]",
".",
"$",
"data",
"[",
"3",
"]",
".",
"$",
"... | Process Exif data
@param array $data Section data as an array
@param int $length Length of the section (length of data array) | [
"Process",
"Exif",
"data",
"@param",
"array",
"$data",
"Section",
"data",
"as",
"an",
"array",
"@param",
"int",
"$length",
"Length",
"of",
"the",
"section",
"(",
"length",
"of",
"data",
"array",
")"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L1578-L1636 |
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.Get16u | function Get16u($val, $by)
{
if ($this->MotorolaOrder)
{
return ((ord($val) << 8) | ord($by));
}
else
{
return ((ord($by) << 8) | ord($val));
}
} | php | function Get16u($val, $by)
{
if ($this->MotorolaOrder)
{
return ((ord($val) << 8) | ord($by));
}
else
{
return ((ord($by) << 8) | ord($val));
}
} | [
"function",
"Get16u",
"(",
"$",
"val",
",",
"$",
"by",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"MotorolaOrder",
")",
"{",
"return",
"(",
"(",
"ord",
"(",
"$",
"val",
")",
"<<",
"8",
")",
"|",
"ord",
"(",
"$",
"by",
")",
")",
";",
"}",
"else... | Converts two byte number into its equivalent int integer
@param int
@param int | [
"Converts",
"two",
"byte",
"number",
"into",
"its",
"equivalent",
"int",
"integer",
"@param",
"int",
"@param",
"int"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L1644-L1654 |
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.Get32s | function Get32s($val1, $val2, $val3, $val4)
{
$val1 = ord($val1);
$val2 = ord($val2);
$val3 = ord($val3);
$val4 = ord($val4);
if ($this->MotorolaOrder)
{
return (($val1 << 24) | ($val2 << 16) | ($val3 << 8) | ($val4 << 0));
}
else
... | php | function Get32s($val1, $val2, $val3, $val4)
{
$val1 = ord($val1);
$val2 = ord($val2);
$val3 = ord($val3);
$val4 = ord($val4);
if ($this->MotorolaOrder)
{
return (($val1 << 24) | ($val2 << 16) | ($val3 << 8) | ($val4 << 0));
}
else
... | [
"function",
"Get32s",
"(",
"$",
"val1",
",",
"$",
"val2",
",",
"$",
"val3",
",",
"$",
"val4",
")",
"{",
"$",
"val1",
"=",
"ord",
"(",
"$",
"val1",
")",
";",
"$",
"val2",
"=",
"ord",
"(",
"$",
"val2",
")",
";",
"$",
"val3",
"=",
"ord",
"(",
... | Converts 4-byte number into its equivalent integer
@param int
@param int
@param int
@param int
@return int | [
"Converts",
"4",
"-",
"byte",
"number",
"into",
"its",
"equivalent",
"integer"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L1666-L1681 |
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.get32u | function get32u($val1, $val2, $val3, $val4)
{
return ($this->Get32s($val1, $val2, $val3, $val4) & 0xffffffff);
} | php | function get32u($val1, $val2, $val3, $val4)
{
return ($this->Get32s($val1, $val2, $val3, $val4) & 0xffffffff);
} | [
"function",
"get32u",
"(",
"$",
"val1",
",",
"$",
"val2",
",",
"$",
"val3",
",",
"$",
"val4",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"Get32s",
"(",
"$",
"val1",
",",
"$",
"val2",
",",
"$",
"val3",
",",
"$",
"val4",
")",
"&",
"0xffffffff",
... | Converts 4-byte number into its equivalent integer with the help of Get32s
@param int
@param int
@param int
@param int
@return int | [
"Converts",
"4",
"-",
"byte",
"number",
"into",
"its",
"equivalent",
"integer",
"with",
"the",
"help",
"of",
"Get32s"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L1694-L1697 |
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.ConvertAnyFormat | function ConvertAnyFormat($ValuePtr, $Format)
{
$Value = 0;
switch ($Format)
{
case FMT_SBYTE:
$Value = $ValuePtr[0];
break;
case FMT_BYTE:
$Value = $ValuePtr[0];
break;
case FMT_USHORT:
... | php | function ConvertAnyFormat($ValuePtr, $Format)
{
$Value = 0;
switch ($Format)
{
case FMT_SBYTE:
$Value = $ValuePtr[0];
break;
case FMT_BYTE:
$Value = $ValuePtr[0];
break;
case FMT_USHORT:
... | [
"function",
"ConvertAnyFormat",
"(",
"$",
"ValuePtr",
",",
"$",
"Format",
")",
"{",
"$",
"Value",
"=",
"0",
";",
"switch",
"(",
"$",
"Format",
")",
"{",
"case",
"FMT_SBYTE",
":",
"$",
"Value",
"=",
"$",
"ValuePtr",
"[",
"0",
"]",
";",
"break",
";",... | -------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L1702-L1756 |
Eresus/EresusCMS | src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php | phpExifReader.saveThumbnail | function saveThumbnail($ThumbFile)
{
$ThumbFile = trim($ThumbFile);
$file = basename($this->file);
if (empty($ThumbFile))
{
$ThumbFile = "th_$file";
}
if (!empty($this->ImageInfo["h"]["Thumbnail"]))
{
$tp = fopen($ThumbFile, "wb");
... | php | function saveThumbnail($ThumbFile)
{
$ThumbFile = trim($ThumbFile);
$file = basename($this->file);
if (empty($ThumbFile))
{
$ThumbFile = "th_$file";
}
if (!empty($this->ImageInfo["h"]["Thumbnail"]))
{
$tp = fopen($ThumbFile, "wb");
... | [
"function",
"saveThumbnail",
"(",
"$",
"ThumbFile",
")",
"{",
"$",
"ThumbFile",
"=",
"trim",
"(",
"$",
"ThumbFile",
")",
";",
"$",
"file",
"=",
"basename",
"(",
"$",
"this",
"->",
"file",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"ThumbFile",
")",
")... | Function to extract thumbnail from Exif data of the image.
and store it in a filename given by $ThumbFile
@param string $ThumbFile Files name to store the thumbnail | [
"Function",
"to",
"extract",
"thumbnail",
"from",
"Exif",
"data",
"of",
"the",
"image",
".",
"and",
"store",
"it",
"in",
"a",
"filename",
"given",
"by",
"$ThumbFile"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/plugins/images/connector/php/exifReader.php#L1765-L1789 |
mikelgoig/nova-spotify-auth-tool | src/Http/Middleware/Authorize.php | Authorize.handle | public function handle($request, $next)
{
return resolve(SpotifyAuthTool::class)->authorize($request) ? $next($request) : abort(403);
} | php | public function handle($request, $next)
{
return resolve(SpotifyAuthTool::class)->authorize($request) ? $next($request) : abort(403);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"$",
"next",
")",
"{",
"return",
"resolve",
"(",
"SpotifyAuthTool",
"::",
"class",
")",
"->",
"authorize",
"(",
"$",
"request",
")",
"?",
"$",
"next",
"(",
"$",
"request",
")",
":",
"abort",
"... | Handle the incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return \Illuminate\Http\Response | [
"Handle",
"the",
"incoming",
"request",
"."
] | train | https://github.com/mikelgoig/nova-spotify-auth-tool/blob/a5351c386206c45f77fe6ae833cdac51f2a030f4/src/Http/Middleware/Authorize.php#L16-L19 |
zhouyl/mellivora | Mellivora/Events/CallQueuedHandler.php | CallQueuedHandler.setJobInstanceIfNecessary | protected function setJobInstanceIfNecessary(Job $job, $instance)
{
if (in_array(InteractsWithQueue::class, class_uses_recursive(get_class($instance)))) {
$instance->setJob($job);
}
return $instance;
} | php | protected function setJobInstanceIfNecessary(Job $job, $instance)
{
if (in_array(InteractsWithQueue::class, class_uses_recursive(get_class($instance)))) {
$instance->setJob($job);
}
return $instance;
} | [
"protected",
"function",
"setJobInstanceIfNecessary",
"(",
"Job",
"$",
"job",
",",
"$",
"instance",
")",
"{",
"if",
"(",
"in_array",
"(",
"InteractsWithQueue",
"::",
"class",
",",
"class_uses_recursive",
"(",
"get_class",
"(",
"$",
"instance",
")",
")",
")",
... | Set the job instance of the given class if necessary.
@param \Mellivora\Support\Contracts\Queue\Job $job
@param mixed $instance
@return mixed | [
"Set",
"the",
"job",
"instance",
"of",
"the",
"given",
"class",
"if",
"necessary",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Events/CallQueuedHandler.php#L63-L70 |
zhouyl/mellivora | Mellivora/Events/CallQueuedHandler.php | CallQueuedHandler.failed | public function failed(array $data, $e)
{
$handler = $this->container->make($data['class']);
$parameters = array_merge(unserialize($data['data']), [$e]);
if (method_exists($handler, 'failed')) {
call_user_func_array([$handler, 'failed'], $parameters);
}
} | php | public function failed(array $data, $e)
{
$handler = $this->container->make($data['class']);
$parameters = array_merge(unserialize($data['data']), [$e]);
if (method_exists($handler, 'failed')) {
call_user_func_array([$handler, 'failed'], $parameters);
}
} | [
"public",
"function",
"failed",
"(",
"array",
"$",
"data",
",",
"$",
"e",
")",
"{",
"$",
"handler",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"$",
"data",
"[",
"'class'",
"]",
")",
";",
"$",
"parameters",
"=",
"array_merge",
"(",
"uns... | Call the failed method on the job instance.
The event instance and the exception will be passed.
@param array $data
@param \Exception $e
@return void | [
"Call",
"the",
"failed",
"method",
"on",
"the",
"job",
"instance",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Events/CallQueuedHandler.php#L82-L91 |
WellCommerce/AppBundle | Twig/CurrencyExtension.php | CurrencyExtension.formatPrice | public function formatPrice(float $price, $baseCurrency = null, $targetCurrency = null, $locale = null, $quantity = 1) : string
{
return $this->helper->convertAndFormat($price, $baseCurrency, $targetCurrency, $quantity, $locale);
} | php | public function formatPrice(float $price, $baseCurrency = null, $targetCurrency = null, $locale = null, $quantity = 1) : string
{
return $this->helper->convertAndFormat($price, $baseCurrency, $targetCurrency, $quantity, $locale);
} | [
"public",
"function",
"formatPrice",
"(",
"float",
"$",
"price",
",",
"$",
"baseCurrency",
"=",
"null",
",",
"$",
"targetCurrency",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"quantity",
"=",
"1",
")",
":",
"string",
"{",
"return",
"$",
... | Formats the given amount
@param int|float $price
@param null|string $baseCurrency
@param null|string $targetCurrency
@param null|string $locale
@return string | [
"Formats",
"the",
"given",
"amount"
] | train | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Twig/CurrencyExtension.php#L75-L78 |
WellCommerce/AppBundle | Twig/CurrencyExtension.php | CurrencyExtension.convertPrice | public function convertPrice(float $price, $baseCurrency = null, $targetCurrency = null, $quantity = 1) : string
{
return $this->helper->convert($price, $baseCurrency, $targetCurrency, $quantity);
} | php | public function convertPrice(float $price, $baseCurrency = null, $targetCurrency = null, $quantity = 1) : string
{
return $this->helper->convert($price, $baseCurrency, $targetCurrency, $quantity);
} | [
"public",
"function",
"convertPrice",
"(",
"float",
"$",
"price",
",",
"$",
"baseCurrency",
"=",
"null",
",",
"$",
"targetCurrency",
"=",
"null",
",",
"$",
"quantity",
"=",
"1",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"helper",
"->",
"con... | Converts the given amount
@param float $price
@param null|string $baseCurrency
@param null|string $targetCurrency
@param int $quantity
@return string | [
"Converts",
"the",
"given",
"amount"
] | train | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Twig/CurrencyExtension.php#L90-L93 |
tttptd/laravel-responder | src/Transformer.php | Transformer.getRelations | public function getRelations():array
{
$relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations));
return array_filter($relations, function($relation) {
return $relation !== '*';
});
} | php | public function getRelations():array
{
$relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations));
return array_filter($relations, function($relation) {
return $relation !== '*';
});
} | [
"public",
"function",
"getRelations",
"(",
")",
":",
"array",
"{",
"$",
"relations",
"=",
"array_unique",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"getAvailableIncludes",
"(",
")",
",",
"$",
"this",
"->",
"relations",
")",
")",
";",
"return",
"array_fil... | Get relations set on the transformer.
@return array | [
"Get",
"relations",
"set",
"on",
"the",
"transformer",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Transformer.php#L32-L39 |
tttptd/laravel-responder | src/Transformer.php | Transformer.setRelations | public function setRelations($relations)
{
$this->setAvailableIncludes(array_unique(array_merge($this->availableIncludes, (array) $relations)));
return $this;
} | php | public function setRelations($relations)
{
$this->setAvailableIncludes(array_unique(array_merge($this->availableIncludes, (array) $relations)));
return $this;
} | [
"public",
"function",
"setRelations",
"(",
"$",
"relations",
")",
"{",
"$",
"this",
"->",
"setAvailableIncludes",
"(",
"array_unique",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"availableIncludes",
",",
"(",
"array",
")",
"$",
"relations",
")",
")",
")",
... | Set relations on the transformer.
@param array|string $relations
@return self | [
"Set",
"relations",
"on",
"the",
"transformer",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Transformer.php#L47-L52 |
tttptd/laravel-responder | src/Transformer.php | Transformer.callIncludeMethod | protected function callIncludeMethod(Scope $scope, $includeName, $data)
{
if ($includeName === 'pivot') {
return $this->includePivot($data->$includeName);
}
$params = $scope->getManager()->getIncludeParams($scope->getIdentifier($includeName));
if (method_exists($this, $... | php | protected function callIncludeMethod(Scope $scope, $includeName, $data)
{
if ($includeName === 'pivot') {
return $this->includePivot($data->$includeName);
}
$params = $scope->getManager()->getIncludeParams($scope->getIdentifier($includeName));
if (method_exists($this, $... | [
"protected",
"function",
"callIncludeMethod",
"(",
"Scope",
"$",
"scope",
",",
"$",
"includeName",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"includeName",
"===",
"'pivot'",
")",
"{",
"return",
"$",
"this",
"->",
"includePivot",
"(",
"$",
"data",
"->",... | Call method for retrieving a relation. This method overrides Fractal's own
[callIncludeMethod] method to load relations directly from your models.
@param Scope $scope
@param string $includeName
@param mixed $data
@return \League\Fractal\Resource\ResourceInterface|bool
@throws \Exception | [
"Call",
"method",
"for",
"retrieving",
"a",
"relation",
".",
"This",
"method",
"overrides",
"Fractal",
"s",
"own",
"[",
"callIncludeMethod",
"]",
"method",
"to",
"load",
"relations",
"directly",
"from",
"your",
"models",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Transformer.php#L74-L93 |
tttptd/laravel-responder | src/Transformer.php | Transformer.includePivot | protected function includePivot(Pivot $pivot)
{
if (! method_exists($this, 'transformPivot')) {
return false;
}
return app(Responder::class)->transform($pivot, function ($pivot) {
return $this->transformPivot($pivot);
})->getResource();
} | php | protected function includePivot(Pivot $pivot)
{
if (! method_exists($this, 'transformPivot')) {
return false;
}
return app(Responder::class)->transform($pivot, function ($pivot) {
return $this->transformPivot($pivot);
})->getResource();
} | [
"protected",
"function",
"includePivot",
"(",
"Pivot",
"$",
"pivot",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"'transformPivot'",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"app",
"(",
"Responder",
"::",
"class",
")",
... | Include pivot table data to the response.
@param Pivot $pivot
@return \League\Fractal\Resource\ResourceInterface|bool | [
"Include",
"pivot",
"table",
"data",
"to",
"the",
"response",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Transformer.php#L101-L110 |
nabab/bbn | src/bbn/cdn/config.php | config._set_cfg | private function _set_cfg(){
if ( \is_array($this->cfg) ){
$p =& $this->cfg['params'];
$components = false;
if ( !empty($p['components']) ){
$components = explode(',', $p['components']);
}
$this->cfg = bbn\x::merge_arrays($this->cfg, [
'test' => !empty($p['test']),
... | php | private function _set_cfg(){
if ( \is_array($this->cfg) ){
$p =& $this->cfg['params'];
$components = false;
if ( !empty($p['components']) ){
$components = explode(',', $p['components']);
}
$this->cfg = bbn\x::merge_arrays($this->cfg, [
'test' => !empty($p['test']),
... | [
"private",
"function",
"_set_cfg",
"(",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"this",
"->",
"cfg",
")",
")",
"{",
"$",
"p",
"=",
"&",
"$",
"this",
"->",
"cfg",
"[",
"'params'",
"]",
";",
"$",
"components",
"=",
"false",
";",
"if",
"(... | Returns an array with all the - default or no - config parameters based on the sent ones | [
"Returns",
"an",
"array",
"with",
"all",
"the",
"-",
"default",
"or",
"no",
"-",
"config",
"parameters",
"based",
"on",
"the",
"sent",
"ones"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/cdn/config.php#L34-L52 |
nabab/bbn | src/bbn/cdn/config.php | config._set_files | protected function _set_files(){
// Shortcuts for files and dir
if ( isset($this->cfg['params']['f']) ){
$this->cfg['params']['files'] = $this->cfg['params']['f'];
unset($this->cfg['params']['f']);
}
if ( isset($this->cfg['params']['d']) ){
$this->cfg['params']['dir'] = $this->cfg['par... | php | protected function _set_files(){
// Shortcuts for files and dir
if ( isset($this->cfg['params']['f']) ){
$this->cfg['params']['files'] = $this->cfg['params']['f'];
unset($this->cfg['params']['f']);
}
if ( isset($this->cfg['params']['d']) ){
$this->cfg['params']['dir'] = $this->cfg['par... | [
"protected",
"function",
"_set_files",
"(",
")",
"{",
"// Shortcuts for files and dir",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cfg",
"[",
"'params'",
"]",
"[",
"'f'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"cfg",
"[",
"'params'",
"]",
"[",
"'file... | Returns an array of arrays of types and files; it will use one of the different methods for retrieving files
depending on the params sent
@return $this | [
"Returns",
"an",
"array",
"of",
"arrays",
"of",
"types",
"and",
"files",
";",
"it",
"will",
"use",
"one",
"of",
"the",
"different",
"methods",
"for",
"retrieving",
"files",
"depending",
"on",
"the",
"params",
"sent"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/cdn/config.php#L59-L134 |
surebert/surebert-framework | src/sb/XMPP/Presence.php | Presence.getPriority | public function getPriority($as_string=true)
{
$nodes = $this->doc->getElementsByTagName('priority');
$node =$nodes->item(0);
if($node){
if($as_string){
return $node->nodeValue;
} else {
return $node;
}
} else {
... | php | public function getPriority($as_string=true)
{
$nodes = $this->doc->getElementsByTagName('priority');
$node =$nodes->item(0);
if($node){
if($as_string){
return $node->nodeValue;
} else {
return $node;
}
} else {
... | [
"public",
"function",
"getPriority",
"(",
"$",
"as_string",
"=",
"true",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"doc",
"->",
"getElementsByTagName",
"(",
"'priority'",
")",
";",
"$",
"node",
"=",
"$",
"nodes",
"->",
"item",
"(",
"0",
")",
";... | Gets the priority value of a presence packet
@param boolean $as_string Determines if node is returned as xml node or string, true by default
@return string | [
"Gets",
"the",
"priority",
"value",
"of",
"a",
"presence",
"packet"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/XMPP/Presence.php#L99-L112 |
surebert/surebert-framework | src/sb/XMPP/Presence.php | Presence.setStatus | public function setStatus($status)
{
$node = $this->getStatus(false);
if(!$node){
$node = $this->createElement('status');
$this->doc->appendChild($node);
}
$node->nodeValue = htmlspecialchars($status);
} | php | public function setStatus($status)
{
$node = $this->getStatus(false);
if(!$node){
$node = $this->createElement('status');
$this->doc->appendChild($node);
}
$node->nodeValue = htmlspecialchars($status);
} | [
"public",
"function",
"setStatus",
"(",
"$",
"status",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"getStatus",
"(",
"false",
")",
";",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"createElement",
"(",
"'status'",... | Set the status of the presence packet
@param string $status The status message to display in human readible format | [
"Set",
"the",
"status",
"of",
"the",
"presence",
"packet"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/XMPP/Presence.php#L119-L129 |
surebert/surebert-framework | src/sb/XMPP/Presence.php | Presence.setShow | public function setShow($show)
{
if($show == 'unavailable') {
$this->setType($show);
}
$node = $this->getShow(false);
if(!$node){
$node = $this->createElement('show');
$this->doc->appendChild($node);
}
$node->nodeValue = htmlspec... | php | public function setShow($show)
{
if($show == 'unavailable') {
$this->setType($show);
}
$node = $this->getShow(false);
if(!$node){
$node = $this->createElement('show');
$this->doc->appendChild($node);
}
$node->nodeValue = htmlspec... | [
"public",
"function",
"setShow",
"(",
"$",
"show",
")",
"{",
"if",
"(",
"$",
"show",
"==",
"'unavailable'",
")",
"{",
"$",
"this",
"->",
"setType",
"(",
"$",
"show",
")",
";",
"}",
"$",
"node",
"=",
"$",
"this",
"->",
"getShow",
"(",
"false",
")"... | Shows the status of the bot
@param string $show A code to describe the state. see http://xmpp.org/rfcs/rfc3921.html
away - The entity or resource is temporarily away.
chat - The entity or resource is actively interested in chatting.
dnd - The entity or resource is busy (dnd = "Do Not Disturb").
xa - The entity or resou... | [
"Shows",
"the",
"status",
"of",
"the",
"bot"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/XMPP/Presence.php#L139-L154 |
surebert/surebert-framework | src/sb/XMPP/Presence.php | Presence.setPriority | public function setPriority($priority=1)
{
$node = $this->getPriority(false);
if(!$node){
$node = $this->createElement('priority');
$this->doc->appendChild($node);
}
$node->nodeValue = htmlspecialchars($priority);
} | php | public function setPriority($priority=1)
{
$node = $this->getPriority(false);
if(!$node){
$node = $this->createElement('priority');
$this->doc->appendChild($node);
}
$node->nodeValue = htmlspecialchars($priority);
} | [
"public",
"function",
"setPriority",
"(",
"$",
"priority",
"=",
"1",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"getPriority",
"(",
"false",
")",
";",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"createElement",
... | Sets the priority of the presence
@param integer $priority | [
"Sets",
"the",
"priority",
"of",
"the",
"presence"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/XMPP/Presence.php#L160-L170 |
surebert/surebert-framework | src/sb/XMPP/Presence.php | Presence.setType | public function setType($type)
{
$attr = $this->createAttribute('type');
$this->doc->appendChild($attr);
$attr->appendChild($this->createTextNode($type));
} | php | public function setType($type)
{
$attr = $this->createAttribute('type');
$this->doc->appendChild($attr);
$attr->appendChild($this->createTextNode($type));
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
")",
"{",
"$",
"attr",
"=",
"$",
"this",
"->",
"createAttribute",
"(",
"'type'",
")",
";",
"$",
"this",
"->",
"doc",
"->",
"appendChild",
"(",
"$",
"attr",
")",
";",
"$",
"attr",
"->",
"appendChild",... | Sets the presence type
@param string $type see http://xmpp.org/rfcs/rfc3921.html for more info
unavailable -- Signals that the entity is no longer available for communication.
subscribe -- The sender wishes to subscribe to the recipient's presence.
subscribed -- The sender has allowed the recipient to receive their pre... | [
"Sets",
"the",
"presence",
"type"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/XMPP/Presence.php#L184-L189 |
juskiewicz/Geolocation | src/Build/CoordinatesBuild.php | CoordinatesBuild.create | public static function create(object $googleData) : Coordinates
{
$build = new self($googleData);
$address = $build->createCoordinatesFromGeometry();
return $address;
} | php | public static function create(object $googleData) : Coordinates
{
$build = new self($googleData);
$address = $build->createCoordinatesFromGeometry();
return $address;
} | [
"public",
"static",
"function",
"create",
"(",
"object",
"$",
"googleData",
")",
":",
"Coordinates",
"{",
"$",
"build",
"=",
"new",
"self",
"(",
"$",
"googleData",
")",
";",
"$",
"address",
"=",
"$",
"build",
"->",
"createCoordinatesFromGeometry",
"(",
")"... | create address from google maps api result
@param object $googleData Google single result
@return Coordinates | [
"create",
"address",
"from",
"google",
"maps",
"api",
"result"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Build/CoordinatesBuild.php#L19-L25 |
juskiewicz/Geolocation | src/Build/CoordinatesBuild.php | CoordinatesBuild.createCoordinatesFromGeometry | public function createCoordinatesFromGeometry() : Coordinates
{
// create new coordinates object
$coordinates = new Coordinates($this->googleData->geometry->location->lat, $this->googleData->geometry->location->lng);
return $coordinates;
} | php | public function createCoordinatesFromGeometry() : Coordinates
{
// create new coordinates object
$coordinates = new Coordinates($this->googleData->geometry->location->lat, $this->googleData->geometry->location->lng);
return $coordinates;
} | [
"public",
"function",
"createCoordinatesFromGeometry",
"(",
")",
":",
"Coordinates",
"{",
"// create new coordinates object",
"$",
"coordinates",
"=",
"new",
"Coordinates",
"(",
"$",
"this",
"->",
"googleData",
"->",
"geometry",
"->",
"location",
"->",
"lat",
",",
... | create address from google address components
@return Coordinates | [
"create",
"address",
"from",
"google",
"address",
"components"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Build/CoordinatesBuild.php#L40-L46 |
znck/countries | src/UpdateCountriesCommand.php | UpdateCountriesCommand.handle | public function handle()
{
$countries = [];
$data = $this->loader->load('en');
foreach ($data as $key => $name) {
$countries[] = [
'name' => $name,
'code' => "${key}",
];
}
$countries = Collection::make($countries);
... | php | public function handle()
{
$countries = [];
$data = $this->loader->load('en');
foreach ($data as $key => $name) {
$countries[] = [
'name' => $name,
'code' => "${key}",
];
}
$countries = Collection::make($countries);
... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"countries",
"=",
"[",
"]",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"loader",
"->",
"load",
"(",
"'en'",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"name",
")",
"{",... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/znck/countries/blob/a78a2b302dfa8eacab8fe0c06127dbb37fa98fd3/src/UpdateCountriesCommand.php#L86-L141 |
eloquent/phony-kahlan | src/AssertionRecorder.php | AssertionRecorder.createSuccess | public function createSuccess(array $events = []): EventCollection
{
$suiteClass = $this->suiteClass;
$suiteClass::current()->assert($this->successConfig);
return new EventSequence($events, $this->callVerifierFactory);
} | php | public function createSuccess(array $events = []): EventCollection
{
$suiteClass = $this->suiteClass;
$suiteClass::current()->assert($this->successConfig);
return new EventSequence($events, $this->callVerifierFactory);
} | [
"public",
"function",
"createSuccess",
"(",
"array",
"$",
"events",
"=",
"[",
"]",
")",
":",
"EventCollection",
"{",
"$",
"suiteClass",
"=",
"$",
"this",
"->",
"suiteClass",
";",
"$",
"suiteClass",
"::",
"current",
"(",
")",
"->",
"assert",
"(",
"$",
"... | Record that a successful assertion occurred.
@param array<Event> $events The events.
@return EventCollection The result. | [
"Record",
"that",
"a",
"successful",
"assertion",
"occurred",
"."
] | train | https://github.com/eloquent/phony-kahlan/blob/a4654a7edf58268b492acc751ecbeddded9b176f/src/AssertionRecorder.php#L50-L56 |
eloquent/phony-kahlan | src/AssertionRecorder.php | AssertionRecorder.createSuccessFromEventCollection | public function createSuccessFromEventCollection(
EventCollection $events
): EventCollection {
$suiteClass = $this->suiteClass;
$suiteClass::current()->assert($this->successConfig);
return $events;
} | php | public function createSuccessFromEventCollection(
EventCollection $events
): EventCollection {
$suiteClass = $this->suiteClass;
$suiteClass::current()->assert($this->successConfig);
return $events;
} | [
"public",
"function",
"createSuccessFromEventCollection",
"(",
"EventCollection",
"$",
"events",
")",
":",
"EventCollection",
"{",
"$",
"suiteClass",
"=",
"$",
"this",
"->",
"suiteClass",
";",
"$",
"suiteClass",
"::",
"current",
"(",
")",
"->",
"assert",
"(",
... | Record that a successful assertion occurred.
@param EventCollection $events The events.
@return EventCollection The result. | [
"Record",
"that",
"a",
"successful",
"assertion",
"occurred",
"."
] | train | https://github.com/eloquent/phony-kahlan/blob/a4654a7edf58268b492acc751ecbeddded9b176f/src/AssertionRecorder.php#L65-L72 |
eloquent/phony-kahlan | src/AssertionRecorder.php | AssertionRecorder.createFailure | public function createFailure(string $description)
{
$exception = new AssertionException($description);
$suiteClass = $this->suiteClass;
$suiteClass::current()->assert([
'handler' => function () use ($exception) {
throw $exception;
},
'typ... | php | public function createFailure(string $description)
{
$exception = new AssertionException($description);
$suiteClass = $this->suiteClass;
$suiteClass::current()->assert([
'handler' => function () use ($exception) {
throw $exception;
},
'typ... | [
"public",
"function",
"createFailure",
"(",
"string",
"$",
"description",
")",
"{",
"$",
"exception",
"=",
"new",
"AssertionException",
"(",
"$",
"description",
")",
";",
"$",
"suiteClass",
"=",
"$",
"this",
"->",
"suiteClass",
";",
"$",
"suiteClass",
"::",
... | Create a new assertion failure exception.
@param string $description The failure description.
@throws AssertionException The assertion failure. | [
"Create",
"a",
"new",
"assertion",
"failure",
"exception",
"."
] | train | https://github.com/eloquent/phony-kahlan/blob/a4654a7edf58268b492acc751ecbeddded9b176f/src/AssertionRecorder.php#L81-L92 |
blast-project/BaseEntitiesBundle | src/Search/SearchAnalyser.php | SearchAnalyser.analyse | public static function analyse($text)
{
// to lowercase
$text = mb_strtolower(trim($text), 'utf-8');
// remove accents
$text = Transliterator::unaccent($text);
// considering very special chars as spaces
$text = str_replace(array(
'@',
'.', ',', ... | php | public static function analyse($text)
{
// to lowercase
$text = mb_strtolower(trim($text), 'utf-8');
// remove accents
$text = Transliterator::unaccent($text);
// considering very special chars as spaces
$text = str_replace(array(
'@',
'.', ',', ... | [
"public",
"static",
"function",
"analyse",
"(",
"$",
"text",
")",
"{",
"// to lowercase",
"$",
"text",
"=",
"mb_strtolower",
"(",
"trim",
"(",
"$",
"text",
")",
",",
"'utf-8'",
")",
";",
"// remove accents",
"$",
"text",
"=",
"Transliterator",
"::",
"unacc... | @param string $text
@return array | [
"@param",
"string",
"$text"
] | train | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Search/SearchAnalyser.php#L24-L55 |
php-lug/lug | src/Bundle/ResourceBundle/Rest/View/EventSubscriber/FormViewSubscriber.php | FormViewSubscriber.createFormView | private function createFormView(FormInterface $form)
{
$themes = $this->getParameterResolver()->resolveThemes();
$view = $form->createView();
if (!empty($themes)) {
$this->formRenderer->setTheme($view, $themes);
}
return $view;
} | php | private function createFormView(FormInterface $form)
{
$themes = $this->getParameterResolver()->resolveThemes();
$view = $form->createView();
if (!empty($themes)) {
$this->formRenderer->setTheme($view, $themes);
}
return $view;
} | [
"private",
"function",
"createFormView",
"(",
"FormInterface",
"$",
"form",
")",
"{",
"$",
"themes",
"=",
"$",
"this",
"->",
"getParameterResolver",
"(",
")",
"->",
"resolveThemes",
"(",
")",
";",
"$",
"view",
"=",
"$",
"form",
"->",
"createView",
"(",
"... | @param FormInterface $form
@return FormView | [
"@param",
"FormInterface",
"$form"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/ResourceBundle/Rest/View/EventSubscriber/FormViewSubscriber.php#L122-L132 |
MASNathan/Parser | src/Type/Xml.php | Xml.encode | public static function encode($data, $prettyPrint = false, $xmlVersion = '1.0', $encoding = 'utf-8')
{
$domDocument = new DOMDocument($xmlVersion, $encoding);
$domDocument = self::loopEncode($data, $domDocument);
if ($prettyPrint) {
$domDocument->preserveWhiteSpace = fal... | php | public static function encode($data, $prettyPrint = false, $xmlVersion = '1.0', $encoding = 'utf-8')
{
$domDocument = new DOMDocument($xmlVersion, $encoding);
$domDocument = self::loopEncode($data, $domDocument);
if ($prettyPrint) {
$domDocument->preserveWhiteSpace = fal... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"data",
",",
"$",
"prettyPrint",
"=",
"false",
",",
"$",
"xmlVersion",
"=",
"'1.0'",
",",
"$",
"encoding",
"=",
"'utf-8'",
")",
"{",
"$",
"domDocument",
"=",
"new",
"DOMDocument",
"(",
"$",
"xmlVersion"... | Encodes an array to xml strutcture
@param mixed $data Data to encode
@param boolean $prettyPrint True to output the encoded data a little bit more readable for the humans
@param string $xmlVersion XML header version
@param string $encoding XML header encoding
@return string | [
"Encodes",
"an",
"array",
"to",
"xml",
"strutcture"
] | train | https://github.com/MASNathan/Parser/blob/0f55402b99b1e071bdcd6277b9268f783ca25e34/src/Type/Xml.php#L19-L41 |
MASNathan/Parser | src/Type/Xml.php | Xml.loopEncode | protected static function loopEncode($data, $domElement)
{
if (is_array($data)) {
foreach ($data as $index => $mixedElement) {
if (is_int($index)) {
if ($index == 0) {
$node = $domElement;
} else {
... | php | protected static function loopEncode($data, $domElement)
{
if (is_array($data)) {
foreach ($data as $index => $mixedElement) {
if (is_int($index)) {
if ($index == 0) {
$node = $domElement;
} else {
... | [
"protected",
"static",
"function",
"loopEncode",
"(",
"$",
"data",
",",
"$",
"domElement",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"index",
"=>",
"$",
"mixedElement",
")",
"{",
"if",
... | Lets loop through our data
@param mixed $data Data to encode
@param DOMDocument|DOMElement $domElement Document to initialize and then it'll call itself with inner Element(s)
@return DOMDocument | [
"Lets",
"loop",
"through",
"our",
"data"
] | train | https://github.com/MASNathan/Parser/blob/0f55402b99b1e071bdcd6277b9268f783ca25e34/src/Type/Xml.php#L49-L72 |
MASNathan/Parser | src/Type/Xml.php | Xml.decode | public static function decode($string)
{
$xml = simplexml_load_string($string);
$array = array($xml->getName() => (array) $xml);
$array = self::loopDecode($array);
return $array;
} | php | public static function decode($string)
{
$xml = simplexml_load_string($string);
$array = array($xml->getName() => (array) $xml);
$array = self::loopDecode($array);
return $array;
} | [
"public",
"static",
"function",
"decode",
"(",
"$",
"string",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"string",
")",
";",
"$",
"array",
"=",
"array",
"(",
"$",
"xml",
"->",
"getName",
"(",
")",
"=>",
"(",
"array",
")",
"$",
"x... | Decodes a json file string
@param string $string File contents
@return array | [
"Decodes",
"a",
"json",
"file",
"string"
] | train | https://github.com/MASNathan/Parser/blob/0f55402b99b1e071bdcd6277b9268f783ca25e34/src/Type/Xml.php#L79-L86 |
MASNathan/Parser | src/Type/Xml.php | Xml.loopDecode | protected static function loopDecode($data)
{
if (is_array($data)) {
foreach ($data as &$value) {
$value = self::loopDecode($value);
}
} elseif (is_object($data)) {
return self::loopDecode((array) $data);
}
return $data;
} | php | protected static function loopDecode($data)
{
if (is_array($data)) {
foreach ($data as &$value) {
$value = self::loopDecode($value);
}
} elseif (is_object($data)) {
return self::loopDecode((array) $data);
}
return $data;
} | [
"protected",
"static",
"function",
"loopDecode",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"&",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"self",
"::",
"loopDecode",
"(",... | Turns all the objects into arrays
@param mixed $data Data
@return array | [
"Turns",
"all",
"the",
"objects",
"into",
"arrays"
] | train | https://github.com/MASNathan/Parser/blob/0f55402b99b1e071bdcd6277b9268f783ca25e34/src/Type/Xml.php#L93-L103 |
surebert/surebert-framework | src/sb/Socket/StreamingClient.php | StreamingClient.open | public function open()
{
$this->log('open socket connection');
$this->socket = @stream_socket_client($this->remote_socket, $errno, $errstr, $this->timeout);
if ($this->socket) {
return true;
} else {
throw(new \Exception("{$errstr} (#{$errno})"));
... | php | public function open()
{
$this->log('open socket connection');
$this->socket = @stream_socket_client($this->remote_socket, $errno, $errstr, $this->timeout);
if ($this->socket) {
return true;
} else {
throw(new \Exception("{$errstr} (#{$errno})"));
... | [
"public",
"function",
"open",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'open socket connection'",
")",
";",
"$",
"this",
"->",
"socket",
"=",
"@",
"stream_socket_client",
"(",
"$",
"this",
"->",
"remote_socket",
",",
"$",
"errno",
",",
"$",
"errstr... | Open the connection
@return boolean Throws exception on error | [
"Open",
"the",
"connection"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Socket/StreamingClient.php#L47-L59 |
surebert/surebert-framework | src/sb/Socket/StreamingClient.php | StreamingClient.read | public function read($byte_count=null)
{
$this->log('read from socket');
$buffer = '';
if(!is_null($byte_count)) {
//read the specified amount of data
$buffer .= fgets($this->socket, 1024);
} else {
//read all the data
while (!feof($this->so... | php | public function read($byte_count=null)
{
$this->log('read from socket');
$buffer = '';
if(!is_null($byte_count)) {
//read the specified amount of data
$buffer .= fgets($this->socket, 1024);
} else {
//read all the data
while (!feof($this->so... | [
"public",
"function",
"read",
"(",
"$",
"byte_count",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'read from socket'",
")",
";",
"$",
"buffer",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"byte_count",
")",
")",
"{",
"//read the ... | Read data from the socket
@param integer $byte_count The amount of data to read, if not set, it reads until feof
@return string The data read from the socket | [
"Read",
"data",
"from",
"the",
"socket"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Socket/StreamingClient.php#L66-L84 |
wenbinye/PhalconX | src/Annotation/Annotations.php | Annotations.import | public function import(array $classes)
{
foreach ($classes as $class => $alias) {
if (is_integer($class)) {
$class = $alias;
$alias = ClassHelper::getSimpleName($class);
}
if (isset($this->imports[$alias])) {
throw new \Runt... | php | public function import(array $classes)
{
foreach ($classes as $class => $alias) {
if (is_integer($class)) {
$class = $alias;
$alias = ClassHelper::getSimpleName($class);
}
if (isset($this->imports[$alias])) {
throw new \Runt... | [
"public",
"function",
"import",
"(",
"array",
"$",
"classes",
")",
"{",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
"=>",
"$",
"alias",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"class",
")",
")",
"{",
"$",
"class",
"=",
"$",
"alias",
... | Imports annotation classes | [
"Imports",
"annotation",
"classes"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Annotation/Annotations.php#L55-L69 |
wenbinye/PhalconX | src/Annotation/Annotations.php | Annotations.get | public function get($class)
{
$annotations = $this->getCache()->get('_PHX.annotations.' . $class);
if (!isset($annotations)) {
$annotations = $this->getAnnotations($class);
$this->getCache()->save('_PHX.annotations.' . $class, $annotations);
}
return $annotati... | php | public function get($class)
{
$annotations = $this->getCache()->get('_PHX.annotations.' . $class);
if (!isset($annotations)) {
$annotations = $this->getAnnotations($class);
$this->getCache()->save('_PHX.annotations.' . $class, $annotations);
}
return $annotati... | [
"public",
"function",
"get",
"(",
"$",
"class",
")",
"{",
"$",
"annotations",
"=",
"$",
"this",
"->",
"getCache",
"(",
")",
"->",
"get",
"(",
"'_PHX.annotations.'",
".",
"$",
"class",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"annotations",
")",
... | Gets all annotations in the class
@param string $class class name
@return array | [
"Gets",
"all",
"annotations",
"in",
"the",
"class"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Annotation/Annotations.php#L94-L102 |
wenbinye/PhalconX | src/Annotation/Annotations.php | Annotations.getAnnotations | private function getAnnotations($class)
{
$parsed = $this->getParser()->parse($class);
if (!is_array($parsed)) {
return [];
}
$context = [
'class' => $class,
'declaringClass' => $class,
'type' => Context::TYPE_CLASS,
'name' ... | php | private function getAnnotations($class)
{
$parsed = $this->getParser()->parse($class);
if (!is_array($parsed)) {
return [];
}
$context = [
'class' => $class,
'declaringClass' => $class,
'type' => Context::TYPE_CLASS,
'name' ... | [
"private",
"function",
"getAnnotations",
"(",
"$",
"class",
")",
"{",
"$",
"parsed",
"=",
"$",
"this",
"->",
"getParser",
"(",
")",
"->",
"parse",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"parsed",
")",
")",
"{",
"return",... | parse all annotations from class | [
"parse",
"all",
"annotations",
"from",
"class"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Annotation/Annotations.php#L129-L173 |
wenbinye/PhalconX | src/Annotation/Annotations.php | Annotations.create | private function create($annotation, $context)
{
$logger = $this->getLogger();
$name = $annotation['name'];
if (!$this->isValidName($name)) {
return null;
}
$annotationClass = $this->resolveClassName($name, $context['declaringClass']);
if (!$annotationClas... | php | private function create($annotation, $context)
{
$logger = $this->getLogger();
$name = $annotation['name'];
if (!$this->isValidName($name)) {
return null;
}
$annotationClass = $this->resolveClassName($name, $context['declaringClass']);
if (!$annotationClas... | [
"private",
"function",
"create",
"(",
"$",
"annotation",
",",
"$",
"context",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"name",
"=",
"$",
"annotation",
"[",
"'name'",
"]",
";",
"if",
"(",
"!",
"$",
"this",
... | create annotation object | [
"create",
"annotation",
"object"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Annotation/Annotations.php#L178-L208 |
juskiewicz/Geolocation | src/Build/AddressBuild.php | AddressBuild.create | public static function create(object $googleData) : Address
{
$build = new self($googleData);
$address = $build->createAddressFromComponents();
return $address;
} | php | public static function create(object $googleData) : Address
{
$build = new self($googleData);
$address = $build->createAddressFromComponents();
return $address;
} | [
"public",
"static",
"function",
"create",
"(",
"object",
"$",
"googleData",
")",
":",
"Address",
"{",
"$",
"build",
"=",
"new",
"self",
"(",
"$",
"googleData",
")",
";",
"$",
"address",
"=",
"$",
"build",
"->",
"createAddressFromComponents",
"(",
")",
";... | create address from google maps api result
@param object $googleData Google single result
@return Address | [
"create",
"address",
"from",
"google",
"maps",
"api",
"result"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Build/AddressBuild.php#L19-L25 |
juskiewicz/Geolocation | src/Build/AddressBuild.php | AddressBuild.createAddressFromComponents | public function createAddressFromComponents() : Address
{
// create new address object
$address = new Address();
// update address from google address components
foreach ($this->googleData->address_components as $component) {
$this->updateAddressFromComponent($address, $... | php | public function createAddressFromComponents() : Address
{
// create new address object
$address = new Address();
// update address from google address components
foreach ($this->googleData->address_components as $component) {
$this->updateAddressFromComponent($address, $... | [
"public",
"function",
"createAddressFromComponents",
"(",
")",
":",
"Address",
"{",
"// create new address object",
"$",
"address",
"=",
"new",
"Address",
"(",
")",
";",
"// update address from google address components",
"foreach",
"(",
"$",
"this",
"->",
"googleData",... | create address from google address components
@return Address | [
"create",
"address",
"from",
"google",
"address",
"components"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Build/AddressBuild.php#L40-L51 |
juskiewicz/Geolocation | src/Build/AddressBuild.php | AddressBuild.updateAddressFromComponent | private function updateAddressFromComponent(Address $address, $component) : Address
{
foreach ($component->types as $type) {
switch ($type) {
case 'postal_code':
$address->setPostalCode($component->long_name);
break;
case 'l... | php | private function updateAddressFromComponent(Address $address, $component) : Address
{
foreach ($component->types as $type) {
switch ($type) {
case 'postal_code':
$address->setPostalCode($component->long_name);
break;
case 'l... | [
"private",
"function",
"updateAddressFromComponent",
"(",
"Address",
"$",
"address",
",",
"$",
"component",
")",
":",
"Address",
"{",
"foreach",
"(",
"$",
"component",
"->",
"types",
"as",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"cas... | update address from google address component
@param Address $address
@param object $component Google address component object
@return Address | [
"update",
"address",
"from",
"google",
"address",
"component"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Build/AddressBuild.php#L60-L112 |
graze/data-structure | src/Container/FlatContainer.php | FlatContainer.getChild | private function getChild($key)
{
$top = $this->params;
foreach (explode($this->delimiter, $key) as $node) {
if (!isset($top[$node])) {
return null;
}
$top = $top[$node];
}
return $top;
} | php | private function getChild($key)
{
$top = $this->params;
foreach (explode($this->delimiter, $key) as $node) {
if (!isset($top[$node])) {
return null;
}
$top = $top[$node];
}
return $top;
} | [
"private",
"function",
"getChild",
"(",
"$",
"key",
")",
"{",
"$",
"top",
"=",
"$",
"this",
"->",
"params",
";",
"foreach",
"(",
"explode",
"(",
"$",
"this",
"->",
"delimiter",
",",
"$",
"key",
")",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"!",
... | @param string $key
@return mixed|null | [
"@param",
"string",
"$key"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Container/FlatContainer.php#L54-L65 |
graze/data-structure | src/Container/FlatContainer.php | FlatContainer.splitToLast | private function splitToLast($key)
{
$split = explode($this->delimiter, $key);
$key = implode($this->delimiter, array_slice($split, 0, -1));
$last = end($split);
return [$key, $last];
} | php | private function splitToLast($key)
{
$split = explode($this->delimiter, $key);
$key = implode($this->delimiter, array_slice($split, 0, -1));
$last = end($split);
return [$key, $last];
} | [
"private",
"function",
"splitToLast",
"(",
"$",
"key",
")",
"{",
"$",
"split",
"=",
"explode",
"(",
"$",
"this",
"->",
"delimiter",
",",
"$",
"key",
")",
";",
"$",
"key",
"=",
"implode",
"(",
"$",
"this",
"->",
"delimiter",
",",
"array_slice",
"(",
... | @param string $key
@return string[] split the key into everything up to the last delimiter, and the last key | [
"@param",
"string",
"$key"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Container/FlatContainer.php#L72-L79 |
graze/data-structure | src/Container/FlatContainer.php | FlatContainer.has | public function has($key)
{
if (mb_strpos($key, $this->delimiter) !== false) {
return (!is_null($this->getChild($key)));
}
return parent::has($key);
} | php | public function has($key)
{
if (mb_strpos($key, $this->delimiter) !== false) {
return (!is_null($this->getChild($key)));
}
return parent::has($key);
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"mb_strpos",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"delimiter",
")",
"!==",
"false",
")",
"{",
"return",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getChild",
"(",
"$",
"key... | @param string $key The key to access, supports delimiter based child access (e.g. `parent.child.node`)
@return bool | [
"@param",
"string",
"$key",
"The",
"key",
"to",
"access",
"supports",
"delimiter",
"based",
"child",
"access",
"(",
"e",
".",
"g",
".",
"parent",
".",
"child",
".",
"node",
")"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Container/FlatContainer.php#L86-L92 |
graze/data-structure | src/Container/FlatContainer.php | FlatContainer.get | public function get($key)
{
if (mb_strpos($key, $this->delimiter) !== false) {
return $this->getChild($key);
}
return parent::get($key);
} | php | public function get($key)
{
if (mb_strpos($key, $this->delimiter) !== false) {
return $this->getChild($key);
}
return parent::get($key);
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"mb_strpos",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"delimiter",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"getChild",
"(",
"$",
"key",
")",
";",
"}",
"return"... | @param string $key The key to access, supports delimiter based child access (e.g. `parent.child.node`)
@return mixed|null | [
"@param",
"string",
"$key",
"The",
"key",
"to",
"access",
"supports",
"delimiter",
"based",
"child",
"access",
"(",
"e",
".",
"g",
".",
"parent",
".",
"child",
".",
"node",
")"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Container/FlatContainer.php#L99-L106 |
graze/data-structure | src/Container/FlatContainer.php | FlatContainer.doRemove | protected function doRemove($key)
{
if (mb_strpos($key, $this->delimiter) !== false) {
list($key, $last) = $this->splitToLast($key);
$top = $this->get($key);
if (is_null($top) || (!is_array($top) && !($top instanceof ArrayAccess))) {
return $this;
... | php | protected function doRemove($key)
{
if (mb_strpos($key, $this->delimiter) !== false) {
list($key, $last) = $this->splitToLast($key);
$top = $this->get($key);
if (is_null($top) || (!is_array($top) && !($top instanceof ArrayAccess))) {
return $this;
... | [
"protected",
"function",
"doRemove",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"mb_strpos",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"delimiter",
")",
"!==",
"false",
")",
"{",
"list",
"(",
"$",
"key",
",",
"$",
"last",
")",
"=",
"$",
"this",
"->",
... | @param string $key
@return ContainerInterface | [
"@param",
"string",
"$key"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Container/FlatContainer.php#L162-L182 |
surebert/surebert-framework | src/sb/Cache/FileSystem.php | FileSystem.store | public function store($key, $data, $lifetime = 0)
{
$file_path = $this->getFilePath($key);
$dir = \dirname($file_path);
if (!is_dir($dir)) {
try {
\mkdir($dir, 0777, true);
} catch (Exception $e) {
throw new \Exception('Could create ca... | php | public function store($key, $data, $lifetime = 0)
{
$file_path = $this->getFilePath($key);
$dir = \dirname($file_path);
if (!is_dir($dir)) {
try {
\mkdir($dir, 0777, true);
} catch (Exception $e) {
throw new \Exception('Could create ca... | [
"public",
"function",
"store",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"lifetime",
"=",
"0",
")",
"{",
"$",
"file_path",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
"$",
"key",
")",
";",
"$",
"dir",
"=",
"\\",
"dirname",
"(",
"$",
"file_path... | Stores the cached data in /private/cache filesystem | [
"Stores",
"the",
"cached",
"data",
"in",
"/",
"private",
"/",
"cache",
"filesystem"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cache/FileSystem.php#L64-L106 |
surebert/surebert-framework | src/sb/Cache/FileSystem.php | FileSystem.fetch | public function fetch($key)
{
$file_name = $this->getFilePath($key);
if (!\file_exists($file_name) || !\is_readable($file_name)) {
return false;
} else {
$h = \fopen($file_name, 'r');
//lock file
\flock($h, LOCK_SH);
}
$data = ... | php | public function fetch($key)
{
$file_name = $this->getFilePath($key);
if (!\file_exists($file_name) || !\is_readable($file_name)) {
return false;
} else {
$h = \fopen($file_name, 'r');
//lock file
\flock($h, LOCK_SH);
}
$data = ... | [
"public",
"function",
"fetch",
"(",
"$",
"key",
")",
"{",
"$",
"file_name",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"\\",
"file_exists",
"(",
"$",
"file_name",
")",
"||",
"!",
"\\",
"is_readable",
"(",
"$",... | Retreives data from /private/cache | [
"Retreives",
"data",
"from",
"/",
"private",
"/",
"cache"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cache/FileSystem.php#L111-L138 |
surebert/surebert-framework | src/sb/Cache/FileSystem.php | FileSystem.delete | public function delete($key)
{
$file = $this->getFilePath($key);
if (\is_dir($file)) {
$this->clearDir($file);
$deleted = \rmdir($file);
} elseif (\file_exists($file)) {
$deleted = \unlink($file);
} else {
$deleted = false;
}
... | php | public function delete($key)
{
$file = $this->getFilePath($key);
if (\is_dir($file)) {
$this->clearDir($file);
$deleted = \rmdir($file);
} elseif (\file_exists($file)) {
$deleted = \unlink($file);
} else {
$deleted = false;
}
... | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
"$",
"key",
")",
";",
"if",
"(",
"\\",
"is_dir",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"clearDir",
"(",
"$",
"file... | Deletes data from /private/cache | [
"Deletes",
"data",
"from",
"/",
"private",
"/",
"cache"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cache/FileSystem.php#L143-L161 |
surebert/surebert-framework | src/sb/Cache/FileSystem.php | FileSystem.clearDir | protected function clearDir($dir)
{
$iterator = new \DirectoryIterator($dir);
foreach ($iterator as $file) {
if ($file->isDir() && !$file->isDot() && !preg_match("~\.~", $file)) {
$this->clearDir($file->getPathname());
if (!\rmdir($file->getPathname())) {... | php | protected function clearDir($dir)
{
$iterator = new \DirectoryIterator($dir);
foreach ($iterator as $file) {
if ($file->isDir() && !$file->isDot() && !preg_match("~\.~", $file)) {
$this->clearDir($file->getPathname());
if (!\rmdir($file->getPathname())) {... | [
"protected",
"function",
"clearDir",
"(",
"$",
"dir",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"DirectoryIterator",
"(",
"$",
"dir",
")",
";",
"foreach",
"(",
"$",
"iterator",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"->",
"isDir",
... | Clears out the contents of a cache directory
@param $dir
@return boolean | [
"Clears",
"out",
"the",
"contents",
"of",
"a",
"cache",
"directory"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cache/FileSystem.php#L177-L195 |
surebert/surebert-framework | src/sb/Cache/FileSystem.php | FileSystem.catalogKeyDelete | protected function catalogKeyDelete($key)
{
$catalog = $this->fetch($this->catalog_key);
$catalog = \is_array($catalog) ? $catalog : Array();
if (isset($catalog[$key])) {
unset($catalog[$key]);
};
return $this->store('/sb_Cache_Catalog', $catalog);
} | php | protected function catalogKeyDelete($key)
{
$catalog = $this->fetch($this->catalog_key);
$catalog = \is_array($catalog) ? $catalog : Array();
if (isset($catalog[$key])) {
unset($catalog[$key]);
};
return $this->store('/sb_Cache_Catalog', $catalog);
} | [
"protected",
"function",
"catalogKeyDelete",
"(",
"$",
"key",
")",
"{",
"$",
"catalog",
"=",
"$",
"this",
"->",
"fetch",
"(",
"$",
"this",
"->",
"catalog_key",
")",
";",
"$",
"catalog",
"=",
"\\",
"is_array",
"(",
"$",
"catalog",
")",
"?",
"$",
"cata... | Deletes a key from the catalog
@param string $key The key to delete
@return boolean | [
"Deletes",
"a",
"key",
"from",
"the",
"catalog"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cache/FileSystem.php#L226-L235 |
surebert/surebert-framework | src/sb/Cache/FileSystem.php | FileSystem.getKeys | public function getKeys()
{
$catalog = $this->fetch($this->catalog_key);
$catalog = \is_array($catalog) ? $catalog : Array();
\ksort($catalog);
return $catalog;
} | php | public function getKeys()
{
$catalog = $this->fetch($this->catalog_key);
$catalog = \is_array($catalog) ? $catalog : Array();
\ksort($catalog);
return $catalog;
} | [
"public",
"function",
"getKeys",
"(",
")",
"{",
"$",
"catalog",
"=",
"$",
"this",
"->",
"fetch",
"(",
"$",
"this",
"->",
"catalog_key",
")",
";",
"$",
"catalog",
"=",
"\\",
"is_array",
"(",
"$",
"catalog",
")",
"?",
"$",
"catalog",
":",
"Array",
"(... | Loads the current catalog
@return Array a list of all keys stored in the cache | [
"Loads",
"the",
"current",
"catalog"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cache/FileSystem.php#L254-L260 |
caffeinated/beverage | src/Publisher.php | Publisher.publish | public function publish()
{
$destination = config_path('packages/' . $this->package);
if (! $this->files->exists($this->sourcePath)) {
return;
}
if (! $this->files->exists($this->destinationPath)) {
$this->files->makeDirectory($destination, 0755, true);
... | php | public function publish()
{
$destination = config_path('packages/' . $this->package);
if (! $this->files->exists($this->sourcePath)) {
return;
}
if (! $this->files->exists($this->destinationPath)) {
$this->files->makeDirectory($destination, 0755, true);
... | [
"public",
"function",
"publish",
"(",
")",
"{",
"$",
"destination",
"=",
"config_path",
"(",
"'packages/'",
".",
"$",
"this",
"->",
"package",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"this",
"->",
"sourcePath",
... | publish | [
"publish"
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Publisher.php#L49-L59 |
thecodingmachine/security.userservice | src/Mouf/Security/UserService/RememberMeAuthProvider.php | RememberMeAuthProvider.isLogged | public function isLogged(UserServiceInterface $userService)
{
$user = $this->getAndLogUserByCookie($userService);
if ($user) {
$this->refreshRememberCookie($user, false);
return true;
} else {
return false;
}
} | php | public function isLogged(UserServiceInterface $userService)
{
$user = $this->getAndLogUserByCookie($userService);
if ($user) {
$this->refreshRememberCookie($user, false);
return true;
} else {
return false;
}
} | [
"public",
"function",
"isLogged",
"(",
"UserServiceInterface",
"$",
"userService",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getAndLogUserByCookie",
"(",
"$",
"userService",
")",
";",
"if",
"(",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"refreshRemem... | (non-PHPdoc)
@see \Mouf\Security\UserService\IsLoggedProviderInterface::isLogged() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/thecodingmachine/security.userservice/blob/39de12c32f324ab113441a69cd73cdb4b4673225/src/Mouf/Security/UserService/RememberMeAuthProvider.php#L71-L80 |
thecodingmachine/security.userservice | src/Mouf/Security/UserService/RememberMeAuthProvider.php | RememberMeAuthProvider.getUserId | public function getUserId(UserServiceInterface $userService)
{
$user = $this->getAndLogUserByCookie($userService);
return $user ? $user->getId() : null;
} | php | public function getUserId(UserServiceInterface $userService)
{
$user = $this->getAndLogUserByCookie($userService);
return $user ? $user->getId() : null;
} | [
"public",
"function",
"getUserId",
"(",
"UserServiceInterface",
"$",
"userService",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getAndLogUserByCookie",
"(",
"$",
"userService",
")",
";",
"return",
"$",
"user",
"?",
"$",
"user",
"->",
"getId",
"(",
")",... | (non-PHPdoc)
@see \Mouf\Security\UserService\AuthenticationProviderInterface::getUserId() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/thecodingmachine/security.userservice/blob/39de12c32f324ab113441a69cd73cdb4b4673225/src/Mouf/Security/UserService/RememberMeAuthProvider.php#L86-L90 |
thecodingmachine/security.userservice | src/Mouf/Security/UserService/RememberMeAuthProvider.php | RememberMeAuthProvider.getUserLogin | public function getUserLogin(UserServiceInterface $userService)
{
$user = $this->getAndLogUserByCookie($userService);
return $user ? $user->getLogin() : null;
} | php | public function getUserLogin(UserServiceInterface $userService)
{
$user = $this->getAndLogUserByCookie($userService);
return $user ? $user->getLogin() : null;
} | [
"public",
"function",
"getUserLogin",
"(",
"UserServiceInterface",
"$",
"userService",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getAndLogUserByCookie",
"(",
"$",
"userService",
")",
";",
"return",
"$",
"user",
"?",
"$",
"user",
"->",
"getLogin",
"(",
... | (non-PHPdoc)
@see \Mouf\Security\UserService\AuthenticationProviderInterface::getUserLogin() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/thecodingmachine/security.userservice/blob/39de12c32f324ab113441a69cd73cdb4b4673225/src/Mouf/Security/UserService/RememberMeAuthProvider.php#L96-L100 |
thecodingmachine/security.userservice | src/Mouf/Security/UserService/RememberMeAuthProvider.php | RememberMeAuthProvider.refreshRememberCookie | private function refreshRememberCookie(UserInterface $user, $gerenateToken = true)
{
$expire = is_numeric($this->expire) ? time() + 60 * $this>expire : strtotime("+" . $this->expire);
if (!$gerenateToken) {
$token = $_COOKIE[$this->cookieName];
} else {
$token = $this... | php | private function refreshRememberCookie(UserInterface $user, $gerenateToken = true)
{
$expire = is_numeric($this->expire) ? time() + 60 * $this>expire : strtotime("+" . $this->expire);
if (!$gerenateToken) {
$token = $_COOKIE[$this->cookieName];
} else {
$token = $this... | [
"private",
"function",
"refreshRememberCookie",
"(",
"UserInterface",
"$",
"user",
",",
"$",
"gerenateToken",
"=",
"true",
")",
"{",
"$",
"expire",
"=",
"is_numeric",
"(",
"$",
"this",
"->",
"expire",
")",
"?",
"time",
"(",
")",
"+",
"60",
"*",
"$",
"t... | Refresh the expiration time of the remember me cookie.
If $gerenateToken is passed to false, then the value of the cookie is not recaculated
@param UserInterface $user
@param bool $gerenateToken | [
"Refresh",
"the",
"expiration",
"time",
"of",
"the",
"remember",
"me",
"cookie",
".",
"If",
"$gerenateToken",
"is",
"passed",
"to",
"false",
"then",
"the",
"value",
"of",
"the",
"cookie",
"is",
"not",
"recaculated"
] | train | https://github.com/thecodingmachine/security.userservice/blob/39de12c32f324ab113441a69cd73cdb4b4673225/src/Mouf/Security/UserService/RememberMeAuthProvider.php#L140-L152 |
jakubkratina/larachartie | src/Formatters/PieChartFormatter.php | PieChartFormatter.format | public function format(DataTable $dataTable)
{
return array_merge(
[$this->columns($dataTable->columns())],
$this->rows($dataTable->rows())
);
} | php | public function format(DataTable $dataTable)
{
return array_merge(
[$this->columns($dataTable->columns())],
$this->rows($dataTable->rows())
);
} | [
"public",
"function",
"format",
"(",
"DataTable",
"$",
"dataTable",
")",
"{",
"return",
"array_merge",
"(",
"[",
"$",
"this",
"->",
"columns",
"(",
"$",
"dataTable",
"->",
"columns",
"(",
")",
")",
"]",
",",
"$",
"this",
"->",
"rows",
"(",
"$",
"data... | {@inheritdoc} | [
"{"
] | train | https://github.com/jakubkratina/larachartie/blob/96c535650d61a2a6c1c1b12d374e5e59d33239f6/src/Formatters/PieChartFormatter.php#L20-L26 |
mothership-ec/composer | src/Composer/Command/ConfigCommand.php | ConfigCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
// Open file in editor
if ($input->getOption('editor')) {
$editor = escapeshellcmd(getenv('EDITOR'));
if (!$editor) {
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
// Open file in editor
if ($input->getOption('editor')) {
$editor = escapeshellcmd(getenv('EDITOR'));
if (!$editor) {
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"// Open file in editor",
"if",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'editor'",
")",
")",
"{",
"$",
"editor",
"=",
"escapeshellcmd"... | {@inheritDoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Command/ConfigCommand.php#L179-L454 |
mothership-ec/composer | src/Composer/Command/ConfigCommand.php | ConfigCommand.listConfiguration | protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
{
$origK = $k;
foreach ($contents as $key => $value) {
if ($k === null && !in_array($key, array('config', 'repositories'))) {
continue;
}
... | php | protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
{
$origK = $k;
foreach ($contents as $key => $value) {
if ($k === null && !in_array($key, array('config', 'repositories'))) {
continue;
}
... | [
"protected",
"function",
"listConfiguration",
"(",
"array",
"$",
"contents",
",",
"array",
"$",
"rawContents",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"k",
"=",
"null",
")",
"{",
"$",
"origK",
"=",
"$",
"k",
";",
"foreach",
"(",
"$",
"contents",... | Display the contents of the file in a pretty formatted way
@param array $contents
@param array $rawContents
@param OutputInterface $output
@param string|null $k | [
"Display",
"the",
"contents",
"of",
"the",
"file",
"in",
"a",
"pretty",
"formatted",
"way"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Command/ConfigCommand.php#L464-L506 |
prooph/link-monitor | src/Controller/Factory/ProcessViewControllerFactory.php | ProcessViewControllerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
return new ProcessViewController(
$serviceLocator->getServiceLocator()->get('prooph.link.monitor.process_logger'),
$serviceLocator->getServiceLocator()->get('prooph.link.monitor.process_stream_reader'),
... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
return new ProcessViewController(
$serviceLocator->getServiceLocator()->get('prooph.link.monitor.process_logger'),
$serviceLocator->getServiceLocator()->get('prooph.link.monitor.process_stream_reader'),
... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"return",
"new",
"ProcessViewController",
"(",
"$",
"serviceLocator",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'prooph.link.monitor.process_logger'",
"... | Create service
@param ServiceLocatorInterface $serviceLocator
@return mixed | [
"Create",
"service"
] | train | https://github.com/prooph/link-monitor/blob/5dd12a4bda48eb05471181bf4dab43938cf39df8/src/Controller/Factory/ProcessViewControllerFactory.php#L34-L42 |
ajgarlag/AjglCsv | src/Csv.php | Csv.createReader | public function createReader($filePath, $delimiter = ReaderInterface::DELIMITER_DEFAULT, $fileCharset = ReaderInterface::CHARSET_DEFAULT, $mode = 'r', $type = null)
{
if (null === $type) {
$type = $this->getDefaultReaderType();
}
return $this->getReaderFactory()->createReader($t... | php | public function createReader($filePath, $delimiter = ReaderInterface::DELIMITER_DEFAULT, $fileCharset = ReaderInterface::CHARSET_DEFAULT, $mode = 'r', $type = null)
{
if (null === $type) {
$type = $this->getDefaultReaderType();
}
return $this->getReaderFactory()->createReader($t... | [
"public",
"function",
"createReader",
"(",
"$",
"filePath",
",",
"$",
"delimiter",
"=",
"ReaderInterface",
"::",
"DELIMITER_DEFAULT",
",",
"$",
"fileCharset",
"=",
"ReaderInterface",
"::",
"CHARSET_DEFAULT",
",",
"$",
"mode",
"=",
"'r'",
",",
"$",
"type",
"=",... | @param string $filePath
@param string $delimiter
@param string $fileCharset
@param string $mode
@param string $type
@return ReaderInterface | [
"@param",
"string",
"$filePath",
"@param",
"string",
"$delimiter",
"@param",
"string",
"$fileCharset",
"@param",
"string",
"$mode",
"@param",
"string",
"$type"
] | train | https://github.com/ajgarlag/AjglCsv/blob/28872f58b9ef864893cac6faddfcb1229c2c2047/src/Csv.php#L138-L145 |
ajgarlag/AjglCsv | src/Csv.php | Csv.createWriter | public function createWriter($filePath, $delimiter = WriterInterface::DELIMITER_DEFAULT, $fileCharset = WriterInterface::CHARSET_DEFAULT, $mode = 'w', $type = null)
{
if (null === $type) {
$type = $this->getDefaultWriterType();
}
return $this->getWriterFactory()->createWriter($t... | php | public function createWriter($filePath, $delimiter = WriterInterface::DELIMITER_DEFAULT, $fileCharset = WriterInterface::CHARSET_DEFAULT, $mode = 'w', $type = null)
{
if (null === $type) {
$type = $this->getDefaultWriterType();
}
return $this->getWriterFactory()->createWriter($t... | [
"public",
"function",
"createWriter",
"(",
"$",
"filePath",
",",
"$",
"delimiter",
"=",
"WriterInterface",
"::",
"DELIMITER_DEFAULT",
",",
"$",
"fileCharset",
"=",
"WriterInterface",
"::",
"CHARSET_DEFAULT",
",",
"$",
"mode",
"=",
"'w'",
",",
"$",
"type",
"=",... | @param string $filePath
@param string $delimiter
@param string $fileCharset
@param string $mode
@param string $type
@return WriterInterface | [
"@param",
"string",
"$filePath",
"@param",
"string",
"$delimiter",
"@param",
"string",
"$fileCharset",
"@param",
"string",
"$mode",
"@param",
"string",
"$type"
] | train | https://github.com/ajgarlag/AjglCsv/blob/28872f58b9ef864893cac6faddfcb1229c2c2047/src/Csv.php#L156-L163 |
surebert/surebert-framework | src/sb/Image.php | Image.set | public function set($orig, $dest='')
{
if(!empty($dest)){
copy($orig, $dest);
$orig = $dest;
}
$this->path = $orig;
$this->getInfo();
} | php | public function set($orig, $dest='')
{
if(!empty($dest)){
copy($orig, $dest);
$orig = $dest;
}
$this->path = $orig;
$this->getInfo();
} | [
"public",
"function",
"set",
"(",
"$",
"orig",
",",
"$",
"dest",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"dest",
")",
")",
"{",
"copy",
"(",
"$",
"orig",
",",
"$",
"dest",
")",
";",
"$",
"orig",
"=",
"$",
"dest",
";",
"}",
... | Sets the image being edited
@param string $orig the file path to the image being edited
@param string $dest optional, the file path to name the edited file should be saved as, without this the original file gets saved over with the edited version | [
"Sets",
"the",
"image",
"being",
"edited"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L97-L107 |
surebert/surebert-framework | src/sb/Image.php | Image.getInfo | public function getInfo()
{
$file_info = @getimagesize($this->path);
//define the original width of the image
$this->width['orig'] = $file_info['0'];
//define the original height of the image
$this->height['orig'] = $file_info['1'];
//image type //1 = GIF, 2 = JPG... | php | public function getInfo()
{
$file_info = @getimagesize($this->path);
//define the original width of the image
$this->width['orig'] = $file_info['0'];
//define the original height of the image
$this->height['orig'] = $file_info['1'];
//image type //1 = GIF, 2 = JPG... | [
"public",
"function",
"getInfo",
"(",
")",
"{",
"$",
"file_info",
"=",
"@",
"getimagesize",
"(",
"$",
"this",
"->",
"path",
")",
";",
"//define the original width of the image",
"$",
"this",
"->",
"width",
"[",
"'orig'",
"]",
"=",
"$",
"file_info",
"[",
"'... | Gets the image file type, width, and height | [
"Gets",
"the",
"image",
"file",
"type",
"width",
"and",
"height"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L113-L144 |
surebert/surebert-framework | src/sb/Image.php | Image.resize | public function resize($width, $height)
{
//if the width is not specified, make it relative to the height
if($width == -1){
$this->width['dest'] = ($height * $this->width['orig']) / $this->height['orig'];
$this->height['dest'] = $height;
//if the height is not speci... | php | public function resize($width, $height)
{
//if the width is not specified, make it relative to the height
if($width == -1){
$this->width['dest'] = ($height * $this->width['orig']) / $this->height['orig'];
$this->height['dest'] = $height;
//if the height is not speci... | [
"public",
"function",
"resize",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"//if the width is not specified, make it relative to the height",
"if",
"(",
"$",
"width",
"==",
"-",
"1",
")",
"{",
"$",
"this",
"->",
"width",
"[",
"'dest'",
"]",
"=",
"(",
... | Resizes an the edited image to the specified width and height
@param int $width can be * to make it relative to a specified height
@param int $height can be * to make it relative to a specified width | [
"Resizes",
"an",
"the",
"edited",
"image",
"to",
"the",
"specified",
"width",
"and",
"height"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L167-L219 |
surebert/surebert-framework | src/sb/Image.php | Image.toGrayscale | public function toGrayscale()
{
$this->getInfo();
$this->edited = imagecreate($this->width['orig'], $this->height['orig']);
//Creates the 256 color palette
for ($c=0;$c<256;$c++)
{
$palette[$c] = imagecolorallocate($this->edited,$c,$c,$c);
}
//Read... | php | public function toGrayscale()
{
$this->getInfo();
$this->edited = imagecreate($this->width['orig'], $this->height['orig']);
//Creates the 256 color palette
for ($c=0;$c<256;$c++)
{
$palette[$c] = imagecolorallocate($this->edited,$c,$c,$c);
}
//Read... | [
"public",
"function",
"toGrayscale",
"(",
")",
"{",
"$",
"this",
"->",
"getInfo",
"(",
")",
";",
"$",
"this",
"->",
"edited",
"=",
"imagecreate",
"(",
"$",
"this",
"->",
"width",
"[",
"'orig'",
"]",
",",
"$",
"this",
"->",
"height",
"[",
"'orig'",
... | Converts the image being edited to grayscale | [
"Converts",
"the",
"image",
"being",
"edited",
"to",
"grayscale"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L225-L256 |
surebert/surebert-framework | src/sb/Image.php | Image.rotate | public function rotate($rotation)
{
if(isset($this->edited)){
$this->getInfo();
$this->edited = imagerotate($this->edited, $rotation, 0);
} else {
$this->edited = imagerotate($this->original, $rotation, 0);
}
} | php | public function rotate($rotation)
{
if(isset($this->edited)){
$this->getInfo();
$this->edited = imagerotate($this->edited, $rotation, 0);
} else {
$this->edited = imagerotate($this->original, $rotation, 0);
}
} | [
"public",
"function",
"rotate",
"(",
"$",
"rotation",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"edited",
")",
")",
"{",
"$",
"this",
"->",
"getInfo",
"(",
")",
";",
"$",
"this",
"->",
"edited",
"=",
"imagerotate",
"(",
"$",
"this",
"... | Rotates an image the number of degrees specified by $rotation
@param int $rotation | [
"Rotates",
"an",
"image",
"the",
"number",
"of",
"degrees",
"specified",
"by",
"$rotation"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L276-L285 |
surebert/surebert-framework | src/sb/Image.php | Image.write | public function write($text, $params=array())
{
$color = (isset($params['color'])) ? $params['color'] : array(0, 0, 0);
$color = imagecolorallocate($this->edited, $color[0], $color[1], $color[2]);
$size = (isset($params['size']))? $params['size'] : 5;
$x = (isset($params['x']))? $pa... | php | public function write($text, $params=array())
{
$color = (isset($params['color'])) ? $params['color'] : array(0, 0, 0);
$color = imagecolorallocate($this->edited, $color[0], $color[1], $color[2]);
$size = (isset($params['size']))? $params['size'] : 5;
$x = (isset($params['x']))? $pa... | [
"public",
"function",
"write",
"(",
"$",
"text",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"color",
"=",
"(",
"isset",
"(",
"$",
"params",
"[",
"'color'",
"]",
")",
")",
"?",
"$",
"params",
"[",
"'color'",
"]",
":",
"array",
"(... | Write text onto an image
@param string $text
@param array $params color array(r,g,b), size, x, y | [
"Write",
"text",
"onto",
"an",
"image"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L301-L311 |
surebert/surebert-framework | src/sb/Image.php | Image.toFile | public function toFile()
{
if ($this->type == "jpg")
{
$this->toJpg();
} elseif ($this->type == "png") {
$this->toPng();
} elseif ($this->type == "gif") {
$this->toGif();
}
} | php | public function toFile()
{
if ($this->type == "jpg")
{
$this->toJpg();
} elseif ($this->type == "png") {
$this->toPng();
} elseif ($this->type == "gif") {
$this->toGif();
}
} | [
"public",
"function",
"toFile",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"==",
"\"jpg\"",
")",
"{",
"$",
"this",
"->",
"toJpg",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"type",
"==",
"\"png\"",
")",
"{",
"$",
"this",
"-... | Saves the edited image as a file based on the original images file type | [
"Saves",
"the",
"edited",
"image",
"as",
"a",
"file",
"based",
"on",
"the",
"original",
"images",
"file",
"type"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L358-L376 |
surebert/surebert-framework | src/sb/Image.php | Image.display | public function display()
{
if(isset($this->edited )){
$image = $this->edited;
} else {
$image = $this->original;
}
if ($this->type == "jpg")
{
header("Content-type: image/jpeg");
imagejpeg($image);
} elseif ($this->type ... | php | public function display()
{
if(isset($this->edited )){
$image = $this->edited;
} else {
$image = $this->original;
}
if ($this->type == "jpg")
{
header("Content-type: image/jpeg");
imagejpeg($image);
} elseif ($this->type ... | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"edited",
")",
")",
"{",
"$",
"image",
"=",
"$",
"this",
"->",
"edited",
";",
"}",
"else",
"{",
"$",
"image",
"=",
"$",
"this",
"->",
"original",
";",
"... | Displays the edited image to screen as a dynamic image file | [
"Displays",
"the",
"edited",
"image",
"to",
"screen",
"as",
"a",
"dynamic",
"image",
"file"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L382-L406 |
surebert/surebert-framework | src/sb/Image.php | Image.forceDownload | public function forceDownload()
{
if ($this->type == "jpg")
{
$this->toJpg();
} elseif ($this->type == "png") {
$this->toPng();
} elseif ($this->type == "gif") {
$this->toGif();
}
header('Content-Description: File Transfer');
... | php | public function forceDownload()
{
if ($this->type == "jpg")
{
$this->toJpg();
} elseif ($this->type == "png") {
$this->toPng();
} elseif ($this->type == "gif") {
$this->toGif();
}
header('Content-Description: File Transfer');
... | [
"public",
"function",
"forceDownload",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"==",
"\"jpg\"",
")",
"{",
"$",
"this",
"->",
"toJpg",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"type",
"==",
"\"png\"",
")",
"{",
"$",
"this... | Forces the image being manipulated to the user as a force download | [
"Forces",
"the",
"image",
"being",
"manipulated",
"to",
"the",
"user",
"as",
"a",
"force",
"download"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Image.php#L412-L439 |
oroinc/OroLayoutComponent | Block.php | Block.getTypeName | public function getTypeName()
{
$blockType = $this->rawLayout->getProperty($this->id, RawLayout::BLOCK_TYPE, true);
return $blockType instanceof BlockTypeInterface
? $blockType->getName()
: $blockType;
} | php | public function getTypeName()
{
$blockType = $this->rawLayout->getProperty($this->id, RawLayout::BLOCK_TYPE, true);
return $blockType instanceof BlockTypeInterface
? $blockType->getName()
: $blockType;
} | [
"public",
"function",
"getTypeName",
"(",
")",
"{",
"$",
"blockType",
"=",
"$",
"this",
"->",
"rawLayout",
"->",
"getProperty",
"(",
"$",
"this",
"->",
"id",
",",
"RawLayout",
"::",
"BLOCK_TYPE",
",",
"true",
")",
";",
"return",
"$",
"blockType",
"instan... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Block.php#L65-L72 |
oroinc/OroLayoutComponent | Block.php | Block.getParent | public function getParent()
{
if ($this->parent === false) {
$parentId = $this->rawLayout->getParentId($this->id);
if ($parentId) {
$this->parent = new self($this->rawLayout, $this->typeHelper, $this->context, $this->data);
$this->parent->initialize($p... | php | public function getParent()
{
if ($this->parent === false) {
$parentId = $this->rawLayout->getParentId($this->id);
if ($parentId) {
$this->parent = new self($this->rawLayout, $this->typeHelper, $this->context, $this->data);
$this->parent->initialize($p... | [
"public",
"function",
"getParent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parent",
"===",
"false",
")",
"{",
"$",
"parentId",
"=",
"$",
"this",
"->",
"rawLayout",
"->",
"getParentId",
"(",
"$",
"this",
"->",
"id",
")",
";",
"if",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Block.php#L85-L98 |
Eluinhost/php-yggdrasil | src/DefaultYggdrasil.php | DefaultYggdrasil.parseTexturesProperties | private function parseTexturesProperties($propertiesArray)
{
foreach($propertiesArray as $property) {
if($property['name'] == 'textures') {
$texturesJSON = json_decode(base64_decode($property['value']), true);
$properties = new PlayerProperties(
... | php | private function parseTexturesProperties($propertiesArray)
{
foreach($propertiesArray as $property) {
if($property['name'] == 'textures') {
$texturesJSON = json_decode(base64_decode($property['value']), true);
$properties = new PlayerProperties(
... | [
"private",
"function",
"parseTexturesProperties",
"(",
"$",
"propertiesArray",
")",
"{",
"foreach",
"(",
"$",
"propertiesArray",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"$",
"property",
"[",
"'name'",
"]",
"==",
"'textures'",
")",
"{",
"$",
"texturesJSON... | Checks the array for a properties with name 'textures' and creates a PlayerProperties for it
@param $propertiesArray array the array of properties
@return PlayerProperties the parsed properties or null if textures property not found | [
"Checks",
"the",
"array",
"for",
"a",
"properties",
"with",
"name",
"textures",
"and",
"creates",
"a",
"PlayerProperties",
"for",
"it"
] | train | https://github.com/Eluinhost/php-yggdrasil/blob/9513f67e7c88f1e92eaacb564a727f23b84c5525/src/DefaultYggdrasil.php#L41-L68 |
Eluinhost/php-yggdrasil | src/DefaultYggdrasil.php | DefaultYggdrasil.getAuthServerResponse | private function getAuthServerResponse($subURL, $jsonData)
{
return $this->getResponse(
self::AUTH_SERVER_URL . $subURL,
[
'json' => $jsonData,
'headers' => [
'Content-Type' => 'application/json'
]
],
... | php | private function getAuthServerResponse($subURL, $jsonData)
{
return $this->getResponse(
self::AUTH_SERVER_URL . $subURL,
[
'json' => $jsonData,
'headers' => [
'Content-Type' => 'application/json'
]
],
... | [
"private",
"function",
"getAuthServerResponse",
"(",
"$",
"subURL",
",",
"$",
"jsonData",
")",
"{",
"return",
"$",
"this",
"->",
"getResponse",
"(",
"self",
"::",
"AUTH_SERVER_URL",
".",
"$",
"subURL",
",",
"[",
"'json'",
"=>",
"$",
"jsonData",
",",
"'head... | Shortcut to getResponse using self::AUTH_SERVER_URL as a base
@param $subURL String the url to append to AUTH_SERVER_URL
@param $jsonData array the json payload
@throws APIRequestException if a non 200 code with the error details from the server
@return array json response | [
"Shortcut",
"to",
"getResponse",
"using",
"self",
"::",
"AUTH_SERVER_URL",
"as",
"a",
"base"
] | train | https://github.com/Eluinhost/php-yggdrasil/blob/9513f67e7c88f1e92eaacb564a727f23b84c5525/src/DefaultYggdrasil.php#L78-L90 |
Eluinhost/php-yggdrasil | src/DefaultYggdrasil.php | DefaultYggdrasil.getSessionServerResponse | private function getSessionServerResponse($subURL, $queryParameters = [])
{
return $this->getResponse(
self::SESSION_SERVER . $subURL,
[
'query' => $queryParameters
],
false
);
} | php | private function getSessionServerResponse($subURL, $queryParameters = [])
{
return $this->getResponse(
self::SESSION_SERVER . $subURL,
[
'query' => $queryParameters
],
false
);
} | [
"private",
"function",
"getSessionServerResponse",
"(",
"$",
"subURL",
",",
"$",
"queryParameters",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getResponse",
"(",
"self",
"::",
"SESSION_SERVER",
".",
"$",
"subURL",
",",
"[",
"'query'",
"=>",
"$"... | Shortcut to getResponse using self::SESSION_SERVER_URL as a base
@param $subURL String the url to append to SESSION_SERVER_URL
@param $queryParameters array an assoc array of the get parameters to set
@throws APIRequestException if a non 200 code with the error details from the server
@return array json response | [
"Shortcut",
"to",
"getResponse",
"using",
"self",
"::",
"SESSION_SERVER_URL",
"as",
"a",
"base"
] | train | https://github.com/Eluinhost/php-yggdrasil/blob/9513f67e7c88f1e92eaacb564a727f23b84c5525/src/DefaultYggdrasil.php#L100-L109 |
Eluinhost/php-yggdrasil | src/DefaultYggdrasil.php | DefaultYggdrasil.getResponse | private function getResponse($url, $options, $post)
{
if($post) {
$response = $this->httpClient->post($url, $options);
} else {
$response = $this->httpClient->get($url, $options);
}
if( $response->getStatusCode() != 200 ) {
$json = $response->json(... | php | private function getResponse($url, $options, $post)
{
if($post) {
$response = $this->httpClient->post($url, $options);
} else {
$response = $this->httpClient->get($url, $options);
}
if( $response->getStatusCode() != 200 ) {
$json = $response->json(... | [
"private",
"function",
"getResponse",
"(",
"$",
"url",
",",
"$",
"options",
",",
"$",
"post",
")",
"{",
"if",
"(",
"$",
"post",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"httpClient",
"->",
"post",
"(",
"$",
"url",
",",
"$",
"options",
"... | Get a response from the given subURL via POST with the given JSON data. Sets header Content-Type for JSON
@param $url String the full URL to request
@param $options array the options to set on the request
@param $post boolean if true uses POST, otherwise uses GET
@throws APIRequestException if a non 200 code with the ... | [
"Get",
"a",
"response",
"from",
"the",
"given",
"subURL",
"via",
"POST",
"with",
"the",
"given",
"JSON",
"data",
".",
"Sets",
"header",
"Content",
"-",
"Type",
"for",
"JSON"
] | train | https://github.com/Eluinhost/php-yggdrasil/blob/9513f67e7c88f1e92eaacb564a727f23b84c5525/src/DefaultYggdrasil.php#L120-L139 |
technote-space/wordpress-plugin-base | src/technote_mock.php | Technote.translate | private function translate( $value ) {
$textdomain = $this->get_textdomain();
if ( ! empty( $textdomain ) ) {
$translated = __( $value, $textdomain );
if ( $value !== $translated ) {
return $translated;
}
}
return __( $value, TECHNOTE_PLUGIN );
} | php | private function translate( $value ) {
$textdomain = $this->get_textdomain();
if ( ! empty( $textdomain ) ) {
$translated = __( $value, $textdomain );
if ( $value !== $translated ) {
return $translated;
}
}
return __( $value, TECHNOTE_PLUGIN );
} | [
"private",
"function",
"translate",
"(",
"$",
"value",
")",
"{",
"$",
"textdomain",
"=",
"$",
"this",
"->",
"get_textdomain",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"textdomain",
")",
")",
"{",
"$",
"translated",
"=",
"__",
"(",
"$",
"va... | @since 1.2.1
@param $value
@return string | [
"@since",
"1",
".",
"2",
".",
"1"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/technote_mock.php#L137-L147 |
technote-space/wordpress-plugin-base | src/technote_mock.php | Technote.get_instance | public static function get_instance( $plugin_name, $plugin_file ) {
if ( ! isset( self::$_instances[ $plugin_name ] ) ) {
self::$_instances[ $plugin_name ] = new static( $plugin_name, $plugin_file );
}
return self::$_instances[ $plugin_name ];
} | php | public static function get_instance( $plugin_name, $plugin_file ) {
if ( ! isset( self::$_instances[ $plugin_name ] ) ) {
self::$_instances[ $plugin_name ] = new static( $plugin_name, $plugin_file );
}
return self::$_instances[ $plugin_name ];
} | [
"public",
"static",
"function",
"get_instance",
"(",
"$",
"plugin_name",
",",
"$",
"plugin_file",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"plugin_name",
"]",
")",
")",
"{",
"self",
"::",
"$",
"_instances",
"["... | @param string $plugin_name
@param string $plugin_file
@return Technote | [
"@param",
"string",
"$plugin_name",
"@param",
"string",
"$plugin_file"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/technote_mock.php#L155-L161 |
technote-space/wordpress-plugin-base | src/technote_mock.php | Technote.init | public function init() {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$this->plugin_data = get_plugin_data( $this->plugin_file, false, false );
} | php | public function init() {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$this->plugin_data = get_plugin_data( $this->plugin_file, false, false );
} | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'get_plugin_data'",
")",
")",
"{",
"require_once",
"ABSPATH",
".",
"'wp-admin/includes/plugin.php'",
";",
"}",
"$",
"this",
"->",
"plugin_data",
"=",
"get_plugin_data",
"(",
... | init
@since 2.1.0 | [
"init"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/technote_mock.php#L175-L180 |
highday/glitter | src/Audit/Listeners/Member/LogCreate.php | LogCreate.handle | public function handle(MemberCreated $event)
{
if (is_null($event->actor)) {
return;
}
$data = [
'ip' => request()->ip(),
'ua' => request()->header('User-Agent'),
];
$event->actor->log('member.create', $data);
} | php | public function handle(MemberCreated $event)
{
if (is_null($event->actor)) {
return;
}
$data = [
'ip' => request()->ip(),
'ua' => request()->header('User-Agent'),
];
$event->actor->log('member.create', $data);
} | [
"public",
"function",
"handle",
"(",
"MemberCreated",
"$",
"event",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"event",
"->",
"actor",
")",
")",
"{",
"return",
";",
"}",
"$",
"data",
"=",
"[",
"'ip'",
"=>",
"request",
"(",
")",
"->",
"ip",
"(",
")... | Handle the event.
@param MemberCreated $event
@return void | [
"Handle",
"the",
"event",
"."
] | train | https://github.com/highday/glitter/blob/d1c7a227fd2343806bd3ec0314e621ced57dfe66/src/Audit/Listeners/Member/LogCreate.php#L26-L38 |
zhouyl/mellivora | Mellivora/Database/DatabaseServiceProvider.php | DatabaseServiceProvider.register | public function register()
{
$this->registerConnectionServices();
$this->registerEloquentFactory();
$this->registerQueueableEntityResolver();
Model::setConnectionResolver($this->container['db']);
Model::setEventDispatcher($this->container['events']);
Model::clearBoot... | php | public function register()
{
$this->registerConnectionServices();
$this->registerEloquentFactory();
$this->registerQueueableEntityResolver();
Model::setConnectionResolver($this->container['db']);
Model::setEventDispatcher($this->container['events']);
Model::clearBoot... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerConnectionServices",
"(",
")",
";",
"$",
"this",
"->",
"registerEloquentFactory",
"(",
")",
";",
"$",
"this",
"->",
"registerQueueableEntityResolver",
"(",
")",
";",
"Model",
"::",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/DatabaseServiceProvider.php#L20-L30 |
zhouyl/mellivora | Mellivora/Database/DatabaseServiceProvider.php | DatabaseServiceProvider.registerConnectionServices | protected function registerConnectionServices()
{
// The connection factory is used to create the actual connection instances on
// the database. We will inject the factory into the manager so that it may
// make the connections while they are actually needed and not of before.
$this... | php | protected function registerConnectionServices()
{
// The connection factory is used to create the actual connection instances on
// the database. We will inject the factory into the manager so that it may
// make the connections while they are actually needed and not of before.
$this... | [
"protected",
"function",
"registerConnectionServices",
"(",
")",
"{",
"// The connection factory is used to create the actual connection instances on",
"// the database. We will inject the factory into the manager so that it may",
"// make the connections while they are actually needed and not of be... | Register the primary database bindings.
@return void | [
"Register",
"the",
"primary",
"database",
"bindings",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/DatabaseServiceProvider.php#L37-L56 |
zhouyl/mellivora | Mellivora/Database/DatabaseServiceProvider.php | DatabaseServiceProvider.registerEloquentFactory | protected function registerEloquentFactory()
{
$this->container['db.faker'] = function () {
return FakerFactory::create();
};
$this->container['db.eloquent'] = function ($container) {
return EloquentFactory::construct(
$container['db.faker'],
... | php | protected function registerEloquentFactory()
{
$this->container['db.faker'] = function () {
return FakerFactory::create();
};
$this->container['db.eloquent'] = function ($container) {
return EloquentFactory::construct(
$container['db.faker'],
... | [
"protected",
"function",
"registerEloquentFactory",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"[",
"'db.faker'",
"]",
"=",
"function",
"(",
")",
"{",
"return",
"FakerFactory",
"::",
"create",
"(",
")",
";",
"}",
";",
"$",
"this",
"->",
"container",
... | Register the Eloquent factory instance in the container.
@return void | [
"Register",
"the",
"Eloquent",
"factory",
"instance",
"in",
"the",
"container",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/DatabaseServiceProvider.php#L63-L75 |
alchemy-fr/GeonamesServer-PHP-Plugin | src/Alchemy/Geonames/Geoname.php | Geoname.get | public function get($property)
{
return isset($this->data[$property]) ? $this->data[$property] : null;
} | php | public function get($property)
{
return isset($this->data[$property]) ? $this->data[$property] : null;
} | [
"public",
"function",
"get",
"(",
"$",
"property",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"property",
"]",
")",
"?",
"$",
"this",
"->",
"data",
"[",
"$",
"property",
"]",
":",
"null",
";",
"}"
] | Returns the value of a given property.
@param string $property
@return mixed|null | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"property",
"."
] | train | https://github.com/alchemy-fr/GeonamesServer-PHP-Plugin/blob/a14bd64b2badaf65ff03cca37ca52bff65f31152/src/Alchemy/Geonames/Geoname.php#L35-L38 |
codeages/beanstalk-client | src/Client.php | Client.connect | public function connect()
{
if (isset($this->_connection)) {
$this->disconnect();
}
$function = $this->_config['persistent'] ? 'pfsockopen' : 'fsockopen';
$params = [$this->_config['host'], $this->_config['port'], &$errNum, &$errStr];
if ($this->_config['timeout... | php | public function connect()
{
if (isset($this->_connection)) {
$this->disconnect();
}
$function = $this->_config['persistent'] ? 'pfsockopen' : 'fsockopen';
$params = [$this->_config['host'], $this->_config['port'], &$errNum, &$errStr];
if ($this->_config['timeout... | [
"public",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_connection",
")",
")",
"{",
"$",
"this",
"->",
"disconnect",
"(",
")",
";",
"}",
"$",
"function",
"=",
"$",
"this",
"->",
"_config",
"[",
"'persistent'",
... | Initiates a socket connection to the beanstalk server. The resulting
stream will not have any timeout set on it. Which means it can wait
an unlimited amount of time until a packet becomes available. This
is required for doing blocking reads.
@see \Beanstalk\Client::$_connection
@see \Beanstalk\Client::reserve()
@retu... | [
"Initiates",
"a",
"socket",
"connection",
"to",
"the",
"beanstalk",
"server",
".",
"The",
"resulting",
"stream",
"will",
"not",
"have",
"any",
"timeout",
"set",
"on",
"it",
".",
"Which",
"means",
"it",
"can",
"wait",
"an",
"unlimited",
"amount",
"of",
"tim... | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L120-L146 |
codeages/beanstalk-client | src/Client.php | Client._write | protected function _write($data)
{
if (!$this->connected) {
$message = 'No connecting found while writing data to socket.';
throw new RuntimeException($message);
}
$data .= "\r\n";
$length = strlen($data);
$fwrited = fwrite($this->_connection, $data,... | php | protected function _write($data)
{
if (!$this->connected) {
$message = 'No connecting found while writing data to socket.';
throw new RuntimeException($message);
}
$data .= "\r\n";
$length = strlen($data);
$fwrited = fwrite($this->_connection, $data,... | [
"protected",
"function",
"_write",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connected",
")",
"{",
"$",
"message",
"=",
"'No connecting found while writing data to socket.'",
";",
"throw",
"new",
"RuntimeException",
"(",
"$",
"message",
"... | Writes a packet to the socket. Prior to writing to the socket will
check for availability of the connection.
@param string $data
@return int|bool number of written bytes or `false` on error. | [
"Writes",
"a",
"packet",
"to",
"the",
"socket",
".",
"Prior",
"to",
"writing",
"to",
"the",
"socket",
"will",
"check",
"for",
"availability",
"of",
"the",
"connection",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L178-L197 |
codeages/beanstalk-client | src/Client.php | Client.useTube | public function useTube($tube)
{
$this->_usingTube = $tube;
$this->_write(sprintf('use %s', $tube));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'USING':
return strtok(' ');
default:
throw new ServerException... | php | public function useTube($tube)
{
$this->_usingTube = $tube;
$this->_write(sprintf('use %s', $tube));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'USING':
return strtok(' ');
default:
throw new ServerException... | [
"public",
"function",
"useTube",
"(",
"$",
"tube",
")",
"{",
"$",
"this",
"->",
"_usingTube",
"=",
"$",
"tube",
";",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'use %s'",
",",
"$",
"tube",
")",
")",
";",
"$",
"status",
"=",
"strtok",
"(",
... | The `use` command is for producers. Subsequent put commands will put
jobs into the tube specified by this command. If no use command has
been issued, jobs will be put into the tube named `default`.
@param string $tube A name at most 200 bytes. It specifies the tube to
use. If the tube does not exist, it will be create... | [
"The",
"use",
"command",
"is",
"for",
"producers",
".",
"Subsequent",
"put",
"commands",
"will",
"put",
"jobs",
"into",
"the",
"tube",
"specified",
"by",
"this",
"command",
".",
"If",
"no",
"use",
"command",
"has",
"been",
"issued",
"jobs",
"will",
"be",
... | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L297-L309 |
codeages/beanstalk-client | src/Client.php | Client.reserve | public function reserve($timeout = null)
{
if (isset($timeout)) {
$this->_write(sprintf('reserve-with-timeout %d', $timeout));
} else {
$this->_write('reserve');
}
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'RESERVED':
... | php | public function reserve($timeout = null)
{
if (isset($timeout)) {
$this->_write(sprintf('reserve-with-timeout %d', $timeout));
} else {
$this->_write('reserve');
}
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'RESERVED':
... | [
"public",
"function",
"reserve",
"(",
"$",
"timeout",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"timeout",
")",
")",
"{",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'reserve-with-timeout %d'",
",",
"$",
"timeout",
")",
")",
";",
"}... | Reserve a job (with a timeout).
@param int $timeout If given specifies number of seconds to wait for
a job. `0` returns immediately.
@return array|false `false` on error otherwise an array holding job id
and body. | [
"Reserve",
"a",
"job",
"(",
"with",
"a",
"timeout",
")",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L346-L368 |
codeages/beanstalk-client | src/Client.php | Client.delete | public function delete($id)
{
$this->_write(sprintf('delete %d', $id));
$status = $this->_read();
switch ($status) {
case 'DELETED':
return true;
case 'NOT_FOUND':
return false;
default:
throw new ServerExce... | php | public function delete($id)
{
$this->_write(sprintf('delete %d', $id));
$status = $this->_read();
switch ($status) {
case 'DELETED':
return true;
case 'NOT_FOUND':
return false;
default:
throw new ServerExce... | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'delete %d'",
",",
"$",
"id",
")",
")",
";",
"$",
"status",
"=",
"$",
"this",
"->",
"_read",
"(",
")",
";",
"switch",
"(",
"$",
"status",... | Removes a job from the server entirely.
@param int $id The id of the job.
@return bool `false` on error, `true` on success. | [
"Removes",
"a",
"job",
"from",
"the",
"server",
"entirely",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L377-L390 |
codeages/beanstalk-client | src/Client.php | Client.release | public function release($id, $pri, $delay)
{
$this->_write(sprintf('release %d %d %d', $id, $pri, $delay));
$status = $this->_read();
switch ($status) {
case 'RELEASED':
case 'BURIED':
return true;
case 'NOT_FOUND':
return ... | php | public function release($id, $pri, $delay)
{
$this->_write(sprintf('release %d %d %d', $id, $pri, $delay));
$status = $this->_read();
switch ($status) {
case 'RELEASED':
case 'BURIED':
return true;
case 'NOT_FOUND':
return ... | [
"public",
"function",
"release",
"(",
"$",
"id",
",",
"$",
"pri",
",",
"$",
"delay",
")",
"{",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'release %d %d %d'",
",",
"$",
"id",
",",
"$",
"pri",
",",
"$",
"delay",
")",
")",
";",
"$",
"status... | Puts a reserved job back into the ready queue.
@param int $id The id of the job.
@param int $pri Priority to assign to the job.
@param int $delay Number of seconds to wait before putting the job in the ready queue.
@return bool `false` on error, `true` on success. | [
"Puts",
"a",
"reserved",
"job",
"back",
"into",
"the",
"ready",
"queue",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L401-L415 |
codeages/beanstalk-client | src/Client.php | Client.watch | public function watch($tube)
{
$this->_watchingTubes[$tube] = true;
$this->_write(sprintf('watch %s', $tube));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'WATCHING':
return (integer) strtok(' ');
default:
th... | php | public function watch($tube)
{
$this->_watchingTubes[$tube] = true;
$this->_write(sprintf('watch %s', $tube));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'WATCHING':
return (integer) strtok(' ');
default:
th... | [
"public",
"function",
"watch",
"(",
"$",
"tube",
")",
"{",
"$",
"this",
"->",
"_watchingTubes",
"[",
"$",
"tube",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'watch %s'",
",",
"$",
"tube",
")",
")",
";",
"$",
"status",... | Adds the named tube to the watch list for the current connection.
@param string $tube Name of tube to watch.
@return int|bool `false` on error otherwise number of tubes in watch list. | [
"Adds",
"the",
"named",
"tube",
"to",
"the",
"watch",
"list",
"for",
"the",
"current",
"connection",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L470-L482 |
codeages/beanstalk-client | src/Client.php | Client._peekRead | protected function _peekRead()
{
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'FOUND':
return [
'id' => (integer) strtok(' '),
'body' => $this->_read((integer) strtok(' ')),
];
case 'NO... | php | protected function _peekRead()
{
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'FOUND':
return [
'id' => (integer) strtok(' '),
'body' => $this->_read((integer) strtok(' ')),
];
case 'NO... | [
"protected",
"function",
"_peekRead",
"(",
")",
"{",
"$",
"status",
"=",
"strtok",
"(",
"$",
"this",
"->",
"_read",
"(",
")",
",",
"' '",
")",
";",
"switch",
"(",
"$",
"status",
")",
"{",
"case",
"'FOUND'",
":",
"return",
"[",
"'id'",
"=>",
"(",
... | Handles response for all peek methods.
@return string|bool `false` on error otherwise the body of the job. | [
"Handles",
"response",
"for",
"all",
"peek",
"methods",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L563-L578 |
codeages/beanstalk-client | src/Client.php | Client.kick | public function kick($bound)
{
$this->_write(sprintf('kick %d', $bound));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'KICKED':
return (integer) strtok(' ');
default:
throw new ServerException('Kick error: '.$status)... | php | public function kick($bound)
{
$this->_write(sprintf('kick %d', $bound));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'KICKED':
return (integer) strtok(' ');
default:
throw new ServerException('Kick error: '.$status)... | [
"public",
"function",
"kick",
"(",
"$",
"bound",
")",
"{",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'kick %d'",
",",
"$",
"bound",
")",
")",
";",
"$",
"status",
"=",
"strtok",
"(",
"$",
"this",
"->",
"_read",
"(",
")",
",",
"' '",
")",
... | Moves jobs into the ready queue (applies to the current tube).
If there are buried jobs those get kicked only otherwise delayed
jobs get kicked.
@param int $bound Upper bound on the number of jobs to kick.
@return int|bool False on error otherwise number of jobs kicked. | [
"Moves",
"jobs",
"into",
"the",
"ready",
"queue",
"(",
"applies",
"to",
"the",
"current",
"tube",
")",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L590-L601 |
codeages/beanstalk-client | src/Client.php | Client.kickJob | public function kickJob($id)
{
$this->_write(sprintf('kick-job %d', $id));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'KICKED':
return true;
case 'NOT_FOUND':
return false;
default:
throw... | php | public function kickJob($id)
{
$this->_write(sprintf('kick-job %d', $id));
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'KICKED':
return true;
case 'NOT_FOUND':
return false;
default:
throw... | [
"public",
"function",
"kickJob",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"_write",
"(",
"sprintf",
"(",
"'kick-job %d'",
",",
"$",
"id",
")",
")",
";",
"$",
"status",
"=",
"strtok",
"(",
"$",
"this",
"->",
"_read",
"(",
")",
",",
"' '",
")",... | This is a variant of the kick command that operates with a single
job identified by its job id. If the given job id exists and is in a
buried or delayed state, it will be moved to the ready queue of the
the same tube where it currently belongs.
@param int $id The job id.
@return bool `false` on error `true` otherwise... | [
"This",
"is",
"a",
"variant",
"of",
"the",
"kick",
"command",
"that",
"operates",
"with",
"a",
"single",
"job",
"identified",
"by",
"its",
"job",
"id",
".",
"If",
"the",
"given",
"job",
"id",
"exists",
"and",
"is",
"in",
"a",
"buried",
"or",
"delayed",... | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L613-L626 |
codeages/beanstalk-client | src/Client.php | Client.listTubeUsed | public function listTubeUsed()
{
$this->_write('list-tube-used');
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'USING':
return strtok(' ');
default:
throw new ServerException('List tube used error: '.$status);
... | php | public function listTubeUsed()
{
$this->_write('list-tube-used');
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'USING':
return strtok(' ');
default:
throw new ServerException('List tube used error: '.$status);
... | [
"public",
"function",
"listTubeUsed",
"(",
")",
"{",
"$",
"this",
"->",
"_write",
"(",
"'list-tube-used'",
")",
";",
"$",
"status",
"=",
"strtok",
"(",
"$",
"this",
"->",
"_read",
"(",
")",
",",
"' '",
")",
";",
"switch",
"(",
"$",
"status",
")",
"... | Returns the tube currently being used by the producer.
@return string|bool `false` on error otherwise a string with the name of the tube. | [
"Returns",
"the",
"tube",
"currently",
"being",
"used",
"by",
"the",
"producer",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L687-L698 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.