id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
188,200 | mitchellvanw/laravel-doctrine | src/Validation/DoctrinePresenceVerifier.php | DoctrinePresenceVerifier.createQueryFrom | private function createQueryFrom(array $queryParts = [])
{
$rsm = new ResultSetMapping();
return $this->entityManager->createNativeQuery(implode(' ', $queryParts), $rsm);
} | php | private function createQueryFrom(array $queryParts = [])
{
$rsm = new ResultSetMapping();
return $this->entityManager->createNativeQuery(implode(' ', $queryParts), $rsm);
} | [
"private",
"function",
"createQueryFrom",
"(",
"array",
"$",
"queryParts",
"=",
"[",
"]",
")",
"{",
"$",
"rsm",
"=",
"new",
"ResultSetMapping",
"(",
")",
";",
"return",
"$",
"this",
"->",
"entityManager",
"->",
"createNativeQuery",
"(",
"implode",
"(",
"' ... | Creates a new Doctrine native query based on the query parts array.
@param array $queryParts
@return mixed | [
"Creates",
"a",
"new",
"Doctrine",
"native",
"query",
"based",
"on",
"the",
"query",
"parts",
"array",
"."
] | 703154d2285232cf9da714b2c1ca127499700ccb | https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/Validation/DoctrinePresenceVerifier.php#L87-L92 |
188,201 | themsaid/laravel-model-transformer | src/AbstractTransformer.php | AbstractTransformer.transform | static function transform($modelOrCollection, $options = [])
{
$static = new static($options);
if ($modelOrCollection instanceof Collection) {
return $modelOrCollection->map([$static, 'transformModel'])->toArray();
}
return $static->transformModel($modelOrCollection);
... | php | static function transform($modelOrCollection, $options = [])
{
$static = new static($options);
if ($modelOrCollection instanceof Collection) {
return $modelOrCollection->map([$static, 'transformModel'])->toArray();
}
return $static->transformModel($modelOrCollection);
... | [
"static",
"function",
"transform",
"(",
"$",
"modelOrCollection",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"static",
"=",
"new",
"static",
"(",
"$",
"options",
")",
";",
"if",
"(",
"$",
"modelOrCollection",
"instanceof",
"Collection",
")",
"{",... | Transform a Model or a Collection.
@param mixed $modelOrCollection
@param array $options
@return mixed | [
"Transform",
"a",
"Model",
"or",
"a",
"Collection",
"."
] | d7b12116483d4b7cdb590b1f1e42a7c180668b10 | https://github.com/themsaid/laravel-model-transformer/blob/d7b12116483d4b7cdb590b1f1e42a7c180668b10/src/AbstractTransformer.php#L30-L39 |
188,202 | themsaid/laravel-model-transformer | src/AbstractTransformer.php | AbstractTransformer.isLoadedFromPivotTable | protected function isLoadedFromPivotTable(Model $item, $tableName)
{
return $item->pivot && $item->pivot->getTable() == $tableName;
} | php | protected function isLoadedFromPivotTable(Model $item, $tableName)
{
return $item->pivot && $item->pivot->getTable() == $tableName;
} | [
"protected",
"function",
"isLoadedFromPivotTable",
"(",
"Model",
"$",
"item",
",",
"$",
"tableName",
")",
"{",
"return",
"$",
"item",
"->",
"pivot",
"&&",
"$",
"item",
"->",
"pivot",
"->",
"getTable",
"(",
")",
"==",
"$",
"tableName",
";",
"}"
] | Check if the model instance is loaded from the provided pivot table.
@param Model $item
@param string $tableName
@return bool | [
"Check",
"if",
"the",
"model",
"instance",
"is",
"loaded",
"from",
"the",
"provided",
"pivot",
"table",
"."
] | d7b12116483d4b7cdb590b1f1e42a7c180668b10 | https://github.com/themsaid/laravel-model-transformer/blob/d7b12116483d4b7cdb590b1f1e42a7c180668b10/src/AbstractTransformer.php#L49-L52 |
188,203 | scopdrag/laravel-google-chart | src/ChartManager.php | ChartManager.processRowsHeads | protected function processRowsHeads() {
$cols = $this->getCols();
$this->data = $this->rows;
if (!empty($cols)) {
array_unshift($this->data, $cols);
}
return $this->data;
} | php | protected function processRowsHeads() {
$cols = $this->getCols();
$this->data = $this->rows;
if (!empty($cols)) {
array_unshift($this->data, $cols);
}
return $this->data;
} | [
"protected",
"function",
"processRowsHeads",
"(",
")",
"{",
"$",
"cols",
"=",
"$",
"this",
"->",
"getCols",
"(",
")",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"this",
"->",
"rows",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cols",
")",
")",
"{",
... | processing rows and there heads
@return type | [
"processing",
"rows",
"and",
"there",
"heads"
] | 338716078351dcdee3a638e087c7511d99878d39 | https://github.com/scopdrag/laravel-google-chart/blob/338716078351dcdee3a638e087c7511d99878d39/src/ChartManager.php#L119-L126 |
188,204 | scopdrag/laravel-google-chart | src/ChartManager.php | ChartManager.render | public function render() {
$this->setId();
$id = $this->id;
$this->processRowsHeads();
return view('LaravelGoogleChart::' . $this->getChartType())
->with(['options' => $this->options,
'id' => $this->id,
'data... | php | public function render() {
$this->setId();
$id = $this->id;
$this->processRowsHeads();
return view('LaravelGoogleChart::' . $this->getChartType())
->with(['options' => $this->options,
'id' => $this->id,
'data... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"setId",
"(",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"this",
"->",
"processRowsHeads",
"(",
")",
";",
"return",
"view",
"(",
"'LaravelGoogleChart::'",
".",
"$",
... | genrate Google chart
@return type | [
"genrate",
"Google",
"chart"
] | 338716078351dcdee3a638e087c7511d99878d39 | https://github.com/scopdrag/laravel-google-chart/blob/338716078351dcdee3a638e087c7511d99878d39/src/ChartManager.php#L132-L140 |
188,205 | drsdre/yii2-wizardwidget | WizardWidget.php | WizardWidget.navButton | protected function navButton($button_type, $step, $button_id) {
// Setup a unique button id
$options = ['id' => $button_id.$button_type];
// Apply default button configuration if defined
if (isset($this->default_buttons[$button_type]['options'])) {
$options = array_merge($options, $this->default_buttons[$bu... | php | protected function navButton($button_type, $step, $button_id) {
// Setup a unique button id
$options = ['id' => $button_id.$button_type];
// Apply default button configuration if defined
if (isset($this->default_buttons[$button_type]['options'])) {
$options = array_merge($options, $this->default_buttons[$bu... | [
"protected",
"function",
"navButton",
"(",
"$",
"button_type",
",",
"$",
"step",
",",
"$",
"button_id",
")",
"{",
"// Setup a unique button id",
"$",
"options",
"=",
"[",
"'id'",
"=>",
"$",
"button_id",
".",
"$",
"button_type",
"]",
";",
"// Apply default butt... | Generate navigation button
@param string $button_type prev|skip|next\save
@param array $step step configuration
@param string $button_id
@return string | [
"Generate",
"navigation",
"button"
] | 51ef01d315875830af2565121fe1f3b1bf32850c | https://github.com/drsdre/yii2-wizardwidget/blob/51ef01d315875830af2565121fe1f3b1bf32850c/WizardWidget.php#L189-L218 |
188,206 | dwightwatson/autologin | src/Providers/AuthAuthenticationProvider.php | AuthAuthenticationProvider.loginUsingId | public function loginUsingId($userId)
{
$guard = config('autologin.guard');
if ($user = Auth::guard($guard)->getProvider()->retrieveById($userId)) {
Auth::guard($guard)->login($user);
return $user;
}
return null;
} | php | public function loginUsingId($userId)
{
$guard = config('autologin.guard');
if ($user = Auth::guard($guard)->getProvider()->retrieveById($userId)) {
Auth::guard($guard)->login($user);
return $user;
}
return null;
} | [
"public",
"function",
"loginUsingId",
"(",
"$",
"userId",
")",
"{",
"$",
"guard",
"=",
"config",
"(",
"'autologin.guard'",
")",
";",
"if",
"(",
"$",
"user",
"=",
"Auth",
"::",
"guard",
"(",
"$",
"guard",
")",
"->",
"getProvider",
"(",
")",
"->",
"ret... | Log a user in through the Laravel Auth facade
through their user id.
@param int $userId
@return mixed | [
"Log",
"a",
"user",
"in",
"through",
"the",
"Laravel",
"Auth",
"facade",
"through",
"their",
"user",
"id",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Providers/AuthAuthenticationProvider.php#L17-L29 |
188,207 | dwightwatson/autologin | src/controllers/AutologinController.php | AutologinController.autologin | public function autologin($token)
{
if ($autologin = $this->autologin->validate($token)) {
// Active token found, login the user and redirect to the
// intended path.
if ($user = $this->authProvider->loginUsingId($autologin->getUserId())) {
return redirect... | php | public function autologin($token)
{
if ($autologin = $this->autologin->validate($token)) {
// Active token found, login the user and redirect to the
// intended path.
if ($user = $this->authProvider->loginUsingId($autologin->getUserId())) {
return redirect... | [
"public",
"function",
"autologin",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"autologin",
"=",
"$",
"this",
"->",
"autologin",
"->",
"validate",
"(",
"$",
"token",
")",
")",
"{",
"// Active token found, login the user and redirect to the",
"// intended path.",
... | Process the autologin token and perform the redirect.
@param string $token
@return \Illuminate\Http\RedirecetResponse | [
"Process",
"the",
"autologin",
"token",
"and",
"perform",
"the",
"redirect",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/controllers/AutologinController.php#L44-L56 |
188,208 | dwightwatson/autologin | src/Autologin.php | Autologin.to | public function to(Authenticatable $user, $path, $extra = [], $secure = null)
{
$path = $this->generator->to($path, $extra, $secure);
return $this->getAutologinLink($user, $path);
} | php | public function to(Authenticatable $user, $path, $extra = [], $secure = null)
{
$path = $this->generator->to($path, $extra, $secure);
return $this->getAutologinLink($user, $path);
} | [
"public",
"function",
"to",
"(",
"Authenticatable",
"$",
"user",
",",
"$",
"path",
",",
"$",
"extra",
"=",
"[",
"]",
",",
"$",
"secure",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"generator",
"->",
"to",
"(",
"$",
"path",
",",
... | Generate a link that will automatically login a user and then redirect
them to a hard-coded path as generated by the URL
generator.
@param \Illuminate\Contracts\Auth\Authenticatable $user
@param string $path
@param mixed $extra
@param bool $secure
@return string | [
"Generate",
"a",
"link",
"that",
"will",
"automatically",
"login",
"a",
"user",
"and",
"then",
"redirect",
"them",
"to",
"a",
"hard",
"-",
"coded",
"path",
"as",
"generated",
"by",
"the",
"URL",
"generator",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L65-L70 |
188,209 | dwightwatson/autologin | src/Autologin.php | Autologin.route | public function route(Authenticatable $user, $name, $parameters = [], $absolute = true, $route = null)
{
$path = $this->generator->route($name, $parameters, $absolute, $route);
return $this->getAutologinLink($user, $path);
} | php | public function route(Authenticatable $user, $name, $parameters = [], $absolute = true, $route = null)
{
$path = $this->generator->route($name, $parameters, $absolute, $route);
return $this->getAutologinLink($user, $path);
} | [
"public",
"function",
"route",
"(",
"Authenticatable",
"$",
"user",
",",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"absolute",
"=",
"true",
",",
"$",
"route",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"generato... | Generate a link that will automatically login a user and then redirect
them to a named route as generated by the URL generator.
@param \Illuminate\Contracts\Auth\Authenticatable $user
@param string $name
@param mixed $paramesters
@param bool $absolute
@param \Illuminate\Routing\Route $route
@return string | [
"Generate",
"a",
"link",
"that",
"will",
"automatically",
"login",
"a",
"user",
"and",
"then",
"redirect",
"them",
"to",
"a",
"named",
"route",
"as",
"generated",
"by",
"the",
"URL",
"generator",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L83-L88 |
188,210 | dwightwatson/autologin | src/Autologin.php | Autologin.validate | public function validate($token)
{
$autologin = $this->provider->findByToken($token);
if ($autologin && $this->autologinValid($autologin)) {
if (config('autologin.count')) {
$autologin->incrementCount();
}
return $autologin;
}
re... | php | public function validate($token)
{
$autologin = $this->provider->findByToken($token);
if ($autologin && $this->autologinValid($autologin)) {
if (config('autologin.count')) {
$autologin->incrementCount();
}
return $autologin;
}
re... | [
"public",
"function",
"validate",
"(",
"$",
"token",
")",
"{",
"$",
"autologin",
"=",
"$",
"this",
"->",
"provider",
"->",
"findByToken",
"(",
"$",
"token",
")",
";",
"if",
"(",
"$",
"autologin",
"&&",
"$",
"this",
"->",
"autologinValid",
"(",
"$",
"... | Validate a token from storage and return the row.
@param string $token
@return mixed | [
"Validate",
"a",
"token",
"from",
"storage",
"and",
"return",
"the",
"row",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L96-L109 |
188,211 | dwightwatson/autologin | src/Autologin.php | Autologin.deleteExpiredTokens | public function deleteExpiredTokens()
{
$lifetime = config('autologin.lifetime');
$expiry = Carbon::now()->subMinutes($lifetime);
return $this->provider->deleteExpiredTokens($expiry);
} | php | public function deleteExpiredTokens()
{
$lifetime = config('autologin.lifetime');
$expiry = Carbon::now()->subMinutes($lifetime);
return $this->provider->deleteExpiredTokens($expiry);
} | [
"public",
"function",
"deleteExpiredTokens",
"(",
")",
"{",
"$",
"lifetime",
"=",
"config",
"(",
"'autologin.lifetime'",
")",
";",
"$",
"expiry",
"=",
"Carbon",
"::",
"now",
"(",
")",
"->",
"subMinutes",
"(",
"$",
"lifetime",
")",
";",
"return",
"$",
"th... | Remove tokens that have expired from storage.
@return bool | [
"Remove",
"tokens",
"that",
"have",
"expired",
"from",
"storage",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L116-L123 |
188,212 | dwightwatson/autologin | src/Autologin.php | Autologin.getAutologinLink | protected function getAutologinLink(Authenticatable $user, $path = null)
{
if ($this->shouldDeleteExpiredTokens()) {
$this->deleteExpiredTokens();
}
// Get the user ID to be associated with a token.
$userId = $user->getAuthIdentifier();
// Generate a random uniq... | php | protected function getAutologinLink(Authenticatable $user, $path = null)
{
if ($this->shouldDeleteExpiredTokens()) {
$this->deleteExpiredTokens();
}
// Get the user ID to be associated with a token.
$userId = $user->getAuthIdentifier();
// Generate a random uniq... | [
"protected",
"function",
"getAutologinLink",
"(",
"Authenticatable",
"$",
"user",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldDeleteExpiredTokens",
"(",
")",
")",
"{",
"$",
"this",
"->",
"deleteExpiredTokens",
"(",
")",
";... | Get the link that can be used to automatically login a user to the
application.
@param \Illuminate\Contracts\Auth\Authenticatable $user
@param string $path
@return string | [
"Get",
"the",
"link",
"that",
"can",
"be",
"used",
"to",
"automatically",
"login",
"a",
"user",
"to",
"the",
"application",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L133-L157 |
188,213 | dwightwatson/autologin | src/Autologin.php | Autologin.getAutologinToken | protected function getAutologinToken()
{
$length = config('autologin.length');
do {
$token = Str::random($length);
} while ($this->provider->findByToken($token));
return $token;
} | php | protected function getAutologinToken()
{
$length = config('autologin.length');
do {
$token = Str::random($length);
} while ($this->provider->findByToken($token));
return $token;
} | [
"protected",
"function",
"getAutologinToken",
"(",
")",
"{",
"$",
"length",
"=",
"config",
"(",
"'autologin.length'",
")",
";",
"do",
"{",
"$",
"token",
"=",
"Str",
"::",
"random",
"(",
"$",
"length",
")",
";",
"}",
"while",
"(",
"$",
"this",
"->",
"... | Generate a random unique token using the length that is provided
in the configuration file.
@return string | [
"Generate",
"a",
"random",
"unique",
"token",
"using",
"the",
"length",
"that",
"is",
"provided",
"in",
"the",
"configuration",
"file",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L165-L174 |
188,214 | dwightwatson/autologin | src/Autologin.php | Autologin.autologinValid | protected function autologinValid(AutologinInterface $autologin) {
if (config('autologin.remove_expired')) {
$lifetime = config('autologin.lifetime');
if ($autologin->created_at <= Carbon::now()->subMinutes($lifetime)) {
$autologin->delete();
return fals... | php | protected function autologinValid(AutologinInterface $autologin) {
if (config('autologin.remove_expired')) {
$lifetime = config('autologin.lifetime');
if ($autologin->created_at <= Carbon::now()->subMinutes($lifetime)) {
$autologin->delete();
return fals... | [
"protected",
"function",
"autologinValid",
"(",
"AutologinInterface",
"$",
"autologin",
")",
"{",
"if",
"(",
"config",
"(",
"'autologin.remove_expired'",
")",
")",
"{",
"$",
"lifetime",
"=",
"config",
"(",
"'autologin.lifetime'",
")",
";",
"if",
"(",
"$",
"aut... | Determine whether the autologin token provided is valid and remove it
if not.
@param \Watson\Autologin\Interfaces\AutologinInterface $autologin
@return bool | [
"Determine",
"whether",
"the",
"autologin",
"token",
"provided",
"is",
"valid",
"and",
"remove",
"it",
"if",
"not",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Autologin.php#L195-L207 |
188,215 | dwightwatson/autologin | src/Providers/SentryAuthenticationProvider.php | SentryAuthenticationProvider.loginUsingId | public function loginUsingId($userId)
{
// Find the user using the user id
try {
$user = Sentry::findUserById($userId);
// Log the user in
Sentry::login($user);
return $user;
} catch (UserNotFoundException $e) {
return null;
... | php | public function loginUsingId($userId)
{
// Find the user using the user id
try {
$user = Sentry::findUserById($userId);
// Log the user in
Sentry::login($user);
return $user;
} catch (UserNotFoundException $e) {
return null;
... | [
"public",
"function",
"loginUsingId",
"(",
"$",
"userId",
")",
"{",
"// Find the user using the user id",
"try",
"{",
"$",
"user",
"=",
"Sentry",
"::",
"findUserById",
"(",
"$",
"userId",
")",
";",
"// Log the user in",
"Sentry",
"::",
"login",
"(",
"$",
"user... | Log a user in through the Sentry facade
through their user id.
@param int $userId
@return mixed | [
"Log",
"a",
"user",
"in",
"through",
"the",
"Sentry",
"facade",
"through",
"their",
"user",
"id",
"."
] | a7e89ab16d92ee49b4eeb54a948c246d0454fe1b | https://github.com/dwightwatson/autologin/blob/a7e89ab16d92ee49b4eeb54a948c246d0454fe1b/src/Providers/SentryAuthenticationProvider.php#L18-L31 |
188,216 | yajra/laravel-disqus | src/DisqusServiceProvider.php | DisqusServiceProvider.publishConfig | protected function publishConfig()
{
$path = __DIR__ . '/../config/disqus.php';
$this->mergeConfigFrom($path, 'disqus');
$this->publishes([
$path => config_path('disqus.php'),
], 'disqus');
} | php | protected function publishConfig()
{
$path = __DIR__ . '/../config/disqus.php';
$this->mergeConfigFrom($path, 'disqus');
$this->publishes([
$path => config_path('disqus.php'),
], 'disqus');
} | [
"protected",
"function",
"publishConfig",
"(",
")",
"{",
"$",
"path",
"=",
"__DIR__",
".",
"'/../config/disqus.php'",
";",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"$",
"path",
",",
"'disqus'",
")",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"$",
"... | Register and publish the config. | [
"Register",
"and",
"publish",
"the",
"config",
"."
] | 6198f4012f129f7b19dec494a096dc05adee3530 | https://github.com/yajra/laravel-disqus/blob/6198f4012f129f7b19dec494a096dc05adee3530/src/DisqusServiceProvider.php#L25-L32 |
188,217 | iverberk/larasearch | src/Iverberk/Larasearch/Query.php | Query.getPagination | private function getPagination()
{
# pagination
$this->pagination['page'] = 1;
$this->pagination['per_page'] = Utils::findKey($this->options, 'limit', 50);
$this->pagination['padding'] = Utils::findKey($this->options, 'padding', 0);
$this->pagination['offset'] = Utils::findKe... | php | private function getPagination()
{
# pagination
$this->pagination['page'] = 1;
$this->pagination['per_page'] = Utils::findKey($this->options, 'limit', 50);
$this->pagination['padding'] = Utils::findKey($this->options, 'padding', 0);
$this->pagination['offset'] = Utils::findKe... | [
"private",
"function",
"getPagination",
"(",
")",
"{",
"# pagination",
"$",
"this",
"->",
"pagination",
"[",
"'page'",
"]",
"=",
"1",
";",
"$",
"this",
"->",
"pagination",
"[",
"'per_page'",
"]",
"=",
"Utils",
"::",
"findKey",
"(",
"$",
"this",
"->",
"... | Add requested pagination parameters to the payload | [
"Add",
"requested",
"pagination",
"parameters",
"to",
"the",
"payload"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Query.php#L120-L130 |
188,218 | iverberk/larasearch | src/Iverberk/Larasearch/Query.php | Query.getHighlight | private function getHighlight()
{
if (Utils::findKey($this->options, 'highlight', false))
{
foreach ($this->fields as $field)
{
$this->payload['highlight']['fields'][$field] = new StdClass();
}
if ($tag = Utils::findKey($this->options[... | php | private function getHighlight()
{
if (Utils::findKey($this->options, 'highlight', false))
{
foreach ($this->fields as $field)
{
$this->payload['highlight']['fields'][$field] = new StdClass();
}
if ($tag = Utils::findKey($this->options[... | [
"private",
"function",
"getHighlight",
"(",
")",
"{",
"if",
"(",
"Utils",
"::",
"findKey",
"(",
"$",
"this",
"->",
"options",
",",
"'highlight'",
",",
"false",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
... | Add requested highlights to the payload | [
"Add",
"requested",
"highlights",
"to",
"the",
"payload"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Query.php#L135-L150 |
188,219 | iverberk/larasearch | src/Iverberk/Larasearch/Query.php | Query.getSuggest | private function getSuggest()
{
if ($suggestions = Utils::findKey($this->options, 'suggest', false))
{
$suggest_fields = Utils::findKey($this->proxy->getConfig(), 'suggest', []);
if ($fields = Utils::findKey($this->options, 'fields', false))
{
$su... | php | private function getSuggest()
{
if ($suggestions = Utils::findKey($this->options, 'suggest', false))
{
$suggest_fields = Utils::findKey($this->proxy->getConfig(), 'suggest', []);
if ($fields = Utils::findKey($this->options, 'fields', false))
{
$su... | [
"private",
"function",
"getSuggest",
"(",
")",
"{",
"if",
"(",
"$",
"suggestions",
"=",
"Utils",
"::",
"findKey",
"(",
"$",
"this",
"->",
"options",
",",
"'suggest'",
",",
"false",
")",
")",
"{",
"$",
"suggest_fields",
"=",
"Utils",
"::",
"findKey",
"(... | Add requested suggestions to the payload | [
"Add",
"requested",
"suggestions",
"to",
"the",
"payload"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Query.php#L155-L175 |
188,220 | iverberk/larasearch | src/Iverberk/Larasearch/Query.php | Query.getSort | private function getSort()
{
if ($sort = Utils::findKey($this->options, 'sort', false))
{
$this->payload['sort'] = $sort;
}
} | php | private function getSort()
{
if ($sort = Utils::findKey($this->options, 'sort', false))
{
$this->payload['sort'] = $sort;
}
} | [
"private",
"function",
"getSort",
"(",
")",
"{",
"if",
"(",
"$",
"sort",
"=",
"Utils",
"::",
"findKey",
"(",
"$",
"this",
"->",
"options",
",",
"'sort'",
",",
"false",
")",
")",
"{",
"$",
"this",
"->",
"payload",
"[",
"'sort'",
"]",
"=",
"$",
"so... | Allow sorting of results | [
"Allow",
"sorting",
"of",
"results"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Query.php#L181-L187 |
188,221 | iverberk/larasearch | src/Iverberk/Larasearch/Query.php | Query.execute | public function execute()
{
$this->getFields();
$this->getPagination();
$this->getHighlight();
$this->getSuggest();
$this->getAggregations();
$this->getSort();
$this->getPayload();
$params = [
'index' => Utils::findKey($this->options, 'ind... | php | public function execute()
{
$this->getFields();
$this->getPagination();
$this->getHighlight();
$this->getSuggest();
$this->getAggregations();
$this->getSort();
$this->getPayload();
$params = [
'index' => Utils::findKey($this->options, 'ind... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"this",
"->",
"getFields",
"(",
")",
";",
"$",
"this",
"->",
"getPagination",
"(",
")",
";",
"$",
"this",
"->",
"getHighlight",
"(",
")",
";",
"$",
"this",
"->",
"getSuggest",
"(",
")",
";",
"$",... | Execute the query and return the response in a rich wrapper class
@return Response | [
"Execute",
"the",
"query",
"and",
"return",
"the",
"response",
"in",
"a",
"rich",
"wrapper",
"class"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Query.php#L307-L324 |
188,222 | iverberk/larasearch | src/Iverberk/Larasearch/Proxy.php | Proxy.searchByQuery | public function searchByQuery($query, $options = [])
{
$options = array_merge(['query' => $query], $options);
return App::make('iverberk.larasearch.query', ['proxy' => $this, 'term' => null, 'options' => $options])->execute();
} | php | public function searchByQuery($query, $options = [])
{
$options = array_merge(['query' => $query], $options);
return App::make('iverberk.larasearch.query', ['proxy' => $this, 'term' => null, 'options' => $options])->execute();
} | [
"public",
"function",
"searchByQuery",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"[",
"'query'",
"=>",
"$",
"query",
"]",
",",
"$",
"options",
")",
";",
"return",
"App",
"::",
"make",
... | Performs a search based on a custom Elasticsearch query
@param array $query
@param array $options
@return \Iverberk\Larasearch\Response | [
"Performs",
"a",
"search",
"based",
"on",
"a",
"custom",
"Elasticsearch",
"query"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Proxy.php#L89-L94 |
188,223 | iverberk/larasearch | src/Iverberk/Larasearch/Proxy.php | Proxy.searchById | public function searchById($id)
{
return App::make('iverberk.larasearch.response.result', $this->config['client']->get(
[
'index' => $this->getIndex()->getName(),
'type' => $this->getType(),
'id' => $id
]
... | php | public function searchById($id)
{
return App::make('iverberk.larasearch.response.result', $this->config['client']->get(
[
'index' => $this->getIndex()->getName(),
'type' => $this->getType(),
'id' => $id
]
... | [
"public",
"function",
"searchById",
"(",
"$",
"id",
")",
"{",
"return",
"App",
"::",
"make",
"(",
"'iverberk.larasearch.response.result'",
",",
"$",
"this",
"->",
"config",
"[",
"'client'",
"]",
"->",
"get",
"(",
"[",
"'index'",
"=>",
"$",
"this",
"->",
... | Retrieves a single document by identifier
@param $id
@return Result | [
"Retrieves",
"a",
"single",
"document",
"by",
"identifier"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Proxy.php#L102-L112 |
188,224 | iverberk/larasearch | src/Iverberk/Larasearch/Proxy.php | Proxy.refreshDoc | public function refreshDoc($model)
{
$this->config['client']->index(
[
'id' => $model->getEsId(),
'index' => $this->getIndex()->getName(),
'type' => $this->getType(),
'body' => $model->transform(true)
]
);
} | php | public function refreshDoc($model)
{
$this->config['client']->index(
[
'id' => $model->getEsId(),
'index' => $this->getIndex()->getName(),
'type' => $this->getType(),
'body' => $model->transform(true)
]
);
} | [
"public",
"function",
"refreshDoc",
"(",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'client'",
"]",
"->",
"index",
"(",
"[",
"'id'",
"=>",
"$",
"model",
"->",
"getEsId",
"(",
")",
",",
"'index'",
"=>",
"$",
"this",
"->",
"getIndex",
... | Reindex a specific database record to Elasticsearch | [
"Reindex",
"a",
"specific",
"database",
"record",
"to",
"Elasticsearch"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Proxy.php#L197-L207 |
188,225 | iverberk/larasearch | src/Iverberk/Larasearch/Proxy.php | Proxy.deleteDoc | public function deleteDoc($id)
{
$this->config['client']->delete(
[
'id' => $id,
'index' => $this->getIndex()->getName(),
'type' => $this->getType()
]
);
} | php | public function deleteDoc($id)
{
$this->config['client']->delete(
[
'id' => $id,
'index' => $this->getIndex()->getName(),
'type' => $this->getType()
]
);
} | [
"public",
"function",
"deleteDoc",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'client'",
"]",
"->",
"delete",
"(",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'index'",
"=>",
"$",
"this",
"->",
"getIndex",
"(",
")",
"->",
"getName",
"(",
... | Delete a specific database record within Elasticsearch
@param $id Eloquent id of model object | [
"Delete",
"a",
"specific",
"database",
"record",
"within",
"Elasticsearch"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Proxy.php#L214-L223 |
188,226 | iverberk/larasearch | src/Iverberk/Larasearch/Commands/PathsCommand.php | PathsCommand.checkDocHints | protected function checkDocHints($docComment, $model)
{
// Check if we never follow this relation
if (preg_match('/@follow\s+NEVER/', $docComment)) return false;
// Check if we follow the relation from the 'base' model
if (preg_match('/@follow\s+UNLESS\s+' . str_replace('\\', '\\\\'... | php | protected function checkDocHints($docComment, $model)
{
// Check if we never follow this relation
if (preg_match('/@follow\s+NEVER/', $docComment)) return false;
// Check if we follow the relation from the 'base' model
if (preg_match('/@follow\s+UNLESS\s+' . str_replace('\\', '\\\\'... | [
"protected",
"function",
"checkDocHints",
"(",
"$",
"docComment",
",",
"$",
"model",
")",
"{",
"// Check if we never follow this relation",
"if",
"(",
"preg_match",
"(",
"'/@follow\\s+NEVER/'",
",",
"$",
"docComment",
")",
")",
"return",
"false",
";",
"// Check if w... | Inspect the relation method annotations to see if we need to follow the relation
@param string $docComment
@param $model
@return bool | [
"Inspect",
"the",
"relation",
"method",
"annotations",
"to",
"see",
"if",
"we",
"need",
"to",
"follow",
"the",
"relation"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Commands/PathsCommand.php#L222-L240 |
188,227 | iverberk/larasearch | src/Iverberk/Larasearch/Commands/PathsCommand.php | PathsCommand.getRelatedModels | protected function getRelatedModels(Model $model)
{
// Store the class name
$modelClass = get_class($model);
// Check if we already know the related models for this model
if (!isset($this->relatedModels[$modelClass]))
{
$relatedModels = [];
$methods ... | php | protected function getRelatedModels(Model $model)
{
// Store the class name
$modelClass = get_class($model);
// Check if we already know the related models for this model
if (!isset($this->relatedModels[$modelClass]))
{
$relatedModels = [];
$methods ... | [
"protected",
"function",
"getRelatedModels",
"(",
"Model",
"$",
"model",
")",
"{",
"// Store the class name",
"$",
"modelClass",
"=",
"get_class",
"(",
"$",
"model",
")",
";",
"// Check if we already know the related models for this model",
"if",
"(",
"!",
"isset",
"(... | Find related models from a base model
@param $model
@return array | [
"Find",
"related",
"models",
"from",
"a",
"base",
"model"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Commands/PathsCommand.php#L248-L297 |
188,228 | iverberk/larasearch | src/Iverberk/Larasearch/Commands/PathsCommand.php | PathsCommand.writeConfig | private function writeConfig()
{
if ($this->option('write-config'))
{
$configFile = base_path() . '/config/larasearch.php';
if ($this->getLaravel())
{
if ( ! File::exists($configFile))
{
if ($this->confirm('It a... | php | private function writeConfig()
{
if ($this->option('write-config'))
{
$configFile = base_path() . '/config/larasearch.php';
if ($this->getLaravel())
{
if ( ! File::exists($configFile))
{
if ($this->confirm('It a... | [
"private",
"function",
"writeConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"option",
"(",
"'write-config'",
")",
")",
"{",
"$",
"configFile",
"=",
"base_path",
"(",
")",
".",
"'/config/larasearch.php'",
";",
"if",
"(",
"$",
"this",
"->",
"getLara... | Write the paths config to a file or to standard output
@return void | [
"Write",
"the",
"paths",
"config",
"to",
"a",
"file",
"or",
"to",
"standard",
"output"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Commands/PathsCommand.php#L304-L340 |
188,229 | iverberk/larasearch | src/Iverberk/Larasearch/Commands/ReindexCommand.php | ReindexCommand.reindexModel | protected function reindexModel(Model $model)
{
$mapping = $this->option('mapping') ? json_decode(File::get($this->option('mapping')), true) : null;
$this->info('---> Reindexing ' . get_class($model));
$model->reindex(
$this->option('relations'),
$this->option('batc... | php | protected function reindexModel(Model $model)
{
$mapping = $this->option('mapping') ? json_decode(File::get($this->option('mapping')), true) : null;
$this->info('---> Reindexing ' . get_class($model));
$model->reindex(
$this->option('relations'),
$this->option('batc... | [
"protected",
"function",
"reindexModel",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"option",
"(",
"'mapping'",
")",
"?",
"json_decode",
"(",
"File",
"::",
"get",
"(",
"$",
"this",
"->",
"option",
"(",
"'mapping'",
")... | Reindex a model to Elasticsearch
@param Model $model | [
"Reindex",
"a",
"model",
"to",
"Elasticsearch"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Commands/ReindexCommand.php#L91-L106 |
188,230 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.import | public function import(Model $model, $relations = [], $batchSize = 750, Callable $callback = null)
{
$batch = 0;
while (true)
{
// Increase the batch number
$batch += 1;
// Load records from the database
$records = $model
->wi... | php | public function import(Model $model, $relations = [], $batchSize = 750, Callable $callback = null)
{
$batch = 0;
while (true)
{
// Increase the batch number
$batch += 1;
// Load records from the database
$records = $model
->wi... | [
"public",
"function",
"import",
"(",
"Model",
"$",
"model",
",",
"$",
"relations",
"=",
"[",
"]",
",",
"$",
"batchSize",
"=",
"750",
",",
"Callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"batch",
"=",
"0",
";",
"while",
"(",
"true",
")",
... | Import an Eloquent
@param Model $model
@param array $relations
@param int $batchSize
@param callable $callback
@internal param $type | [
"Import",
"an",
"Eloquent"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L71-L113 |
188,231 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.setName | public function setName($name)
{
$index_prefix = Config::get('larasearch.elasticsearch.index_prefix', '');
if ($index_prefix && !Str::startsWith($name, $index_prefix)) $name = $index_prefix . $name;
$this->name = $name;
return $this;
} | php | public function setName($name)
{
$index_prefix = Config::get('larasearch.elasticsearch.index_prefix', '');
if ($index_prefix && !Str::startsWith($name, $index_prefix)) $name = $index_prefix . $name;
$this->name = $name;
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"$",
"index_prefix",
"=",
"Config",
"::",
"get",
"(",
"'larasearch.elasticsearch.index_prefix'",
",",
"''",
")",
";",
"if",
"(",
"$",
"index_prefix",
"&&",
"!",
"Str",
"::",
"startsWith",
"(",
"$... | Set index name
@param string
@return Index | [
"Set",
"index",
"name"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L121-L129 |
188,232 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.aliasExists | public function aliasExists($alias)
{
$index_prefix = Config::get('larasearch.elasticsearch.index_prefix', '');
if ($index_prefix && !Str::startsWith($alias, $index_prefix)) $alias = $index_prefix . $alias;
return self::getClient()->indices()->existsAlias(['name' => $alias]);
} | php | public function aliasExists($alias)
{
$index_prefix = Config::get('larasearch.elasticsearch.index_prefix', '');
if ($index_prefix && !Str::startsWith($alias, $index_prefix)) $alias = $index_prefix . $alias;
return self::getClient()->indices()->existsAlias(['name' => $alias]);
} | [
"public",
"function",
"aliasExists",
"(",
"$",
"alias",
")",
"{",
"$",
"index_prefix",
"=",
"Config",
"::",
"get",
"(",
"'larasearch.elasticsearch.index_prefix'",
",",
"''",
")",
";",
"if",
"(",
"$",
"index_prefix",
"&&",
"!",
"Str",
"::",
"startsWith",
"(",... | Check if an alias exists
@param $alias
@return bool | [
"Check",
"if",
"an",
"alias",
"exists"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L201-L207 |
188,233 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.store | public function store($record)
{
$params['index'] = $this->getName();
$params['type'] = $record['type'];
$params['id'] = $record['id'];
$params['body'] = $record['data'];
self::getClient()->index($params);
} | php | public function store($record)
{
$params['index'] = $this->getName();
$params['type'] = $record['type'];
$params['id'] = $record['id'];
$params['body'] = $record['data'];
self::getClient()->index($params);
} | [
"public",
"function",
"store",
"(",
"$",
"record",
")",
"{",
"$",
"params",
"[",
"'index'",
"]",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"params",
"[",
"'type'",
"]",
"=",
"$",
"record",
"[",
"'type'",
"]",
";",
"$",
"params",
"[",... | Store a record in the index
@param $record | [
"Store",
"a",
"record",
"in",
"the",
"index"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L214-L222 |
188,234 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.retrieve | public function retrieve($record)
{
$params['index'] = $this->getName();
$params['type'] = $record['type'];
$params['id'] = $record['id'];
self::getClient()->get($params);
} | php | public function retrieve($record)
{
$params['index'] = $this->getName();
$params['type'] = $record['type'];
$params['id'] = $record['id'];
self::getClient()->get($params);
} | [
"public",
"function",
"retrieve",
"(",
"$",
"record",
")",
"{",
"$",
"params",
"[",
"'index'",
"]",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"params",
"[",
"'type'",
"]",
"=",
"$",
"record",
"[",
"'type'",
"]",
";",
"$",
"params",
"... | Retrieve a record from the index
@param $record | [
"Retrieve",
"a",
"record",
"from",
"the",
"index"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L229-L236 |
188,235 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.remove | public function remove($record)
{
$params['index'] = $this->getName();
$params['type'] = $record['type'];
$params['id'] = $record['id'];
self::getClient()->delete($params);
} | php | public function remove($record)
{
$params['index'] = $this->getName();
$params['type'] = $record['type'];
$params['id'] = $record['id'];
self::getClient()->delete($params);
} | [
"public",
"function",
"remove",
"(",
"$",
"record",
")",
"{",
"$",
"params",
"[",
"'index'",
"]",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"params",
"[",
"'type'",
"]",
"=",
"$",
"record",
"[",
"'type'",
"]",
";",
"$",
"params",
"["... | Remove a record from the index
@param $record | [
"Remove",
"a",
"record",
"from",
"the",
"index"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L243-L250 |
188,236 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.tokens | public function tokens($text, $options = [])
{
self::getClient()->indices()->analyze(array_merge(['index' => $this->getName(), 'text' => $text], $options));
} | php | public function tokens($text, $options = [])
{
self::getClient()->indices()->analyze(array_merge(['index' => $this->getName(), 'text' => $text], $options));
} | [
"public",
"function",
"tokens",
"(",
"$",
"text",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"self",
"::",
"getClient",
"(",
")",
"->",
"indices",
"(",
")",
"->",
"analyze",
"(",
"array_merge",
"(",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"getN... | Inspect tokens returned from the analyzer
@param string $text
@param array $options | [
"Inspect",
"tokens",
"returned",
"from",
"the",
"analyzer"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L258-L261 |
188,237 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.refresh | public static function refresh($index)
{
$index_prefix = Config::get('larasearch.elasticsearch.index_prefix', '');
if ($index_prefix && !Str::startsWith($index, $index_prefix)) $index = $index_prefix . $index;
return self::getClient()->indices()->refresh(['index' => $index]);
} | php | public static function refresh($index)
{
$index_prefix = Config::get('larasearch.elasticsearch.index_prefix', '');
if ($index_prefix && !Str::startsWith($index, $index_prefix)) $index = $index_prefix . $index;
return self::getClient()->indices()->refresh(['index' => $index]);
} | [
"public",
"static",
"function",
"refresh",
"(",
"$",
"index",
")",
"{",
"$",
"index_prefix",
"=",
"Config",
"::",
"get",
"(",
"'larasearch.elasticsearch.index_prefix'",
",",
"''",
")",
";",
"if",
"(",
"$",
"index_prefix",
"&&",
"!",
"Str",
"::",
"startsWith"... | Refresh an index
@param $index
@return array | [
"Refresh",
"an",
"index"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L366-L372 |
188,238 | iverberk/larasearch | src/Iverberk/Larasearch/Index.php | Index.getDefaultIndexParams | private function getDefaultIndexParams()
{
$analyzers = Config::get('larasearch.elasticsearch.analyzers');
$params = Config::get('larasearch.elasticsearch.defaults.index');
$mapping = [];
$mapping_options = array_combine(
$analyzers,
array_map(function ($type... | php | private function getDefaultIndexParams()
{
$analyzers = Config::get('larasearch.elasticsearch.analyzers');
$params = Config::get('larasearch.elasticsearch.defaults.index');
$mapping = [];
$mapping_options = array_combine(
$analyzers,
array_map(function ($type... | [
"private",
"function",
"getDefaultIndexParams",
"(",
")",
"{",
"$",
"analyzers",
"=",
"Config",
"::",
"get",
"(",
"'larasearch.elasticsearch.analyzers'",
")",
";",
"$",
"params",
"=",
"Config",
"::",
"get",
"(",
"'larasearch.elasticsearch.defaults.index'",
")",
";",... | Initialize the default index settings and mappings
@return array | [
"Initialize",
"the",
"default",
"index",
"settings",
"and",
"mappings"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Index.php#L379-L460 |
188,239 | iverberk/larasearch | src/Iverberk/Larasearch/Traits/SearchableTrait.php | SearchableTrait.getProxy | public static function getProxy()
{
if (!static::$__es_proxy)
{
$instance = new static;
if ($instance instanceof Model)
{
static::$__es_proxy = App::make('iverberk.larasearch.proxy', $instance);
return static::$__es_proxy;
... | php | public static function getProxy()
{
if (!static::$__es_proxy)
{
$instance = new static;
if ($instance instanceof Model)
{
static::$__es_proxy = App::make('iverberk.larasearch.proxy', $instance);
return static::$__es_proxy;
... | [
"public",
"static",
"function",
"getProxy",
"(",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"__es_proxy",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
";",
"if",
"(",
"$",
"instance",
"instanceof",
"Model",
")",
"{",
"static",
"::",
"$",
"__e... | Return an instance of the Elasticsearch proxy
@throws \Exception
@return \Iverberk\Larasearch\Proxy | bool | [
"Return",
"an",
"instance",
"of",
"the",
"Elasticsearch",
"proxy"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Traits/SearchableTrait.php#L38-L56 |
188,240 | iverberk/larasearch | src/Iverberk/Larasearch/Observer.php | Observer.deleted | public function deleted(Model $model)
{
// Delete corresponding $model document from Elasticsearch
Queue::push('Iverberk\Larasearch\Jobs\DeleteJob', [get_class($model) . ':' . $model->getKey()]);
// Update all related model documents to reflect that $model has been removed
Queue::pu... | php | public function deleted(Model $model)
{
// Delete corresponding $model document from Elasticsearch
Queue::push('Iverberk\Larasearch\Jobs\DeleteJob', [get_class($model) . ':' . $model->getKey()]);
// Update all related model documents to reflect that $model has been removed
Queue::pu... | [
"public",
"function",
"deleted",
"(",
"Model",
"$",
"model",
")",
"{",
"// Delete corresponding $model document from Elasticsearch",
"Queue",
"::",
"push",
"(",
"'Iverberk\\Larasearch\\Jobs\\DeleteJob'",
",",
"[",
"get_class",
"(",
"$",
"model",
")",
".",
"':'",
".",
... | Model delete event handler
@param Model $model | [
"Model",
"delete",
"event",
"handler"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Observer.php#L15-L22 |
188,241 | iverberk/larasearch | src/Iverberk/Larasearch/Observer.php | Observer.saved | public function saved(Model $model)
{
if ($model::$__es_enable && $model->shouldIndex())
{
Queue::push('Iverberk\Larasearch\Jobs\ReindexJob', $this->findAffectedModels($model));
}
} | php | public function saved(Model $model)
{
if ($model::$__es_enable && $model->shouldIndex())
{
Queue::push('Iverberk\Larasearch\Jobs\ReindexJob', $this->findAffectedModels($model));
}
} | [
"public",
"function",
"saved",
"(",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"model",
"::",
"$",
"__es_enable",
"&&",
"$",
"model",
"->",
"shouldIndex",
"(",
")",
")",
"{",
"Queue",
"::",
"push",
"(",
"'Iverberk\\Larasearch\\Jobs\\ReindexJob'",
","... | Model save event handler
@param Model $model | [
"Model",
"save",
"event",
"handler"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Observer.php#L29-L35 |
188,242 | iverberk/larasearch | src/Iverberk/Larasearch/Observer.php | Observer.findAffectedModels | private function findAffectedModels(Model $model, $excludeCurrent = false)
{
// Temporary array to store affected models
$affectedModels = [];
$paths = Config::get('larasearch.reversedPaths.' . get_class($model), []);
foreach ((array)$paths as $path)
{
if (!empt... | php | private function findAffectedModels(Model $model, $excludeCurrent = false)
{
// Temporary array to store affected models
$affectedModels = [];
$paths = Config::get('larasearch.reversedPaths.' . get_class($model), []);
foreach ((array)$paths as $path)
{
if (!empt... | [
"private",
"function",
"findAffectedModels",
"(",
"Model",
"$",
"model",
",",
"$",
"excludeCurrent",
"=",
"false",
")",
"{",
"// Temporary array to store affected models",
"$",
"affectedModels",
"=",
"[",
"]",
";",
"$",
"paths",
"=",
"Config",
"::",
"get",
"(",
... | Find all searchable models that are affected by the model change
@param Model $model
@return array | [
"Find",
"all",
"searchable",
"models",
"that",
"are",
"affected",
"by",
"the",
"model",
"change"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Observer.php#L43-L103 |
188,243 | iverberk/larasearch | src/Iverberk/Larasearch/Utils.php | Utils.findKey | public static function findKey($params, $arg, $default = null)
{
if (is_object($params) === true)
{
$params = (array)$params;
}
if (isset($params[$arg]) === true)
{
$val = $params[$arg];
unset($params[$arg]);
return $val;
... | php | public static function findKey($params, $arg, $default = null)
{
if (is_object($params) === true)
{
$params = (array)$params;
}
if (isset($params[$arg]) === true)
{
$val = $params[$arg];
unset($params[$arg]);
return $val;
... | [
"public",
"static",
"function",
"findKey",
"(",
"$",
"params",
",",
"$",
"arg",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"params",
")",
"===",
"true",
")",
"{",
"$",
"params",
"=",
"(",
"array",
")",
"$",
"par... | Read and return parameters from an array.
@param array $params
@param string $arg
@param null $default
@return null|mixed | [
"Read",
"and",
"return",
"parameters",
"from",
"an",
"array",
"."
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Utils.php#L22-L39 |
188,244 | iverberk/larasearch | src/Iverberk/Larasearch/Traits/TransformableTrait.php | TransformableTrait.transform | public function transform($relations = false)
{
$relations = $relations ? Config::get('larasearch.paths.' . get_class($this)) : [];
$doc = $this->load($relations)->toArray();
return $doc;
} | php | public function transform($relations = false)
{
$relations = $relations ? Config::get('larasearch.paths.' . get_class($this)) : [];
$doc = $this->load($relations)->toArray();
return $doc;
} | [
"public",
"function",
"transform",
"(",
"$",
"relations",
"=",
"false",
")",
"{",
"$",
"relations",
"=",
"$",
"relations",
"?",
"Config",
"::",
"get",
"(",
"'larasearch.paths.'",
".",
"get_class",
"(",
"$",
"this",
")",
")",
":",
"[",
"]",
";",
"$",
... | Transform the Person model and its relations to an Elasticsearch document.
@param bool $relations
@return array | [
"Transform",
"the",
"Person",
"model",
"and",
"its",
"relations",
"to",
"an",
"Elasticsearch",
"document",
"."
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/Traits/TransformableTrait.php#L13-L20 |
188,245 | yajra/laravel-disqus | src/DisqusMiddleware.php | DisqusMiddleware.appendDisqusScript | protected function appendDisqusScript($request, $response)
{
$content = $response->getContent();
if (! Str::contains($content, '<div id="disqus_thread"></div>')) {
return;
}
$uri = $request->getRequestUri();
$pageUrl = url($uri);
$pageId = 'route... | php | protected function appendDisqusScript($request, $response)
{
$content = $response->getContent();
if (! Str::contains($content, '<div id="disqus_thread"></div>')) {
return;
}
$uri = $request->getRequestUri();
$pageUrl = url($uri);
$pageId = 'route... | [
"protected",
"function",
"appendDisqusScript",
"(",
"$",
"request",
",",
"$",
"response",
")",
"{",
"$",
"content",
"=",
"$",
"response",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"Str",
"::",
"contains",
"(",
"$",
"content",
",",
"'<div id=\"di... | Append disqus script on the end of the page.
@param \Illuminate\Http\Request $request
@param \Illuminate\Http\Response $response
@return mixed | [
"Append",
"disqus",
"script",
"on",
"the",
"end",
"of",
"the",
"page",
"."
] | 6198f4012f129f7b19dec494a096dc05adee3530 | https://github.com/yajra/laravel-disqus/blob/6198f4012f129f7b19dec494a096dc05adee3530/src/DisqusMiddleware.php#L35-L74 |
188,246 | iverberk/larasearch | src/Iverberk/Larasearch/LarasearchServiceProvider.php | LarasearchServiceProvider.bootContainerBindings | public function bootContainerBindings()
{
$this->bindElasticsearch();
$this->bindLogger();
$this->bindIndex();
$this->bindQuery();
$this->bindProxy();
$this->bindResult();
} | php | public function bootContainerBindings()
{
$this->bindElasticsearch();
$this->bindLogger();
$this->bindIndex();
$this->bindQuery();
$this->bindProxy();
$this->bindResult();
} | [
"public",
"function",
"bootContainerBindings",
"(",
")",
"{",
"$",
"this",
"->",
"bindElasticsearch",
"(",
")",
";",
"$",
"this",
"->",
"bindLogger",
"(",
")",
";",
"$",
"this",
"->",
"bindIndex",
"(",
")",
";",
"$",
"this",
"->",
"bindQuery",
"(",
")"... | Boot the container bindings.
@return void | [
"Boot",
"the",
"container",
"bindings",
"."
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/LarasearchServiceProvider.php#L54-L62 |
188,247 | iverberk/larasearch | src/Iverberk/Larasearch/LarasearchServiceProvider.php | LarasearchServiceProvider.bindElasticsearch | protected function bindElasticsearch()
{
$this->app->singleton('Elasticsearch', function ($app)
{
return new Client(\Illuminate\Support\Facades\Config::get('larasearch.elasticsearch.params'));
});
} | php | protected function bindElasticsearch()
{
$this->app->singleton('Elasticsearch', function ($app)
{
return new Client(\Illuminate\Support\Facades\Config::get('larasearch.elasticsearch.params'));
});
} | [
"protected",
"function",
"bindElasticsearch",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'Elasticsearch'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Client",
"(",
"\\",
"Illuminate",
"\\",
"Support",
"\\",
"Facade... | Bind the Elasticsearch client to the container | [
"Bind",
"the",
"Elasticsearch",
"client",
"to",
"the",
"container"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/LarasearchServiceProvider.php#L78-L84 |
188,248 | iverberk/larasearch | src/Iverberk/Larasearch/LarasearchServiceProvider.php | LarasearchServiceProvider.bindIndex | protected function bindIndex()
{
$this->app->bind('iverberk.larasearch.index', function ($app, $params)
{
$name = isset($params['name']) ? $params['name'] : '';
return new Index($params['proxy'], $name);
});
} | php | protected function bindIndex()
{
$this->app->bind('iverberk.larasearch.index', function ($app, $params)
{
$name = isset($params['name']) ? $params['name'] : '';
return new Index($params['proxy'], $name);
});
} | [
"protected",
"function",
"bindIndex",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'iverberk.larasearch.index'",
",",
"function",
"(",
"$",
"app",
",",
"$",
"params",
")",
"{",
"$",
"name",
"=",
"isset",
"(",
"$",
"params",
"[",
"'name'... | Bind the Larasearch index to the container | [
"Bind",
"the",
"Larasearch",
"index",
"to",
"the",
"container"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/LarasearchServiceProvider.php#L89-L97 |
188,249 | iverberk/larasearch | src/Iverberk/Larasearch/LarasearchServiceProvider.php | LarasearchServiceProvider.bindQuery | protected function bindQuery()
{
$this->app->bind('iverberk.larasearch.query', function ($app, $params)
{
return new Query($params['proxy'], $params['term'], $params['options']);
});
} | php | protected function bindQuery()
{
$this->app->bind('iverberk.larasearch.query', function ($app, $params)
{
return new Query($params['proxy'], $params['term'], $params['options']);
});
} | [
"protected",
"function",
"bindQuery",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'iverberk.larasearch.query'",
",",
"function",
"(",
"$",
"app",
",",
"$",
"params",
")",
"{",
"return",
"new",
"Query",
"(",
"$",
"params",
"[",
"'proxy'",... | Bind the Larasearch Query to the container | [
"Bind",
"the",
"Larasearch",
"Query",
"to",
"the",
"container"
] | d648243433b14c748fe8ae03a257e46e71d327ce | https://github.com/iverberk/larasearch/blob/d648243433b14c748fe8ae03a257e46e71d327ce/src/Iverberk/Larasearch/LarasearchServiceProvider.php#L102-L108 |
188,250 | mdmsoft/yii2-upload-file | UploadBehavior.php | UploadBehavior.getSavedFile | public function getSavedFile()
{
if($this->savedAttribute && $this->owner->{$this->savedAttribute}){
return FileModel::findOne($this->owner->{$this->savedAttribute});
}
} | php | public function getSavedFile()
{
if($this->savedAttribute && $this->owner->{$this->savedAttribute}){
return FileModel::findOne($this->owner->{$this->savedAttribute});
}
} | [
"public",
"function",
"getSavedFile",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"savedAttribute",
"&&",
"$",
"this",
"->",
"owner",
"->",
"{",
"$",
"this",
"->",
"savedAttribute",
"}",
")",
"{",
"return",
"FileModel",
"::",
"findOne",
"(",
"$",
"thi... | Get saved file
@return FileModel | [
"Get",
"saved",
"file"
] | 9917dc1de333632cef8bc75b02114346ab527f2f | https://github.com/mdmsoft/yii2-upload-file/blob/9917dc1de333632cef8bc75b02114346ab527f2f/UploadBehavior.php#L111-L116 |
188,251 | mdmsoft/yii2-upload-file | UploadBehavior.php | UploadBehavior.beforeDelete | public function beforeDelete($event)
{
$oldId = $this->owner->{$this->savedAttribute};
if (($oldModel = FileModel::findOne($oldId)) !== null) {
$event->isValid = $event->isValid && $oldModel->delete();
}
} | php | public function beforeDelete($event)
{
$oldId = $this->owner->{$this->savedAttribute};
if (($oldModel = FileModel::findOne($oldId)) !== null) {
$event->isValid = $event->isValid && $oldModel->delete();
}
} | [
"public",
"function",
"beforeDelete",
"(",
"$",
"event",
")",
"{",
"$",
"oldId",
"=",
"$",
"this",
"->",
"owner",
"->",
"{",
"$",
"this",
"->",
"savedAttribute",
"}",
";",
"if",
"(",
"(",
"$",
"oldModel",
"=",
"FileModel",
"::",
"findOne",
"(",
"$",
... | Event handler for beforeDelete
@param \yii\base\ModelEvent $event | [
"Event",
"handler",
"for",
"beforeDelete"
] | 9917dc1de333632cef8bc75b02114346ab527f2f | https://github.com/mdmsoft/yii2-upload-file/blob/9917dc1de333632cef8bc75b02114346ab527f2f/UploadBehavior.php#L214-L220 |
188,252 | waylaidwanderer/PHP-SteamCommunity | MobileAuth/MobileAuth.php | MobileAuth.refreshMobileSession | public function refreshMobileSession()
{
try {
$response = $this->steamCommunity->cURL('https://api.steampowered.com/IMobileAuthService/GetWGToken/v0001', null, ['access_token' => $this->oauth['oauth_token']]);
$json = json_decode($response, true);
$this->oauth['wgtoken']... | php | public function refreshMobileSession()
{
try {
$response = $this->steamCommunity->cURL('https://api.steampowered.com/IMobileAuthService/GetWGToken/v0001', null, ['access_token' => $this->oauth['oauth_token']]);
$json = json_decode($response, true);
$this->oauth['wgtoken']... | [
"public",
"function",
"refreshMobileSession",
"(",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"steamCommunity",
"->",
"cURL",
"(",
"'https://api.steampowered.com/IMobileAuthService/GetWGToken/v0001'",
",",
"null",
",",
"[",
"'access_token'",
"=>",
... | Refreshes the mobile session by retrieving new tokens. | [
"Refreshes",
"the",
"mobile",
"session",
"by",
"retrieving",
"new",
"tokens",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/MobileAuth/MobileAuth.php#L55-L65 |
188,253 | waylaidwanderer/PHP-SteamCommunity | TradeOffers.php | TradeOffers.acceptTrade | public function acceptTrade(TradeOffer $tradeOffer)
{
if (!$tradeOffer->isOurOffer()) {
$url = 'https://steamcommunity.com/tradeoffer/' . $tradeOffer->getTradeOfferId() . '/accept';
$referer = 'https://steamcommunity.com/tradeoffer/' . $tradeOffer->getTradeOfferId() . '/';
... | php | public function acceptTrade(TradeOffer $tradeOffer)
{
if (!$tradeOffer->isOurOffer()) {
$url = 'https://steamcommunity.com/tradeoffer/' . $tradeOffer->getTradeOfferId() . '/accept';
$referer = 'https://steamcommunity.com/tradeoffer/' . $tradeOffer->getTradeOfferId() . '/';
... | [
"public",
"function",
"acceptTrade",
"(",
"TradeOffer",
"$",
"tradeOffer",
")",
"{",
"if",
"(",
"!",
"$",
"tradeOffer",
"->",
"isOurOffer",
"(",
")",
")",
"{",
"$",
"url",
"=",
"'https://steamcommunity.com/tradeoffer/'",
".",
"$",
"tradeOffer",
"->",
"getTrade... | Accept a trade offer.
@param TradeOffer $tradeOffer
@return bool | [
"Accept",
"a",
"trade",
"offer",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/TradeOffers.php#L268-L288 |
188,254 | waylaidwanderer/PHP-SteamCommunity | TradeOffers.php | TradeOffers.declineTrade | public function declineTrade(TradeOffer $tradeOffer)
{
if (!$tradeOffer->isOurOffer()) {
return $this->declineTradeById($tradeOffer->getTradeOfferId());
}
return false;
} | php | public function declineTrade(TradeOffer $tradeOffer)
{
if (!$tradeOffer->isOurOffer()) {
return $this->declineTradeById($tradeOffer->getTradeOfferId());
}
return false;
} | [
"public",
"function",
"declineTrade",
"(",
"TradeOffer",
"$",
"tradeOffer",
")",
"{",
"if",
"(",
"!",
"$",
"tradeOffer",
"->",
"isOurOffer",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"declineTradeById",
"(",
"$",
"tradeOffer",
"->",
"getTradeOfferId",... | Decline a trade offer.
@param TradeOffer $tradeOffer
@return bool | [
"Decline",
"a",
"trade",
"offer",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/TradeOffers.php#L295-L301 |
188,255 | waylaidwanderer/PHP-SteamCommunity | TradeOffers.php | TradeOffers.declineTradeById | public function declineTradeById($tradeOfferId)
{
$url = 'https://steamcommunity.com/tradeoffer/' . $tradeOfferId . '/decline';
$referer = 'https://steamcommunity.com/tradeoffer/' . $tradeOfferId . '/';
$params = [
'sessionid' => $this->steamCommunity->getSessionId(),
... | php | public function declineTradeById($tradeOfferId)
{
$url = 'https://steamcommunity.com/tradeoffer/' . $tradeOfferId . '/decline';
$referer = 'https://steamcommunity.com/tradeoffer/' . $tradeOfferId . '/';
$params = [
'sessionid' => $this->steamCommunity->getSessionId(),
... | [
"public",
"function",
"declineTradeById",
"(",
"$",
"tradeOfferId",
")",
"{",
"$",
"url",
"=",
"'https://steamcommunity.com/tradeoffer/'",
".",
"$",
"tradeOfferId",
".",
"'/decline'",
";",
"$",
"referer",
"=",
"'https://steamcommunity.com/tradeoffer/'",
".",
"$",
"tra... | Decline a trade offer by its id.
@param $tradeOfferId
@return bool | [
"Decline",
"a",
"trade",
"offer",
"by",
"its",
"id",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/TradeOffers.php#L308-L323 |
188,256 | waylaidwanderer/PHP-SteamCommunity | TradeOffers.php | TradeOffers.cancelTrade | public function cancelTrade(TradeOffer $tradeOffer)
{
if ($tradeOffer->isOurOffer()) {
return $this->cancelTradeById($tradeOffer->getTradeOfferId());
}
return false;
} | php | public function cancelTrade(TradeOffer $tradeOffer)
{
if ($tradeOffer->isOurOffer()) {
return $this->cancelTradeById($tradeOffer->getTradeOfferId());
}
return false;
} | [
"public",
"function",
"cancelTrade",
"(",
"TradeOffer",
"$",
"tradeOffer",
")",
"{",
"if",
"(",
"$",
"tradeOffer",
"->",
"isOurOffer",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cancelTradeById",
"(",
"$",
"tradeOffer",
"->",
"getTradeOfferId",
"(",
... | Cancel a trade offer.
@param TradeOffer $tradeOffer
@return bool | [
"Cancel",
"a",
"trade",
"offer",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/TradeOffers.php#L330-L336 |
188,257 | waylaidwanderer/PHP-SteamCommunity | TradeOffers.php | TradeOffers.getItems | public function getItems($tradeOffer)
{
if (is_int($tradeOffer)) {
$tradeOffer = $this->getTradeOfferViaAPI($tradeOffer);
}
if ($tradeOffer instanceof TradeOffer && $tradeId = $tradeOffer->getTradeId()) {
$url = 'https://steamcommunity.com/trade/' . $tradeId . '/rece... | php | public function getItems($tradeOffer)
{
if (is_int($tradeOffer)) {
$tradeOffer = $this->getTradeOfferViaAPI($tradeOffer);
}
if ($tradeOffer instanceof TradeOffer && $tradeId = $tradeOffer->getTradeId()) {
$url = 'https://steamcommunity.com/trade/' . $tradeId . '/rece... | [
"public",
"function",
"getItems",
"(",
"$",
"tradeOffer",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"tradeOffer",
")",
")",
"{",
"$",
"tradeOffer",
"=",
"$",
"this",
"->",
"getTradeOfferViaAPI",
"(",
"$",
"tradeOffer",
")",
";",
"}",
"if",
"(",
"$",
"... | Get the new assetid after a trade
@param mixed $tradeOffer object or id
@return array|null | [
"Get",
"the",
"new",
"assetid",
"after",
"a",
"trade"
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/TradeOffers.php#L374-L393 |
188,258 | waylaidwanderer/PHP-SteamCommunity | SteamCommunity.php | SteamCommunity.createAccount | public function createAccount($email)
{
$captchaUrl = 'https://store.steampowered.com/join/';
if (is_null($this->captchaGID)) {
$captchaUrlResponse = $this->cURL($captchaUrl);
$pattern = '/<input(?:.*?)id=\"captchagid\"(?:.*)value=\"([^"]+).*>/i';
preg_match($patt... | php | public function createAccount($email)
{
$captchaUrl = 'https://store.steampowered.com/join/';
if (is_null($this->captchaGID)) {
$captchaUrlResponse = $this->cURL($captchaUrl);
$pattern = '/<input(?:.*?)id=\"captchagid\"(?:.*)value=\"([^"]+).*>/i';
preg_match($patt... | [
"public",
"function",
"createAccount",
"(",
"$",
"email",
")",
"{",
"$",
"captchaUrl",
"=",
"'https://store.steampowered.com/join/'",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"captchaGID",
")",
")",
"{",
"$",
"captchaUrlResponse",
"=",
"$",
"this",
... | Create a new Steam account.
@param $email
@return CreateAccountResult
@throws SteamException Thrown when Steam gives an unexpected response (e.g. Steam is down/having issues)
@throws \Exception Thrown when cookiefile is unable to be created. | [
"Create",
"a",
"new",
"Steam",
"account",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/SteamCommunity.php#L179-L220 |
188,259 | waylaidwanderer/PHP-SteamCommunity | SteamCommunity.php | SteamCommunity._createFile | private function _createFile($dir, $name, $ext)
{
if (!empty($this->rootDir)) {
if (!file_exists($this->_getFileDir($dir))) {
mkdir($this->_getFileDir($dir), 0777, true);
}
if (!file_exists($this->_getFilePath($dir, $name, $ext))) {
if (fil... | php | private function _createFile($dir, $name, $ext)
{
if (!empty($this->rootDir)) {
if (!file_exists($this->_getFileDir($dir))) {
mkdir($this->_getFileDir($dir), 0777, true);
}
if (!file_exists($this->_getFilePath($dir, $name, $ext))) {
if (fil... | [
"private",
"function",
"_createFile",
"(",
"$",
"dir",
",",
"$",
"name",
",",
"$",
"ext",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"rootDir",
")",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"_getFileDir",
"... | The directory and file are created automatically.
@param $dir
@param $name
@param $ext
@throws \Exception | [
"The",
"directory",
"and",
"file",
"are",
"created",
"automatically",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/SteamCommunity.php#L323-L335 |
188,260 | waylaidwanderer/PHP-SteamCommunity | SteamCommunity.php | SteamCommunity.registerApiKey | public function registerApiKey($domain = '')
{
$this->apiKeyDomain = $domain;
$this->_setApiKey();
if (empty($this->apiKey)) {
throw new SteamException('Could not register API key.');
}
return $this->apiKey;
} | php | public function registerApiKey($domain = '')
{
$this->apiKeyDomain = $domain;
$this->_setApiKey();
if (empty($this->apiKey)) {
throw new SteamException('Could not register API key.');
}
return $this->apiKey;
} | [
"public",
"function",
"registerApiKey",
"(",
"$",
"domain",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"apiKeyDomain",
"=",
"$",
"domain",
";",
"$",
"this",
"->",
"_setApiKey",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"apiKey",
")",
... | In most cases, you don't need to call this since an API key is registered automatically upon logging in as long as you have set the domain first.
@param string $domain
@return string
@throws SteamException Thrown when Steam gives an unexpected response (e.g. Steam is down/having issues) | [
"In",
"most",
"cases",
"you",
"don",
"t",
"need",
"to",
"call",
"this",
"since",
"an",
"API",
"key",
"is",
"registered",
"automatically",
"upon",
"logging",
"in",
"as",
"long",
"as",
"you",
"have",
"set",
"the",
"domain",
"first",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/SteamCommunity.php#L391-L399 |
188,261 | waylaidwanderer/PHP-SteamCommunity | MobileAuth/Confirmations.php | Confirmations.fetchConfirmations | public function fetchConfirmations()
{
$url = $this->generateConfirmationUrl();
$confirmations = [];
$response = '';
try {
$response = $this->mobileAuth->steamCommunity()->cURL($url);
} catch (\Exception $ex) {
return $confirmations;
}
... | php | public function fetchConfirmations()
{
$url = $this->generateConfirmationUrl();
$confirmations = [];
$response = '';
try {
$response = $this->mobileAuth->steamCommunity()->cURL($url);
} catch (\Exception $ex) {
return $confirmations;
}
... | [
"public",
"function",
"fetchConfirmations",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"generateConfirmationUrl",
"(",
")",
";",
"$",
"confirmations",
"=",
"[",
"]",
";",
"$",
"response",
"=",
"''",
";",
"try",
"{",
"$",
"response",
"=",
"$",
... | Fetch list of confirmations. May need to retry more than once because of Steam occasionally not showing any confirmations.
@return Confirmation[]
@throws WgTokenInvalidException Thrown when session is invalid. | [
"Fetch",
"list",
"of",
"confirmations",
".",
"May",
"need",
"to",
"retry",
"more",
"than",
"once",
"because",
"of",
"Steam",
"occasionally",
"not",
"showing",
"any",
"confirmations",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/MobileAuth/Confirmations.php#L28-L71 |
188,262 | waylaidwanderer/PHP-SteamCommunity | MobileAuth/Confirmations.php | Confirmations.getConfirmationTradeOfferId | public function getConfirmationTradeOfferId(Confirmation $confirmation)
{
$url = 'https://steamcommunity.com/mobileconf/details/' . $confirmation->getConfirmationId() . '?' . $this->generateConfirmationQueryParams('details');
$response = '';
try {
$response = $this->mobileAuth->s... | php | public function getConfirmationTradeOfferId(Confirmation $confirmation)
{
$url = 'https://steamcommunity.com/mobileconf/details/' . $confirmation->getConfirmationId() . '?' . $this->generateConfirmationQueryParams('details');
$response = '';
try {
$response = $this->mobileAuth->s... | [
"public",
"function",
"getConfirmationTradeOfferId",
"(",
"Confirmation",
"$",
"confirmation",
")",
"{",
"$",
"url",
"=",
"'https://steamcommunity.com/mobileconf/details/'",
".",
"$",
"confirmation",
"->",
"getConfirmationId",
"(",
")",
".",
"'?'",
".",
"$",
"this",
... | Get the trade offer ID of a confirmation. May need to retry more than once due to Steam occasionally failing to load the trade page.
@param Confirmation $confirmation
@return string | [
"Get",
"the",
"trade",
"offer",
"ID",
"of",
"a",
"confirmation",
".",
"May",
"need",
"to",
"retry",
"more",
"than",
"once",
"due",
"to",
"Steam",
"occasionally",
"failing",
"to",
"load",
"the",
"trade",
"page",
"."
] | f1317d08b9f5c8e1b451f82368a04d36f47333d4 | https://github.com/waylaidwanderer/PHP-SteamCommunity/blob/f1317d08b9f5c8e1b451f82368a04d36f47333d4/MobileAuth/Confirmations.php#L101-L120 |
188,263 | jdrda/laravel-google-custom-search-engine | src/JanDrda/LaravelGoogleCustomSearchEngine/LaravelGoogleCustomSearchEngine.php | LaravelGoogleCustomSearchEngine.getResults | public function getResults($phrase, $parameters = array())
{
/**
* Check required parameters
*/
if ($phrase == '') {
return array();
}
if ($this->engineId == '') {
throw new \Exception('You must specify a engineId');
}
if (... | php | public function getResults($phrase, $parameters = array())
{
/**
* Check required parameters
*/
if ($phrase == '') {
return array();
}
if ($this->engineId == '') {
throw new \Exception('You must specify a engineId');
}
if (... | [
"public",
"function",
"getResults",
"(",
"$",
"phrase",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"/**\n * Check required parameters\n */",
"if",
"(",
"$",
"phrase",
"==",
"''",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",... | Get search results
Gets results from CSE only as array of objects where the most important variables are
[title] - page title
[htmlTitle] - page title with HTML tags
[link] - page URL
[displayLink] - displayed part of page URL
[snippet] - short text from page with the searched phrase
[htmlSnippet] - short text from pa... | [
"Get",
"search",
"results"
] | d87d41b89de43e5cecf88179f8c1f36bf2174703 | https://github.com/jdrda/laravel-google-custom-search-engine/blob/d87d41b89de43e5cecf88179f8c1f36bf2174703/src/JanDrda/LaravelGoogleCustomSearchEngine/LaravelGoogleCustomSearchEngine.php#L84-L157 |
188,264 | symfony2admingenerator/GeneratorBundle | Exception/ValidationException.php | ValidationException.setErrors | public function setErrors($errors = array())
{
foreach ($errors as $error) {
if (!$error instanceof ConstraintViolation) {
throw new \InvalidArgumentException(sprintf('The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.', g... | php | public function setErrors($errors = array())
{
foreach ($errors as $error) {
if (!$error instanceof ConstraintViolation) {
throw new \InvalidArgumentException(sprintf('The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.', g... | [
"public",
"function",
"setErrors",
"(",
"$",
"errors",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"error",
")",
"{",
"if",
"(",
"!",
"$",
"error",
"instanceof",
"ConstraintViolation",
")",
"{",
"throw",
"new",
"\\",
"... | Validate and set errors.
@param ConstraintViolation[] $errors An array of ConstraintViolation instances. | [
"Validate",
"and",
"set",
"errors",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Exception/ValidationException.php#L34-L43 |
188,265 | symfony2admingenerator/GeneratorBundle | Builder/Admin/ActionsBuilder.php | ActionsBuilder.getBatchActions | public function getBatchActions()
{
if (null === $this->batchActions) {
$this->batchActions = array();
$this->findBatchActions();
}
return $this->batchActions;
} | php | public function getBatchActions()
{
if (null === $this->batchActions) {
$this->batchActions = array();
$this->findBatchActions();
}
return $this->batchActions;
} | [
"public",
"function",
"getBatchActions",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"batchActions",
")",
"{",
"$",
"this",
"->",
"batchActions",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"findBatchActions",
"(",
")",
";",
"}",
... | Return a list of batch action from list.batch_actions
@return array | [
"Return",
"a",
"list",
"of",
"batch",
"action",
"from",
"list",
".",
"batch_actions"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/ActionsBuilder.php#L56-L64 |
188,266 | symfony2admingenerator/GeneratorBundle | Builder/Admin/NestedListBuilder.php | NestedListBuilder.getIndentationColumnIndex | public function getIndentationColumnIndex()
{
if (null === $this->indentationColumnIndex) {
$field = $this->getGenerator()->getFromYaml('builders.nested_list.indentation.field');
if (!$field) {
return $this->indentationColumnIndex = 0;
}
$this... | php | public function getIndentationColumnIndex()
{
if (null === $this->indentationColumnIndex) {
$field = $this->getGenerator()->getFromYaml('builders.nested_list.indentation.field');
if (!$field) {
return $this->indentationColumnIndex = 0;
}
$this... | [
"public",
"function",
"getIndentationColumnIndex",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"indentationColumnIndex",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"getGenerator",
"(",
")",
"->",
"getFromYaml",
"(",
"'builders.nested_list.... | Get the indentation field that should be used.
No validity is made uppon the field name.
@return mixed | [
"Get",
"the",
"indentation",
"field",
"that",
"should",
"be",
"used",
".",
"No",
"validity",
"is",
"made",
"uppon",
"the",
"field",
"name",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/NestedListBuilder.php#L55-L67 |
188,267 | symfony2admingenerator/GeneratorBundle | Form/BaseType.php | BaseType.resolveOptions | protected function resolveOptions($name, array $fieldOptions, array $builderOptions = array(), $optionsClass = null)
{
$getter = 'get'.ucfirst($name).'Options';
if ($optionsClass) {
if (method_exists($optionsClass, 'setAuthorizationChecker')) {
$optionsClass->setAuthoriz... | php | protected function resolveOptions($name, array $fieldOptions, array $builderOptions = array(), $optionsClass = null)
{
$getter = 'get'.ucfirst($name).'Options';
if ($optionsClass) {
if (method_exists($optionsClass, 'setAuthorizationChecker')) {
$optionsClass->setAuthoriz... | [
"protected",
"function",
"resolveOptions",
"(",
"$",
"name",
",",
"array",
"$",
"fieldOptions",
",",
"array",
"$",
"builderOptions",
"=",
"array",
"(",
")",
",",
"$",
"optionsClass",
"=",
"null",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"("... | Resolve field options.
@param string $name Field name.
@param array $fieldOptions Field options.
@param array $builderOptions Form builder options.
@param object|null $optionsClass The options class.
@return array Resolved field options. | [
"Resolve",
"field",
"options",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Form/BaseType.php#L52-L73 |
188,268 | symfony2admingenerator/GeneratorBundle | Builder/Generator.php | Generator.mergeConfiguration | protected function mergeConfiguration(array $global, array $builder)
{
foreach ($global as $name => &$value) {
if (!array_key_exists($name, $builder) || is_null($builder[$name])) {
continue;
}
if (!is_array($value)) {
$value = $builder[$na... | php | protected function mergeConfiguration(array $global, array $builder)
{
foreach ($global as $name => &$value) {
if (!array_key_exists($name, $builder) || is_null($builder[$name])) {
continue;
}
if (!is_array($value)) {
$value = $builder[$na... | [
"protected",
"function",
"mergeConfiguration",
"(",
"array",
"$",
"global",
",",
"array",
"$",
"builder",
")",
"{",
"foreach",
"(",
"$",
"global",
"as",
"$",
"name",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name... | Merge configuration on a single level
@param array $global
@param array $builder
@return array | [
"Merge",
"configuration",
"on",
"a",
"single",
"level"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Generator.php#L183-L204 |
188,269 | symfony2admingenerator/GeneratorBundle | Builder/Generator.php | Generator.applyActionsBuilderDefaults | protected function applyActionsBuilderDefaults(array $params)
{
if (!array_key_exists('namespace_prefix', $params) || !array_key_exists('bundle_name', $params)) {
return $params;
}
$routeBase = $params['namespace_prefix'].'_'.$params['bundle_name'].'_'.$this->getBaseGeneratorNam... | php | protected function applyActionsBuilderDefaults(array $params)
{
if (!array_key_exists('namespace_prefix', $params) || !array_key_exists('bundle_name', $params)) {
return $params;
}
$routeBase = $params['namespace_prefix'].'_'.$params['bundle_name'].'_'.$this->getBaseGeneratorNam... | [
"protected",
"function",
"applyActionsBuilderDefaults",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'namespace_prefix'",
",",
"$",
"params",
")",
"||",
"!",
"array_key_exists",
"(",
"'bundle_name'",
",",
"$",
"params",
")",
... | Inject default batch and object actions settings
@return array | [
"Inject",
"default",
"batch",
"and",
"object",
"actions",
"settings"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Generator.php#L240-L298 |
188,270 | symfony2admingenerator/GeneratorBundle | Builder/Generator.php | Generator.setYamlConfig | protected function setYamlConfig(array $yaml)
{
$this->yaml = array_replace_recursive(
Yaml::parse(file_get_contents(__DIR__.'/../Resources/config/default.yml')),
$yaml
);
} | php | protected function setYamlConfig(array $yaml)
{
$this->yaml = array_replace_recursive(
Yaml::parse(file_get_contents(__DIR__.'/../Resources/config/default.yml')),
$yaml
);
} | [
"protected",
"function",
"setYamlConfig",
"(",
"array",
"$",
"yaml",
")",
"{",
"$",
"this",
"->",
"yaml",
"=",
"array_replace_recursive",
"(",
"Yaml",
"::",
"parse",
"(",
"file_get_contents",
"(",
"__DIR__",
".",
"'/../Resources/config/default.yml'",
")",
")",
"... | Set the yaml to pass all the vars to the builders
@param array $yaml
@return void | [
"Set",
"the",
"yaml",
"to",
"pass",
"all",
"the",
"vars",
"to",
"the",
"builders"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Generator.php#L323-L329 |
188,271 | symfony2admingenerator/GeneratorBundle | Builder/Admin/EditBuilderAction.php | EditBuilderAction.getObjectActions | public function getObjectActions()
{
$objectActions = parent::getObjectActions();
if (array_key_exists('edit', $objectActions)) {
unset($objectActions['edit']);
$this->objectActions = $objectActions;
}
return $this->objectActions;
} | php | public function getObjectActions()
{
$objectActions = parent::getObjectActions();
if (array_key_exists('edit', $objectActions)) {
unset($objectActions['edit']);
$this->objectActions = $objectActions;
}
return $this->objectActions;
} | [
"public",
"function",
"getObjectActions",
"(",
")",
"{",
"$",
"objectActions",
"=",
"parent",
"::",
"getObjectActions",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'edit'",
",",
"$",
"objectActions",
")",
")",
"{",
"unset",
"(",
"$",
"objectActions",... | Return a list of action from list.object_actions
@return array | [
"Return",
"a",
"list",
"of",
"action",
"from",
"list",
".",
"object_actions"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/EditBuilderAction.php#L20-L30 |
188,272 | symfony2admingenerator/GeneratorBundle | Twig/Extension/ArrayExtension.php | ArrayExtension.mapBy | public function mapBy(array $input, $key)
{
return array_map(function ($item) use ($key) {
if (is_array($item)) {
if (!array_key_exists($key, $item)) {
throw new \LogicException("Could not map item by key \"$key\". Array key does not exist.");
... | php | public function mapBy(array $input, $key)
{
return array_map(function ($item) use ($key) {
if (is_array($item)) {
if (!array_key_exists($key, $item)) {
throw new \LogicException("Could not map item by key \"$key\". Array key does not exist.");
... | [
"public",
"function",
"mapBy",
"(",
"array",
"$",
"input",
",",
"$",
"key",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"item",
")",
"use",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"item",
")",
")",
"{",
"if",
... | Map collection by key. For objects, return the property, use
get method or is method, if avaliable.
@param array $input Array of arrays or objects.
@param string $key Key to map by.
@throws \InvalidArgumentException If array item is not an array or object.
@throws \LogicExcep... | [
"Map",
"collection",
"by",
"key",
".",
"For",
"objects",
"return",
"the",
"property",
"use",
"get",
"method",
"or",
"is",
"method",
"if",
"avaliable",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Twig/Extension/ArrayExtension.php#L35-L74 |
188,273 | symfony2admingenerator/GeneratorBundle | Builder/Admin/BaseBuilder.php | BaseBuilder.getColumns | public function getColumns()
{
if (null === $this->columns) {
$this->columns = array();
$this->findColumns();
}
return $this->columns;
} | php | public function getColumns()
{
if (null === $this->columns) {
$this->columns = array();
$this->findColumns();
}
return $this->columns;
} | [
"public",
"function",
"getColumns",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"columns",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"findColumns",
"(",
")",
";",
"}",
"return",
"$",
"... | Return a list of columns from list.display.
@return array | [
"Return",
"a",
"list",
"of",
"columns",
"from",
"list",
".",
"display",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/BaseBuilder.php#L49-L57 |
188,274 | symfony2admingenerator/GeneratorBundle | Builder/Admin/BaseBuilder.php | BaseBuilder.getColumnsFor | public function getColumnsFor($input)
{
if (!is_array($input)) {
$input = array($input);
}
$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($input));
$fieldsNames = iterator_to_array($it, false);
return array_intersect_key($this->getColumns(), a... | php | public function getColumnsFor($input)
{
if (!is_array($input)) {
$input = array($input);
}
$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($input));
$fieldsNames = iterator_to_array($it, false);
return array_intersect_key($this->getColumns(), a... | [
"public",
"function",
"getColumnsFor",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"input",
")",
")",
"{",
"$",
"input",
"=",
"array",
"(",
"$",
"input",
")",
";",
"}",
"$",
"it",
"=",
"new",
"\\",
"RecursiveIteratorIterator",
... | Get columns for tab, fieldset, row or field.
@param mixed $input
@return array Array of columns. | [
"Get",
"columns",
"for",
"tab",
"fieldset",
"row",
"or",
"field",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/BaseBuilder.php#L355-L366 |
188,275 | symfony2admingenerator/GeneratorBundle | Builder/Admin/BaseBuilder.php | BaseBuilder.getActions | public function getActions()
{
if (null === $this->actions) {
$this->actions = array();
$this->findActions();
}
return $this->actions;
} | php | public function getActions()
{
if (null === $this->actions) {
$this->actions = array();
$this->findActions();
}
return $this->actions;
} | [
"public",
"function",
"getActions",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"actions",
")",
"{",
"$",
"this",
"->",
"actions",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"findActions",
"(",
")",
";",
"}",
"return",
"$",
"... | Return a list of action from list.actions.
@return array | [
"Return",
"a",
"list",
"of",
"action",
"from",
"list",
".",
"actions",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/BaseBuilder.php#L373-L381 |
188,276 | symfony2admingenerator/GeneratorBundle | Builder/Admin/BaseBuilder.php | BaseBuilder.getObjectActions | public function getObjectActions()
{
if (null === $this->objectActions) {
$this->objectActions = array();
$this->findObjectActions();
}
return $this->objectActions;
} | php | public function getObjectActions()
{
if (null === $this->objectActions) {
$this->objectActions = array();
$this->findObjectActions();
}
return $this->objectActions;
} | [
"public",
"function",
"getObjectActions",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"objectActions",
")",
"{",
"$",
"this",
"->",
"objectActions",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"findObjectActions",
"(",
")",
";",
"}"... | Return a list of action from list.object_actions.
@return array | [
"Return",
"a",
"list",
"of",
"action",
"from",
"list",
".",
"object_actions",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/BaseBuilder.php#L445-L453 |
188,277 | symfony2admingenerator/GeneratorBundle | Builder/Admin/BaseBuilder.php | BaseBuilder.getStylesheets | public function getStylesheets()
{
$parse_stylesheets = function ($params, $stylesheets) {
foreach ($params as $css) {
if (is_string($css)) {
$css = array(
'path' => $css,
'media' => 'all',
);... | php | public function getStylesheets()
{
$parse_stylesheets = function ($params, $stylesheets) {
foreach ($params as $css) {
if (is_string($css)) {
$css = array(
'path' => $css,
'media' => 'all',
);... | [
"public",
"function",
"getStylesheets",
"(",
")",
"{",
"$",
"parse_stylesheets",
"=",
"function",
"(",
"$",
"params",
",",
"$",
"stylesheets",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"css",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"css",... | Allow to add complementary strylesheets.
param:
stylesheets:
- path/css.css
- { path: path/css.css, media: all }
@return array | [
"Allow",
"to",
"add",
"complementary",
"strylesheets",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/BaseBuilder.php#L590-L618 |
188,278 | symfony2admingenerator/GeneratorBundle | Builder/Admin/BaseBuilder.php | BaseBuilder.getJavascripts | public function getJavascripts()
{
$self = $this;
$parse_javascripts = function ($params, $javascripts) use ($self) {
foreach ($params as $js) {
if (is_string($js)) {
$js = array(
'path' => $js,
);
... | php | public function getJavascripts()
{
$self = $this;
$parse_javascripts = function ($params, $javascripts) use ($self) {
foreach ($params as $js) {
if (is_string($js)) {
$js = array(
'path' => $js,
);
... | [
"public",
"function",
"getJavascripts",
"(",
")",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"$",
"parse_javascripts",
"=",
"function",
"(",
"$",
"params",
",",
"$",
"javascripts",
")",
"use",
"(",
"$",
"self",
")",
"{",
"foreach",
"(",
"$",
"params",
... | Allow to add complementary javascripts.
param:
javascripts:
- path/js.js
- { path: path/js.js }
- { route: my_route, routeparams: {} }
@return array | [
"Allow",
"to",
"add",
"complementary",
"javascripts",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/BaseBuilder.php#L632-L666 |
188,279 | symfony2admingenerator/GeneratorBundle | Builder/Admin/ExcelBuilder.php | ExcelBuilder.getExport | public function getExport()
{
if (null === $this->export) {
$this->export = array();
$this->fillExport();
}
return $this->export;
} | php | public function getExport()
{
if (null === $this->export) {
$this->export = array();
$this->fillExport();
}
return $this->export;
} | [
"public",
"function",
"getExport",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"export",
")",
"{",
"$",
"this",
"->",
"export",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"fillExport",
"(",
")",
";",
"}",
"return",
"$",
"this... | Return a list of columns from excel.export
@return array | [
"Return",
"a",
"list",
"of",
"columns",
"from",
"excel",
".",
"export"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/ExcelBuilder.php#L61-L69 |
188,280 | symfony2admingenerator/GeneratorBundle | Builder/Admin/ListBuilderTemplate.php | ListBuilderTemplate.getFiltersMode | public function getFiltersMode()
{
if (null === $this->filtersMode) {
$this->filtersMode = $this->getGenerator()->getFromYaml('builders.list.params.filtersMode', 'default');
}
return $this->filtersMode;
} | php | public function getFiltersMode()
{
if (null === $this->filtersMode) {
$this->filtersMode = $this->getGenerator()->getFromYaml('builders.list.params.filtersMode', 'default');
}
return $this->filtersMode;
} | [
"public",
"function",
"getFiltersMode",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"filtersMode",
")",
"{",
"$",
"this",
"->",
"filtersMode",
"=",
"$",
"this",
"->",
"getGenerator",
"(",
")",
"->",
"getFromYaml",
"(",
"'builders.list.param... | Retrieve the filters mode parameter defined into the
YAML generator file under the list builder.
@return string | [
"Retrieve",
"the",
"filters",
"mode",
"parameter",
"defined",
"into",
"the",
"YAML",
"generator",
"file",
"under",
"the",
"list",
"builder",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/ListBuilderTemplate.php#L33-L40 |
188,281 | symfony2admingenerator/GeneratorBundle | Builder/Admin/ListBuilder.php | ListBuilder.getFormType | public function getFormType()
{
return sprintf(
'%s%s\\Form\Type\\%s\\FiltersType',
$this->getVariable('namespace_prefix') ? $this->getVariable('namespace_prefix') . '\\' : '',
$this->getVariable('bundle_name'),
$this->getBaseGeneratorName()
);
} | php | public function getFormType()
{
return sprintf(
'%s%s\\Form\Type\\%s\\FiltersType',
$this->getVariable('namespace_prefix') ? $this->getVariable('namespace_prefix') . '\\' : '',
$this->getVariable('bundle_name'),
$this->getBaseGeneratorName()
);
} | [
"public",
"function",
"getFormType",
"(",
")",
"{",
"return",
"sprintf",
"(",
"'%s%s\\\\Form\\Type\\\\%s\\\\FiltersType'",
",",
"$",
"this",
"->",
"getVariable",
"(",
"'namespace_prefix'",
")",
"?",
"$",
"this",
"->",
"getVariable",
"(",
"'namespace_prefix'",
")",
... | Retrieve the FQCN formType used by this builder
@return string | [
"Retrieve",
"the",
"FQCN",
"formType",
"used",
"by",
"this",
"builder"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/ListBuilder.php#L52-L60 |
188,282 | symfony2admingenerator/GeneratorBundle | Builder/Admin/ListBuilder.php | ListBuilder.getExcelActions | public function getExcelActions()
{
if (null === $this->excelActions) {
$this->excelActions = array();
$this->fillExportActions();
}
return $this->excelActions;
} | php | public function getExcelActions()
{
if (null === $this->excelActions) {
$this->excelActions = array();
$this->fillExportActions();
}
return $this->excelActions;
} | [
"public",
"function",
"getExcelActions",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"excelActions",
")",
"{",
"$",
"this",
"->",
"excelActions",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"fillExportActions",
"(",
")",
";",
"}",
... | Return a list of actions from excel.export
@return array | [
"Return",
"a",
"list",
"of",
"actions",
"from",
"excel",
".",
"export"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Builder/Admin/ListBuilder.php#L238-L246 |
188,283 | symfony2admingenerator/GeneratorBundle | Twig/Extension/ConfigExtension.php | ConfigExtension.getAdmingeneratorConfig | public function getAdmingeneratorConfig($name)
{
$search_in = $this->bundleConfig;
$path = explode('.', $name);
foreach ($path as $key) {
if (!array_key_exists($key, $search_in)) {
throw new \InvalidArgumentException('Unknown parameter "admingenerator.' . $name . ... | php | public function getAdmingeneratorConfig($name)
{
$search_in = $this->bundleConfig;
$path = explode('.', $name);
foreach ($path as $key) {
if (!array_key_exists($key, $search_in)) {
throw new \InvalidArgumentException('Unknown parameter "admingenerator.' . $name . ... | [
"public",
"function",
"getAdmingeneratorConfig",
"(",
"$",
"name",
")",
"{",
"$",
"search_in",
"=",
"$",
"this",
"->",
"bundleConfig",
";",
"$",
"path",
"=",
"explode",
"(",
"'.'",
",",
"$",
"name",
")",
";",
"foreach",
"(",
"$",
"path",
"as",
"$",
"... | Returns admingenerator parameter
@param string $name
@return string Parameter value | [
"Returns",
"admingenerator",
"parameter"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Twig/Extension/ConfigExtension.php#L39-L51 |
188,284 | symfony2admingenerator/GeneratorBundle | DependencyInjection/Compiler/FormPass.php | FormPass.injectFormThemeConfiguration | private function injectFormThemeConfiguration(ContainerBuilder $container)
{
if (($twigConfiguration = $container->getParameter('admingenerator.twig')) !== false) {
$resources = $container->getParameter('twig.form.resources');
$alreadyIn = in_array('bootstrap_3_layout.html.twig', $re... | php | private function injectFormThemeConfiguration(ContainerBuilder $container)
{
if (($twigConfiguration = $container->getParameter('admingenerator.twig')) !== false) {
$resources = $container->getParameter('twig.form.resources');
$alreadyIn = in_array('bootstrap_3_layout.html.twig', $re... | [
"private",
"function",
"injectFormThemeConfiguration",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"(",
"$",
"twigConfiguration",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'admingenerator.twig'",
")",
")",
"!==",
"false",
")",
"{",
"... | Check if we need to automatically add form theme from admingen in the
application configuration.
@param ContainerBuilder $container | [
"Check",
"if",
"we",
"need",
"to",
"automatically",
"add",
"form",
"theme",
"from",
"admingen",
"in",
"the",
"application",
"configuration",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/DependencyInjection/Compiler/FormPass.php#L29-L43 |
188,285 | symfony2admingenerator/GeneratorBundle | Menu/AdmingeneratorMenuBuilder.php | AdmingeneratorMenuBuilder.addDropdown | protected function addDropdown(ItemInterface $menu, $label, $caret = true)
{
$item = $this->addLinkURI($menu, $label, '#');
$item->setChildrenAttributes(array('class' => 'treeview-menu'));
$item->setAttributes(array('class' => 'treeview'));
$item->setExtra('caret', $caret);
... | php | protected function addDropdown(ItemInterface $menu, $label, $caret = true)
{
$item = $this->addLinkURI($menu, $label, '#');
$item->setChildrenAttributes(array('class' => 'treeview-menu'));
$item->setAttributes(array('class' => 'treeview'));
$item->setExtra('caret', $caret);
... | [
"protected",
"function",
"addDropdown",
"(",
"ItemInterface",
"$",
"menu",
",",
"$",
"label",
",",
"$",
"caret",
"=",
"true",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"addLinkURI",
"(",
"$",
"menu",
",",
"$",
"label",
",",
"'#'",
")",
";",
"$... | Creates dropdown menu element and adds it to menu
@param \Knp\Menu\ItemInterface $menu
@param string $label Dropdown label
@param bool $caret Wheather or not append caret
@return ItemInterface Dropdown element | [
"Creates",
"dropdown",
"menu",
"element",
"and",
"adds",
"it",
"to",
"menu"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/Menu/AdmingeneratorMenuBuilder.php#L106-L114 |
188,286 | symfony2admingenerator/GeneratorBundle | CacheWarmer/GeneratorCacheWarmer.php | GeneratorCacheWarmer.propelInit | protected function propelInit()
{
if (!\Propel::isInit()) {
\Propel::setConfiguration($this->container->get('propel.configuration'));
\Propel::initialize();
}
} | php | protected function propelInit()
{
if (!\Propel::isInit()) {
\Propel::setConfiguration($this->container->get('propel.configuration'));
\Propel::initialize();
}
} | [
"protected",
"function",
"propelInit",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"Propel",
"::",
"isInit",
"(",
")",
")",
"{",
"\\",
"Propel",
"::",
"setConfiguration",
"(",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'propel.configuration'",
")",
")",... | Force Propel boot before cache warmup | [
"Force",
"Propel",
"boot",
"before",
"cache",
"warmup"
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/CacheWarmer/GeneratorCacheWarmer.php#L97-L103 |
188,287 | symfony2admingenerator/GeneratorBundle | DependencyInjection/AdmingeneratorGeneratorExtension.php | AdmingeneratorGeneratorExtension.registerFormsServicesFromGenerator | private function registerFormsServicesFromGenerator(array $generatorParameters, array $builders, ContainerBuilder $container)
{
$modelParts = explode('\\', $generatorParameters['model']);
$model = strtolower(array_pop($modelParts)); // @TODO: BC Suppo... | php | private function registerFormsServicesFromGenerator(array $generatorParameters, array $builders, ContainerBuilder $container)
{
$modelParts = explode('\\', $generatorParameters['model']);
$model = strtolower(array_pop($modelParts)); // @TODO: BC Suppo... | [
"private",
"function",
"registerFormsServicesFromGenerator",
"(",
"array",
"$",
"generatorParameters",
",",
"array",
"$",
"builders",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"modelParts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"generatorParameter... | Register forms as services for a generator.
Register only generated forms based on defined builders.
@param array $generatorParameters
@param array $builders
@param ContainerBuilder $container | [
"Register",
"forms",
"as",
"services",
"for",
"a",
"generator",
".",
"Register",
"only",
"generated",
"forms",
"based",
"on",
"defined",
"builders",
"."
] | a09b8f99e433cb9225953ce01e8047adef1e854e | https://github.com/symfony2admingenerator/GeneratorBundle/blob/a09b8f99e433cb9225953ce01e8047adef1e854e/DependencyInjection/AdmingeneratorGeneratorExtension.php#L269-L317 |
188,288 | djchen/oauth2-fitbit | src/Provider/Fitbit.php | Fitbit.checkResponse | protected function checkResponse(ResponseInterface $response, $data)
{
if ($response->getStatusCode() >= 400) {
$errorMessage = '';
if (!empty($data['errors'])) {
foreach ($data['errors'] as $error) {
if (!empty($errorMessage)) {
... | php | protected function checkResponse(ResponseInterface $response, $data)
{
if ($response->getStatusCode() >= 400) {
$errorMessage = '';
if (!empty($data['errors'])) {
foreach ($data['errors'] as $error) {
if (!empty($errorMessage)) {
... | [
"protected",
"function",
"checkResponse",
"(",
"ResponseInterface",
"$",
"response",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
">=",
"400",
")",
"{",
"$",
"errorMessage",
"=",
"''",
";",
"if",
"(",
"!",
"e... | Checks Fitbit API response for errors.
@throws IdentityProviderException
@param ResponseInterface $response
@param array|string $data Parsed response data | [
"Checks",
"Fitbit",
"API",
"response",
"for",
"errors",
"."
] | 3de8cf81623fd932b4ab926a525e09688cca3fc3 | https://github.com/djchen/oauth2-fitbit/blob/3de8cf81623fd932b4ab926a525e09688cca3fc3/src/Provider/Fitbit.php#L96-L116 |
188,289 | djchen/oauth2-fitbit | src/Provider/Fitbit.php | Fitbit.getAuthorizationParameters | protected function getAuthorizationParameters(array $options)
{
$params = parent::getAuthorizationParameters($options);
unset($params['approval_prompt']);
if (!empty($options['prompt'])) {
$params['prompt'] = $options['prompt'];
}
return $params;
} | php | protected function getAuthorizationParameters(array $options)
{
$params = parent::getAuthorizationParameters($options);
unset($params['approval_prompt']);
if (!empty($options['prompt'])) {
$params['prompt'] = $options['prompt'];
}
return $params;
} | [
"protected",
"function",
"getAuthorizationParameters",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"params",
"=",
"parent",
"::",
"getAuthorizationParameters",
"(",
"$",
"options",
")",
";",
"unset",
"(",
"$",
"params",
"[",
"'approval_prompt'",
"]",
")",
";"... | Returns authorization parameters based on provided options.
Fitbit does not use the 'approval_prompt' param and here we remove it.
@param array $options
@return array Authorization parameters | [
"Returns",
"authorization",
"parameters",
"based",
"on",
"provided",
"options",
".",
"Fitbit",
"does",
"not",
"use",
"the",
"approval_prompt",
"param",
"and",
"here",
"we",
"remove",
"it",
"."
] | 3de8cf81623fd932b4ab926a525e09688cca3fc3 | https://github.com/djchen/oauth2-fitbit/blob/3de8cf81623fd932b4ab926a525e09688cca3fc3/src/Provider/Fitbit.php#L136-L145 |
188,290 | djchen/oauth2-fitbit | src/Provider/Fitbit.php | Fitbit.getAccessTokenOptions | protected function getAccessTokenOptions(array $params)
{
$options = parent::getAccessTokenOptions($params);
$options['headers']['Authorization'] =
'Basic '.base64_encode($this->clientId.':'.$this->clientSecret);
return $options;
} | php | protected function getAccessTokenOptions(array $params)
{
$options = parent::getAccessTokenOptions($params);
$options['headers']['Authorization'] =
'Basic '.base64_encode($this->clientId.':'.$this->clientSecret);
return $options;
} | [
"protected",
"function",
"getAccessTokenOptions",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"options",
"=",
"parent",
"::",
"getAccessTokenOptions",
"(",
"$",
"params",
")",
";",
"$",
"options",
"[",
"'headers'",
"]",
"[",
"'Authorization'",
"]",
"=",
"'Ba... | Builds request options used for requesting an access token.
@param array $params
@return array | [
"Builds",
"request",
"options",
"used",
"for",
"requesting",
"an",
"access",
"token",
"."
] | 3de8cf81623fd932b4ab926a525e09688cca3fc3 | https://github.com/djchen/oauth2-fitbit/blob/3de8cf81623fd932b4ab926a525e09688cca3fc3/src/Provider/Fitbit.php#L154-L161 |
188,291 | djchen/oauth2-fitbit | src/Provider/Fitbit.php | Fitbit.revoke | public function revoke(AccessToken $accessToken)
{
$options = $this->getAccessTokenOptions([]);
$uri = $this->appendQuery(
self::BASE_FITBIT_API_URL.'/oauth2/revoke',
$this->buildQueryString(['token' => $accessToken->getToken()])
);
$request = $this->getReques... | php | public function revoke(AccessToken $accessToken)
{
$options = $this->getAccessTokenOptions([]);
$uri = $this->appendQuery(
self::BASE_FITBIT_API_URL.'/oauth2/revoke',
$this->buildQueryString(['token' => $accessToken->getToken()])
);
$request = $this->getReques... | [
"public",
"function",
"revoke",
"(",
"AccessToken",
"$",
"accessToken",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getAccessTokenOptions",
"(",
"[",
"]",
")",
";",
"$",
"uri",
"=",
"$",
"this",
"->",
"appendQuery",
"(",
"self",
"::",
"BASE_FITBIT... | Revoke access for the given token.
@param AccessToken $accessToken
@return mixed | [
"Revoke",
"access",
"for",
"the",
"given",
"token",
"."
] | 3de8cf81623fd932b4ab926a525e09688cca3fc3 | https://github.com/djchen/oauth2-fitbit/blob/3de8cf81623fd932b4ab926a525e09688cca3fc3/src/Provider/Fitbit.php#L194-L204 |
188,292 | neos/form | Classes/ViewHelpers/FormViewHelper.php | FormViewHelper.renderHiddenReferrerFields | protected function renderHiddenReferrerFields()
{
$tagBuilder = new TagBuilder('input');
$tagBuilder->addAttribute('type', 'hidden');
$tagBuilder->addAttribute('name', $this->prefixFieldName('__state'));
/** @var FormRuntime $formRuntime */
$formRuntime = $this->arguments['ob... | php | protected function renderHiddenReferrerFields()
{
$tagBuilder = new TagBuilder('input');
$tagBuilder->addAttribute('type', 'hidden');
$tagBuilder->addAttribute('name', $this->prefixFieldName('__state'));
/** @var FormRuntime $formRuntime */
$formRuntime = $this->arguments['ob... | [
"protected",
"function",
"renderHiddenReferrerFields",
"(",
")",
"{",
"$",
"tagBuilder",
"=",
"new",
"TagBuilder",
"(",
"'input'",
")",
";",
"$",
"tagBuilder",
"->",
"addAttribute",
"(",
"'type'",
",",
"'hidden'",
")",
";",
"$",
"tagBuilder",
"->",
"addAttribu... | Renders hidden form fields for referrer information about
the current request.
@return string Hidden fields with referrer information | [
"Renders",
"hidden",
"form",
"fields",
"for",
"referrer",
"information",
"about",
"the",
"current",
"request",
"."
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/ViewHelpers/FormViewHelper.php#L30-L39 |
188,293 | neos/form | Classes/ViewHelpers/FormViewHelper.php | FormViewHelper.getFormActionUri | protected function getFormActionUri()
{
/** @var ActionRequest $actionRequest */
$actionRequest = $this->controllerContext->getRequest();
$uri = $actionRequest->getHttpRequest()->getUri();
if ($this->hasArgument('section')) {
$uri = preg_replace('/#.*$/', '', $uri) . '#' ... | php | protected function getFormActionUri()
{
/** @var ActionRequest $actionRequest */
$actionRequest = $this->controllerContext->getRequest();
$uri = $actionRequest->getHttpRequest()->getUri();
if ($this->hasArgument('section')) {
$uri = preg_replace('/#.*$/', '', $uri) . '#' ... | [
"protected",
"function",
"getFormActionUri",
"(",
")",
"{",
"/** @var ActionRequest $actionRequest */",
"$",
"actionRequest",
"=",
"$",
"this",
"->",
"controllerContext",
"->",
"getRequest",
"(",
")",
";",
"$",
"uri",
"=",
"$",
"actionRequest",
"->",
"getHttpRequest... | Overrides the forms action URI to be the same as the currently requested URI
@return string | [
"Overrides",
"the",
"forms",
"action",
"URI",
"to",
"be",
"the",
"same",
"as",
"the",
"currently",
"requested",
"URI"
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/ViewHelpers/FormViewHelper.php#L58-L67 |
188,294 | neos/form | Classes/Persistence/YamlPersistenceManager.php | YamlPersistenceManager.listForms | public function listForms()
{
$this->assertSavePathIsValid();
$forms = [];
$directoryIterator = new \DirectoryIterator($this->savePath);
foreach ($directoryIterator as $fileObject) {
if (!$fileObject->isFile()) {
continue;
}
$file... | php | public function listForms()
{
$this->assertSavePathIsValid();
$forms = [];
$directoryIterator = new \DirectoryIterator($this->savePath);
foreach ($directoryIterator as $fileObject) {
if (!$fileObject->isFile()) {
continue;
}
$file... | [
"public",
"function",
"listForms",
"(",
")",
"{",
"$",
"this",
"->",
"assertSavePathIsValid",
"(",
")",
";",
"$",
"forms",
"=",
"[",
"]",
";",
"$",
"directoryIterator",
"=",
"new",
"\\",
"DirectoryIterator",
"(",
"$",
"this",
"->",
"savePath",
")",
";",
... | List all form definitions which can be loaded through this form persistence
manager.
Returns an associative array with each item containing the keys 'name' (the human-readable name of the form)
and 'persistenceIdentifier' (the unique identifier for the Form Persistence Manager e.g. the path to the saved form definitio... | [
"List",
"all",
"form",
"definitions",
"which",
"can",
"be",
"loaded",
"through",
"this",
"form",
"persistence",
"manager",
"."
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/Persistence/YamlPersistenceManager.php#L92-L116 |
188,295 | neos/form | Classes/Persistence/YamlPersistenceManager.php | YamlPersistenceManager.assertSavePathIsValid | protected function assertSavePathIsValid()
{
if ($this->savePath === null || !is_dir($this->savePath)) {
throw new PersistenceManagerException(sprintf('The savePath "%s" is not usable.', $this->savePath), 1499347363);
}
} | php | protected function assertSavePathIsValid()
{
if ($this->savePath === null || !is_dir($this->savePath)) {
throw new PersistenceManagerException(sprintf('The savePath "%s" is not usable.', $this->savePath), 1499347363);
}
} | [
"protected",
"function",
"assertSavePathIsValid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"savePath",
"===",
"null",
"||",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"savePath",
")",
")",
"{",
"throw",
"new",
"PersistenceManagerException",
"(",
"sprintf",
... | Check if the save path is set and points to a directory.
@return void
@throws PersistenceManagerException | [
"Check",
"if",
"the",
"save",
"path",
"is",
"set",
"and",
"points",
"to",
"a",
"directory",
"."
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/Persistence/YamlPersistenceManager.php#L139-L144 |
188,296 | neos/form | Classes/FormElements/ImageUpload.php | ImageUpload.onSubmit | public function onSubmit(FormRuntime $formRuntime, &$elementValue)
{
$imageTypeValidator = new ImageTypeValidator(array('allowedTypes' => $this->properties['allowedTypes']));
$this->addValidator($imageTypeValidator);
} | php | public function onSubmit(FormRuntime $formRuntime, &$elementValue)
{
$imageTypeValidator = new ImageTypeValidator(array('allowedTypes' => $this->properties['allowedTypes']));
$this->addValidator($imageTypeValidator);
} | [
"public",
"function",
"onSubmit",
"(",
"FormRuntime",
"$",
"formRuntime",
",",
"&",
"$",
"elementValue",
")",
"{",
"$",
"imageTypeValidator",
"=",
"new",
"ImageTypeValidator",
"(",
"array",
"(",
"'allowedTypes'",
"=>",
"$",
"this",
"->",
"properties",
"[",
"'a... | Add ImageTypeValidator just before submitting so that the "allowedTypes" can be changed at runtime
@param FormRuntime $formRuntime
@param mixed $elementValue
@return void | [
"Add",
"ImageTypeValidator",
"just",
"before",
"submitting",
"so",
"that",
"the",
"allowedTypes",
"can",
"be",
"changed",
"at",
"runtime"
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/FormElements/ImageUpload.php#L49-L53 |
188,297 | neos/form | Classes/ViewHelpers/Form/UploadedResourceViewHelper.php | UploadedResourceViewHelper.getUploadedResource | protected function getUploadedResource()
{
if ($this->getMappingResultsForProperty()->hasErrors()) {
return null;
}
$resourceObject = $this->getPropertyValue();
if ($resourceObject instanceof PersistentResource) {
return $resourceObject;
}
retu... | php | protected function getUploadedResource()
{
if ($this->getMappingResultsForProperty()->hasErrors()) {
return null;
}
$resourceObject = $this->getPropertyValue();
if ($resourceObject instanceof PersistentResource) {
return $resourceObject;
}
retu... | [
"protected",
"function",
"getUploadedResource",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getMappingResultsForProperty",
"(",
")",
"->",
"hasErrors",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"resourceObject",
"=",
"$",
"this",
"->",
"getPro... | Returns a previously uploaded resource.
If errors occurred during property mapping for this property, NULL is returned
@return PersistentResource | [
"Returns",
"a",
"previously",
"uploaded",
"resource",
".",
"If",
"errors",
"occurred",
"during",
"property",
"mapping",
"for",
"this",
"property",
"NULL",
"is",
"returned"
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/ViewHelpers/Form/UploadedResourceViewHelper.php#L80-L90 |
188,298 | neos/form | Classes/Core/Model/Renderable/AbstractCompositeRenderable.php | AbstractCompositeRenderable.addRenderable | protected function addRenderable(RenderableInterface $renderable)
{
if ($renderable->getParentRenderable() !== null) {
throw new FormDefinitionConsistencyException(sprintf('The renderable with identifier "%s" is already added to another element (element identifier: "%s").', $renderable->getIdent... | php | protected function addRenderable(RenderableInterface $renderable)
{
if ($renderable->getParentRenderable() !== null) {
throw new FormDefinitionConsistencyException(sprintf('The renderable with identifier "%s" is already added to another element (element identifier: "%s").', $renderable->getIdent... | [
"protected",
"function",
"addRenderable",
"(",
"RenderableInterface",
"$",
"renderable",
")",
"{",
"if",
"(",
"$",
"renderable",
"->",
"getParentRenderable",
"(",
")",
"!==",
"null",
")",
"{",
"throw",
"new",
"FormDefinitionConsistencyException",
"(",
"sprintf",
"... | Add a renderable to the list of child renderables.
This function will be wrapped by the subclasses, f.e. with an "addPage"
or "addElement" method with the correct type hint.
@param RenderableInterface $renderable
@return void
@throws FormDefinitionConsistencyException
@internal | [
"Add",
"a",
"renderable",
"to",
"the",
"list",
"of",
"child",
"renderables",
"."
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/Core/Model/Renderable/AbstractCompositeRenderable.php#L44-L52 |
188,299 | neos/form | Classes/Core/Model/Renderable/AbstractCompositeRenderable.php | AbstractCompositeRenderable.getRenderablesRecursively | public function getRenderablesRecursively()
{
$renderables = [];
foreach ($this->renderables as $renderable) {
$renderables[] = $renderable;
if ($renderable instanceof CompositeRenderableInterface) {
$renderables = array_merge($renderables, $renderable->getRen... | php | public function getRenderablesRecursively()
{
$renderables = [];
foreach ($this->renderables as $renderable) {
$renderables[] = $renderable;
if ($renderable instanceof CompositeRenderableInterface) {
$renderables = array_merge($renderables, $renderable->getRen... | [
"public",
"function",
"getRenderablesRecursively",
"(",
")",
"{",
"$",
"renderables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"renderables",
"as",
"$",
"renderable",
")",
"{",
"$",
"renderables",
"[",
"]",
"=",
"$",
"renderable",
";",
"if"... | Returns all RenderableInterface instances of this composite renderable recursively
@return RenderableInterface[]
@internal | [
"Returns",
"all",
"RenderableInterface",
"instances",
"of",
"this",
"composite",
"renderable",
"recursively"
] | 5a4de206f68a24384ee30d712f57fd9fd30a187d | https://github.com/neos/form/blob/5a4de206f68a24384ee30d712f57fd9fd30a187d/Classes/Core/Model/Renderable/AbstractCompositeRenderable.php#L135-L145 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.