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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
231,300 | PaymentSuite/paymentsuite | src/PaymentSuite/BankwireBundle/Services/BankwireManager.php | BankwireManager.declinePayment | public function declinePayment($orderId)
{
/**
* Loads order to validate.
*/
$this
->paymentBridge
->findOrder($orderId);
/**
* Order Not found Exception must be thrown just here.
*/
if (!$this->paymentBridge->getOrder()) {
throw new PaymentOrderNotFoundException();
}
/**
* Payment failed.
*
* Paid process has ended with failure
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderFail(
$this->paymentBridge,
$this
->methodFactory
->create()
);
return $this;
} | php | public function declinePayment($orderId)
{
/**
* Loads order to validate.
*/
$this
->paymentBridge
->findOrder($orderId);
/**
* Order Not found Exception must be thrown just here.
*/
if (!$this->paymentBridge->getOrder()) {
throw new PaymentOrderNotFoundException();
}
/**
* Payment failed.
*
* Paid process has ended with failure
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderFail(
$this->paymentBridge,
$this
->methodFactory
->create()
);
return $this;
} | [
"public",
"function",
"declinePayment",
"(",
"$",
"orderId",
")",
"{",
"/**\n * Loads order to validate.\n */",
"$",
"this",
"->",
"paymentBridge",
"->",
"findOrder",
"(",
"$",
"orderId",
")",
";",
"/**\n * Order Not found Exception must be thrown just... | Decline payment, given an Id of an existing order.
@param int $orderId Id from order to decline
@return BankwireManager self Object
@throws PaymentOrderNotFoundException | [
"Decline",
"payment",
"given",
"an",
"Id",
"of",
"an",
"existing",
"order",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/BankwireBundle/Services/BankwireManager.php#L173-L204 |
231,301 | benmag/laravel-rancher | src/Factories/Api/AbstractApi.php | AbstractApi.all | public function all()
{
// Get all objects from Rancher API
$objects = $this->client->get($this->getEndpoint(), $this->prepareParams());
// Decode the json response
$objects = json_decode($objects);
// Convert to entityClass
return array_map(function ($object) {
return $this->instantiateEntity($object);
}, $objects->data);
} | php | public function all()
{
// Get all objects from Rancher API
$objects = $this->client->get($this->getEndpoint(), $this->prepareParams());
// Decode the json response
$objects = json_decode($objects);
// Convert to entityClass
return array_map(function ($object) {
return $this->instantiateEntity($object);
}, $objects->data);
} | [
"public",
"function",
"all",
"(",
")",
"{",
"// Get all objects from Rancher API",
"$",
"objects",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"this",
"->",
"getEndpoint",
"(",
")",
",",
"$",
"this",
"->",
"prepareParams",
"(",
")",
")",
";"... | Get all of the Entities for the API resource.
@return mixed | [
"Get",
"all",
"of",
"the",
"Entities",
"for",
"the",
"API",
"resource",
"."
] | 8cd933757c206588215c72b6691f72515eaa0f38 | https://github.com/benmag/laravel-rancher/blob/8cd933757c206588215c72b6691f72515eaa0f38/src/Factories/Api/AbstractApi.php#L80-L93 |
231,302 | benmag/laravel-rancher | src/Factories/Api/AbstractApi.php | AbstractApi.get | public function get($id = null)
{
// Prep the endpoint
$endpoint = ($id) ? $this->getEndpoint() . "/" . $id : $this->getEndpoint();
// Get the resource
$response = $this->client->get($endpoint, $this->prepareParams());
// Handle response
return $this->handleResponse(json_decode($response));
} | php | public function get($id = null)
{
// Prep the endpoint
$endpoint = ($id) ? $this->getEndpoint() . "/" . $id : $this->getEndpoint();
// Get the resource
$response = $this->client->get($endpoint, $this->prepareParams());
// Handle response
return $this->handleResponse(json_decode($response));
} | [
"public",
"function",
"get",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"// Prep the endpoint",
"$",
"endpoint",
"=",
"(",
"$",
"id",
")",
"?",
"$",
"this",
"->",
"getEndpoint",
"(",
")",
".",
"\"/\"",
".",
"$",
"id",
":",
"$",
"this",
"->",
"getEndpoi... | Get a specified Entity from the API resource.
@param null $id
@return mixed | [
"Get",
"a",
"specified",
"Entity",
"from",
"the",
"API",
"resource",
"."
] | 8cd933757c206588215c72b6691f72515eaa0f38 | https://github.com/benmag/laravel-rancher/blob/8cd933757c206588215c72b6691f72515eaa0f38/src/Factories/Api/AbstractApi.php#L101-L113 |
231,303 | benmag/laravel-rancher | src/Factories/Api/AbstractApi.php | AbstractApi.with | public function with($relations)
{
$this->with = $relations;
$this->fields = array_merge($this->fields, $this->with);
return $this;
} | php | public function with($relations)
{
$this->with = $relations;
$this->fields = array_merge($this->fields, $this->with);
return $this;
} | [
"public",
"function",
"with",
"(",
"$",
"relations",
")",
"{",
"$",
"this",
"->",
"with",
"=",
"$",
"relations",
";",
"$",
"this",
"->",
"fields",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"fields",
",",
"$",
"this",
"->",
"with",
")",
";",
"retu... | Define the endpoints to load
@var array
@return $this | [
"Define",
"the",
"endpoints",
"to",
"load"
] | 8cd933757c206588215c72b6691f72515eaa0f38 | https://github.com/benmag/laravel-rancher/blob/8cd933757c206588215c72b6691f72515eaa0f38/src/Factories/Api/AbstractApi.php#L136-L141 |
231,304 | benmag/laravel-rancher | src/Factories/Api/AbstractApi.php | AbstractApi.instantiateEntity | public function instantiateEntity($params)
{
// Modify params so the class builder knows what was included via with()
$params->_with = $this->with;
$params->_fields = $this->fields;
// Instantiate new entity class
return new $this->class($params);
} | php | public function instantiateEntity($params)
{
// Modify params so the class builder knows what was included via with()
$params->_with = $this->with;
$params->_fields = $this->fields;
// Instantiate new entity class
return new $this->class($params);
} | [
"public",
"function",
"instantiateEntity",
"(",
"$",
"params",
")",
"{",
"// Modify params so the class builder knows what was included via with()",
"$",
"params",
"->",
"_with",
"=",
"$",
"this",
"->",
"with",
";",
"$",
"params",
"->",
"_fields",
"=",
"$",
"this",
... | Instantiate a new entityClass
@param $params
@return mixed | [
"Instantiate",
"a",
"new",
"entityClass"
] | 8cd933757c206588215c72b6691f72515eaa0f38 | https://github.com/benmag/laravel-rancher/blob/8cd933757c206588215c72b6691f72515eaa0f38/src/Factories/Api/AbstractApi.php#L201-L212 |
231,305 | benmag/laravel-rancher | src/Factories/Client.php | Client.prepareData | private function prepareData($params = [], $options = [])
{
if(array_get($options, 'content_type') == "json") {
$data['json'] = $params; // pass data as array which gets json_encoded
} else {
$data['query'] = $this->prepareQueryString($params); // pass data as query string
}
return array_merge($data, $options);
} | php | private function prepareData($params = [], $options = [])
{
if(array_get($options, 'content_type') == "json") {
$data['json'] = $params; // pass data as array which gets json_encoded
} else {
$data['query'] = $this->prepareQueryString($params); // pass data as query string
}
return array_merge($data, $options);
} | [
"private",
"function",
"prepareData",
"(",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"array_get",
"(",
"$",
"options",
",",
"'content_type'",
")",
"==",
"\"json\"",
")",
"{",
"$",
"data",
"[",
"'json'",
... | Prepare option data to be passed to the Guzzle request
@param array $params
@param array $options
@return array | [
"Prepare",
"option",
"data",
"to",
"be",
"passed",
"to",
"the",
"Guzzle",
"request"
] | 8cd933757c206588215c72b6691f72515eaa0f38 | https://github.com/benmag/laravel-rancher/blob/8cd933757c206588215c72b6691f72515eaa0f38/src/Factories/Client.php#L47-L56 |
231,306 | lukasdev/DRouter | src/App.php | App.notFound | public function notFound($fnc)
{
if (is_callable($fnc)) {
if ($fnc instanceof \Closure) {
$this->notFoundModified = $fnc;
} else {
$this->addedExceptions['\InvalidArgumentException'] = 'O callable do metodo notFound deve ser um closure!';
}
} else {
$this->addedExceptions['\InvalidArgumentException'] = 'App::notFound, callable invalido';
}
} | php | public function notFound($fnc)
{
if (is_callable($fnc)) {
if ($fnc instanceof \Closure) {
$this->notFoundModified = $fnc;
} else {
$this->addedExceptions['\InvalidArgumentException'] = 'O callable do metodo notFound deve ser um closure!';
}
} else {
$this->addedExceptions['\InvalidArgumentException'] = 'App::notFound, callable invalido';
}
} | [
"public",
"function",
"notFound",
"(",
"$",
"fnc",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"fnc",
")",
")",
"{",
"if",
"(",
"$",
"fnc",
"instanceof",
"\\",
"Closure",
")",
"{",
"$",
"this",
"->",
"notFoundModified",
"=",
"$",
"fnc",
";",
"}",... | Define uma pagina notfoud
@param callable $fnc | [
"Define",
"uma",
"pagina",
"notfoud"
] | b02e9fb595f00b89122886ccb77f623bae09141a | https://github.com/lukasdev/DRouter/blob/b02e9fb595f00b89122886ccb77f623bae09141a/src/App.php#L140-L151 |
231,307 | oanhnn/laravel-presets | src/Presets/Bootstrap.php | Bootstrap.updateSass | protected function updateSass()
{
$this->filesystem->copy($this->stubPath('/_variables.scss'), resource_path('assets/sass/_variables.scss'));
$this->filesystem->copy($this->stubPath('/app.scss'), resource_path('assets/sass/app.scss'));
} | php | protected function updateSass()
{
$this->filesystem->copy($this->stubPath('/_variables.scss'), resource_path('assets/sass/_variables.scss'));
$this->filesystem->copy($this->stubPath('/app.scss'), resource_path('assets/sass/app.scss'));
} | [
"protected",
"function",
"updateSass",
"(",
")",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"copy",
"(",
"$",
"this",
"->",
"stubPath",
"(",
"'/_variables.scss'",
")",
",",
"resource_path",
"(",
"'assets/sass/_variables.scss'",
")",
")",
";",
"$",
"this",
"... | Update the Sass files for the application.
@return void | [
"Update",
"the",
"Sass",
"files",
"for",
"the",
"application",
"."
] | b30d731bb23b764e0767715ae243876faf13408e | https://github.com/oanhnn/laravel-presets/blob/b30d731bb23b764e0767715ae243876faf13408e/src/Presets/Bootstrap.php#L38-L42 |
231,308 | PaymentSuite/paymentsuite | src/PaymentSuite/PaypalWebCheckoutBundle/Services/PaypalWebCheckoutUrlFactory.php | PaypalWebCheckoutUrlFactory.getSuccessReturnUrlForOrderId | public function getSuccessReturnUrlForOrderId($orderId)
{
$redirectRoute = $this
->redirectRoutes
->getRedirectionRoute('success');
return $this
->urlGenerator
->generate(
$redirectRoute->getRoute(),
$redirectRoute->getRouteAttributes(
$orderId
),
true
);
} | php | public function getSuccessReturnUrlForOrderId($orderId)
{
$redirectRoute = $this
->redirectRoutes
->getRedirectionRoute('success');
return $this
->urlGenerator
->generate(
$redirectRoute->getRoute(),
$redirectRoute->getRouteAttributes(
$orderId
),
true
);
} | [
"public",
"function",
"getSuccessReturnUrlForOrderId",
"(",
"$",
"orderId",
")",
"{",
"$",
"redirectRoute",
"=",
"$",
"this",
"->",
"redirectRoutes",
"->",
"getRedirectionRoute",
"(",
"'success'",
")",
";",
"return",
"$",
"this",
"->",
"urlGenerator",
"->",
"gen... | Generate success return url.
@param string $orderId Order id
@return string | [
"Generate",
"success",
"return",
"url",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/PaypalWebCheckoutBundle/Services/PaypalWebCheckoutUrlFactory.php#L93-L108 |
231,309 | JimmDiGrizli/phalcon-autoload-services | src/Registrant.php | Registrant.registration | public function registration()
{
/**
* @var Config $settings
*/
if ($this->getDI() === null) {
throw new DiNotFoundException("DI can't be found.");
}
$creator = new Creator($this->di);
foreach ($this->services as $name => $settings) {
$creator->setService($settings);
$service = $creator->injection();
if ($service !== null) {
$call = $settings->get('shared') ? 'setShared' : 'set';
$this->getDI()->$call($name, $service);
}
}
$this->services = null;
} | php | public function registration()
{
/**
* @var Config $settings
*/
if ($this->getDI() === null) {
throw new DiNotFoundException("DI can't be found.");
}
$creator = new Creator($this->di);
foreach ($this->services as $name => $settings) {
$creator->setService($settings);
$service = $creator->injection();
if ($service !== null) {
$call = $settings->get('shared') ? 'setShared' : 'set';
$this->getDI()->$call($name, $service);
}
}
$this->services = null;
} | [
"public",
"function",
"registration",
"(",
")",
"{",
"/**\n * @var Config $settings\n */",
"if",
"(",
"$",
"this",
"->",
"getDI",
"(",
")",
"===",
"null",
")",
"{",
"throw",
"new",
"DiNotFoundException",
"(",
"\"DI can't be found.\"",
")",
";",
"}"... | Registration services in the dependency injector | [
"Registration",
"services",
"in",
"the",
"dependency",
"injector"
] | 6279a2d6f85478eb0380419437950581d002f9e3 | https://github.com/JimmDiGrizli/phalcon-autoload-services/blob/6279a2d6f85478eb0380419437950581d002f9e3/src/Registrant.php#L38-L59 |
231,310 | PaymentSuite/paymentsuite | src/PaymentSuite/FreePaymentBundle/Controller/PaymentController.php | PaymentController.executeAction | public function executeAction()
{
$this
->freePaymentManager
->processPayment();
$successUrl = $this
->urlGenerator
->generate(
$this->successRedirectionRoute->getRoute(),
$this->successRedirectionRoute->getRouteAttributes(
$this->paymentBridge->getOrderId()
)
);
return new RedirectResponse($successUrl);
} | php | public function executeAction()
{
$this
->freePaymentManager
->processPayment();
$successUrl = $this
->urlGenerator
->generate(
$this->successRedirectionRoute->getRoute(),
$this->successRedirectionRoute->getRouteAttributes(
$this->paymentBridge->getOrderId()
)
);
return new RedirectResponse($successUrl);
} | [
"public",
"function",
"executeAction",
"(",
")",
"{",
"$",
"this",
"->",
"freePaymentManager",
"->",
"processPayment",
"(",
")",
";",
"$",
"successUrl",
"=",
"$",
"this",
"->",
"urlGenerator",
"->",
"generate",
"(",
"$",
"this",
"->",
"successRedirectionRoute"... | Free Payment execution.
@return RedirectResponse | [
"Free",
"Payment",
"execution",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/FreePaymentBundle/Controller/PaymentController.php#L83-L99 |
231,311 | php-task/TaskBundle | src/Executor/ExecutionProcessFactory.php | ExecutionProcessFactory.create | public function create($uuid)
{
return $process = ProcessBuilder::create(
[$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]
)
->setTimeout($this->processTimeout)
->getProcess();
} | php | public function create($uuid)
{
return $process = ProcessBuilder::create(
[$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]
)
->setTimeout($this->processTimeout)
->getProcess();
} | [
"public",
"function",
"create",
"(",
"$",
"uuid",
")",
"{",
"return",
"$",
"process",
"=",
"ProcessBuilder",
"::",
"create",
"(",
"[",
"$",
"this",
"->",
"consolePath",
",",
"'task:execute'",
",",
"$",
"uuid",
",",
"'--env='",
".",
"$",
"this",
"->",
"... | Create process for given execution-uuid.
@param string $uuid
@return Process | [
"Create",
"process",
"for",
"given",
"execution",
"-",
"uuid",
"."
] | be8f0bbdfa3dc9dcaf0e01814166730a336eea07 | https://github.com/php-task/TaskBundle/blob/be8f0bbdfa3dc9dcaf0e01814166730a336eea07/src/Executor/ExecutionProcessFactory.php#L47-L54 |
231,312 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.setModelClass | public function setModelClass($model_class): Repository
{
if ( !is_subclass_of($model_class, Model::class)) {
throw new InvalidArgumentException('Specified model class must be an instance of ' . Model::class);
}
$this->model_class = $model_class;
/** @var \Illuminate\Database\Eloquent\Model|\Fuzz\MagicBox\Contracts\MagicBoxResource $instance */
$instance = new $model_class;
// @todo use set methods
$this->setFillable($instance->getRepositoryFillable());
$this->setIncludable($instance->getRepositoryIncludable());
$this->setFilterable($instance->getRepositoryFilterable());
$this->key_name = $instance->getKeyName();
return $this;
} | php | public function setModelClass($model_class): Repository
{
if ( !is_subclass_of($model_class, Model::class)) {
throw new InvalidArgumentException('Specified model class must be an instance of ' . Model::class);
}
$this->model_class = $model_class;
/** @var \Illuminate\Database\Eloquent\Model|\Fuzz\MagicBox\Contracts\MagicBoxResource $instance */
$instance = new $model_class;
// @todo use set methods
$this->setFillable($instance->getRepositoryFillable());
$this->setIncludable($instance->getRepositoryIncludable());
$this->setFilterable($instance->getRepositoryFilterable());
$this->key_name = $instance->getKeyName();
return $this;
} | [
"public",
"function",
"setModelClass",
"(",
"$",
"model_class",
")",
":",
"Repository",
"{",
"if",
"(",
"!",
"is_subclass_of",
"(",
"$",
"model_class",
",",
"Model",
"::",
"class",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Specified mod... | Set the model for an instance of this resource controller.
@param string $model_class
@return \Fuzz\MagicBox\Contracts\Repository | [
"Set",
"the",
"model",
"for",
"an",
"instance",
"of",
"this",
"resource",
"controller",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L138-L157 |
231,313 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.addFilters | public function addFilters(array $filters): Repository
{
foreach ($filters as $key => $value) {
$this->addFilter($key, $value);
}
return $this;
} | php | public function addFilters(array $filters): Repository
{
foreach ($filters as $key => $value) {
$this->addFilter($key, $value);
}
return $this;
} | [
"public",
"function",
"addFilters",
"(",
"array",
"$",
"filters",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"addFilter",
"(",
"$",
"key",
",",
"$",
"value",
")",
... | Add filters to already existing filters without overwriting them.
@param array $filters
@return \Fuzz\MagicBox\Contracts\Repository | [
"Add",
"filters",
"to",
"already",
"existing",
"filters",
"without",
"overwriting",
"them",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L289-L296 |
231,314 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.addFilter | public function addFilter(string $key, string $value): Repository
{
$this->filters[$key] = $value;
return $this;
} | php | public function addFilter(string $key, string $value): Repository
{
$this->filters[$key] = $value;
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"value",
")",
":",
"Repository",
"{",
"$",
"this",
"->",
"filters",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Add a single filter to already existing filters without overwriting them.
@param string $key
@param string $value
@return \Fuzz\MagicBox\Contracts\Repository | [
"Add",
"a",
"single",
"filter",
"to",
"already",
"existing",
"filters",
"without",
"overwriting",
"them",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L305-L310 |
231,315 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.setFillable | public function setFillable(array $fillable): Repository
{
if ($fillable === self::ALLOW_ALL) {
$this->fillable = self::ALLOW_ALL;
return $this;
}
// Reset fillable
$this->fillable = [];
foreach ($fillable as $allowed_field) {
$this->fillable[$allowed_field] = true;
}
return $this;
} | php | public function setFillable(array $fillable): Repository
{
if ($fillable === self::ALLOW_ALL) {
$this->fillable = self::ALLOW_ALL;
return $this;
}
// Reset fillable
$this->fillable = [];
foreach ($fillable as $allowed_field) {
$this->fillable[$allowed_field] = true;
}
return $this;
} | [
"public",
"function",
"setFillable",
"(",
"array",
"$",
"fillable",
")",
":",
"Repository",
"{",
"if",
"(",
"$",
"fillable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"$",
"this",
"->",
"fillable",
"=",
"self",
"::",
"ALLOW_ALL",
";",
"return",
"$",
... | Set the fillable array
@param array $fillable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Set",
"the",
"fillable",
"array"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L426-L442 |
231,316 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.getFillable | public function getFillable(bool $assoc = false): array
{
if ($this->fillable === self::ALLOW_ALL) {
return self::ALLOW_ALL;
}
return $assoc ? $this->fillable : array_keys($this->fillable);
} | php | public function getFillable(bool $assoc = false): array
{
if ($this->fillable === self::ALLOW_ALL) {
return self::ALLOW_ALL;
}
return $assoc ? $this->fillable : array_keys($this->fillable);
} | [
"public",
"function",
"getFillable",
"(",
"bool",
"$",
"assoc",
"=",
"false",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"fillable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"return",
"self",
"::",
"ALLOW_ALL",
";",
"}",
"return",
"$",
... | Get the fillable attributes
@param bool $assoc
@return array | [
"Get",
"the",
"fillable",
"attributes"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L451-L458 |
231,317 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.addManyFillable | public function addManyFillable(array $fillable): Repository
{
foreach ($fillable as $allowed_field) {
$this->addFillable($allowed_field);
}
return $this;
} | php | public function addManyFillable(array $fillable): Repository
{
foreach ($fillable as $allowed_field) {
$this->addFillable($allowed_field);
}
return $this;
} | [
"public",
"function",
"addManyFillable",
"(",
"array",
"$",
"fillable",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"fillable",
"as",
"$",
"allowed_field",
")",
"{",
"$",
"this",
"->",
"addFillable",
"(",
"$",
"allowed_field",
")",
";",
"}",
"return"... | Add many fillable fields
@param array $fillable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Add",
"many",
"fillable",
"fields"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L481-L488 |
231,318 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.removeManyFillable | public function removeManyFillable(array $fillable): Repository
{
foreach ($fillable as $disallowed_field) {
$this->removeFillable($disallowed_field);
}
return $this;
} | php | public function removeManyFillable(array $fillable): Repository
{
foreach ($fillable as $disallowed_field) {
$this->removeFillable($disallowed_field);
}
return $this;
} | [
"public",
"function",
"removeManyFillable",
"(",
"array",
"$",
"fillable",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"fillable",
"as",
"$",
"disallowed_field",
")",
"{",
"$",
"this",
"->",
"removeFillable",
"(",
"$",
"disallowed_field",
")",
";",
"}"... | Remove many fillable fields
@param array $fillable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Remove",
"many",
"fillable",
"fields"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L511-L518 |
231,319 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.isFillable | public function isFillable(string $key): bool
{
if ($this->fillable === self::ALLOW_ALL) {
return true;
}
return isset($this->fillable[$key]) && $this->fillable[$key];
} | php | public function isFillable(string $key): bool
{
if ($this->fillable === self::ALLOW_ALL) {
return true;
}
return isset($this->fillable[$key]) && $this->fillable[$key];
} | [
"public",
"function",
"isFillable",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"fillable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"return",
"true",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"fillab... | Determine whether a given key is fillable
@param string $key
@return bool | [
"Determine",
"whether",
"a",
"given",
"key",
"is",
"fillable"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L527-L534 |
231,320 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.setIncludable | public function setIncludable(array $includable): Repository
{
if ($includable === self::ALLOW_ALL) {
$this->includable = self::ALLOW_ALL;
return $this;
}
// Reset includable
$this->includable = [];
foreach ($includable as $allowed_include) {
$this->includable[$allowed_include] = true;
}
return $this;
} | php | public function setIncludable(array $includable): Repository
{
if ($includable === self::ALLOW_ALL) {
$this->includable = self::ALLOW_ALL;
return $this;
}
// Reset includable
$this->includable = [];
foreach ($includable as $allowed_include) {
$this->includable[$allowed_include] = true;
}
return $this;
} | [
"public",
"function",
"setIncludable",
"(",
"array",
"$",
"includable",
")",
":",
"Repository",
"{",
"if",
"(",
"$",
"includable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"$",
"this",
"->",
"includable",
"=",
"self",
"::",
"ALLOW_ALL",
";",
"return",
... | Set the relationships which can be included by the model
@param array $includable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Set",
"the",
"relationships",
"which",
"can",
"be",
"included",
"by",
"the",
"model"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L543-L559 |
231,321 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.getIncludable | public function getIncludable(bool $assoc = false): array
{
if ($this->includable === self::ALLOW_ALL) {
return self::ALLOW_ALL;
}
return $assoc ? $this->includable : array_keys($this->includable);
} | php | public function getIncludable(bool $assoc = false): array
{
if ($this->includable === self::ALLOW_ALL) {
return self::ALLOW_ALL;
}
return $assoc ? $this->includable : array_keys($this->includable);
} | [
"public",
"function",
"getIncludable",
"(",
"bool",
"$",
"assoc",
"=",
"false",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"includable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"return",
"self",
"::",
"ALLOW_ALL",
";",
"}",
"return",
"$"... | Get the includable relationships
@param bool $assoc
@return array | [
"Get",
"the",
"includable",
"relationships"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L568-L575 |
231,322 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.addManyIncludable | public function addManyIncludable(array $includable): Repository
{
foreach ($includable as $allowed_include) {
$this->addIncludable($allowed_include);
}
return $this;
} | php | public function addManyIncludable(array $includable): Repository
{
foreach ($includable as $allowed_include) {
$this->addIncludable($allowed_include);
}
return $this;
} | [
"public",
"function",
"addManyIncludable",
"(",
"array",
"$",
"includable",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"includable",
"as",
"$",
"allowed_include",
")",
"{",
"$",
"this",
"->",
"addIncludable",
"(",
"$",
"allowed_include",
")",
";",
"}"... | Add many includable fields
@param array $includable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Add",
"many",
"includable",
"fields"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L598-L605 |
231,323 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.removeManyIncludable | public function removeManyIncludable(array $includable): Repository
{
foreach ($includable as $disallowed_include) {
$this->removeIncludable($disallowed_include);
}
return $this;
} | php | public function removeManyIncludable(array $includable): Repository
{
foreach ($includable as $disallowed_include) {
$this->removeIncludable($disallowed_include);
}
return $this;
} | [
"public",
"function",
"removeManyIncludable",
"(",
"array",
"$",
"includable",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"includable",
"as",
"$",
"disallowed_include",
")",
"{",
"$",
"this",
"->",
"removeIncludable",
"(",
"$",
"disallowed_include",
")",
... | Remove many includable relationships
@param array $includable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Remove",
"many",
"includable",
"relationships"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L628-L635 |
231,324 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.isIncludable | public function isIncludable(string $key): bool
{
if ($this->includable === self::ALLOW_ALL) {
return true;
}
return isset($this->includable[$key]) && $this->includable[$key];
} | php | public function isIncludable(string $key): bool
{
if ($this->includable === self::ALLOW_ALL) {
return true;
}
return isset($this->includable[$key]) && $this->includable[$key];
} | [
"public",
"function",
"isIncludable",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"includable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"return",
"true",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"in... | Determine whether a given key is includable
@param string $key
@return bool | [
"Determine",
"whether",
"a",
"given",
"key",
"is",
"includable"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L644-L651 |
231,325 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.setFilterable | public function setFilterable(array $filterable): Repository
{
if ($filterable === self::ALLOW_ALL) {
$this->filterable = self::ALLOW_ALL;
return $this;
}
// Reset filterable
$this->filterable = [];
foreach ($filterable as $allowed_field) {
$this->filterable[$allowed_field] = true;
}
return $this;
} | php | public function setFilterable(array $filterable): Repository
{
if ($filterable === self::ALLOW_ALL) {
$this->filterable = self::ALLOW_ALL;
return $this;
}
// Reset filterable
$this->filterable = [];
foreach ($filterable as $allowed_field) {
$this->filterable[$allowed_field] = true;
}
return $this;
} | [
"public",
"function",
"setFilterable",
"(",
"array",
"$",
"filterable",
")",
":",
"Repository",
"{",
"if",
"(",
"$",
"filterable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"$",
"this",
"->",
"filterable",
"=",
"self",
"::",
"ALLOW_ALL",
";",
"return",
... | Set the fields which can be filtered on the model
@param array $filterable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Set",
"the",
"fields",
"which",
"can",
"be",
"filtered",
"on",
"the",
"model"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L660-L676 |
231,326 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.getFilterable | public function getFilterable(bool $assoc = false): array
{
if ($this->filterable === self::ALLOW_ALL) {
return self::ALLOW_ALL;
}
return $assoc ? $this->filterable : array_keys($this->filterable);
} | php | public function getFilterable(bool $assoc = false): array
{
if ($this->filterable === self::ALLOW_ALL) {
return self::ALLOW_ALL;
}
return $assoc ? $this->filterable : array_keys($this->filterable);
} | [
"public",
"function",
"getFilterable",
"(",
"bool",
"$",
"assoc",
"=",
"false",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"filterable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"return",
"self",
"::",
"ALLOW_ALL",
";",
"}",
"return",
"$"... | Get the filterable fields
@param bool $assoc
@return array | [
"Get",
"the",
"filterable",
"fields"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L685-L692 |
231,327 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.addManyFilterable | public function addManyFilterable(array $filterable): Repository
{
foreach ($filterable as $allowed_field) {
$this->addFilterable($allowed_field);
}
return $this;
} | php | public function addManyFilterable(array $filterable): Repository
{
foreach ($filterable as $allowed_field) {
$this->addFilterable($allowed_field);
}
return $this;
} | [
"public",
"function",
"addManyFilterable",
"(",
"array",
"$",
"filterable",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"filterable",
"as",
"$",
"allowed_field",
")",
"{",
"$",
"this",
"->",
"addFilterable",
"(",
"$",
"allowed_field",
")",
";",
"}",
... | Add many filterable fields
@param array $filterable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Add",
"many",
"filterable",
"fields"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L715-L722 |
231,328 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.removeManyFilterable | public function removeManyFilterable(array $filterable): Repository
{
foreach ($filterable as $disallowed_field) {
$this->removeFilterable($disallowed_field);
}
return $this;
} | php | public function removeManyFilterable(array $filterable): Repository
{
foreach ($filterable as $disallowed_field) {
$this->removeFilterable($disallowed_field);
}
return $this;
} | [
"public",
"function",
"removeManyFilterable",
"(",
"array",
"$",
"filterable",
")",
":",
"Repository",
"{",
"foreach",
"(",
"$",
"filterable",
"as",
"$",
"disallowed_field",
")",
"{",
"$",
"this",
"->",
"removeFilterable",
"(",
"$",
"disallowed_field",
")",
";... | Remove many filterable fields
@param array $filterable
@return \Fuzz\MagicBox\Contracts\Repository | [
"Remove",
"many",
"filterable",
"fields"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L745-L752 |
231,329 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.isFilterable | public function isFilterable(string $key): bool
{
if ($this->filterable === self::ALLOW_ALL) {
return true;
}
return isset($this->filterable[$key]) && $this->filterable[$key];
} | php | public function isFilterable(string $key): bool
{
if ($this->filterable === self::ALLOW_ALL) {
return true;
}
return isset($this->filterable[$key]) && $this->filterable[$key];
} | [
"public",
"function",
"isFilterable",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"filterable",
"===",
"self",
"::",
"ALLOW_ALL",
")",
"{",
"return",
"true",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"fi... | Determine whether a given key is filterable
@param string $key
@return bool | [
"Determine",
"whether",
"a",
"given",
"key",
"is",
"filterable"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L761-L768 |
231,330 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.query | protected function query()
{
$query = forward_static_call(
[
$this->getModelClass(),
'query',
]
);
$this->modifyQuery($query);
$eager_loads = $this->getEagerLoads();
if ( !empty($eager_loads)) {
$this->safeWith($query, $eager_loads);
}
if ( !empty($modifiers = $this->getModifiers())) {
foreach ($modifiers as $modifier) {
$modifier($query);
}
}
return $query;
} | php | protected function query()
{
$query = forward_static_call(
[
$this->getModelClass(),
'query',
]
);
$this->modifyQuery($query);
$eager_loads = $this->getEagerLoads();
if ( !empty($eager_loads)) {
$this->safeWith($query, $eager_loads);
}
if ( !empty($modifiers = $this->getModifiers())) {
foreach ($modifiers as $modifier) {
$modifier($query);
}
}
return $query;
} | [
"protected",
"function",
"query",
"(",
")",
"{",
"$",
"query",
"=",
"forward_static_call",
"(",
"[",
"$",
"this",
"->",
"getModelClass",
"(",
")",
",",
"'query'",
",",
"]",
")",
";",
"$",
"this",
"->",
"modifyQuery",
"(",
"$",
"query",
")",
";",
"$",... | Base query for all behaviors within this repository.
@return \Illuminate\Database\Eloquent\Builder | [
"Base",
"query",
"for",
"all",
"behaviors",
"within",
"this",
"repository",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L786-L810 |
231,331 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.sortQuery | protected function sortQuery(Builder $query, array $sort_order_options, Model $temp_instance, array $columns)
{
$allowed_directions = [
'ASC',
'DESC',
];
foreach ($sort_order_options as $order_by => $direction) {
if (in_array(strtoupper($direction), $allowed_directions)) {
$split = explode(self::GLUE, $order_by);
// Sorts deeper than the depth restriction + 1 are not allowed
// Depth restriction is offset by 1 because sorts terminate with a column
// i.e. 'users.posts.title' => 'asc' but the depth we expect is 'users.posts'
if (count($split) > ($this->getDepthRestriction() + 1)) {
// Unset the disallowed sort
unset($sort_order_options[$order_by]);
continue;
}
if (in_array($order_by, $columns)) {
$query->orderBy($order_by, $direction);
} else {
// Pull out orderBy field
$field = array_pop($split);
// Select only the base table fields, don't select relation data. Desired relation data
// should be explicitly included
$base_table = $temp_instance->getTable();
$query->selectRaw("$base_table.*");
$this->applyNestedJoins($query, $split, $temp_instance, $field, $direction);
}
}
}
} | php | protected function sortQuery(Builder $query, array $sort_order_options, Model $temp_instance, array $columns)
{
$allowed_directions = [
'ASC',
'DESC',
];
foreach ($sort_order_options as $order_by => $direction) {
if (in_array(strtoupper($direction), $allowed_directions)) {
$split = explode(self::GLUE, $order_by);
// Sorts deeper than the depth restriction + 1 are not allowed
// Depth restriction is offset by 1 because sorts terminate with a column
// i.e. 'users.posts.title' => 'asc' but the depth we expect is 'users.posts'
if (count($split) > ($this->getDepthRestriction() + 1)) {
// Unset the disallowed sort
unset($sort_order_options[$order_by]);
continue;
}
if (in_array($order_by, $columns)) {
$query->orderBy($order_by, $direction);
} else {
// Pull out orderBy field
$field = array_pop($split);
// Select only the base table fields, don't select relation data. Desired relation data
// should be explicitly included
$base_table = $temp_instance->getTable();
$query->selectRaw("$base_table.*");
$this->applyNestedJoins($query, $split, $temp_instance, $field, $direction);
}
}
}
} | [
"protected",
"function",
"sortQuery",
"(",
"Builder",
"$",
"query",
",",
"array",
"$",
"sort_order_options",
",",
"Model",
"$",
"temp_instance",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"allowed_directions",
"=",
"[",
"'ASC'",
",",
"'DESC'",
",",
"]",
... | Apply a sort to a database query
@param \Illuminate\Database\Eloquent\Builder $query
@param array $sort_order_options
@param \Illuminate\Database\Eloquent\Model $temp_instance
@param array $columns | [
"Apply",
"a",
"sort",
"to",
"a",
"database",
"query"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L905-L940 |
231,332 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.applyNestedJoins | public function applyNestedJoins(Builder $query, array $relations, Model $instance, $field, $direction = 'asc')
{
$base_table = $instance->getTable();
// The current working relation
$relation = $relations[0];
// Current working table
$table = Str::plural($relation);
$singular = Str::singular($relation);
$class = get_class($instance);
// If the relation exists, determine which type (singular, multiple)
if ($this->isRelation($instance, $singular, $class)) {
$related = $instance->$singular();
} elseif ($this->isRelation($instance, $relation, $class)) {
$related = $instance->$relation();
} else {
// This relation does not exist
return;
}
$foreign_key = $related->getForeignKey();
// Join tables differently depending on relationship type
switch (get_class($related)) {
case BelongsToMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsToMany $related
*/
$base_table_key = $instance->getKeyName();
$relation_primary_key = $related->getModel()->getKeyName();
// Join through the pivot table
$query->join($related->getTable(), "$base_table.$base_table_key", '=', $foreign_key);
$query->join($table, $related->getOtherKey(), '=', "$relation.$relation_primary_key");
break;
case HasMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasMany $related
*/
$base_table_key = $instance->getKeyName();
// Join child's table
$query->join($table, "$base_table.$base_table_key", '=', $foreign_key);
break;
case BelongsTo::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo $related
*/
$relation_key = $related->getOtherKey();
// Join related's table on the base table's foreign key
$query->join($table, "$base_table.$foreign_key", '=', "$table.$relation_key");
break;
case HasOne::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasOne $related
*/
$parent_key = $instance->getKeyName();
// Join related's table on the base table's foreign key
$query->join($table, "$base_table.$parent_key", '=', "$foreign_key");
break;
}
// @todo is it necessary to allow nested relationships further than the first/second degrees?
array_shift($relations);
if (count($relations) >= 1) {
$this->applyNestedJoins($query, $relations, $related->getModel(), $field, $direction);
} else {
$query->orderBy("$table.$field", $direction);
}
} | php | public function applyNestedJoins(Builder $query, array $relations, Model $instance, $field, $direction = 'asc')
{
$base_table = $instance->getTable();
// The current working relation
$relation = $relations[0];
// Current working table
$table = Str::plural($relation);
$singular = Str::singular($relation);
$class = get_class($instance);
// If the relation exists, determine which type (singular, multiple)
if ($this->isRelation($instance, $singular, $class)) {
$related = $instance->$singular();
} elseif ($this->isRelation($instance, $relation, $class)) {
$related = $instance->$relation();
} else {
// This relation does not exist
return;
}
$foreign_key = $related->getForeignKey();
// Join tables differently depending on relationship type
switch (get_class($related)) {
case BelongsToMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsToMany $related
*/
$base_table_key = $instance->getKeyName();
$relation_primary_key = $related->getModel()->getKeyName();
// Join through the pivot table
$query->join($related->getTable(), "$base_table.$base_table_key", '=', $foreign_key);
$query->join($table, $related->getOtherKey(), '=', "$relation.$relation_primary_key");
break;
case HasMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasMany $related
*/
$base_table_key = $instance->getKeyName();
// Join child's table
$query->join($table, "$base_table.$base_table_key", '=', $foreign_key);
break;
case BelongsTo::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo $related
*/
$relation_key = $related->getOtherKey();
// Join related's table on the base table's foreign key
$query->join($table, "$base_table.$foreign_key", '=', "$table.$relation_key");
break;
case HasOne::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasOne $related
*/
$parent_key = $instance->getKeyName();
// Join related's table on the base table's foreign key
$query->join($table, "$base_table.$parent_key", '=', "$foreign_key");
break;
}
// @todo is it necessary to allow nested relationships further than the first/second degrees?
array_shift($relations);
if (count($relations) >= 1) {
$this->applyNestedJoins($query, $relations, $related->getModel(), $field, $direction);
} else {
$query->orderBy("$table.$field", $direction);
}
} | [
"public",
"function",
"applyNestedJoins",
"(",
"Builder",
"$",
"query",
",",
"array",
"$",
"relations",
",",
"Model",
"$",
"instance",
",",
"$",
"field",
",",
"$",
"direction",
"=",
"'asc'",
")",
"{",
"$",
"base_table",
"=",
"$",
"instance",
"->",
"getTa... | Apply nested joins to allow nested sorting for select relationship combinations
@param \Illuminate\Database\Eloquent\Builder $query
@param array $relations
@param \Illuminate\Database\Eloquent\Model $instance
@param $field
@param string $direction
@return void | [
"Apply",
"nested",
"joins",
"to",
"allow",
"nested",
"sorting",
"for",
"select",
"relationship",
"combinations"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1037-L1111 |
231,333 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.getInputId | public function getInputId()
{
$input = $this->getInput();
/** @var Model $model */
$model = $this->getModelClass();
// If the model or the input is not set, then we cannot get an id.
if (! $model || ! $input) {
return null;
}
return array_get($input, (new $model)->getKeyName());
} | php | public function getInputId()
{
$input = $this->getInput();
/** @var Model $model */
$model = $this->getModelClass();
// If the model or the input is not set, then we cannot get an id.
if (! $model || ! $input) {
return null;
}
return array_get($input, (new $model)->getKeyName());
} | [
"public",
"function",
"getInputId",
"(",
")",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"getInput",
"(",
")",
";",
"/** @var Model $model */",
"$",
"model",
"=",
"$",
"this",
"->",
"getModelClass",
"(",
")",
";",
"// If the model or the input is not set, then w... | Get the primary key from input.
@return mixed | [
"Get",
"the",
"primary",
"key",
"from",
"input",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1191-L1204 |
231,334 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.fill | protected function fill(Model $instance): bool
{
$input = $this->getInput();
$model_fields = $this->getFields($instance);
$before_relations = [];
$after_relations = [];
$instance_model = get_class($instance);
$safe_instance = new $instance_model;
$input = ($safe_instance->getIncrementing()) ? array_except($input, [$instance->getKeyName()]) : $input;
foreach ($input as $key => $value) {
if (($relation = $this->isRelation($instance, $key, $instance_model)) && $this->isFillable($key)) {
$relation_type = get_class($relation);
switch ($relation_type) {
case BelongsTo::class:
$before_relations[] = [
'relation' => $relation,
'value' => $value,
];
break;
case HasOne::class:
case HasMany::class:
case BelongsToMany::class:
$after_relations[] = [
'relation' => $relation,
'value' => $value,
];
break;
}
} elseif ((in_array($key, $model_fields) || $instance->hasSetMutator($key)) && $this->isFillable($key)) {
$instance->{$key} = $value;
}
}
unset($safe_instance);
$this->applyRelations($before_relations, $instance);
$instance->save();
$this->applyRelations($after_relations, $instance);
return true;
} | php | protected function fill(Model $instance): bool
{
$input = $this->getInput();
$model_fields = $this->getFields($instance);
$before_relations = [];
$after_relations = [];
$instance_model = get_class($instance);
$safe_instance = new $instance_model;
$input = ($safe_instance->getIncrementing()) ? array_except($input, [$instance->getKeyName()]) : $input;
foreach ($input as $key => $value) {
if (($relation = $this->isRelation($instance, $key, $instance_model)) && $this->isFillable($key)) {
$relation_type = get_class($relation);
switch ($relation_type) {
case BelongsTo::class:
$before_relations[] = [
'relation' => $relation,
'value' => $value,
];
break;
case HasOne::class:
case HasMany::class:
case BelongsToMany::class:
$after_relations[] = [
'relation' => $relation,
'value' => $value,
];
break;
}
} elseif ((in_array($key, $model_fields) || $instance->hasSetMutator($key)) && $this->isFillable($key)) {
$instance->{$key} = $value;
}
}
unset($safe_instance);
$this->applyRelations($before_relations, $instance);
$instance->save();
$this->applyRelations($after_relations, $instance);
return true;
} | [
"protected",
"function",
"fill",
"(",
"Model",
"$",
"instance",
")",
":",
"bool",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"getInput",
"(",
")",
";",
"$",
"model_fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
"$",
"instance",
")",
";",
"$",
"... | Fill an instance of a model with all known fields.
@param \Illuminate\Database\Eloquent\Model $instance
@return mixed
@todo support more relationship types, such as polymorphic ones! | [
"Fill",
"an",
"instance",
"of",
"a",
"model",
"with",
"all",
"known",
"fields",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1213-L1256 |
231,335 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.applyRelations | protected function applyRelations(array $specs, Model $instance)
{
foreach ($specs as $spec) {
$this->cascadeRelation($spec['relation'], $spec['value'], $instance);
}
} | php | protected function applyRelations(array $specs, Model $instance)
{
foreach ($specs as $spec) {
$this->cascadeRelation($spec['relation'], $spec['value'], $instance);
}
} | [
"protected",
"function",
"applyRelations",
"(",
"array",
"$",
"specs",
",",
"Model",
"$",
"instance",
")",
"{",
"foreach",
"(",
"$",
"specs",
"as",
"$",
"spec",
")",
"{",
"$",
"this",
"->",
"cascadeRelation",
"(",
"$",
"spec",
"[",
"'relation'",
"]",
"... | Apply relations from an array to an instance model.
@param array $specs
@param \Illuminate\Database\Eloquent\Model $instance
@return void | [
"Apply",
"relations",
"from",
"an",
"array",
"to",
"an",
"instance",
"model",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1265-L1270 |
231,336 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.cascadeRelation | protected function cascadeRelation(Relation $relation, array $input, Model $parent = null)
{
// Make a child repository for containing the cascaded relationship through saves
$target_model_class = get_class($relation->getQuery()->getModel());
$relation_repository = (new self)->setModelClass($target_model_class);
switch (get_class($relation)) {
case BelongsTo::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo $relation
*/
// For BelongsTo, simply associate by foreign key.
// (We don't have to assume the parent model exists to do this.)
$related = $relation_repository->setInput($input)->save();
$relation->associate($related);
break;
case HasMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasMany $relation
*/
// The parent model "owns" child models; any not specified here should be deleted.
$current_ids = $relation->pluck($this->getKeyName())->toArray();
$new_ids = array_filter(array_column($input, $this->getKeyName()));
$removed_ids = array_diff($current_ids, $new_ids);
if ( !empty($removed_ids)) {
$relation->whereIn($this->getKeyName(), $removed_ids)->delete();
}
// Set foreign keys on the children from the parent, and save.
foreach ($input as $sub_input) {
$sub_input[$this->getRelationsForeignKeyName($relation)] = $parent->{$this->getKeyName()};
$relation_repository->setInput($sub_input)->save();
}
break;
case HasOne::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasOne $relation
*/
// The parent model "owns" the child model; if we have a new and/or different
// existing child model, delete the old one.
$current = $relation->getResults();
if ( !is_null($current)
&& ( !isset($input[$this->getKeyName()]) || $current->{$this->getKeyName()} !== intval($input[$this->getKeyName()]))
) {
$relation->delete();
}
// Set foreign key on the child from the parent, and save.
$input[$this->getRelationsForeignKeyName($relation)] = $parent->{$this->getKeyName()};
$relation_repository->setInput($input)->save();
break;
case BelongsToMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsToMany $relation
*/
// Find all the IDs to sync.
$ids = [];
foreach ($input as $sub_input) {
$id = $relation_repository->setInput($sub_input)->save()->{$this->getKeyName()};
// If we were passed pivot data, pass it through accordingly.
if (isset($sub_input['pivot'])) {
$ids[$id] = (array)$sub_input['pivot'];
} else {
$ids[] = $id;
}
}
// Sync to save pivot table and optional extra data.
$relation->sync($ids);
break;
}
} | php | protected function cascadeRelation(Relation $relation, array $input, Model $parent = null)
{
// Make a child repository for containing the cascaded relationship through saves
$target_model_class = get_class($relation->getQuery()->getModel());
$relation_repository = (new self)->setModelClass($target_model_class);
switch (get_class($relation)) {
case BelongsTo::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo $relation
*/
// For BelongsTo, simply associate by foreign key.
// (We don't have to assume the parent model exists to do this.)
$related = $relation_repository->setInput($input)->save();
$relation->associate($related);
break;
case HasMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasMany $relation
*/
// The parent model "owns" child models; any not specified here should be deleted.
$current_ids = $relation->pluck($this->getKeyName())->toArray();
$new_ids = array_filter(array_column($input, $this->getKeyName()));
$removed_ids = array_diff($current_ids, $new_ids);
if ( !empty($removed_ids)) {
$relation->whereIn($this->getKeyName(), $removed_ids)->delete();
}
// Set foreign keys on the children from the parent, and save.
foreach ($input as $sub_input) {
$sub_input[$this->getRelationsForeignKeyName($relation)] = $parent->{$this->getKeyName()};
$relation_repository->setInput($sub_input)->save();
}
break;
case HasOne::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\HasOne $relation
*/
// The parent model "owns" the child model; if we have a new and/or different
// existing child model, delete the old one.
$current = $relation->getResults();
if ( !is_null($current)
&& ( !isset($input[$this->getKeyName()]) || $current->{$this->getKeyName()} !== intval($input[$this->getKeyName()]))
) {
$relation->delete();
}
// Set foreign key on the child from the parent, and save.
$input[$this->getRelationsForeignKeyName($relation)] = $parent->{$this->getKeyName()};
$relation_repository->setInput($input)->save();
break;
case BelongsToMany::class:
/**
* @var \Illuminate\Database\Eloquent\Relations\BelongsToMany $relation
*/
// Find all the IDs to sync.
$ids = [];
foreach ($input as $sub_input) {
$id = $relation_repository->setInput($sub_input)->save()->{$this->getKeyName()};
// If we were passed pivot data, pass it through accordingly.
if (isset($sub_input['pivot'])) {
$ids[$id] = (array)$sub_input['pivot'];
} else {
$ids[] = $id;
}
}
// Sync to save pivot table and optional extra data.
$relation->sync($ids);
break;
}
} | [
"protected",
"function",
"cascadeRelation",
"(",
"Relation",
"$",
"relation",
",",
"array",
"$",
"input",
",",
"Model",
"$",
"parent",
"=",
"null",
")",
"{",
"// Make a child repository for containing the cascaded relationship through saves",
"$",
"target_model_class",
"=... | Cascade relations through saves on a model.
@param \Illuminate\Database\Eloquent\Relations\Relation $relation
@param array $input
@param \Illuminate\Database\Eloquent\Model $parent
@return void | [
"Cascade",
"relations",
"through",
"saves",
"on",
"a",
"model",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1281-L1354 |
231,337 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.create | public function create(): Model
{
$model_class = $this->getModelClass();
$instance = new $model_class;
$this->fill($instance);
return $instance;
} | php | public function create(): Model
{
$model_class = $this->getModelClass();
$instance = new $model_class;
$this->fill($instance);
return $instance;
} | [
"public",
"function",
"create",
"(",
")",
":",
"Model",
"{",
"$",
"model_class",
"=",
"$",
"this",
"->",
"getModelClass",
"(",
")",
";",
"$",
"instance",
"=",
"new",
"$",
"model_class",
";",
"$",
"this",
"->",
"fill",
"(",
"$",
"instance",
")",
";",
... | Create a model.
@return Model | Collection | [
"Create",
"a",
"model",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1361-L1368 |
231,338 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.createMany | public function createMany(): Collection
{
$collection = new Collection();
foreach ($this->getInput() as $item) {
$repository = clone $this;
$repository->setInput($item);
$collection->add($repository->create());
}
return $collection;
} | php | public function createMany(): Collection
{
$collection = new Collection();
foreach ($this->getInput() as $item) {
$repository = clone $this;
$repository->setInput($item);
$collection->add($repository->create());
}
return $collection;
} | [
"public",
"function",
"createMany",
"(",
")",
":",
"Collection",
"{",
"$",
"collection",
"=",
"new",
"Collection",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getInput",
"(",
")",
"as",
"$",
"item",
")",
"{",
"$",
"repository",
"=",
"clone",
"... | Create many models.
@return Collection | [
"Create",
"many",
"models",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1375-L1386 |
231,339 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.update | public function update($id = null): Model
{
$instance = $this->read($id);
$this->fill($instance);
return $this->read($instance->getKey());
} | php | public function update($id = null): Model
{
$instance = $this->read($id);
$this->fill($instance);
return $this->read($instance->getKey());
} | [
"public",
"function",
"update",
"(",
"$",
"id",
"=",
"null",
")",
":",
"Model",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"read",
"(",
"$",
"id",
")",
";",
"$",
"this",
"->",
"fill",
"(",
"$",
"instance",
")",
";",
"return",
"$",
"this",
"-... | Update a model.
@param int|string|null $id
@return Model|Collection | [
"Update",
"a",
"model",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1407-L1413 |
231,340 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.updateMany | public function updateMany(): Collection
{
$collection = new Collection();
foreach ($this->getInput() as $item) {
$repository = clone $this;
$repository->setInput($item);
$collection->add($repository->update($repository->getInputId()));
}
return $collection;
} | php | public function updateMany(): Collection
{
$collection = new Collection();
foreach ($this->getInput() as $item) {
$repository = clone $this;
$repository->setInput($item);
$collection->add($repository->update($repository->getInputId()));
}
return $collection;
} | [
"public",
"function",
"updateMany",
"(",
")",
":",
"Collection",
"{",
"$",
"collection",
"=",
"new",
"Collection",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getInput",
"(",
")",
"as",
"$",
"item",
")",
"{",
"$",
"repository",
"=",
"clone",
"... | Updates many models.
@return Collection | [
"Updates",
"many",
"models",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1420-L1431 |
231,341 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.save | public function save($id = null): Model
{
$id = $id ?? $this->getInputId();
if ($id) {
return $this->update($id);
}
return $this->create();
} | php | public function save($id = null): Model
{
$id = $id ?? $this->getInputId();
if ($id) {
return $this->update($id);
}
return $this->create();
} | [
"public",
"function",
"save",
"(",
"$",
"id",
"=",
"null",
")",
":",
"Model",
"{",
"$",
"id",
"=",
"$",
"id",
"??",
"$",
"this",
"->",
"getInputId",
"(",
")",
";",
"if",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"update",
"(",
"$... | Save a model, regardless of whether or not it is "new".
@param int|string|null $id
@return Model|Collection | [
"Save",
"a",
"model",
"regardless",
"of",
"whether",
"or",
"not",
"it",
"is",
"new",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1456-L1465 |
231,342 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.isManyOperation | public function isManyOperation(): bool
{
return ($this->getInput() && array_keys($this->getInput()) === range(0, count($this->getInput()) - 1));
} | php | public function isManyOperation(): bool
{
return ($this->getInput() && array_keys($this->getInput()) === range(0, count($this->getInput()) - 1));
} | [
"public",
"function",
"isManyOperation",
"(",
")",
":",
"bool",
"{",
"return",
"(",
"$",
"this",
"->",
"getInput",
"(",
")",
"&&",
"array_keys",
"(",
"$",
"this",
"->",
"getInput",
"(",
")",
")",
"===",
"range",
"(",
"0",
",",
"count",
"(",
"$",
"t... | Checks if the input has many items.
@return bool | [
"Checks",
"if",
"the",
"input",
"has",
"many",
"items",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1472-L1475 |
231,343 | fuzz-productions/magic-box | src/EloquentRepository.php | EloquentRepository.getRelationsForeignKeyName | private function getRelationsForeignKeyName(HasOneOrMany $relation): string
{
return method_exists($relation, 'getForeignKeyName') ? $relation->getForeignKeyName() : $relation->getPlainForeignKey();
} | php | private function getRelationsForeignKeyName(HasOneOrMany $relation): string
{
return method_exists($relation, 'getForeignKeyName') ? $relation->getForeignKeyName() : $relation->getPlainForeignKey();
} | [
"private",
"function",
"getRelationsForeignKeyName",
"(",
"HasOneOrMany",
"$",
"relation",
")",
":",
"string",
"{",
"return",
"method_exists",
"(",
"$",
"relation",
",",
"'getForeignKeyName'",
")",
"?",
"$",
"relation",
"->",
"getForeignKeyName",
"(",
")",
":",
... | A helper method for backwards compatibility.
In laravel 5.4 they renamed the method `getPlainForeignKey` to `getForeignKeyName`
@param HasOneOrMany $relation
@return string | [
"A",
"helper",
"method",
"for",
"backwards",
"compatibility",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/EloquentRepository.php#L1486-L1489 |
231,344 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/SrsPoint.php | SrsPoint.getGeomFromText | public function getGeomFromText($databasetype)
{
$wkt = "";
switch(strtoupper($databasetype))
{
case SrsPoint::$POSTGIS:
$wkt = "ST_GEOMFROMTEXT('POINT(" . $this->lon . " " . $this->lat . ")'," . $this->srs . ")";
break;
default:
break;
}
return $wkt;
} | php | public function getGeomFromText($databasetype)
{
$wkt = "";
switch(strtoupper($databasetype))
{
case SrsPoint::$POSTGIS:
$wkt = "ST_GEOMFROMTEXT('POINT(" . $this->lon . " " . $this->lat . ")'," . $this->srs . ")";
break;
default:
break;
}
return $wkt;
} | [
"public",
"function",
"getGeomFromText",
"(",
"$",
"databasetype",
")",
"{",
"$",
"wkt",
"=",
"\"\"",
";",
"switch",
"(",
"strtoupper",
"(",
"$",
"databasetype",
")",
")",
"{",
"case",
"SrsPoint",
"::",
"$",
"POSTGIS",
":",
"$",
"wkt",
"=",
"\"ST_GEOMFRO... | Generates the "geomfromtext function"
@param int $databasetype the databasa type
@return string "geomfromtext function" | [
"Generates",
"the",
"geomfromtext",
"function"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/SrsPoint.php#L82-L95 |
231,345 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/SrsPoint.php | SrsPoint.getGeomFromTextMultiPoint | public static function getGeomFromTextMultiPoint(
$databasetype, $points)
{
$wkt = "";
switch(strtoupper($databasetype))
{
case SrsPoint::$POSTGIS:
// $wkt .= "ST_GEOMFROMTEXT('MULTIPOINT(";
foreach($points as $point)
{
$wkt .= "," . $point->getLon() . " " . $point->getLat();
}
$wkt = "ST_GEOMFROMTEXT('MULTIPOINT("
. substr($wkt, 1) . ")'," . $point->getSrs() . ")";
break;
default:
break;
}
return $wkt;
} | php | public static function getGeomFromTextMultiPoint(
$databasetype, $points)
{
$wkt = "";
switch(strtoupper($databasetype))
{
case SrsPoint::$POSTGIS:
// $wkt .= "ST_GEOMFROMTEXT('MULTIPOINT(";
foreach($points as $point)
{
$wkt .= "," . $point->getLon() . " " . $point->getLat();
}
$wkt = "ST_GEOMFROMTEXT('MULTIPOINT("
. substr($wkt, 1) . ")'," . $point->getSrs() . ")";
break;
default:
break;
}
return $wkt;
} | [
"public",
"static",
"function",
"getGeomFromTextMultiPoint",
"(",
"$",
"databasetype",
",",
"$",
"points",
")",
"{",
"$",
"wkt",
"=",
"\"\"",
";",
"switch",
"(",
"strtoupper",
"(",
"$",
"databasetype",
")",
")",
"{",
"case",
"SrsPoint",
"::",
"$",
"POSTGIS... | Generates the "geomfromtext function" for multipoint object
@param int $databasetype the databasa type
@return string "geomfromtext function" | [
"Generates",
"the",
"geomfromtext",
"function",
"for",
"multipoint",
"object"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/SrsPoint.php#L103-L123 |
231,346 | PaymentSuite/paymentsuite | src/PaymentSuite/PaymentCoreBundle/Services/PaymentEventDispatcher.php | PaymentEventDispatcher.notifyPaymentOrderDone | public function notifyPaymentOrderDone(
PaymentBridgeInterface $paymentBridge,
PaymentMethodInterface $paymentMethod
) {
$paymentOrderDoneEvent = new PaymentOrderDoneEvent(
$paymentBridge,
$paymentMethod
);
$this
->eventDispatcher
->dispatch(
PaymentCoreEvents::PAYMENT_ORDER_DONE,
$paymentOrderDoneEvent
);
return $this;
} | php | public function notifyPaymentOrderDone(
PaymentBridgeInterface $paymentBridge,
PaymentMethodInterface $paymentMethod
) {
$paymentOrderDoneEvent = new PaymentOrderDoneEvent(
$paymentBridge,
$paymentMethod
);
$this
->eventDispatcher
->dispatch(
PaymentCoreEvents::PAYMENT_ORDER_DONE,
$paymentOrderDoneEvent
);
return $this;
} | [
"public",
"function",
"notifyPaymentOrderDone",
"(",
"PaymentBridgeInterface",
"$",
"paymentBridge",
",",
"PaymentMethodInterface",
"$",
"paymentMethod",
")",
"{",
"$",
"paymentOrderDoneEvent",
"=",
"new",
"PaymentOrderDoneEvent",
"(",
"$",
"paymentBridge",
",",
"$",
"p... | Notifies when order payment process is done.
It doesn't matters if process its been success or failed
@param PaymentBridgeInterface $paymentBridge Payment Bridge
@param PaymentMethodInterface $paymentMethod Payment method
@return PaymentEventDispatcher self Object | [
"Notifies",
"when",
"order",
"payment",
"process",
"is",
"done",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/PaymentCoreBundle/Services/PaymentEventDispatcher.php#L115-L132 |
231,347 | PaymentSuite/paymentsuite | src/PaymentSuite/PaymentCoreBundle/Services/PaymentEventDispatcher.php | PaymentEventDispatcher.notifyPaymentOrderSuccess | public function notifyPaymentOrderSuccess(
PaymentBridgeInterface $paymentBridge,
PaymentMethodInterface $paymentMethod
) {
$paymentOrderSuccessEvent = new PaymentOrderSuccessEvent(
$paymentBridge,
$paymentMethod
);
$this
->eventDispatcher
->dispatch(
PaymentCoreEvents::PAYMENT_ORDER_SUCCESS,
$paymentOrderSuccessEvent
);
return $this;
} | php | public function notifyPaymentOrderSuccess(
PaymentBridgeInterface $paymentBridge,
PaymentMethodInterface $paymentMethod
) {
$paymentOrderSuccessEvent = new PaymentOrderSuccessEvent(
$paymentBridge,
$paymentMethod
);
$this
->eventDispatcher
->dispatch(
PaymentCoreEvents::PAYMENT_ORDER_SUCCESS,
$paymentOrderSuccessEvent
);
return $this;
} | [
"public",
"function",
"notifyPaymentOrderSuccess",
"(",
"PaymentBridgeInterface",
"$",
"paymentBridge",
",",
"PaymentMethodInterface",
"$",
"paymentMethod",
")",
"{",
"$",
"paymentOrderSuccessEvent",
"=",
"new",
"PaymentOrderSuccessEvent",
"(",
"$",
"paymentBridge",
",",
... | Notifies when payment process is done and succeded.
@param PaymentBridgeInterface $paymentBridge Payment Bridge
@param PaymentMethodInterface $paymentMethod Payment method
@return PaymentEventDispatcher self Object | [
"Notifies",
"when",
"payment",
"process",
"is",
"done",
"and",
"succeded",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/PaymentCoreBundle/Services/PaymentEventDispatcher.php#L142-L159 |
231,348 | PaymentSuite/paymentsuite | src/PaymentSuite/PaymentCoreBundle/Services/PaymentEventDispatcher.php | PaymentEventDispatcher.notifyPaymentOrderFail | public function notifyPaymentOrderFail(
PaymentBridgeInterface $paymentBridge,
PaymentMethodInterface $paymentMethod
) {
$paymentOrderFailEvent = new PaymentOrderFailEvent(
$paymentBridge,
$paymentMethod
);
$this
->eventDispatcher
->dispatch(
PaymentCoreEvents::PAYMENT_ORDER_FAIL,
$paymentOrderFailEvent
);
return $this;
} | php | public function notifyPaymentOrderFail(
PaymentBridgeInterface $paymentBridge,
PaymentMethodInterface $paymentMethod
) {
$paymentOrderFailEvent = new PaymentOrderFailEvent(
$paymentBridge,
$paymentMethod
);
$this
->eventDispatcher
->dispatch(
PaymentCoreEvents::PAYMENT_ORDER_FAIL,
$paymentOrderFailEvent
);
return $this;
} | [
"public",
"function",
"notifyPaymentOrderFail",
"(",
"PaymentBridgeInterface",
"$",
"paymentBridge",
",",
"PaymentMethodInterface",
"$",
"paymentMethod",
")",
"{",
"$",
"paymentOrderFailEvent",
"=",
"new",
"PaymentOrderFailEvent",
"(",
"$",
"paymentBridge",
",",
"$",
"p... | Notifies when payment is done and failed.
@param PaymentBridgeInterface $paymentBridge Payment Bridge
@param PaymentMethodInterface $paymentMethod Payment method
@return PaymentEventDispatcher self Object | [
"Notifies",
"when",
"payment",
"is",
"done",
"and",
"failed",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/PaymentCoreBundle/Services/PaymentEventDispatcher.php#L169-L186 |
231,349 | PaymentSuite/paymentsuite | src/PaymentSuite/PaylandsBundle/Services/PaylandsCurrencyServiceResolver.php | PaylandsCurrencyServiceResolver.getService | public function getService()
{
$currency = $this->paymentBridge->getCurrency();
if (key_exists($currency, $this->services)) {
return $this->services[$currency];
}
return '';
} | php | public function getService()
{
$currency = $this->paymentBridge->getCurrency();
if (key_exists($currency, $this->services)) {
return $this->services[$currency];
}
return '';
} | [
"public",
"function",
"getService",
"(",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"paymentBridge",
"->",
"getCurrency",
"(",
")",
";",
"if",
"(",
"key_exists",
"(",
"$",
"currency",
",",
"$",
"this",
"->",
"services",
")",
")",
"{",
"return",... | Gets the available service ID for currency indicated by PaymentBridge.
@return string Service ID for the currency | [
"Gets",
"the",
"available",
"service",
"ID",
"for",
"currency",
"indicated",
"by",
"PaymentBridge",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/PaylandsBundle/Services/PaylandsCurrencyServiceResolver.php#L78-L87 |
231,350 | niklongstone/regex-reverse | src/RegRev/RegRev.php | RegRev.generate | static public function generate($regExp)
{
if (@preg_match('/'.$regExp.'/', '') === false) {
throw new RegExpNotValidException($regExp);
}
self::bootstrap();
self::$typesFound = array();
while (strlen($regExp) > 0) {
foreach (self::$expressions as $type) {
if ($type->isValid($regExp)) {
Debug::setMessage($type->getName() . ' ' . $type->getMatch());
self::$typesFound[] = clone $type;
$lengthOfMatch = strlen($type->getMatch());
$regExp = substr($regExp, $lengthOfMatch);
break;
}
}
}
return self::outPut();
} | php | static public function generate($regExp)
{
if (@preg_match('/'.$regExp.'/', '') === false) {
throw new RegExpNotValidException($regExp);
}
self::bootstrap();
self::$typesFound = array();
while (strlen($regExp) > 0) {
foreach (self::$expressions as $type) {
if ($type->isValid($regExp)) {
Debug::setMessage($type->getName() . ' ' . $type->getMatch());
self::$typesFound[] = clone $type;
$lengthOfMatch = strlen($type->getMatch());
$regExp = substr($regExp, $lengthOfMatch);
break;
}
}
}
return self::outPut();
} | [
"static",
"public",
"function",
"generate",
"(",
"$",
"regExp",
")",
"{",
"if",
"(",
"@",
"preg_match",
"(",
"'/'",
".",
"$",
"regExp",
".",
"'/'",
",",
"''",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"RegExpNotValidException",
"(",
"$",
"regExp",... | Generates the regular expression result.
@param string $regExp
@return mixed
@throws Exception\RegExpNotValidException | [
"Generates",
"the",
"regular",
"expression",
"result",
"."
] | a93bb266fbc0621094a5d1ad2583b8a54999ea25 | https://github.com/niklongstone/regex-reverse/blob/a93bb266fbc0621094a5d1ad2583b8a54999ea25/src/RegRev/RegRev.php#L33-L54 |
231,351 | niklongstone/regex-reverse | src/RegRev/RegRev.php | RegRev.bootstrap | static private function bootstrap()
{
if (self::$expressions === null) {
$configuration = new Configuration();
$parameters = $configuration->getConfig();
self::$expressions = $configuration->setUp($parameters);
}
} | php | static private function bootstrap()
{
if (self::$expressions === null) {
$configuration = new Configuration();
$parameters = $configuration->getConfig();
self::$expressions = $configuration->setUp($parameters);
}
} | [
"static",
"private",
"function",
"bootstrap",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"expressions",
"===",
"null",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"parameters",
"=",
"$",
"configuration",
"->",
"getC... | Configures with default values,
if custom values are not present. | [
"Configures",
"with",
"default",
"values",
"if",
"custom",
"values",
"are",
"not",
"present",
"."
] | a93bb266fbc0621094a5d1ad2583b8a54999ea25 | https://github.com/niklongstone/regex-reverse/blob/a93bb266fbc0621094a5d1ad2583b8a54999ea25/src/RegRev/RegRev.php#L60-L67 |
231,352 | oanhnn/laravel-presets | src/Presets/React.php | React.updateComponent | protected function updateComponent()
{
$this->filesystem->delete(resource_path('assets/js/components/Example.vue'));
$this->filesystem->copy($this->stubPath('/Example.js'), resource_path('assets/js/components/Example.js'));
} | php | protected function updateComponent()
{
$this->filesystem->delete(resource_path('assets/js/components/Example.vue'));
$this->filesystem->copy($this->stubPath('/Example.js'), resource_path('assets/js/components/Example.js'));
} | [
"protected",
"function",
"updateComponent",
"(",
")",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"delete",
"(",
"resource_path",
"(",
"'assets/js/components/Example.vue'",
")",
")",
";",
"$",
"this",
"->",
"filesystem",
"->",
"copy",
"(",
"$",
"this",
"->",
... | Update the example component.
@return void | [
"Update",
"the",
"example",
"component",
"."
] | b30d731bb23b764e0767715ae243876faf13408e | https://github.com/oanhnn/laravel-presets/blob/b30d731bb23b764e0767715ae243876faf13408e/src/Presets/React.php#L54-L58 |
231,353 | klaravel/db-logger | src/DbLogger.php | DbLogger.getLogData | protected function getLogData($queryNr, $query, $execTime)
{
$time = $this->convertToSeconds ? ($execTime / 1000.0) . '.s'
: $execTime . 'ms';
return '/* Query ' . $queryNr . ' - ' . date('Y-m-d H:i:s') . ' [' .
$time . ']' . " */\n" . $query . ';' .
"\n/*==================================================*/\n";
} | php | protected function getLogData($queryNr, $query, $execTime)
{
$time = $this->convertToSeconds ? ($execTime / 1000.0) . '.s'
: $execTime . 'ms';
return '/* Query ' . $queryNr . ' - ' . date('Y-m-d H:i:s') . ' [' .
$time . ']' . " */\n" . $query . ';' .
"\n/*==================================================*/\n";
} | [
"protected",
"function",
"getLogData",
"(",
"$",
"queryNr",
",",
"$",
"query",
",",
"$",
"execTime",
")",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"convertToSeconds",
"?",
"(",
"$",
"execTime",
"/",
"1000.0",
")",
".",
"'.s'",
":",
"$",
"execTime",
... | Get full query information to be used to save it
@param int $queryNr
@param string $query
@param int $execTime
@return string | [
"Get",
"full",
"query",
"information",
"to",
"be",
"used",
"to",
"save",
"it"
] | 4afeaf3ec8c1f9ba6219982091a15797f4a4cab9 | https://github.com/klaravel/db-logger/blob/4afeaf3ec8c1f9ba6219982091a15797f4a4cab9/src/DbLogger.php#L157-L165 |
231,354 | klaravel/db-logger | src/DbLogger.php | DbLogger.getSqlQuery | protected function getSqlQuery($query, $bindings, $execTime)
{
$bindings = $query->bindings;
$execTime = $query->time;
$query = $query->sql;
// need to format bindings properly
foreach ($bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$bindings[$i] = $binding->format('Y-m-d H:i:s');
} elseif (is_string($binding)) {
$bindings[$i] = str_replace("'", "\\'", $binding);
}
}
// now we create full SQL query - in case of failure, we log this
$query = str_replace(['%', '?', "\n"], ['%%', "'%s'", ' '], $query);
$fullSql = vsprintf($query, $bindings);
return [$fullSql, $execTime];
} | php | protected function getSqlQuery($query, $bindings, $execTime)
{
$bindings = $query->bindings;
$execTime = $query->time;
$query = $query->sql;
// need to format bindings properly
foreach ($bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$bindings[$i] = $binding->format('Y-m-d H:i:s');
} elseif (is_string($binding)) {
$bindings[$i] = str_replace("'", "\\'", $binding);
}
}
// now we create full SQL query - in case of failure, we log this
$query = str_replace(['%', '?', "\n"], ['%%', "'%s'", ' '], $query);
$fullSql = vsprintf($query, $bindings);
return [$fullSql, $execTime];
} | [
"protected",
"function",
"getSqlQuery",
"(",
"$",
"query",
",",
"$",
"bindings",
",",
"$",
"execTime",
")",
"{",
"$",
"bindings",
"=",
"$",
"query",
"->",
"bindings",
";",
"$",
"execTime",
"=",
"$",
"query",
"->",
"time",
";",
"$",
"query",
"=",
"$",... | Get SQL query and query exection time
@param mixed $query
@param mixed $bindings
@param mixed $execTime
@return array | [
"Get",
"SQL",
"query",
"and",
"query",
"exection",
"time"
] | 4afeaf3ec8c1f9ba6219982091a15797f4a4cab9 | https://github.com/klaravel/db-logger/blob/4afeaf3ec8c1f9ba6219982091a15797f4a4cab9/src/DbLogger.php#L176-L196 |
231,355 | schemaio/schema-php-client | lib/Resource.php | Resource.instance | public static function instance($result, $client = null)
{
if ((array)$result['$data'] === $result['$data']
&& isset($result['$data']['results'])
&& isset($result['$data']['count'])) {
return new Collection($result, $client);
}
return new Record($result, $client);
} | php | public static function instance($result, $client = null)
{
if ((array)$result['$data'] === $result['$data']
&& isset($result['$data']['results'])
&& isset($result['$data']['count'])) {
return new Collection($result, $client);
}
return new Record($result, $client);
} | [
"public",
"static",
"function",
"instance",
"(",
"$",
"result",
",",
"$",
"client",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"array",
")",
"$",
"result",
"[",
"'$data'",
"]",
"===",
"$",
"result",
"[",
"'$data'",
"]",
"&&",
"isset",
"(",
"$",
"result... | Create a resource instance from request result
@return Resource | [
"Create",
"a",
"resource",
"instance",
"from",
"request",
"result"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Resource.php#L75-L84 |
231,356 | schemaio/schema-php-client | lib/Resource.php | Resource.data | public function data($raw = false)
{
$data = $this->getArrayCopy();
if ($raw) {
foreach ($data as $key => $val) {
if ($val instanceof Resource) {
$data[$key] = $val->data($raw);
}
}
foreach ($this->link_data as $key => $val) {
if ($val instanceof Resource) {
$data[$key] = $val->data($raw);
}
}
}
return $data;
} | php | public function data($raw = false)
{
$data = $this->getArrayCopy();
if ($raw) {
foreach ($data as $key => $val) {
if ($val instanceof Resource) {
$data[$key] = $val->data($raw);
}
}
foreach ($this->link_data as $key => $val) {
if ($val instanceof Resource) {
$data[$key] = $val->data($raw);
}
}
}
return $data;
} | [
"public",
"function",
"data",
"(",
"$",
"raw",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getArrayCopy",
"(",
")",
";",
"if",
"(",
"$",
"raw",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
... | Get resource data
@param bool $raw
@return mixed | [
"Get",
"resource",
"data"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Resource.php#L112-L130 |
231,357 | schemaio/schema-php-client | lib/Resource.php | Resource.& | public function & links()
{
if (!isset(self::$client_links[$this->url])) {
self::$client_links[$this->url] = array();
}
return self::$client_links[$this->url];
} | php | public function & links()
{
if (!isset(self::$client_links[$this->url])) {
self::$client_links[$this->url] = array();
}
return self::$client_links[$this->url];
} | [
"public",
"function",
"&",
"links",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"client_links",
"[",
"$",
"this",
"->",
"url",
"]",
")",
")",
"{",
"self",
"::",
"$",
"client_links",
"[",
"$",
"this",
"->",
"url",
"]",
"=",
"... | Get links for this resource
@return array | [
"Get",
"links",
"for",
"this",
"resource"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Resource.php#L147-L153 |
231,358 | schemaio/schema-php-client | lib/Resource.php | Resource.request | public function request($method, $scope = null, $data = null)
{
if (is_array($scope)) {
$data = $scope;
$scope = null;
}
$url = $scope ? $this->url.'/'.ltrim($scope, '/') : $this->url;
$result = self::$client->request($method, $url, $data);
if (!$scope && $result instanceof Resource) {
// TODO: how should POST be handled here?
foreach ($result->data() as $key => $value) {
self::offsetSet($key, $value);
}
}
return $scope ? $result : $this;
} | php | public function request($method, $scope = null, $data = null)
{
if (is_array($scope)) {
$data = $scope;
$scope = null;
}
$url = $scope ? $this->url.'/'.ltrim($scope, '/') : $this->url;
$result = self::$client->request($method, $url, $data);
if (!$scope && $result instanceof Resource) {
// TODO: how should POST be handled here?
foreach ($result->data() as $key => $value) {
self::offsetSet($key, $value);
}
}
return $scope ? $result : $this;
} | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"scope",
"=",
"null",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"scope",
")",
")",
"{",
"$",
"data",
"=",
"$",
"scope",
";",
"$",
"scope",
"=",
"null... | Execute a request on this resource
@param mixed $scope
@param mixed $data
@return mixed | [
"Execute",
"a",
"request",
"on",
"this",
"resource"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Resource.php#L230-L245 |
231,359 | schemaio/schema-php-client | lib/Resource.php | Resource.dump_links | public function dump_links($links = null)
{
if ($links === null) {
$links = $this->links;
}
$dump = array();
foreach ($links as $key => $link) {
if (isset($link['url'])) {
$dump[$key] = $link['url'];
}
if ($key === '*') {
$dump = array_merge($dump, $this->dump_links($link));
} else if (isset($link['links'])) {
$dump[$key] = $this->dump_links($link['links']);
}
}
return $dump;
} | php | public function dump_links($links = null)
{
if ($links === null) {
$links = $this->links;
}
$dump = array();
foreach ($links as $key => $link) {
if (isset($link['url'])) {
$dump[$key] = $link['url'];
}
if ($key === '*') {
$dump = array_merge($dump, $this->dump_links($link));
} else if (isset($link['links'])) {
$dump[$key] = $this->dump_links($link['links']);
}
}
return $dump;
} | [
"public",
"function",
"dump_links",
"(",
"$",
"links",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"links",
"===",
"null",
")",
"{",
"$",
"links",
"=",
"$",
"this",
"->",
"links",
";",
"}",
"$",
"dump",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"... | Dump resource links
@param array $links | [
"Dump",
"resource",
"links"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Resource.php#L264-L282 |
231,360 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Utils.php | Utils.getParams | public static function getParams(Request $request, $method = null)
{
if($method === null)
{
$method = $request->getMethod();
}
if(strtoupper($method) === Utils::$METHOD_GET)
{
return $request->query->all();
} else if(strtoupper($method) === Utils::$METHOD_POST)
{
return $request->request->all();
} else
{
return null;
}
} | php | public static function getParams(Request $request, $method = null)
{
if($method === null)
{
$method = $request->getMethod();
}
if(strtoupper($method) === Utils::$METHOD_GET)
{
return $request->query->all();
} else if(strtoupper($method) === Utils::$METHOD_POST)
{
return $request->request->all();
} else
{
return null;
}
} | [
"public",
"static",
"function",
"getParams",
"(",
"Request",
"$",
"request",
",",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"method",
"===",
"null",
")",
"{",
"$",
"method",
"=",
"$",
"request",
"->",
"getMethod",
"(",
")",
";",
"}",
"i... | Returns the array with parameters.
@param \Symfony\Component\HttpFoundation\Request $request the request
@param string $method the HTTP method POST/GET
(default null -> the method is determined from request)
@return array the parameters | [
"Returns",
"the",
"array",
"with",
"parameters",
"."
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Utils.php#L49-L65 |
231,361 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Utils.php | Utils.getParamValue | public static function getParamValue(Request $request, $name,
$method = null, $ignoreCase = false)
{
$params = Utils::getParams($request, $method);
if($params === null)
{
return null;
}
if($ignoreCase)
{
$name = strtolower($name);
foreach($params as $key => $value)
{
if(strtolower($key) === $name)
{
return urldecode($value);
}
}
} else
{
foreach($params as $key => $value)
{
if($key === $name)
{
return urldecode($value);
}
}
}
return null;
} | php | public static function getParamValue(Request $request, $name,
$method = null, $ignoreCase = false)
{
$params = Utils::getParams($request, $method);
if($params === null)
{
return null;
}
if($ignoreCase)
{
$name = strtolower($name);
foreach($params as $key => $value)
{
if(strtolower($key) === $name)
{
return urldecode($value);
}
}
} else
{
foreach($params as $key => $value)
{
if($key === $name)
{
return urldecode($value);
}
}
}
return null;
} | [
"public",
"static",
"function",
"getParamValue",
"(",
"Request",
"$",
"request",
",",
"$",
"name",
",",
"$",
"method",
"=",
"null",
",",
"$",
"ignoreCase",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"Utils",
"::",
"getParams",
"(",
"$",
"request",
","... | Returns the parameter value from request
@param \Symfony\Component\HttpFoundation\Request $request the request
@param string $method the HTTP method POST/GET
(default null -> the method is determined from request)
@param boolean $ignoreCase false if the parameter name is case sensitive
(default false)
@param string $name the parameter name
@return string the parameter value or null | [
"Returns",
"the",
"parameter",
"value",
"from",
"request"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Utils.php#L78-L107 |
231,362 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Utils.php | Utils.getParamValueFromAll | public static function getParamValueFromAll(Request $request, $name,
$ignoreCase = false)
{
$value = Utils::getParamValue($request, $name, "GET", $ignoreCase);
if($value === null)
{
$value = Utils::getParamValue($request, $name, "POST", $ignoreCase);
}
return $value;
} | php | public static function getParamValueFromAll(Request $request, $name,
$ignoreCase = false)
{
$value = Utils::getParamValue($request, $name, "GET", $ignoreCase);
if($value === null)
{
$value = Utils::getParamValue($request, $name, "POST", $ignoreCase);
}
return $value;
} | [
"public",
"static",
"function",
"getParamValueFromAll",
"(",
"Request",
"$",
"request",
",",
"$",
"name",
",",
"$",
"ignoreCase",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"getParamValue",
"(",
"$",
"request",
",",
"$",
"name",
",",
"\"GE... | Returns the parameter value
@param \Symfony\Component\HttpFoundation\Request $request the request
@param string $name the parameter name
@param boolean $ignoreCase if the parameter name is case sensitive
=> false (default false)
@return string|null the parameter value | [
"Returns",
"the",
"parameter",
"value"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Utils.php#L145-L154 |
231,363 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Utils.php | Utils.getHeadersFromRequest | public static function getHeadersFromRequest(Request $request)
{
$headers = array();
foreach($request->headers as $key => $value)
{
if(isset($key) && isset($value) && isset($value[0]))
{
$headers[$key] = $value[0];
}
}
return $headers;
} | php | public static function getHeadersFromRequest(Request $request)
{
$headers = array();
foreach($request->headers as $key => $value)
{
if(isset($key) && isset($value) && isset($value[0]))
{
$headers[$key] = $value[0];
}
}
return $headers;
} | [
"public",
"static",
"function",
"getHeadersFromRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"request",
"->",
"headers",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
... | Returns the headers from Request
@param \Symfony\Component\HttpFoundation\Request $request
@return array the headers | [
"Returns",
"the",
"headers",
"from",
"Request"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Utils.php#L162-L173 |
231,364 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Utils.php | Utils.setHeadersFromBrowserResponse | public static function setHeadersFromBrowserResponse(Response $response,
MessageInterface $browserResponse)
{
$heasers_resp = Utils::getHeadersFromBrowserResponse($browserResponse);
foreach($heasers_resp as $key => $value)
{
if(strtolower($key) !== "transfer-encoding"){
$response->headers->set($key, $value);
}
}
} | php | public static function setHeadersFromBrowserResponse(Response $response,
MessageInterface $browserResponse)
{
$heasers_resp = Utils::getHeadersFromBrowserResponse($browserResponse);
foreach($heasers_resp as $key => $value)
{
if(strtolower($key) !== "transfer-encoding"){
$response->headers->set($key, $value);
}
}
} | [
"public",
"static",
"function",
"setHeadersFromBrowserResponse",
"(",
"Response",
"$",
"response",
",",
"MessageInterface",
"$",
"browserResponse",
")",
"{",
"$",
"heasers_resp",
"=",
"Utils",
"::",
"getHeadersFromBrowserResponse",
"(",
"$",
"browserResponse",
")",
";... | Sets the headers from proxy's browser response into proxy response
@param Response $response the response
@param MessageInterface $browserResponse the browser response | [
"Sets",
"the",
"headers",
"from",
"proxy",
"s",
"browser",
"response",
"into",
"proxy",
"response"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Utils.php#L203-L213 |
231,365 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Utils.php | Utils.buzzResponseToResponse | public static function buzzResponseToResponse($buzzResponse)
{
// adapt header formatting: Buzz uses a flat list of lines, HttpFoundation expects a name: value mapping
$headers = array();
foreach ($buzzResponse->getHeaders() as $headerLine) {
$parts = explode(':', $headerLine, 2);
/**
* Forward all headers except Transfer-Encoding.
* Buzz (actually curl) pipes this through even though the content is
* never chunked and never compressed.
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding
*/
if (count($parts) == 2 && strtolower($parts[0]) != 'transfer-encoding') {
$headers[$parts[0]] = $parts[1];
}
}
$response = new Response($buzzResponse->getContent(), $buzzResponse->getStatusCode(), $headers);
$response->setProtocolVersion($buzzResponse->getProtocolVersion());
$statusText = $buzzResponse->getReasonPhrase();
if ($statusText) {
$response->setStatusCode($buzzResponse->getStatusCode(), $statusText);
}
return $response;
} | php | public static function buzzResponseToResponse($buzzResponse)
{
// adapt header formatting: Buzz uses a flat list of lines, HttpFoundation expects a name: value mapping
$headers = array();
foreach ($buzzResponse->getHeaders() as $headerLine) {
$parts = explode(':', $headerLine, 2);
/**
* Forward all headers except Transfer-Encoding.
* Buzz (actually curl) pipes this through even though the content is
* never chunked and never compressed.
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding
*/
if (count($parts) == 2 && strtolower($parts[0]) != 'transfer-encoding') {
$headers[$parts[0]] = $parts[1];
}
}
$response = new Response($buzzResponse->getContent(), $buzzResponse->getStatusCode(), $headers);
$response->setProtocolVersion($buzzResponse->getProtocolVersion());
$statusText = $buzzResponse->getReasonPhrase();
if ($statusText) {
$response->setStatusCode($buzzResponse->getStatusCode(), $statusText);
}
return $response;
} | [
"public",
"static",
"function",
"buzzResponseToResponse",
"(",
"$",
"buzzResponse",
")",
"{",
"// adapt header formatting: Buzz uses a flat list of lines, HttpFoundation expects a name: value mapping",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"buzzRes... | Convert a Buzz Response to a Symfony HttpFoundation Response.
Preserves original status code and message.
Note: We do not do anything about cookies here. Buzz\Response::getHeaders() DOES NOT return received cookies.
When using the Mapbender host as a proxy, none of the upstream cookies have any meaning to begin with,
as they are for a domain the client never talked to directly. As such, cookie handling of any form
is redundant for the proxy use case via Buzz.
@param \Buzz\Message\Response $buzzResponse
@return Response | [
"Convert",
"a",
"Buzz",
"Response",
"to",
"a",
"Symfony",
"HttpFoundation",
"Response",
"."
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Utils.php#L248-L271 |
231,366 | PaymentSuite/paymentsuite | src/PaymentSuite/FreePaymentBundle/Services/FreePaymentManager.php | FreePaymentManager.processPayment | public function processPayment()
{
$paymentMethod = $this
->methodFactory
->create();
/**
* At this point, order must be created given a card, and placed in
* PaymentBridge.
*
* So, $this->paymentBridge->getOrder() must return an object
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderLoad(
$this->paymentBridge,
$paymentMethod
);
/**
* Order exists right here.
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderCreated(
$this->paymentBridge,
$paymentMethod
);
/**
* Payment paid done.
*
* Paid process has ended (No matters result)
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderDone(
$this->paymentBridge,
$paymentMethod
);
/**
* Payment paid successfully.
*
* Paid process has ended successfully
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderSuccess(
$this->paymentBridge,
$paymentMethod
);
return $this;
} | php | public function processPayment()
{
$paymentMethod = $this
->methodFactory
->create();
/**
* At this point, order must be created given a card, and placed in
* PaymentBridge.
*
* So, $this->paymentBridge->getOrder() must return an object
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderLoad(
$this->paymentBridge,
$paymentMethod
);
/**
* Order exists right here.
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderCreated(
$this->paymentBridge,
$paymentMethod
);
/**
* Payment paid done.
*
* Paid process has ended (No matters result)
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderDone(
$this->paymentBridge,
$paymentMethod
);
/**
* Payment paid successfully.
*
* Paid process has ended successfully
*/
$this
->paymentEventDispatcher
->notifyPaymentOrderSuccess(
$this->paymentBridge,
$paymentMethod
);
return $this;
} | [
"public",
"function",
"processPayment",
"(",
")",
"{",
"$",
"paymentMethod",
"=",
"$",
"this",
"->",
"methodFactory",
"->",
"create",
"(",
")",
";",
"/**\n * At this point, order must be created given a card, and placed in\n * PaymentBridge.\n *\n ... | Tries to process a free payment.
@return FreePaymentManager Self object | [
"Tries",
"to",
"process",
"a",
"free",
"payment",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/FreePaymentBundle/Services/FreePaymentManager.php#L69-L123 |
231,367 | PaymentSuite/paymentsuite | src/PaymentSuite/GestpayBundle/Services/GestpayTransactionIdAssembler.php | GestpayTransactionIdAssembler.assemble | public function assemble()
{
$orderId = $this->paymentBridge->getOrderId();
return sprintf('%d%s%d', $orderId, self::SEPARTOR, time());
} | php | public function assemble()
{
$orderId = $this->paymentBridge->getOrderId();
return sprintf('%d%s%d', $orderId, self::SEPARTOR, time());
} | [
"public",
"function",
"assemble",
"(",
")",
"{",
"$",
"orderId",
"=",
"$",
"this",
"->",
"paymentBridge",
"->",
"getOrderId",
"(",
")",
";",
"return",
"sprintf",
"(",
"'%d%s%d'",
",",
"$",
"orderId",
",",
"self",
"::",
"SEPARTOR",
",",
"time",
"(",
")"... | Returns gestpay shop transaction id.
@return string | [
"Returns",
"gestpay",
"shop",
"transaction",
"id",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/GestpayBundle/Services/GestpayTransactionIdAssembler.php#L48-L53 |
231,368 | PaymentSuite/paymentsuite | src/PaymentSuite/GestpayBundle/Services/GestpayTransactionIdAssembler.php | GestpayTransactionIdAssembler.extract | public function extract(string $shopTransactionId)
{
$pieces = explode(self::SEPARTOR, $shopTransactionId);
return (int) $pieces[0];
} | php | public function extract(string $shopTransactionId)
{
$pieces = explode(self::SEPARTOR, $shopTransactionId);
return (int) $pieces[0];
} | [
"public",
"function",
"extract",
"(",
"string",
"$",
"shopTransactionId",
")",
"{",
"$",
"pieces",
"=",
"explode",
"(",
"self",
"::",
"SEPARTOR",
",",
"$",
"shopTransactionId",
")",
";",
"return",
"(",
"int",
")",
"$",
"pieces",
"[",
"0",
"]",
";",
"}"... | Extracts order id from shop transaction id.
@param string $shopTransactionId
@return int | [
"Extracts",
"order",
"id",
"from",
"shop",
"transaction",
"id",
"."
] | 8ae57df57fa07aff7e59701a0b3c83c504095b92 | https://github.com/PaymentSuite/paymentsuite/blob/8ae57df57fa07aff7e59701a0b3c83c504095b92/src/PaymentSuite/GestpayBundle/Services/GestpayTransactionIdAssembler.php#L62-L67 |
231,369 | JPinkney/TVMaze-PHP-API-Wrapper | TVMaze/TVShow.php | TVShow.isEmpty | public function isEmpty(){
return($this->id == null || ($this->id == 0 && $this->url == null && $this->name == null));
} | php | public function isEmpty(){
return($this->id == null || ($this->id == 0 && $this->url == null && $this->name == null));
} | [
"public",
"function",
"isEmpty",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"id",
"==",
"null",
"||",
"(",
"$",
"this",
"->",
"id",
"==",
"0",
"&&",
"$",
"this",
"->",
"url",
"==",
"null",
"&&",
"$",
"this",
"->",
"name",
"==",
"null",
")... | This function is used to check whether or not the object contains any data
@return bool | [
"This",
"function",
"is",
"used",
"to",
"check",
"whether",
"or",
"not",
"the",
"object",
"contains",
"any",
"data"
] | 174429341ef2009a42f77743faa342726d7d8467 | https://github.com/JPinkney/TVMaze-PHP-API-Wrapper/blob/174429341ef2009a42f77743faa342726d7d8467/TVMaze/TVShow.php#L153-L155 |
231,370 | bariew/yii2-event-component | EventManager.php | EventManager.attachEvents | public function attachEvents($eventConfig)
{
foreach ($eventConfig as $className => $events) {
foreach ($events as $eventName => $handlers) {
foreach ($handlers as $handler) {
if (is_array($handler) && is_callable($handler[0])) {
$data = isset($handler[1]) ? array_pop($handler) : null;
$append = isset($handler[2]) ? array_pop($handler) : null;
Event::on($className, $eventName, $handler[0], $data, $append);
} else if (is_callable($handler)){
Event::on($className, $eventName, $handler);
}
}
}
}
} | php | public function attachEvents($eventConfig)
{
foreach ($eventConfig as $className => $events) {
foreach ($events as $eventName => $handlers) {
foreach ($handlers as $handler) {
if (is_array($handler) && is_callable($handler[0])) {
$data = isset($handler[1]) ? array_pop($handler) : null;
$append = isset($handler[2]) ? array_pop($handler) : null;
Event::on($className, $eventName, $handler[0], $data, $append);
} else if (is_callable($handler)){
Event::on($className, $eventName, $handler);
}
}
}
}
} | [
"public",
"function",
"attachEvents",
"(",
"$",
"eventConfig",
")",
"{",
"foreach",
"(",
"$",
"eventConfig",
"as",
"$",
"className",
"=>",
"$",
"events",
")",
"{",
"foreach",
"(",
"$",
"events",
"as",
"$",
"eventName",
"=>",
"$",
"handlers",
")",
"{",
... | attaches all events to all classNames
@param array $eventConfig commonly $this->events config | [
"attaches",
"all",
"events",
"to",
"all",
"classNames"
] | 0b93904a79b3b39b85832dcbd7131f66f39f976e | https://github.com/bariew/yii2-event-component/blob/0b93904a79b3b39b85832dcbd7131f66f39f976e/EventManager.php#L49-L64 |
231,371 | davin-bao/workflow | src/DavinBao/Workflow/Workflow.php | Workflow.checkAction | public function checkAction( $action, $parameters = array(), $absolute = true )
{
try {
$url = $this->_app['url']->action($action, $parameters, $absolute);
} catch( InvalidArgumentException $e ) {
return false;
}
return $url;
} | php | public function checkAction( $action, $parameters = array(), $absolute = true )
{
try {
$url = $this->_app['url']->action($action, $parameters, $absolute);
} catch( InvalidArgumentException $e ) {
return false;
}
return $url;
} | [
"public",
"function",
"checkAction",
"(",
"$",
"action",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"absolute",
"=",
"true",
")",
"{",
"try",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"_app",
"[",
"'url'",
"]",
"->",
"action",
"(",
... | Check whether the controller's action exists.
Returns the url if it does. Otherwise false.
@param $controllerAction
@return string | [
"Check",
"whether",
"the",
"controller",
"s",
"action",
"exists",
".",
"Returns",
"the",
"url",
"if",
"it",
"does",
".",
"Otherwise",
"false",
"."
] | 8af8b33ef63e455a2a5a1cdf6ac7bc154d590488 | https://github.com/davin-bao/workflow/blob/8af8b33ef63e455a2a5a1cdf6ac7bc154d590488/src/DavinBao/Workflow/Workflow.php#L44-L53 |
231,372 | machour/yii2-swagger-api | ApiException.php | ApiException.fromException | public static function fromException($e)
{
if (is_subclass_of($e, self::class)) {
return $e;
}
return new self($e->message, $e->code);
} | php | public static function fromException($e)
{
if (is_subclass_of($e, self::class)) {
return $e;
}
return new self($e->message, $e->code);
} | [
"public",
"static",
"function",
"fromException",
"(",
"$",
"e",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"e",
",",
"self",
"::",
"class",
")",
")",
"{",
"return",
"$",
"e",
";",
"}",
"return",
"new",
"self",
"(",
"$",
"e",
"->",
"message",
... | Transforms a non ApiException to an ApiException
@param Exception $e The exception to be transformed
@return ApiException | [
"Transforms",
"a",
"non",
"ApiException",
"to",
"an",
"ApiException"
] | 577d9877f196a0a94b06d5623a0ea66cf329409b | https://github.com/machour/yii2-swagger-api/blob/577d9877f196a0a94b06d5623a0ea66cf329409b/ApiException.php#L28-L34 |
231,373 | toohamster/ws-http | src/Ws/Http/Request.php | Request.create | public static function create($id = null)
{
if ( empty($id) )
{
$id = md5(__METHOD__) . count(self::$instances);
}
if ( empty(self::$instances[$id]) )
{
self::$instances[$id] = new self();
}
return self::$instances[$id];
} | php | public static function create($id = null)
{
if ( empty($id) )
{
$id = md5(__METHOD__) . count(self::$instances);
}
if ( empty(self::$instances[$id]) )
{
self::$instances[$id] = new self();
}
return self::$instances[$id];
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"id",
"=",
"md5",
"(",
"__METHOD__",
")",
".",
"count",
"(",
"self",
"::",
"$",
"instances",
")",
";",
"}",... | Get a Object
@param string $id object identification, default auto build
@return \Ws\Http\Request | [
"Get",
"a",
"Object"
] | 8854ea40efd010680497c4dff73ec8ebfc45f888 | https://github.com/toohamster/ws-http/blob/8854ea40efd010680497c4dff73ec8ebfc45f888/src/Ws/Http/Request.php#L47-L58 |
231,374 | schemaio/schema-php-client | lib/Collection.php | Collection.build_records | protected function build_records($result)
{
$url = $result['$url'];
$parent_url = $url;
if (false !== ($pos = strpos($url, '?'))) {
$url = substr(0, $pos);
}
$url = '/'.trim($url, '/');
foreach ($result['$data'] as $key => $record) {
$record_url = $url;
if (isset($record['id'])) {
$record_url .= '/'.$record['id'];
}
self::$client_links[$record_url] = &self::$client_links[$parent_url];
$result['$data'][$key] = new Record(array(
'$url' => $record_url,
'$data' => $record
));
}
return $result;
} | php | protected function build_records($result)
{
$url = $result['$url'];
$parent_url = $url;
if (false !== ($pos = strpos($url, '?'))) {
$url = substr(0, $pos);
}
$url = '/'.trim($url, '/');
foreach ($result['$data'] as $key => $record) {
$record_url = $url;
if (isset($record['id'])) {
$record_url .= '/'.$record['id'];
}
self::$client_links[$record_url] = &self::$client_links[$parent_url];
$result['$data'][$key] = new Record(array(
'$url' => $record_url,
'$data' => $record
));
}
return $result;
} | [
"protected",
"function",
"build_records",
"(",
"$",
"result",
")",
"{",
"$",
"url",
"=",
"$",
"result",
"[",
"'$url'",
"]",
";",
"$",
"parent_url",
"=",
"$",
"url",
";",
"if",
"(",
"false",
"!==",
"(",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"url",
... | Build records from result data
@param array $result
@return array | [
"Build",
"records",
"from",
"result",
"data"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Collection.php#L54-L76 |
231,375 | schemaio/schema-php-client | lib/Collection.php | Collection.offsetExists | public function offsetExists($index)
{
if (!$exists = parent::offsetExists($index)) {
if (isset($this->{$index})) {
return true;
}
}
return $exists;
} | php | public function offsetExists($index)
{
if (!$exists = parent::offsetExists($index)) {
if (isset($this->{$index})) {
return true;
}
}
return $exists;
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"$",
"exists",
"=",
"parent",
"::",
"offsetExists",
"(",
"$",
"index",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"{",
"$",
"index",
"}",
")",
")",... | Check if collection field value exists
@param string $index
@return bool | [
"Check",
"if",
"collection",
"field",
"value",
"exists"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Collection.php#L84-L92 |
231,376 | schemaio/schema-php-client | lib/Collection.php | Collection.offsetGet | function offsetGet($index)
{
if (isset($this->{$index})) {
return $this->{$index};
} else {
$records = $this->records();
if ($index === "results") {
return $records;
}
if ($record =& $records[$index]) {
return $record;
}
foreach ((array)$records as $key => $record) {
if ($record['id'] === $index) {
$record =& $records[$key];
return $record;
}
}
}
return null;
} | php | function offsetGet($index)
{
if (isset($this->{$index})) {
return $this->{$index};
} else {
$records = $this->records();
if ($index === "results") {
return $records;
}
if ($record =& $records[$index]) {
return $record;
}
foreach ((array)$records as $key => $record) {
if ($record['id'] === $index) {
$record =& $records[$key];
return $record;
}
}
}
return null;
} | [
"function",
"offsetGet",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"{",
"$",
"index",
"}",
")",
")",
"{",
"return",
"$",
"this",
"->",
"{",
"$",
"index",
"}",
";",
"}",
"else",
"{",
"$",
"records",
"=",
"$",
"th... | Get collection record or meta data
@param string $index
@return mixed | [
"Get",
"collection",
"record",
"or",
"meta",
"data"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Collection.php#L100-L121 |
231,377 | schemaio/schema-php-client | lib/Collection.php | Collection.data | public function data($raw = false)
{
$data = array(
'count' => $this->count,
'results' => parent::data($raw),
'pages' => $this->pages,
'page' => $this->page
);
return $data;
} | php | public function data($raw = false)
{
$data = array(
'count' => $this->count,
'results' => parent::data($raw),
'pages' => $this->pages,
'page' => $this->page
);
return $data;
} | [
"public",
"function",
"data",
"(",
"$",
"raw",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'count'",
"=>",
"$",
"this",
"->",
"count",
",",
"'results'",
"=>",
"parent",
"::",
"data",
"(",
"$",
"raw",
")",
",",
"'pages'",
"=>",
"$",
"... | Get collection data
@param bool $raw
@return mixed | [
"Get",
"collection",
"data"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Collection.php#L139-L149 |
231,378 | schemaio/schema-php-client | lib/Collection.php | Collection.dump | function dump($return = false, $print = true, $depth = 1)
{
$dump = array();
$dump['count'] = $this->count;
$dump['results'] = array();
foreach ((array)$this->records() as $key => $record) {
if ($record instanceof Resource) {
$dump['results'][$key] = $record->data();
foreach ($record->links as $field => $link) {
if ($depth < 1) {
try {
$link_record = $record[$field];
} catch (ServerException $e) {
$link_record = array('$error' => $e->getMessage());
}
if ($link_record instanceof Resource) {
$dump['results'][$key][$field] = $link_record->dump(true, false, $depth+1);
} else {
$dump['results'][$key][$field] = $link_record;
}
}
}
}
}
if ($dump['results'] && $links = $this->links) {
$dump['$links'] = $this->dump_links($links);
}
if ($dump['count'] > 0) {
$dump['page'] = $this->page;
}
if ($this->pages) {
$dump['pages'] = $this->pages;
}
if ($print) {
return print_r($dump, $return);
} else {
return $dump;
}
} | php | function dump($return = false, $print = true, $depth = 1)
{
$dump = array();
$dump['count'] = $this->count;
$dump['results'] = array();
foreach ((array)$this->records() as $key => $record) {
if ($record instanceof Resource) {
$dump['results'][$key] = $record->data();
foreach ($record->links as $field => $link) {
if ($depth < 1) {
try {
$link_record = $record[$field];
} catch (ServerException $e) {
$link_record = array('$error' => $e->getMessage());
}
if ($link_record instanceof Resource) {
$dump['results'][$key][$field] = $link_record->dump(true, false, $depth+1);
} else {
$dump['results'][$key][$field] = $link_record;
}
}
}
}
}
if ($dump['results'] && $links = $this->links) {
$dump['$links'] = $this->dump_links($links);
}
if ($dump['count'] > 0) {
$dump['page'] = $this->page;
}
if ($this->pages) {
$dump['pages'] = $this->pages;
}
if ($print) {
return print_r($dump, $return);
} else {
return $dump;
}
} | [
"function",
"dump",
"(",
"$",
"return",
"=",
"false",
",",
"$",
"print",
"=",
"true",
",",
"$",
"depth",
"=",
"1",
")",
"{",
"$",
"dump",
"=",
"array",
"(",
")",
";",
"$",
"dump",
"[",
"'count'",
"]",
"=",
"$",
"this",
"->",
"count",
";",
"$"... | Dump raw collection values
@param bool $return
@param bool $print
@return void | [
"Dump",
"raw",
"collection",
"values"
] | 20759434a6dd7fcc38910eca5ad228287472751b | https://github.com/schemaio/schema-php-client/blob/20759434a6dd7fcc38910eca5ad228287472751b/lib/Collection.php#L158-L198 |
231,379 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Clipping.php | Clipping.findSvgGeometry | public function findSvgGeometry($conn, $MultiPointBbox, $database,
$geomColumn, $whereCol, $whereColValues, $width, $height)
{
$bboxGeoText = "ST_ENVELOPE("
. SrsPoint::getGeomFromTextMultiPoint("POSTGIS", $MultiPointBbox)
. ")";
$paramArray = array();
if(isset($whereColValues[0]))
{
if(is_string($whereColValues[0]))
{
$paramArray = array(\Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
} else if(is_int($whereColValues[0]))
{
$paramArray = array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
}
}
$srsInt = $MultiPointBbox[0]->getSrs();
$sql = "";
if("POSTGIS")
{
$sql .= "SELECT st_assvg(ST_INTERSECTION(" . $bboxGeoText
. ", ST_UNION(ST_TRANSFORM(" . $geomColumn . ","
. $srsInt . ")))) as svg_geom"
. ",ST_INTERSECTS(ST_UNION(ST_TRANSFORM(" . $geomColumn
. "," . $srsInt . "))," . $bboxGeoText . ") as intersects"
. ",ST_CONTAINS(ST_UNION(ST_TRANSFORM(" . $geomColumn . ","
. $srsInt . "))," . $bboxGeoText . ") as contains"
. ",area2d(" . $bboxGeoText . ") as bboxarea"
. ",area2d(ST_INTERSECTION(" . $bboxGeoText
. ",ST_UNION(ST_TRANSFORM(" . $geomColumn
. "," . $srsInt . ")))) as geomarea"
. ",st_assvg(" . $bboxGeoText . ") as envelope"
. " FROM " . $database
. " WHERE " . $whereCol . " IN (?) AND ST_INTERSECTS("
. $bboxGeoText . ",ST_TRANSFORM(" . $geomColumn . "," . $srsInt . "))";
}
$stmt = $conn->executeQuery($sql, array($whereColValues), $paramArray);
$row = $stmt->fetch();
$this->svgEnvelope = $row["envelope"];
$this->svgGeometry = $row["svg_geom"];
$this->intersects = $row["intersects"] === null ? false : $row["intersects"];
$this->contains = $row["contains"] === null ? false : $row["contains"];
$geomarea = $row["geomarea"] !== null ? floatval($row["geomarea"]) : 0.0;
$bboxarea = $row["bboxarea"];
$factor = $geomarea / $bboxarea;
$this->pixelNumber = intval($factor * $width * $height);
} | php | public function findSvgGeometry($conn, $MultiPointBbox, $database,
$geomColumn, $whereCol, $whereColValues, $width, $height)
{
$bboxGeoText = "ST_ENVELOPE("
. SrsPoint::getGeomFromTextMultiPoint("POSTGIS", $MultiPointBbox)
. ")";
$paramArray = array();
if(isset($whereColValues[0]))
{
if(is_string($whereColValues[0]))
{
$paramArray = array(\Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
} else if(is_int($whereColValues[0]))
{
$paramArray = array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
}
}
$srsInt = $MultiPointBbox[0]->getSrs();
$sql = "";
if("POSTGIS")
{
$sql .= "SELECT st_assvg(ST_INTERSECTION(" . $bboxGeoText
. ", ST_UNION(ST_TRANSFORM(" . $geomColumn . ","
. $srsInt . ")))) as svg_geom"
. ",ST_INTERSECTS(ST_UNION(ST_TRANSFORM(" . $geomColumn
. "," . $srsInt . "))," . $bboxGeoText . ") as intersects"
. ",ST_CONTAINS(ST_UNION(ST_TRANSFORM(" . $geomColumn . ","
. $srsInt . "))," . $bboxGeoText . ") as contains"
. ",area2d(" . $bboxGeoText . ") as bboxarea"
. ",area2d(ST_INTERSECTION(" . $bboxGeoText
. ",ST_UNION(ST_TRANSFORM(" . $geomColumn
. "," . $srsInt . ")))) as geomarea"
. ",st_assvg(" . $bboxGeoText . ") as envelope"
. " FROM " . $database
. " WHERE " . $whereCol . " IN (?) AND ST_INTERSECTS("
. $bboxGeoText . ",ST_TRANSFORM(" . $geomColumn . "," . $srsInt . "))";
}
$stmt = $conn->executeQuery($sql, array($whereColValues), $paramArray);
$row = $stmt->fetch();
$this->svgEnvelope = $row["envelope"];
$this->svgGeometry = $row["svg_geom"];
$this->intersects = $row["intersects"] === null ? false : $row["intersects"];
$this->contains = $row["contains"] === null ? false : $row["contains"];
$geomarea = $row["geomarea"] !== null ? floatval($row["geomarea"]) : 0.0;
$bboxarea = $row["bboxarea"];
$factor = $geomarea / $bboxarea;
$this->pixelNumber = intval($factor * $width * $height);
} | [
"public",
"function",
"findSvgGeometry",
"(",
"$",
"conn",
",",
"$",
"MultiPointBbox",
",",
"$",
"database",
",",
"$",
"geomColumn",
",",
"$",
"whereCol",
",",
"$",
"whereColValues",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"bboxGeoText",
"=... | Queries the svgEnvelope and the svgGeometry from the database
@param type $conn the database connection
@param array $MultiPointBbox the bounding box as a collection of the
SrsPoints
@param string $database the name of the database
@param string $geomColumn the name of the geometry column
@param string $whereCol the name of the column at the where clause
@param array $whereColValues the values for the column at the where clause
@param int $width the width of the image
@param int $height the height of the image | [
"Queries",
"the",
"svgEnvelope",
"and",
"the",
"svgGeometry",
"from",
"the",
"database"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Clipping.php#L110-L161 |
231,380 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Clipping.php | Clipping.getSVG | public function getSVG($width, $height)
{
if($this->svgEnvelope === null)
{
return null;
}
$min_max = explode(" ",
preg_replace('/M\s?|\sL|\sZ/', "", $this->svgEnvelope));
$min_x = floatval($min_max[0]);
$min_y = floatval($min_max[1]);
$max_x = floatval($min_max[0]);
$max_y = floatval($min_max[1]);
for($i = 1; $i < count($min_max); $i = $i + 2)
{
$min_x = min($min_x, floatval($min_max[$i - 1]));
$max_x = max($max_x, floatval($min_max[$i - 1]));
$min_y = min($min_y, floatval($min_max[$i]));
$max_y = max($max_y, floatval($min_max[$i]));
}
$vb = $min_x . " " . $min_y . " " . ($max_x - $min_x) . " " . ($max_y - $min_y);
return '<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="' . $width . 'px" height="' . $height . 'px" viewBox="' . $vb . '" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="' . ($this->svgGeometry === null
? '' : $this->svgGeometry) . '" fill="black" />
</svg>';
} | php | public function getSVG($width, $height)
{
if($this->svgEnvelope === null)
{
return null;
}
$min_max = explode(" ",
preg_replace('/M\s?|\sL|\sZ/', "", $this->svgEnvelope));
$min_x = floatval($min_max[0]);
$min_y = floatval($min_max[1]);
$max_x = floatval($min_max[0]);
$max_y = floatval($min_max[1]);
for($i = 1; $i < count($min_max); $i = $i + 2)
{
$min_x = min($min_x, floatval($min_max[$i - 1]));
$max_x = max($max_x, floatval($min_max[$i - 1]));
$min_y = min($min_y, floatval($min_max[$i]));
$max_y = max($max_y, floatval($min_max[$i]));
}
$vb = $min_x . " " . $min_y . " " . ($max_x - $min_x) . " " . ($max_y - $min_y);
return '<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="' . $width . 'px" height="' . $height . 'px" viewBox="' . $vb . '" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="' . ($this->svgGeometry === null
? '' : $this->svgGeometry) . '" fill="black" />
</svg>';
} | [
"public",
"function",
"getSVG",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"svgEnvelope",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"min_max",
"=",
"explode",
"(",
"\" \"",
",",
"preg_replace",
"(",... | Creates SVG for svgEnvelope and svgGeometry
@param type $geometry
@param \stdClass $viewbox viewbox from $this->getViewBox($envelope)
@return string svg as string | [
"Creates",
"SVG",
"for",
"svgEnvelope",
"and",
"svgGeometry"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Clipping.php#L234-L261 |
231,381 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Clipping.php | Clipping.clipImage | public function clipImage($sourceImage, $maskImage, $format)
{
$source = new \Imagick();
$source->readImageBlob($sourceImage);
$mask = new \Imagick();
$mask->setBackgroundColor(new \ImagickPixel('transparent'));
$mask->readImageBlob($maskImage);
$mask->setImageFormat($format);
$source->setImageMatte(1);
$source->compositeImage($mask, \Imagick::COMPOSITE_DSTIN, 0, 0);
$mask->destroy();
unset($mask);
$this->colorNumber = $source->getImageColors();
$content = $source->getimageblob();
// $mask->compositeImage($source, \Imagick::COMPOSITE_DSTOUT, 0, 0);
// $content = $mask->getimageblob();
$source->destroy();
unset($source);
return $content;
} | php | public function clipImage($sourceImage, $maskImage, $format)
{
$source = new \Imagick();
$source->readImageBlob($sourceImage);
$mask = new \Imagick();
$mask->setBackgroundColor(new \ImagickPixel('transparent'));
$mask->readImageBlob($maskImage);
$mask->setImageFormat($format);
$source->setImageMatte(1);
$source->compositeImage($mask, \Imagick::COMPOSITE_DSTIN, 0, 0);
$mask->destroy();
unset($mask);
$this->colorNumber = $source->getImageColors();
$content = $source->getimageblob();
// $mask->compositeImage($source, \Imagick::COMPOSITE_DSTOUT, 0, 0);
// $content = $mask->getimageblob();
$source->destroy();
unset($source);
return $content;
} | [
"public",
"function",
"clipImage",
"(",
"$",
"sourceImage",
",",
"$",
"maskImage",
",",
"$",
"format",
")",
"{",
"$",
"source",
"=",
"new",
"\\",
"Imagick",
"(",
")",
";",
"$",
"source",
"->",
"readImageBlob",
"(",
"$",
"sourceImage",
")",
";",
"$",
... | Clips the svgGeometry from the image
@param type $sourceImage
@param type $maskImage
@param string $format the image format
@return \Imagick the clipped image | [
"Clips",
"the",
"svgGeometry",
"from",
"the",
"image"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Clipping.php#L271-L293 |
231,382 | mapbender/owsproxy3 | src/OwsProxy3/CoreBundle/Component/Clipping.php | Clipping.createImage | public function createImage($width, $height, $format)
{
$image = new \Imagick();
$pixel = new \ImagickPixel('none');
$image->newImage(intval($width), intval($height), $pixel);
$image->setImageFormat($format);
$this->colorNumber = $image->getImageColors();
$this->pixelNumber = 0;
$content = $image->getimageblob();
$image->destroy();
unset($image);
return $content;
} | php | public function createImage($width, $height, $format)
{
$image = new \Imagick();
$pixel = new \ImagickPixel('none');
$image->newImage(intval($width), intval($height), $pixel);
$image->setImageFormat($format);
$this->colorNumber = $image->getImageColors();
$this->pixelNumber = 0;
$content = $image->getimageblob();
$image->destroy();
unset($image);
return $content;
} | [
"public",
"function",
"createImage",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"format",
")",
"{",
"$",
"image",
"=",
"new",
"\\",
"Imagick",
"(",
")",
";",
"$",
"pixel",
"=",
"new",
"\\",
"ImagickPixel",
"(",
"'none'",
")",
";",
"$",
"image... | Creates the graphical image
@param int $width the image widht
@param int $height the image height
@param string $format the image format
@return \Imagick the image | [
"Creates",
"the",
"graphical",
"image"
] | 7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3 | https://github.com/mapbender/owsproxy3/blob/7aa0d22d489489bde3df6722ac3f9cfb2a5b7ce3/src/OwsProxy3/CoreBundle/Component/Clipping.php#L303-L315 |
231,383 | lukasdev/DRouter | src/Http/Request.php | Request.get | public function get($key)
{
$data = $this->getParsedBody();
if (isset($data[$key])) {
return $data[$key];
}
} | php | public function get($key)
{
$data = $this->getParsedBody();
if (isset($data[$key])) {
return $data[$key];
}
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getParsedBody",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"data",
"[",
"$",
"key",
"]... | Retorna o valor de um indice no corpo do request, caso exista!
@param $key string | [
"Retorna",
"o",
"valor",
"de",
"um",
"indice",
"no",
"corpo",
"do",
"request",
"caso",
"exista!"
] | b02e9fb595f00b89122886ccb77f623bae09141a | https://github.com/lukasdev/DRouter/blob/b02e9fb595f00b89122886ccb77f623bae09141a/src/Http/Request.php#L92-L98 |
231,384 | lukasdev/DRouter | src/Http/Request.php | Request.getRequestUri | public function getRequestUri()
{
if (isset($_SERVER['ORIG_PATH_INFO'])) {
$pathInfo = $_SERVER['ORIG_PATH_INFO'];
} elseif (isset($_SERVER['PATH_INFO'])) {
$pathInfo = $_SERVER['PATH_INFO'];
}
//correção para alguns hosts
if (isset($pathInfo)) {
$pathInfo = str_replace('/index.php', '', $pathInfo);
}
$rota = (!isset($pathInfo)) ? '/' : strip_tags(trim($pathInfo));
return $rota;
} | php | public function getRequestUri()
{
if (isset($_SERVER['ORIG_PATH_INFO'])) {
$pathInfo = $_SERVER['ORIG_PATH_INFO'];
} elseif (isset($_SERVER['PATH_INFO'])) {
$pathInfo = $_SERVER['PATH_INFO'];
}
//correção para alguns hosts
if (isset($pathInfo)) {
$pathInfo = str_replace('/index.php', '', $pathInfo);
}
$rota = (!isset($pathInfo)) ? '/' : strip_tags(trim($pathInfo));
return $rota;
} | [
"public",
"function",
"getRequestUri",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'ORIG_PATH_INFO'",
"]",
")",
")",
"{",
"$",
"pathInfo",
"=",
"$",
"_SERVER",
"[",
"'ORIG_PATH_INFO'",
"]",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
... | Retorna o RequestUri atual
@return string | [
"Retorna",
"o",
"RequestUri",
"atual"
] | b02e9fb595f00b89122886ccb77f623bae09141a | https://github.com/lukasdev/DRouter/blob/b02e9fb595f00b89122886ccb77f623bae09141a/src/Http/Request.php#L104-L120 |
231,385 | dnadesign/silverstripe-elemental-subsites | src/Extensions/ElementalSubsitesPageExtension.php | ElementalSubsitePageExtension.onAfterDuplicateToSubsite | public function onAfterDuplicateToSubsite($originalPage)
{
/** @var ElementalArea $originalElementalArea */
$originalElementalArea = $originalPage->getComponent('ElementalArea');
$duplicateElementalArea = $originalElementalArea->duplicate(false);
$duplicateElementalArea->write();
$this->owner->ElementalAreaID = $duplicateElementalArea->ID;
$this->owner->write();
foreach ($originalElementalArea->Items() as $originalElement) {
/** @var BaseElement $originalElement */
$duplicateElement = $originalElement->duplicate(true);
// manually set the ParentID of each element, so we don't get versioning issues
DB::query(
sprintf(
"UPDATE %s SET ParentID = %d WHERE ID = %d",
DataObject::getSchema()->tableName(BaseElement::class),
$duplicateElementalArea->ID,
$duplicateElement->ID
)
);
}
} | php | public function onAfterDuplicateToSubsite($originalPage)
{
/** @var ElementalArea $originalElementalArea */
$originalElementalArea = $originalPage->getComponent('ElementalArea');
$duplicateElementalArea = $originalElementalArea->duplicate(false);
$duplicateElementalArea->write();
$this->owner->ElementalAreaID = $duplicateElementalArea->ID;
$this->owner->write();
foreach ($originalElementalArea->Items() as $originalElement) {
/** @var BaseElement $originalElement */
$duplicateElement = $originalElement->duplicate(true);
// manually set the ParentID of each element, so we don't get versioning issues
DB::query(
sprintf(
"UPDATE %s SET ParentID = %d WHERE ID = %d",
DataObject::getSchema()->tableName(BaseElement::class),
$duplicateElementalArea->ID,
$duplicateElement->ID
)
);
}
} | [
"public",
"function",
"onAfterDuplicateToSubsite",
"(",
"$",
"originalPage",
")",
"{",
"/** @var ElementalArea $originalElementalArea */",
"$",
"originalElementalArea",
"=",
"$",
"originalPage",
"->",
"getComponent",
"(",
"'ElementalArea'",
")",
";",
"$",
"duplicateElementa... | If the page is duplicated across subsites, copy the elements across too.
@return Page The duplicated page | [
"If",
"the",
"page",
"is",
"duplicated",
"across",
"subsites",
"copy",
"the",
"elements",
"across",
"too",
"."
] | c6b0581779e39ffecf033ec72ab455ace2cf6951 | https://github.com/dnadesign/silverstripe-elemental-subsites/blob/c6b0581779e39ffecf033ec72ab455ace2cf6951/src/Extensions/ElementalSubsitesPageExtension.php#L22-L47 |
231,386 | artkost/yii2-trumbowyg | src/TrumbowygAsset.php | TrumbowygAsset.registerAssetFiles | public function registerAssetFiles($view)
{
if ($this->language !== null) {
$this->js[] = 'langs/' . $this->language . '.min.js';
}
if (!empty($this->plugins)) {
foreach ($this->plugins as $plugin => $properties) {
if (is_string($properties)) {
$plugin = $properties;
}
if ($plugin === 'colors') {
$this->css[] = 'plugins/' . $plugin . '/ui/trumbowyg.' . $plugin . '.css';
}
$this->js[] = 'plugins/' . $plugin . '/trumbowyg.' . $plugin . '.js';
}
}
parent::registerAssetFiles($view);
} | php | public function registerAssetFiles($view)
{
if ($this->language !== null) {
$this->js[] = 'langs/' . $this->language . '.min.js';
}
if (!empty($this->plugins)) {
foreach ($this->plugins as $plugin => $properties) {
if (is_string($properties)) {
$plugin = $properties;
}
if ($plugin === 'colors') {
$this->css[] = 'plugins/' . $plugin . '/ui/trumbowyg.' . $plugin . '.css';
}
$this->js[] = 'plugins/' . $plugin . '/trumbowyg.' . $plugin . '.js';
}
}
parent::registerAssetFiles($view);
} | [
"public",
"function",
"registerAssetFiles",
"(",
"$",
"view",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"language",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"js",
"[",
"]",
"=",
"'langs/'",
".",
"$",
"this",
"->",
"language",
".",
"'.min.js'",
";",
... | Register asset bundle language files and plugins. | [
"Register",
"asset",
"bundle",
"language",
"files",
"and",
"plugins",
"."
] | 68d0fe03d30814674cad7ca5c0aed3ef0108b262 | https://github.com/artkost/yii2-trumbowyg/blob/68d0fe03d30814674cad7ca5c0aed3ef0108b262/src/TrumbowygAsset.php#L37-L58 |
231,387 | machour/yii2-swagger-api | ApiController.php | ApiController.shutdown | public function shutdown($message = null, $code = null)
{
if (!is_null($message)) {
$this->shutdownMessage = $message;
}
if (!is_null($code)) {
$this->shutdownCode = $code;
}
$this->shutdown = true;
return true;
} | php | public function shutdown($message = null, $code = null)
{
if (!is_null($message)) {
$this->shutdownMessage = $message;
}
if (!is_null($code)) {
$this->shutdownCode = $code;
}
$this->shutdown = true;
return true;
} | [
"public",
"function",
"shutdown",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"message",
")",
")",
"{",
"$",
"this",
"->",
"shutdownMessage",
"=",
"$",
"message",
";",
"}",
"if",
... | Ask the controller not to run the API call, but to raise
an ApiException instead
@param string $message
@param int $code
@return bool Returns TRUE | [
"Ask",
"the",
"controller",
"not",
"to",
"run",
"the",
"API",
"call",
"but",
"to",
"raise",
"an",
"ApiException",
"instead"
] | 577d9877f196a0a94b06d5623a0ea66cf329409b | https://github.com/machour/yii2-swagger-api/blob/577d9877f196a0a94b06d5623a0ea66cf329409b/ApiController.php#L278-L288 |
231,388 | machour/yii2-swagger-api | ApiController.php | ApiController.sendResponse | private function sendResponse($code, $message, $response = null) {
$ret = [
'code' => $code,
'message' => $message,
];
if ($response) {
$ret['response'] = $response;
}
return $ret;
} | php | private function sendResponse($code, $message, $response = null) {
$ret = [
'code' => $code,
'message' => $message,
];
if ($response) {
$ret['response'] = $response;
}
return $ret;
} | [
"private",
"function",
"sendResponse",
"(",
"$",
"code",
",",
"$",
"message",
",",
"$",
"response",
"=",
"null",
")",
"{",
"$",
"ret",
"=",
"[",
"'code'",
"=>",
"$",
"code",
",",
"'message'",
"=>",
"$",
"message",
",",
"]",
";",
"if",
"(",
"$",
"... | Formats an API response
@param int $code The response code
@param string $message The response human readable message
@param object $response The responded object
@return array | [
"Formats",
"an",
"API",
"response"
] | 577d9877f196a0a94b06d5623a0ea66cf329409b | https://github.com/machour/yii2-swagger-api/blob/577d9877f196a0a94b06d5623a0ea66cf329409b/ApiController.php#L314-L323 |
231,389 | machour/yii2-swagger-api | ApiController.php | ApiController.actionDocumentation | public function actionDocumentation()
{
Yii::$app->response->format = Response::FORMAT_JSON;
if ($this->apiDocsCacheEnabled) {
$filename = str_replace('\\', '-', static::class);
$path = Yii::getAlias($this->apiDocsCacheDirectory) . $filename . '.json';
if (file_exists($path)) {
$doc = file_get_contents($path);
} else {
$doc = $this->generator->getJson($this->version);
// Store the credentials to disk.
if (!is_dir(dirname($path))) {
mkdir(dirname($path), 0700, true);
}
file_put_contents($path, Json::encode($doc));
}
} else {
$doc = $this->generator->getJson($this->version);
}
return $doc;
} | php | public function actionDocumentation()
{
Yii::$app->response->format = Response::FORMAT_JSON;
if ($this->apiDocsCacheEnabled) {
$filename = str_replace('\\', '-', static::class);
$path = Yii::getAlias($this->apiDocsCacheDirectory) . $filename . '.json';
if (file_exists($path)) {
$doc = file_get_contents($path);
} else {
$doc = $this->generator->getJson($this->version);
// Store the credentials to disk.
if (!is_dir(dirname($path))) {
mkdir(dirname($path), 0700, true);
}
file_put_contents($path, Json::encode($doc));
}
} else {
$doc = $this->generator->getJson($this->version);
}
return $doc;
} | [
"public",
"function",
"actionDocumentation",
"(",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"response",
"->",
"format",
"=",
"Response",
"::",
"FORMAT_JSON",
";",
"if",
"(",
"$",
"this",
"->",
"apiDocsCacheEnabled",
")",
"{",
"$",
"filename",
"=",
"str_repl... | Gets the swagger documentation
This will fetch/write into the cache if $apiDocsCacheEnabled is set to true.
@todo Automatically refresh the cache by checking controller and models mtimes
@return array The swagger documentation structure | [
"Gets",
"the",
"swagger",
"documentation"
] | 577d9877f196a0a94b06d5623a0ea66cf329409b | https://github.com/machour/yii2-swagger-api/blob/577d9877f196a0a94b06d5623a0ea66cf329409b/ApiController.php#L333-L355 |
231,390 | fuzz-productions/magic-box | src/Filter.php | Filter.intersectAllowedFilters | public static function intersectAllowedFilters(array $filters, array $allowed)
{
foreach ($filters as $filter => $value) {
// We want to recursively go down and check all OR conjuctions to ensure they're all whitlisted
if ($filter === 'or') {
$filters['or'] = self::intersectAllowedFilters($filters['or'], $allowed);
// If there are no more filters under this OR, we can safely unset it
if (count($filters['or']) === 0) {
unset($filters['or']);
}
continue;
}
// We want to recursively go down and check all AND conjuctions to ensure they're all whitlisted
if ($filter === 'and') {
$filters['and'] = self::intersectAllowedFilters($filters['and'], $allowed);
// If there are no more filters under this AND, we can safely unset it
if (count($filters['and']) === 0) {
unset($filters['and']);
}
continue;
}
// A whitelisted filter looks like 'filter_name' => true in $allowed
if (! isset($allowed[$filter]) || ! $allowed[$filter]) {
unset($filters[$filter]);
}
}
return $filters;
} | php | public static function intersectAllowedFilters(array $filters, array $allowed)
{
foreach ($filters as $filter => $value) {
// We want to recursively go down and check all OR conjuctions to ensure they're all whitlisted
if ($filter === 'or') {
$filters['or'] = self::intersectAllowedFilters($filters['or'], $allowed);
// If there are no more filters under this OR, we can safely unset it
if (count($filters['or']) === 0) {
unset($filters['or']);
}
continue;
}
// We want to recursively go down and check all AND conjuctions to ensure they're all whitlisted
if ($filter === 'and') {
$filters['and'] = self::intersectAllowedFilters($filters['and'], $allowed);
// If there are no more filters under this AND, we can safely unset it
if (count($filters['and']) === 0) {
unset($filters['and']);
}
continue;
}
// A whitelisted filter looks like 'filter_name' => true in $allowed
if (! isset($allowed[$filter]) || ! $allowed[$filter]) {
unset($filters[$filter]);
}
}
return $filters;
} | [
"public",
"static",
"function",
"intersectAllowedFilters",
"(",
"array",
"$",
"filters",
",",
"array",
"$",
"allowed",
")",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filter",
"=>",
"$",
"value",
")",
"{",
"// We want to recursively go down and check all OR ... | Clean a set of filters by checking them against an array of allowed filters
This is similar to an array intersect, if a $filter is present in $allowed and set to true,
then it is an allowed filter.
$filters = [
'foo' => 'bar',
'and' => [
'baz' => 'bat'
'or' => [
'bag' => 'boo'
]
],
'or' => [
'bar' => 'foo'
],
];
$allowed = [
'foo' => true,
'baz' => true,
'baz' => true,
'bar' => true,
];
$result = [
'foo' => 'bar',
'and' => [
'baz' => 'bat'
],
'or' => [
'bar' => 'foo'
],
];
@param array $filters
@param array $allowed
@return array | [
"Clean",
"a",
"set",
"of",
"filters",
"by",
"checking",
"them",
"against",
"an",
"array",
"of",
"allowed",
"filters"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L87-L119 |
231,391 | fuzz-productions/magic-box | src/Filter.php | Filter.applyQueryFilters | public static function applyQueryFilters($query, $filters, $columns, $table)
{
// Wrap in a complex where so we don't break soft delete checks
$query->where(
function ($query) use ($filters, $columns, $table) {
self::filterQuery($query, $filters, $columns, $table);
});
} | php | public static function applyQueryFilters($query, $filters, $columns, $table)
{
// Wrap in a complex where so we don't break soft delete checks
$query->where(
function ($query) use ($filters, $columns, $table) {
self::filterQuery($query, $filters, $columns, $table);
});
} | [
"public",
"static",
"function",
"applyQueryFilters",
"(",
"$",
"query",
",",
"$",
"filters",
",",
"$",
"columns",
",",
"$",
"table",
")",
"{",
"// Wrap in a complex where so we don't break soft delete checks",
"$",
"query",
"->",
"where",
"(",
"function",
"(",
"$"... | Funnel for rest of filter methods
@param \Illuminate\Database\Eloquent\Builder $query
@param array $filters
@param array $columns
@param string $table | [
"Funnel",
"for",
"rest",
"of",
"filter",
"methods"
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L129-L136 |
231,392 | fuzz-productions/magic-box | src/Filter.php | Filter.startsWith | protected static function startsWith($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, 'LIKE', $filter . '%');
} | php | protected static function startsWith($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, 'LIKE', $filter . '%');
} | [
"protected",
"static",
"function",
"startsWith",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"$",
... | Query for items that begin with a string.
Ex: users?filters[name]=^John
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"that",
"begin",
"with",
"a",
"string",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L270-L274 |
231,393 | fuzz-productions/magic-box | src/Filter.php | Filter.endsWith | protected static function endsWith($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, 'LIKE', '%' . $filter);
} | php | protected static function endsWith($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, 'LIKE', '%' . $filter);
} | [
"protected",
"static",
"function",
"endsWith",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"$",
"q... | Query for items that end with a string.
Ex: users?filters[name]=$Smith
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"that",
"end",
"with",
"a",
"string",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L286-L290 |
231,394 | fuzz-productions/magic-box | src/Filter.php | Filter.contains | protected static function contains($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, 'LIKE', '%' . $filter . '%');
} | php | protected static function contains($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, 'LIKE', '%' . $filter . '%');
} | [
"protected",
"static",
"function",
"contains",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"$",
"q... | Query for items that contain a string.
Ex: users?filters[favorite_cheese]=~cheddar
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"that",
"contain",
"a",
"string",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L302-L306 |
231,395 | fuzz-productions/magic-box | src/Filter.php | Filter.lessThan | protected static function lessThan($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '<', $filter);
} | php | protected static function lessThan($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '<', $filter);
} | [
"protected",
"static",
"function",
"lessThan",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"$",
"q... | Query for items with a value less than a filter.
Ex: users?filters[lifetime_value]=<50
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"with",
"a",
"value",
"less",
"than",
"a",
"filter",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L318-L322 |
231,396 | fuzz-productions/magic-box | src/Filter.php | Filter.greaterThan | protected static function greaterThan($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '>', $filter);
} | php | protected static function greaterThan($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '>', $filter);
} | [
"protected",
"static",
"function",
"greaterThan",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"$",
... | Query for items with a value greater than a filter.
Ex: users?filters[lifetime_value]=>50
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"with",
"a",
"value",
"greater",
"than",
"a",
"filter",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L334-L338 |
231,397 | fuzz-productions/magic-box | src/Filter.php | Filter.greaterThanOrEquals | protected static function greaterThanOrEquals($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '>=', $filter);
} | php | protected static function greaterThanOrEquals($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '>=', $filter);
} | [
"protected",
"static",
"function",
"greaterThanOrEquals",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
... | Query for items with a value greater than or equal to a filter.
Ex: users?filters[lifetime_value]=>=50
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"with",
"a",
"value",
"greater",
"than",
"or",
"equal",
"to",
"a",
"filter",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L350-L354 |
231,398 | fuzz-productions/magic-box | src/Filter.php | Filter.lessThanOrEquals | protected static function lessThanOrEquals($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '<=', $filter);
} | php | protected static function lessThanOrEquals($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
$query->$method($column, '<=', $filter);
} | [
"protected",
"static",
"function",
"lessThanOrEquals",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"... | Query for items with a value less than or equal to a filter.
Ex: users?filters[lifetime_value]=<=50
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"with",
"a",
"value",
"less",
"than",
"or",
"equal",
"to",
"a",
"filter",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L366-L370 |
231,399 | fuzz-productions/magic-box | src/Filter.php | Filter.equals | protected static function equals($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
if ($filter === 'true' || $filter === 'false') {
$filter = $filter === 'true';
}
$query->$method($column, '=', $filter);
} | php | protected static function equals($column, $filter, $query, $or = false)
{
$method = self::determineMethod('where', $or);
if ($filter === 'true' || $filter === 'false') {
$filter = $filter === 'true';
}
$query->$method($column, '=', $filter);
} | [
"protected",
"static",
"function",
"equals",
"(",
"$",
"column",
",",
"$",
"filter",
",",
"$",
"query",
",",
"$",
"or",
"=",
"false",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"determineMethod",
"(",
"'where'",
",",
"$",
"or",
")",
";",
"if",
"("... | Query for items with a value equal to a filter.
Ex: users?filters[username]==Specific%20Username
@param string $column
@param string $filter
@param \Illuminate\Database\Eloquent\Builder $query
@param bool $or | [
"Query",
"for",
"items",
"with",
"a",
"value",
"equal",
"to",
"a",
"filter",
"."
] | 996f8a5cf99177216cbab4a82a8ca79b87d05dfe | https://github.com/fuzz-productions/magic-box/blob/996f8a5cf99177216cbab4a82a8ca79b87d05dfe/src/Filter.php#L382-L391 |
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.