repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.removePermission | public function removePermission(ChildPermission $permission)
{
if ($this->getPermissions()->contains($permission)) { $rolePermission = new ChildRolePermission();
$rolePermission->setPermission($permission);
if ($permission->isRolesLoaded()) {
//remove the back refer... | php | public function removePermission(ChildPermission $permission)
{
if ($this->getPermissions()->contains($permission)) { $rolePermission = new ChildRolePermission();
$rolePermission->setPermission($permission);
if ($permission->isRolesLoaded()) {
//remove the back refer... | [
"public",
"function",
"removePermission",
"(",
"ChildPermission",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPermissions",
"(",
")",
"->",
"contains",
"(",
"$",
"permission",
")",
")",
"{",
"$",
"rolePermission",
"=",
"new",
"ChildRolePer... | Remove permission of this object
through the role_permission cross reference table.
@param ChildPermission $permission
@return ChildRole The current object (for fluent API support) | [
"Remove",
"permission",
"of",
"this",
"object",
"through",
"the",
"role_permission",
"cross",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2394-L2420 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.clearAllReferences | public function clearAllReferences($deep = false)
{
if ($deep) {
if ($this->collUserRoles) {
foreach ($this->collUserRoles as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collRolePermissions) {
for... | php | public function clearAllReferences($deep = false)
{
if ($deep) {
if ($this->collUserRoles) {
foreach ($this->collUserRoles as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collRolePermissions) {
for... | [
"public",
"function",
"clearAllReferences",
"(",
"$",
"deep",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"deep",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collUserRoles",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collUserRoles",
"as",
"$",
"o",
")",
... | Resets all references and back-references to other model objects or collections of model objects.
This method is used to reset all php object references (not the actual reference in the database).
Necessary for object serialisation.
@param boolean $deep Whether to also clear the references on all referrer object... | [
"Resets",
"all",
"references",
"and",
"back",
"-",
"references",
"to",
"other",
"model",
"objects",
"or",
"collections",
"of",
"model",
"objects",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2451-L2480 |
fuelphp/display | src/Parser/MustacheLoader.php | MustacheLoader.findView | public function findView($name)
{
if (substr($name, -9) !== '.mustache')
{
$name .= '.mustache';
}
if ( ! $file = parent::findView($name))
{
throw new Mustache_Exception_UnknownTemplateException('Could not locate: '.$name);
}
return $file;
} | php | public function findView($name)
{
if (substr($name, -9) !== '.mustache')
{
$name .= '.mustache';
}
if ( ! $file = parent::findView($name))
{
throw new Mustache_Exception_UnknownTemplateException('Could not locate: '.$name);
}
return $file;
} | [
"public",
"function",
"findView",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"name",
",",
"-",
"9",
")",
"!==",
"'.mustache'",
")",
"{",
"$",
"name",
".=",
"'.mustache'",
";",
"}",
"if",
"(",
"!",
"$",
"file",
"=",
"parent",
"::",... | {@inheritdoc}
@throws Mustache_Exception_UnknownTemplateException If the template is not found | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/MustacheLoader.php#L27-L40 |
nealerickson/laravel-azure-blob-storage | src/Heedworks/LaravelAzureBlobStorage/LaravelAzureBlobStorageServiceProvider.php | LaravelAzureBlobStorageServiceProvider.register | public function register()
{
$this->app['blob-storage'] = $this->app->share(function($app)
{
return new BlobClient(
Config::get('laravel-azure-blob-storage::accountUrl'),
Config::get('laravel-azure-blob-storage::accountName'),
Config::get('laravel-azure-blob-storage::accountKey')
);
});
} | php | public function register()
{
$this->app['blob-storage'] = $this->app->share(function($app)
{
return new BlobClient(
Config::get('laravel-azure-blob-storage::accountUrl'),
Config::get('laravel-azure-blob-storage::accountName'),
Config::get('laravel-azure-blob-storage::accountKey')
);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'blob-storage'",
"]",
"=",
"$",
"this",
"->",
"app",
"->",
"share",
"(",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"BlobClient",
"(",
"Config",
"::",
"get"... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/nealerickson/laravel-azure-blob-storage/blob/e1d9e1acf0bd26fb6d273eb6b364df162c5fbd53/src/Heedworks/LaravelAzureBlobStorage/LaravelAzureBlobStorageServiceProvider.php#L31-L41 |
Coercive/Xss | XssUrl.php | XssUrl.detect | private function detect()
{
# Init
$this->xss = false;
# No data
if(!$this->string) { return; }
# Detect
foreach ($this->list as $item) {
if(preg_match("`$item`i", $this->string)) {
$this->xss = true;
}
}
} | php | private function detect()
{
# Init
$this->xss = false;
# No data
if(!$this->string) { return; }
# Detect
foreach ($this->list as $item) {
if(preg_match("`$item`i", $this->string)) {
$this->xss = true;
}
}
} | [
"private",
"function",
"detect",
"(",
")",
"{",
"# Init",
"$",
"this",
"->",
"xss",
"=",
"false",
";",
"# No data",
"if",
"(",
"!",
"$",
"this",
"->",
"string",
")",
"{",
"return",
";",
"}",
"# Detect",
"foreach",
"(",
"$",
"this",
"->",
"list",
"a... | DETECT XSS URL ATTACK
@return void | [
"DETECT",
"XSS",
"URL",
"ATTACK"
] | train | https://github.com/Coercive/Xss/blob/d47a05347550f7e2c846d7015483a7e91e5a5138/XssUrl.php#L94-L108 |
avoo/SerializerTranslation | Expression/ExpressionEvaluator.php | ExpressionEvaluator.registerFunction | public function registerFunction(ExpressionFunctionInterface $function)
{
$this->expressionLanguage->register(
$function->getName(),
$function->getCompiler(),
$function->getEvaluator()
);
foreach ($function->getContextVariables() as $name => $value) {
... | php | public function registerFunction(ExpressionFunctionInterface $function)
{
$this->expressionLanguage->register(
$function->getName(),
$function->getCompiler(),
$function->getEvaluator()
);
foreach ($function->getContextVariables() as $name => $value) {
... | [
"public",
"function",
"registerFunction",
"(",
"ExpressionFunctionInterface",
"$",
"function",
")",
"{",
"$",
"this",
"->",
"expressionLanguage",
"->",
"register",
"(",
"$",
"function",
"->",
"getName",
"(",
")",
",",
"$",
"function",
"->",
"getCompiler",
"(",
... | Register a new new ExpressionLanguage function.
@param ExpressionFunctionInterface $function
@return ExpressionEvaluator | [
"Register",
"a",
"new",
"new",
"ExpressionLanguage",
"function",
"."
] | train | https://github.com/avoo/SerializerTranslation/blob/e66de5482adb944197a36874465ef144b293a157/Expression/ExpressionEvaluator.php#L84-L97 |
letyii/yii2-jstree | JsTree.php | JsTree.run | public function run()
{
$clientOptions = $this->getClientOptions();
$clientOptions = empty($clientOptions) ? '' : Json::encode($clientOptions);
$view = $this->getView();
$view->registerJs("
jQuery('#" . $this->options['id'] . "')
.on('loaded.jstree', funct... | php | public function run()
{
$clientOptions = $this->getClientOptions();
$clientOptions = empty($clientOptions) ? '' : Json::encode($clientOptions);
$view = $this->getView();
$view->registerJs("
jQuery('#" . $this->options['id'] . "')
.on('loaded.jstree', funct... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"clientOptions",
"=",
"$",
"this",
"->",
"getClientOptions",
"(",
")",
";",
"$",
"clientOptions",
"=",
"empty",
"(",
"$",
"clientOptions",
")",
"?",
"''",
":",
"Json",
"::",
"encode",
"(",
"$",
"clientOp... | Renders the widget. | [
"Renders",
"the",
"widget",
"."
] | train | https://github.com/letyii/yii2-jstree/blob/33bcce6e0109994a86c8ae236cbb9084ee360c45/JsTree.php#L48-L60 |
letyii/yii2-jstree | JsTree.php | JsTree.getClientOptions | protected function getClientOptions()
{
$options = $this->clientOptions;
if ($this->items !== null)
$options['core']['data'] = $this->items;
$options['core']['check_callback'] = isset($options['core']['check_callback']) ? $options['core']['check_callback'] : tru... | php | protected function getClientOptions()
{
$options = $this->clientOptions;
if ($this->items !== null)
$options['core']['data'] = $this->items;
$options['core']['check_callback'] = isset($options['core']['check_callback']) ? $options['core']['check_callback'] : tru... | [
"protected",
"function",
"getClientOptions",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"clientOptions",
";",
"if",
"(",
"$",
"this",
"->",
"items",
"!==",
"null",
")",
"$",
"options",
"[",
"'core'",
"]",
"[",
"'data'",
"]",
"=",
"$",
"th... | Returns the options for jstree
@return array | [
"Returns",
"the",
"options",
"for",
"jstree"
] | train | https://github.com/letyii/yii2-jstree/blob/33bcce6e0109994a86c8ae236cbb9084ee360c45/JsTree.php#L66-L76 |
datasift/datasift-php | examples/football.php | EventHandler.onInteraction | public function onInteraction($consumer, $interaction, $hash)
{
echo 'Type: '.$interaction['interaction']['type']."\n";
echo 'Content: '.$interaction['interaction']['content']."\n--\n";
// Stop after 10
if ($this->_num-- == 1) {
echo "Stopping consumer...\n";
$consumer->stop();
}
} | php | public function onInteraction($consumer, $interaction, $hash)
{
echo 'Type: '.$interaction['interaction']['type']."\n";
echo 'Content: '.$interaction['interaction']['content']."\n--\n";
// Stop after 10
if ($this->_num-- == 1) {
echo "Stopping consumer...\n";
$consumer->stop();
}
} | [
"public",
"function",
"onInteraction",
"(",
"$",
"consumer",
",",
"$",
"interaction",
",",
"$",
"hash",
")",
"{",
"echo",
"'Type: '",
".",
"$",
"interaction",
"[",
"'interaction'",
"]",
"[",
"'type'",
"]",
".",
"\"\\n\"",
";",
"echo",
"'Content: '",
".",
... | Called for each interaction consumed.
@param DataSift_StreamConsumer $consumer The consumer sending the
event.
@param array $interaction The interaction data.
@param string $hash The hash of the stream that
matched this interaction.
@return void | [
"Called",
"for",
"each",
"interaction",
"consumed",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/examples/football.php#L70-L80 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Controller/PdfController.php | PdfController.orderConfirmationAction | public function orderConfirmationAction(Request $request, $id)
{
$locale = $this->getLocale($request);
$this->get('translator')->setLocale($locale);
try {
$orderApiEntity = $this->getOrderManager()->findByIdAndLocale($id, $locale);
$order = $orderApiEntity->getEntit... | php | public function orderConfirmationAction(Request $request, $id)
{
$locale = $this->getLocale($request);
$this->get('translator')->setLocale($locale);
try {
$orderApiEntity = $this->getOrderManager()->findByIdAndLocale($id, $locale);
$order = $orderApiEntity->getEntit... | [
"public",
"function",
"orderConfirmationAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"get",
"(",
"'translator'",
")",
"->",
"set... | Finds a order object by a given id from the url
and returns a rendered pdf in a download window
@param Request $request
@param $id
@throws OrderNotFoundException
@return Response | [
"Finds",
"a",
"order",
"object",
"by",
"a",
"given",
"id",
"from",
"the",
"url",
"and",
"returns",
"a",
"rendered",
"pdf",
"in",
"a",
"download",
"window"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Controller/PdfController.php#L49-L74 |
o2system/html | src/Dom/Style.php | Style.import | public function import(Style $style)
{
foreach ($style->getArrayCopy() as $styleTextContent) {
$this->append($styleTextContent);
}
} | php | public function import(Style $style)
{
foreach ($style->getArrayCopy() as $styleTextContent) {
$this->append($styleTextContent);
}
} | [
"public",
"function",
"import",
"(",
"Style",
"$",
"style",
")",
"{",
"foreach",
"(",
"$",
"style",
"->",
"getArrayCopy",
"(",
")",
"as",
"$",
"styleTextContent",
")",
"{",
"$",
"this",
"->",
"append",
"(",
"$",
"styleTextContent",
")",
";",
"}",
"}"
] | Style::import
@param \O2System\Html\Dom\Style $style | [
"Style",
"::",
"import"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Style.php#L30-L35 |
kderyabin/logger | src/Handlers/StreamHandler.php | StreamHandler.open | public function open(): bool
{
$path = $this->getOptionOrDefault('path');
if (is_resource($path)) {
$this->resource = $path;
return true;
}
$context = $this->getOptionOrDefault('context');
if (is_resource($context)) {
$this->resource = @fo... | php | public function open(): bool
{
$path = $this->getOptionOrDefault('path');
if (is_resource($path)) {
$this->resource = $path;
return true;
}
$context = $this->getOptionOrDefault('context');
if (is_resource($context)) {
$this->resource = @fo... | [
"public",
"function",
"open",
"(",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getOptionOrDefault",
"(",
"'path'",
")",
";",
"if",
"(",
"is_resource",
"(",
"$",
"path",
")",
")",
"{",
"$",
"this",
"->",
"resource",
"=",
"$",
"path"... | Open a log destination.
@return bool | [
"Open",
"a",
"log",
"destination",
"."
] | train | https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/Handlers/StreamHandler.php#L41-L57 |
kderyabin/logger | src/Handlers/StreamHandler.php | StreamHandler.handle | public function handle(string $level, string $log): bool
{
if (!is_resource($this->resource)) {
$status = $this->open();
if (!$status) {
throw new \Exception(
sprintf('Failed to open a resource "%s"', $this->getOptionOrDefault('path'))
... | php | public function handle(string $level, string $log): bool
{
if (!is_resource($this->resource)) {
$status = $this->open();
if (!$status) {
throw new \Exception(
sprintf('Failed to open a resource "%s"', $this->getOptionOrDefault('path'))
... | [
"public",
"function",
"handle",
"(",
"string",
"$",
"level",
",",
"string",
"$",
"log",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"resource",
")",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"open",
"(",
"... | Write a log message.
@param string $level
@param string $log
@return bool
@throws \Exception | [
"Write",
"a",
"log",
"message",
"."
] | train | https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/Handlers/StreamHandler.php#L77-L88 |
siriusphp/middleware | src/FrameRunner.php | FrameRunner.factory | public static function factory(array $middlewares = array())
{
$runner = null;
foreach ($middlewares as $middleware) {
$runner = $runner ? $runner->add($middleware) : new static($middleware);
}
return $runner;
} | php | public static function factory(array $middlewares = array())
{
$runner = null;
foreach ($middlewares as $middleware) {
$runner = $runner ? $runner->add($middleware) : new static($middleware);
}
return $runner;
} | [
"public",
"static",
"function",
"factory",
"(",
"array",
"$",
"middlewares",
"=",
"array",
"(",
")",
")",
"{",
"$",
"runner",
"=",
"null",
";",
"foreach",
"(",
"$",
"middlewares",
"as",
"$",
"middleware",
")",
"{",
"$",
"runner",
"=",
"$",
"runner",
... | Creates a runner based on an array of middleware
@param array $middlewares
@return FrameRunner | [
"Creates",
"a",
"runner",
"based",
"on",
"an",
"array",
"of",
"middleware"
] | train | https://github.com/siriusphp/middleware/blob/e6805639982d2c0ae01dc9e9a1583915b7873782/src/FrameRunner.php#L26-L33 |
fuzz-productions/laravel-api-data | src/Support/CollectionUtility.php | CollectionUtility.collapseSerialized | public static function collapseSerialized(EloquentCollection $collection)
{
return $collection->map(
function (SerializedModel $menu_item) {
return $menu_item->serialized();
}
)->collapse();
} | php | public static function collapseSerialized(EloquentCollection $collection)
{
return $collection->map(
function (SerializedModel $menu_item) {
return $menu_item->serialized();
}
)->collapse();
} | [
"public",
"static",
"function",
"collapseSerialized",
"(",
"EloquentCollection",
"$",
"collection",
")",
"{",
"return",
"$",
"collection",
"->",
"map",
"(",
"function",
"(",
"SerializedModel",
"$",
"menu_item",
")",
"{",
"return",
"$",
"menu_item",
"->",
"serial... | Collapse a keyed Eloquent Collection.
@param \Illuminate\Database\Eloquent\Collection $collection
@return \Illuminate\Support\Collection | [
"Collapse",
"a",
"keyed",
"Eloquent",
"Collection",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Support/CollectionUtility.php#L21-L28 |
withfatpanda/illuminate-wordpress | src/WordPress/Providers/Pagination/PaginationServiceProvider.php | PaginationServiceProvider.boot | public function boot()
{
$this->loadViewsFrom(__DIR__.'/resources/views', 'pagination');
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/resources/views' => $this->app->basePath('resources/views/vendor/pagination'),
], 'laravel-pagination');
}
... | php | public function boot()
{
$this->loadViewsFrom(__DIR__.'/resources/views', 'pagination');
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/resources/views' => $this->app->basePath('resources/views/vendor/pagination'),
], 'laravel-pagination');
}
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"loadViewsFrom",
"(",
"__DIR__",
".",
"'/resources/views'",
",",
"'pagination'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"$",
"this",
"... | Bootstrap any application services.
@return void | [
"Bootstrap",
"any",
"application",
"services",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Providers/Pagination/PaginationServiceProvider.php#L11-L20 |
Laralum/Roles | src/Models/Role.php | Role.addUser | public function addUser($user)
{
if (!$this->hasUser($user)) {
return RoleUser::create(['role_id' => $this->id, 'user_id' => $user->id]);
}
return false;
} | php | public function addUser($user)
{
if (!$this->hasUser($user)) {
return RoleUser::create(['role_id' => $this->id, 'user_id' => $user->id]);
}
return false;
} | [
"public",
"function",
"addUser",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasUser",
"(",
"$",
"user",
")",
")",
"{",
"return",
"RoleUser",
"::",
"create",
"(",
"[",
"'role_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'user_id'"... | Adds a user into the role.
@param mixed $user | [
"Adds",
"a",
"user",
"into",
"the",
"role",
"."
] | train | https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Models/Role.php#L62-L69 |
Laralum/Roles | src/Models/Role.php | Role.addPermission | public function addPermission($permission)
{
if (!$this->hasPermission($permission)) {
return PermissionRole::create(['role_id' => $this->id, 'permission_id' => $permission->id]);
}
return false;
} | php | public function addPermission($permission)
{
if (!$this->hasPermission($permission)) {
return PermissionRole::create(['role_id' => $this->id, 'permission_id' => $permission->id]);
}
return false;
} | [
"public",
"function",
"addPermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasPermission",
"(",
"$",
"permission",
")",
")",
"{",
"return",
"PermissionRole",
"::",
"create",
"(",
"[",
"'role_id'",
"=>",
"$",
"this",
"->"... | Adds a permission into the role.
@param mixed $permission | [
"Adds",
"a",
"permission",
"into",
"the",
"role",
"."
] | train | https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Models/Role.php#L76-L83 |
Laralum/Roles | src/Models/Role.php | Role.deleteUser | public function deleteUser($user)
{
if ($this->hasUser($user)) {
return RoleUser::where(
['role_id' => $this->id, 'user_id' => $user->id]
)->first()->delete();
}
return false;
} | php | public function deleteUser($user)
{
if ($this->hasUser($user)) {
return RoleUser::where(
['role_id' => $this->id, 'user_id' => $user->id]
)->first()->delete();
}
return false;
} | [
"public",
"function",
"deleteUser",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasUser",
"(",
"$",
"user",
")",
")",
"{",
"return",
"RoleUser",
"::",
"where",
"(",
"[",
"'role_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'user_id'",
"... | Deletes the specified role user.
@param mixed $user | [
"Deletes",
"the",
"specified",
"role",
"user",
"."
] | train | https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Models/Role.php#L118-L127 |
Laralum/Roles | src/Models/Role.php | Role.deletePermission | public function deletePermission($permission)
{
if ($this->hasPermission($permission)) {
return PermissionRole::where(
['role_id' => $this->id, 'permission_id' => $permission->id]
)->first()->delete();
}
return false;
} | php | public function deletePermission($permission)
{
if ($this->hasPermission($permission)) {
return PermissionRole::where(
['role_id' => $this->id, 'permission_id' => $permission->id]
)->first()->delete();
}
return false;
} | [
"public",
"function",
"deletePermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasPermission",
"(",
"$",
"permission",
")",
")",
"{",
"return",
"PermissionRole",
"::",
"where",
"(",
"[",
"'role_id'",
"=>",
"$",
"this",
"->",
"... | Deletes the specified role permission.
@param mixed $permission | [
"Deletes",
"the",
"specified",
"role",
"permission",
"."
] | train | https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Models/Role.php#L134-L143 |
heyday/heystack | src/Storage/Storage.php | Storage.process | public function process(StorableInterface $object)
{
if (is_array($this->backends) && count($this->backends) > 0) {
$results = [];
$identifiers = $object->getStorableBackendIdentifiers();
foreach ($this->backends as $identifier => $backend) {
if (in_arra... | php | public function process(StorableInterface $object)
{
if (is_array($this->backends) && count($this->backends) > 0) {
$results = [];
$identifiers = $object->getStorableBackendIdentifiers();
foreach ($this->backends as $identifier => $backend) {
if (in_arra... | [
"public",
"function",
"process",
"(",
"StorableInterface",
"$",
"object",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"backends",
")",
"&&",
"count",
"(",
"$",
"this",
"->",
"backends",
")",
">",
"0",
")",
"{",
"$",
"results",
"=",
"[",
... | Runs through each storage backend and processes the Storable object
@param StorableInterface $object
@return array
@throws \Exception | [
"Runs",
"through",
"each",
"storage",
"backend",
"and",
"processes",
"the",
"Storable",
"object"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/Storage/Storage.php#L69-L91 |
czim/laravel-pxlcms | src/Generator/Writer/Model/CmsModelWriter.php | CmsModelWriter.processSteps | protected function processSteps()
{
return [
Steps\CheckConditionsAndSetup::class,
Steps\StubReplaceSimple::class,
Steps\StubReplaceAttributeData::class,
Steps\StubReplaceRelationData::class,
Steps\StubReplaceAccessorsAndMutators::class,
... | php | protected function processSteps()
{
return [
Steps\CheckConditionsAndSetup::class,
Steps\StubReplaceSimple::class,
Steps\StubReplaceAttributeData::class,
Steps\StubReplaceRelationData::class,
Steps\StubReplaceAccessorsAndMutators::class,
... | [
"protected",
"function",
"processSteps",
"(",
")",
"{",
"return",
"[",
"Steps",
"\\",
"CheckConditionsAndSetup",
"::",
"class",
",",
"Steps",
"\\",
"StubReplaceSimple",
"::",
"class",
",",
"Steps",
"\\",
"StubReplaceAttributeData",
"::",
"class",
",",
"Steps",
"... | Gathers the steps to pass the dataobject through as a collection
These are the steps for AFTER the initial checks and retrieval
has been handled.
@return array | [
"Gathers",
"the",
"steps",
"to",
"pass",
"the",
"dataobject",
"through",
"as",
"a",
"collection",
"These",
"are",
"the",
"steps",
"for",
"AFTER",
"the",
"initial",
"checks",
"and",
"retrieval",
"has",
"been",
"handled",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/CmsModelWriter.php#L39-L55 |
phower/escaper | src/Phower/Escaper/Escaper.php | Escaper.toUtf8 | protected function toUtf8($string)
{
if ($this->getEncoding() === 'utf-8') {
$result = $string;
} else {
$result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding());
}
return $result;
} | php | protected function toUtf8($string)
{
if ($this->getEncoding() === 'utf-8') {
$result = $string;
} else {
$result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding());
}
return $result;
} | [
"protected",
"function",
"toUtf8",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getEncoding",
"(",
")",
"===",
"'utf-8'",
")",
"{",
"$",
"result",
"=",
"$",
"string",
";",
"}",
"else",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"... | Convert string to UTF-8
@param string $string
@return string
@throws RuntimeException | [
"Convert",
"string",
"to",
"UTF",
"-",
"8"
] | train | https://github.com/phower/escaper/blob/2c74ab507ac8cb272da27d6225c596abd972a0c3/src/Phower/Escaper/Escaper.php#L187-L196 |
phower/escaper | src/Phower/Escaper/Escaper.php | Escaper.escapeAttribute | public function escapeAttribute($attribute)
{
$attribute = $this->toUtf8($attribute);
if ($attribute === '' || ctype_digit($attribute)) {
return $attribute;
}
$result = preg_replace_callback('/[^a-z0-9,\.\-_]/iSu', $this->attributeMatcher, $attribute);
return $t... | php | public function escapeAttribute($attribute)
{
$attribute = $this->toUtf8($attribute);
if ($attribute === '' || ctype_digit($attribute)) {
return $attribute;
}
$result = preg_replace_callback('/[^a-z0-9,\.\-_]/iSu', $this->attributeMatcher, $attribute);
return $t... | [
"public",
"function",
"escapeAttribute",
"(",
"$",
"attribute",
")",
"{",
"$",
"attribute",
"=",
"$",
"this",
"->",
"toUtf8",
"(",
"$",
"attribute",
")",
";",
"if",
"(",
"$",
"attribute",
"===",
"''",
"||",
"ctype_digit",
"(",
"$",
"attribute",
")",
")... | Escape attribute
@param string $attribute
@return string | [
"Escape",
"attribute"
] | train | https://github.com/phower/escaper/blob/2c74ab507ac8cb272da27d6225c596abd972a0c3/src/Phower/Escaper/Escaper.php#L258-L268 |
phower/escaper | src/Phower/Escaper/Escaper.php | Escaper.escapeJs | public function escapeJs($js)
{
$js = $this->toUtf8($js);
if ($js === '' || ctype_digit($js)) {
return $js;
}
$result = preg_replace_callback('/[^a-z0-9,\._]/iSu', $this->jsMatcher, $js);
return $this->fromUtf8($result);
} | php | public function escapeJs($js)
{
$js = $this->toUtf8($js);
if ($js === '' || ctype_digit($js)) {
return $js;
}
$result = preg_replace_callback('/[^a-z0-9,\._]/iSu', $this->jsMatcher, $js);
return $this->fromUtf8($result);
} | [
"public",
"function",
"escapeJs",
"(",
"$",
"js",
")",
"{",
"$",
"js",
"=",
"$",
"this",
"->",
"toUtf8",
"(",
"$",
"js",
")",
";",
"if",
"(",
"$",
"js",
"===",
"''",
"||",
"ctype_digit",
"(",
"$",
"js",
")",
")",
"{",
"return",
"$",
"js",
";"... | Escape JS
@param string $js
@return string | [
"Escape",
"JS"
] | train | https://github.com/phower/escaper/blob/2c74ab507ac8cb272da27d6225c596abd972a0c3/src/Phower/Escaper/Escaper.php#L276-L287 |
phower/escaper | src/Phower/Escaper/Escaper.php | Escaper.escapeCss | public function escapeCss($css)
{
$css = $this->toUtf8($css);
if ($css === '' || ctype_digit($css)) {
return $css;
}
$result = preg_replace_callback('/[^a-z0-9]/iSu', $this->cssMatcher, $css);
return $this->fromUtf8($result);
} | php | public function escapeCss($css)
{
$css = $this->toUtf8($css);
if ($css === '' || ctype_digit($css)) {
return $css;
}
$result = preg_replace_callback('/[^a-z0-9]/iSu', $this->cssMatcher, $css);
return $this->fromUtf8($result);
} | [
"public",
"function",
"escapeCss",
"(",
"$",
"css",
")",
"{",
"$",
"css",
"=",
"$",
"this",
"->",
"toUtf8",
"(",
"$",
"css",
")",
";",
"if",
"(",
"$",
"css",
"===",
"''",
"||",
"ctype_digit",
"(",
"$",
"css",
")",
")",
"{",
"return",
"$",
"css"... | Escape CSS
@param string $css
@return string | [
"Escape",
"CSS"
] | train | https://github.com/phower/escaper/blob/2c74ab507ac8cb272da27d6225c596abd972a0c3/src/Phower/Escaper/Escaper.php#L295-L306 |
pageon/SlackWebhookMonolog | src/Monolog/Error.php | Error.addParameterFallback | private function addParameterFallback($name, $fallbackData = null)
{
if (!isset($this->parameters[$name]) && !empty($fallbackData)) {
$this->parameters[$name] = $fallbackData;
}
} | php | private function addParameterFallback($name, $fallbackData = null)
{
if (!isset($this->parameters[$name]) && !empty($fallbackData)) {
$this->parameters[$name] = $fallbackData;
}
} | [
"private",
"function",
"addParameterFallback",
"(",
"$",
"name",
",",
"$",
"fallbackData",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"parameters",
"[",
"$",
"name",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"fallbackData",
... | This will add fallback data to the parameters if the key is not set.
@param string $name
@param mixed $fallbackData | [
"This",
"will",
"add",
"fallback",
"data",
"to",
"the",
"parameters",
"if",
"the",
"key",
"is",
"not",
"set",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Monolog/Error.php#L127-L132 |
Wonail/wocenter | libs/PinYin.php | PinYin.Pinyin | public static function Pinyin($_String, $_Code = 'UTF8')
{
// GBK页面可改为gb2312,其他随意填写为UTF8
$_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" .
"|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|ch... | php | public static function Pinyin($_String, $_Code = 'UTF8')
{
// GBK页面可改为gb2312,其他随意填写为UTF8
$_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" .
"|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|ch... | [
"public",
"static",
"function",
"Pinyin",
"(",
"$",
"_String",
",",
"$",
"_Code",
"=",
"'UTF8'",
")",
"{",
"// GBK页面可改为gb2312,其他随意填写为UTF8",
"$",
"_DataKey",
"=",
"\"a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha\"",... | 返回中文拼音 | [
"返回中文拼音"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/libs/PinYin.php#L15-L80 |
wpottier/WizadSettingsBundle | DependencyInjection/ContainerInjectionManager.php | ContainerInjectionManager.inject | public function inject(ContainerBuilder $container)
{
foreach ($this->schema as $parameter) {
$value = $parameter['default'];
if ($this->parametersStorage->has($parameter['key'])) {
$value = $this->parametersStorage->get($parameter['key']);
}
... | php | public function inject(ContainerBuilder $container)
{
foreach ($this->schema as $parameter) {
$value = $parameter['default'];
if ($this->parametersStorage->has($parameter['key'])) {
$value = $this->parametersStorage->get($parameter['key']);
}
... | [
"public",
"function",
"inject",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"schema",
"as",
"$",
"parameter",
")",
"{",
"$",
"value",
"=",
"$",
"parameter",
"[",
"'default'",
"]",
";",
"if",
"(",
"$",
"this",... | Inject dynamic parameters in the container builder
@param ContainerBuilder $container | [
"Inject",
"dynamic",
"parameters",
"in",
"the",
"container",
"builder"
] | train | https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/DependencyInjection/ContainerInjectionManager.php#L39-L51 |
wpottier/WizadSettingsBundle | DependencyInjection/ContainerInjectionManager.php | ContainerInjectionManager.rebuild | public function rebuild(Kernel $kernel)
{
$kernelReflectionClass = new \ReflectionClass($kernel);
$buildContainerReflectionMethod = $kernelReflectionClass->getMethod('buildContainer');
$buildContainerReflectionMethod->setAccessible(true);
$dumpContainerReflectionMethod = $kernelRef... | php | public function rebuild(Kernel $kernel)
{
$kernelReflectionClass = new \ReflectionClass($kernel);
$buildContainerReflectionMethod = $kernelReflectionClass->getMethod('buildContainer');
$buildContainerReflectionMethod->setAccessible(true);
$dumpContainerReflectionMethod = $kernelRef... | [
"public",
"function",
"rebuild",
"(",
"Kernel",
"$",
"kernel",
")",
"{",
"$",
"kernelReflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"kernel",
")",
";",
"$",
"buildContainerReflectionMethod",
"=",
"$",
"kernelReflectionClass",
"->",
"getMethod",
... | Rebuild the container and dump it to the cache to apply change on redis stored parameters | [
"Rebuild",
"the",
"container",
"and",
"dump",
"it",
"to",
"the",
"cache",
"to",
"apply",
"change",
"on",
"redis",
"stored",
"parameters"
] | train | https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/DependencyInjection/ContainerInjectionManager.php#L56-L82 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.parseIds | public static function parseIds($ids)
{
if (empty($ids)) {
return [];
}
// 转换数字ID和字符串形式ID串为数组
if (is_numeric($ids)) {
$ids = [$ids];
} else if (is_string($ids)) {
$ids = self::stringToArray($ids);
}
$id_arr... | php | public static function parseIds($ids)
{
if (empty($ids)) {
return [];
}
// 转换数字ID和字符串形式ID串为数组
if (is_numeric($ids)) {
$ids = [$ids];
} else if (is_string($ids)) {
$ids = self::stringToArray($ids);
}
$id_arr... | [
"public",
"static",
"function",
"parseIds",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"ids",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// 转换数字ID和字符串形式ID串为数组",
"if",
"(",
"is_numeric",
"(",
"$",
"ids",
")",
")",
"{",
"$",
"ids",
... | 转换数字ID和字符串形式ID串为数组,并过滤重复和空的数据
@param mixed $ids 要格式化的字符串
@return array | [
"转换数字ID和字符串形式ID串为数组,并过滤重复和空的数据"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L37-L53 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.parseString | public static function parseString($string)
{
$array = preg_split('/[,;\r\n]+/', trim($string, ",;\r\n"));
if (strpos($string, ':')) {
$value = [];
foreach ($array as $val) {
list($k, $v) = explode(':', $val);
$value[$k] = $v;
}
... | php | public static function parseString($string)
{
$array = preg_split('/[,;\r\n]+/', trim($string, ",;\r\n"));
if (strpos($string, ':')) {
$value = [];
foreach ($array as $val) {
list($k, $v) = explode(':', $val);
$value[$k] = $v;
}
... | [
"public",
"static",
"function",
"parseString",
"(",
"$",
"string",
")",
"{",
"$",
"array",
"=",
"preg_split",
"(",
"'/[,;\\r\\n]+/'",
",",
"trim",
"(",
"$",
"string",
",",
"\",;\\r\\n\"",
")",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"string",
",",
"':... | 解析[下拉框,单选框,多选框]类型额外配置值
格式:
1. 以英文逗号分隔。a:名称1,b:名称2
2. 以英文分号分隔。a:名称1;b:名称2;
3. 以回车换行分隔。
a:名称1
b:名称2
@param string $string 要解析的字符串
@return array | [
"解析",
"[",
"下拉框",
"单选框",
"多选框",
"]",
"类型额外配置值",
"格式",
":",
"1",
".",
"以英文逗号分隔。a",
":",
"名称1",
"b",
":",
"名称2",
"2",
".",
"以英文分号分隔。a",
":",
"名称1",
";",
"b",
":",
"名称2",
";",
"3",
".",
"以回车换行分隔。",
"a",
":",
"名称1",
"b",
":",
"名称2"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L68-L82 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.getFirstLetter | public static function getFirstLetter($str)
{
$firstCharOrd = ord(strtoupper($str{0}));
if ($firstCharOrd >= 65 and $firstCharOrd <= 91) {
return strtoupper($str{0});
}
if ($firstCharOrd >= 48 and $firstCharOrd <= 57) {
return '#';
}
$s = iconv... | php | public static function getFirstLetter($str)
{
$firstCharOrd = ord(strtoupper($str{0}));
if ($firstCharOrd >= 65 and $firstCharOrd <= 91) {
return strtoupper($str{0});
}
if ($firstCharOrd >= 48 and $firstCharOrd <= 57) {
return '#';
}
$s = iconv... | [
"public",
"static",
"function",
"getFirstLetter",
"(",
"$",
"str",
")",
"{",
"$",
"firstCharOrd",
"=",
"ord",
"(",
"strtoupper",
"(",
"$",
"str",
"{",
"0",
"}",
")",
")",
";",
"if",
"(",
"$",
"firstCharOrd",
">=",
"65",
"and",
"$",
"firstCharOrd",
"<... | 获取字符串首字母
@param $str
@return string | [
"获取字符串首字母"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L91-L150 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.mbSubstr | public static function mbSubstr($str, $start = 0, $length = 5, $charset = "utf-8", $suffix = true)
{
if (function_exists("mb_substr")) {
$slice = mb_substr($str, $start, $length, $charset);
} elseif (function_exists('iconv_substr')) {
$slice = iconv_substr($str, $start, $leng... | php | public static function mbSubstr($str, $start = 0, $length = 5, $charset = "utf-8", $suffix = true)
{
if (function_exists("mb_substr")) {
$slice = mb_substr($str, $start, $length, $charset);
} elseif (function_exists('iconv_substr')) {
$slice = iconv_substr($str, $start, $leng... | [
"public",
"static",
"function",
"mbSubstr",
"(",
"$",
"str",
",",
"$",
"start",
"=",
"0",
",",
"$",
"length",
"=",
"5",
",",
"$",
"charset",
"=",
"\"utf-8\"",
",",
"$",
"suffix",
"=",
"true",
")",
"{",
"if",
"(",
"function_exists",
"(",
"\"mb_substr\... | 截取中文字符串
@param string $str 需要截取的字符串
@param integer $start 开始查询的下标
@param integer $length 截取长度
@param string $charset 字符串编码
@param boolean $suffix 超出部分是否显示省略号
@return string | [
"截取中文字符串"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L163-L183 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.randString | public static function randString($len = 6, $type = Constants::UNLIMITED, $addChars = '')
{
$str = '';
switch ($type) {
case 0:
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' . $addChars;
break;
case 1:
$chars =... | php | public static function randString($len = 6, $type = Constants::UNLIMITED, $addChars = '')
{
$str = '';
switch ($type) {
case 0:
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' . $addChars;
break;
case 1:
$chars =... | [
"public",
"static",
"function",
"randString",
"(",
"$",
"len",
"=",
"6",
",",
"$",
"type",
"=",
"Constants",
"::",
"UNLIMITED",
",",
"$",
"addChars",
"=",
"''",
")",
"{",
"$",
"str",
"=",
"''",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"... | 产生随机字串,可用来自动生成密码
默认长度6位 字母和数字混合 支持中文
@param integer $len 长度
@param integer $type 字串类型,默认去掉了容易混淆的字符oOLl和数字01,要添加请使用addChars参数
0 - 所有字母,包括大小写
1 - 数字
2 - 大写字母
3 - 小写字母
4 - 中文
默认 - 混合,默认去掉了容易混淆的字符oOLl和数字01,要添加请使用addChars参数
@param string $addChars 额外字符
@return string | [
"产生随机字串,可用来自动生成密码",
"默认长度6位",
"字母和数字混合",
"支持中文"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L243-L281 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.buildCountRand | public static function buildCountRand($number, $length = 4, $type = Constants::UNLIMITED)
{
if ($type == 1 && $length < strlen($number)) {
//不足以生成一定数量的不重复数字
return false;
}
$rand = [];
for ($i = 0; $i < $number; $i++) {
$rand[] = self::randString($... | php | public static function buildCountRand($number, $length = 4, $type = Constants::UNLIMITED)
{
if ($type == 1 && $length < strlen($number)) {
//不足以生成一定数量的不重复数字
return false;
}
$rand = [];
for ($i = 0; $i < $number; $i++) {
$rand[] = self::randString($... | [
"public",
"static",
"function",
"buildCountRand",
"(",
"$",
"number",
",",
"$",
"length",
"=",
"4",
",",
"$",
"type",
"=",
"Constants",
"::",
"UNLIMITED",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"1",
"&&",
"$",
"length",
"<",
"strlen",
"(",
"$",
"n... | 生成一定数量的随机数,并且不重复
@param integer $number 数量
@param integer $length 长度
@param integer $type 字串类型,默认去掉了容易混淆的字符oOLl和数字01,要添加请使用addChars参数
0 - 所有字母,包括大小写
1 - 数字
2 - 大写字母
3 - 小写字母
4 - 中文
默认 - 混合,默认去掉了容易混淆的字符oOLl和数字01,要添加请使用addChars参数
@return bool|array | [
"生成一定数量的随机数,并且不重复"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L298-L319 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.autoCharset | public static function autoCharset($string, $from = 'gbk', $to = 'utf-8')
{
$from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;
$to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;
if (strtoupper($from) === strtoupper($to) || empty($string) || (is_scalar($string) && !is_string($string))) {
... | php | public static function autoCharset($string, $from = 'gbk', $to = 'utf-8')
{
$from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;
$to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;
if (strtoupper($from) === strtoupper($to) || empty($string) || (is_scalar($string) && !is_string($string))) {
... | [
"public",
"static",
"function",
"autoCharset",
"(",
"$",
"string",
",",
"$",
"from",
"=",
"'gbk'",
",",
"$",
"to",
"=",
"'utf-8'",
")",
"{",
"$",
"from",
"=",
"strtoupper",
"(",
"$",
"from",
")",
"==",
"'UTF8'",
"?",
"'utf-8'",
":",
"$",
"from",
";... | 自动转换字符集 支持数组转换
@param $string
@param string $from
@param string $to
@return array|string | [
"自动转换字符集",
"支持数组转换"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L385-L413 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.htmlSubString | public static function htmlSubString($str, $length, $url = null, $anchor = '<!-- break -->')
{
$_length = mb_strlen(strip_tags($str), "utf-8"); // 统计字符串长度(中、英文都算一个字符)
if ($_length <= $length) {
return $str; // 传入的字符串长度小于截取长度,原样返回
}
$strlen_var = strlen($str); // 统计字符串长度(... | php | public static function htmlSubString($str, $length, $url = null, $anchor = '<!-- break -->')
{
$_length = mb_strlen(strip_tags($str), "utf-8"); // 统计字符串长度(中、英文都算一个字符)
if ($_length <= $length) {
return $str; // 传入的字符串长度小于截取长度,原样返回
}
$strlen_var = strlen($str); // 统计字符串长度(... | [
"public",
"static",
"function",
"htmlSubString",
"(",
"$",
"str",
",",
"$",
"length",
",",
"$",
"url",
"=",
"null",
",",
"$",
"anchor",
"=",
"'<!-- break -->'",
")",
"{",
"$",
"_length",
"=",
"mb_strlen",
"(",
"strip_tags",
"(",
"$",
"str",
")",
",",
... | 截取含有 html标签的字符串
@param string $str 待截取字符串
@param int $length 截取长度
@param string $url 链接
@param string $anchor 截取锚点,如果截取过程中遇到这个标记锚点就截至该锚点处
@return string $result 返回值
@demo $res = cut_html_str($str, 256, '...'); //截取256个长度,其余部分用'...'替换
@author Wang Jian. <wj@yurendu.com> Date: 2014/03/16 | [
"截取含有",
"html标签的字符串"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L428-L526 |
Wonail/wocenter | helpers/StringHelper.php | StringHelper.replace | public static function replace(string $str, string $find, $replace = ''): string
{
return ($position = strpos($str, $find)) !== false ? substr_replace($str, $replace, $position, strlen($find)) : $str;
} | php | public static function replace(string $str, string $find, $replace = ''): string
{
return ($position = strpos($str, $find)) !== false ? substr_replace($str, $replace, $position, strlen($find)) : $str;
} | [
"public",
"static",
"function",
"replace",
"(",
"string",
"$",
"str",
",",
"string",
"$",
"find",
",",
"$",
"replace",
"=",
"''",
")",
":",
"string",
"{",
"return",
"(",
"$",
"position",
"=",
"strpos",
"(",
"$",
"str",
",",
"$",
"find",
")",
")",
... | 替换第一个被找到的字符串
@param string $str
@param string $find
@param string $replace
@return string | [
"替换第一个被找到的字符串"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/StringHelper.php#L549-L552 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.filterByCreateDate | public function filterByCreateDate($createDate = null, $comparison = null)
{
if (is_array($createDate)) {
$useMinMax = false;
if (isset($createDate['min'])) {
$this->addUsingAlias(RoleTableMap::COL_CREATE_DATE, $createDate['min'], Criteria::GREATER_EQUAL);
... | php | public function filterByCreateDate($createDate = null, $comparison = null)
{
if (is_array($createDate)) {
$useMinMax = false;
if (isset($createDate['min'])) {
$this->addUsingAlias(RoleTableMap::COL_CREATE_DATE, $createDate['min'], Criteria::GREATER_EQUAL);
... | [
"public",
"function",
"filterByCreateDate",
"(",
"$",
"createDate",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"createDate",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
... | Filter the query on the create_date column
Example usage:
<code>
$query->filterByCreateDate('2011-03-14'); // WHERE create_date = '2011-03-14'
$query->filterByCreateDate('now'); // WHERE create_date = '2011-03-14'
$query->filterByCreateDate(array('max' => 'yesterday')); // WHERE create_date > '2011-03-13'
</code>
@pa... | [
"Filter",
"the",
"query",
"on",
"the",
"create_date",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L366-L387 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.filterByUpdateDate | public function filterByUpdateDate($updateDate = null, $comparison = null)
{
if (is_array($updateDate)) {
$useMinMax = false;
if (isset($updateDate['min'])) {
$this->addUsingAlias(RoleTableMap::COL_UPDATE_DATE, $updateDate['min'], Criteria::GREATER_EQUAL);
... | php | public function filterByUpdateDate($updateDate = null, $comparison = null)
{
if (is_array($updateDate)) {
$useMinMax = false;
if (isset($updateDate['min'])) {
$this->addUsingAlias(RoleTableMap::COL_UPDATE_DATE, $updateDate['min'], Criteria::GREATER_EQUAL);
... | [
"public",
"function",
"filterByUpdateDate",
"(",
"$",
"updateDate",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"updateDate",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
... | Filter the query on the update_date column
Example usage:
<code>
$query->filterByUpdateDate('2011-03-14'); // WHERE update_date = '2011-03-14'
$query->filterByUpdateDate('now'); // WHERE update_date = '2011-03-14'
$query->filterByUpdateDate(array('max' => 'yesterday')); // WHERE update_date > '2011-03-13'
</code>
@pa... | [
"Filter",
"the",
"query",
"on",
"the",
"update_date",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L409-L430 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.filterByUserRole | public function filterByUserRole($userRole, $comparison = null)
{
if ($userRole instanceof \Alchemy\Component\Cerberus\Model\UserRole) {
return $this
->addUsingAlias(RoleTableMap::COL_ID, $userRole->getRoleId(), $comparison);
} elseif ($userRole instanceof ObjectCollectio... | php | public function filterByUserRole($userRole, $comparison = null)
{
if ($userRole instanceof \Alchemy\Component\Cerberus\Model\UserRole) {
return $this
->addUsingAlias(RoleTableMap::COL_ID, $userRole->getRoleId(), $comparison);
} elseif ($userRole instanceof ObjectCollectio... | [
"public",
"function",
"filterByUserRole",
"(",
"$",
"userRole",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"userRole",
"instanceof",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"UserRole",
")",
"{",
"retur... | Filter the query by a related \Alchemy\Component\Cerberus\Model\UserRole object
@param \Alchemy\Component\Cerberus\Model\UserRole|ObjectCollection $userRole the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildRoleQuery The ... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"UserRole",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L469-L482 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.useUserRoleQuery | public function useUserRoleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinUserRole($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'UserRole', '\Alchemy\Component\Cerberus\Model\UserRoleQuery');
} | php | public function useUserRoleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinUserRole($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'UserRole', '\Alchemy\Component\Cerberus\Model\UserRoleQuery');
} | [
"public",
"function",
"useUserRoleQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinUserRole",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
... | Use the UserRole relation UserRole object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Alchemy\Component\Cerberus\Model\UserRoleQ... | [
"Use",
"the",
"UserRole",
"relation",
"UserRole",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L527-L532 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.useRolePermissionQuery | public function useRolePermissionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRolePermission($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'RolePermission', '\Alchemy\Component\Cerberus\Model\RolePermissionQuery');
... | php | public function useRolePermissionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRolePermission($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'RolePermission', '\Alchemy\Component\Cerberus\Model\RolePermissionQuery');
... | [
"public",
"function",
"useRolePermissionQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinRolePermission",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")"... | Use the RolePermission relation RolePermission object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Alchemy\Component\Cerberus\Mod... | [
"Use",
"the",
"RolePermission",
"relation",
"RolePermission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L600-L605 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.filterByUser | public function filterByUser($user, $comparison = Criteria::EQUAL)
{
return $this
->useUserRoleQuery()
->filterByUser($user, $comparison)
->endUse();
} | php | public function filterByUser($user, $comparison = Criteria::EQUAL)
{
return $this
->useUserRoleQuery()
->filterByUser($user, $comparison)
->endUse();
} | [
"public",
"function",
"filterByUser",
"(",
"$",
"user",
",",
"$",
"comparison",
"=",
"Criteria",
"::",
"EQUAL",
")",
"{",
"return",
"$",
"this",
"->",
"useUserRoleQuery",
"(",
")",
"->",
"filterByUser",
"(",
"$",
"user",
",",
"$",
"comparison",
")",
"->"... | Filter the query by a related User object
using the user_role table as cross reference
@param User $user the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildRoleQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"User",
"object",
"using",
"the",
"user_role",
"table",
"as",
"cross",
"reference"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L616-L622 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.filterByPermission | public function filterByPermission($permission, $comparison = Criteria::EQUAL)
{
return $this
->useRolePermissionQuery()
->filterByPermission($permission, $comparison)
->endUse();
} | php | public function filterByPermission($permission, $comparison = Criteria::EQUAL)
{
return $this
->useRolePermissionQuery()
->filterByPermission($permission, $comparison)
->endUse();
} | [
"public",
"function",
"filterByPermission",
"(",
"$",
"permission",
",",
"$",
"comparison",
"=",
"Criteria",
"::",
"EQUAL",
")",
"{",
"return",
"$",
"this",
"->",
"useRolePermissionQuery",
"(",
")",
"->",
"filterByPermission",
"(",
"$",
"permission",
",",
"$",... | Filter the query by a related Permission object
using the role_permission table as cross reference
@param Permission $permission the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildRoleQuery The current query, for fluid inte... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"Permission",
"object",
"using",
"the",
"role_permission",
"table",
"as",
"cross",
"reference"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L633-L639 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.prune | public function prune($role = null)
{
if ($role) {
$this->addUsingAlias(RoleTableMap::COL_ID, $role->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | php | public function prune($role = null)
{
if ($role) {
$this->addUsingAlias(RoleTableMap::COL_ID, $role->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | [
"public",
"function",
"prune",
"(",
"$",
"role",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RoleTableMap",
"::",
"COL_ID",
",",
"$",
"role",
"->",
"getId",
"(",
")",
",",
"Criteria",
"::",
"NO... | Exclude object from result
@param ChildRole $role Object to remove from the list of results
@return $this|ChildRoleQuery The current query, for fluid interface | [
"Exclude",
"object",
"from",
"result"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L648-L655 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.doDeleteAll | public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME);
}
// use transaction because $criteria could contain info
// for more than one table or we could emu... | php | public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME);
}
// use transaction because $criteria could contain info
// for more than one table or we could emu... | [
"public",
"function",
"doDeleteAll",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getWriteConnection",
"(",
"RoleTabl... | Deletes all rows from the role table.
@param ConnectionInterface $con the connection to use
@return int The number of affected rows (if supported by underlying database driver). | [
"Deletes",
"all",
"rows",
"from",
"the",
"role",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L663-L682 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php | RoleQuery.delete | public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(RoleTableMap::DATABASE_NAME)... | php | public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RoleTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(RoleTableMap::DATABASE_NAME)... | [
"public",
"function",
"delete",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getWriteConnection",
"(",
"RoleTableMap"... | Performs a DELETE on the database based on the current ModelCriteria
@param ConnectionInterface $con the connection to use
@return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
if supported by native driver or if emulated using Propel.
@th... | [
"Performs",
"a",
"DELETE",
"on",
"the",
"database",
"based",
"on",
"the",
"current",
"ModelCriteria"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RoleQuery.php#L693-L716 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtPage/PageSelector.php | PageSelector.checkValue | public function checkValue(&$value)
{
if (parent::checkValue($value) === true) {
$value = trim($value);
if (in_array($value,
[
self::SELECTOR_ALL, self::SELECTOR_FIRST, self::SELECTOR_LEFT,
self::SELECTOR_RIGHT, self::SELECTOR_B... | php | public function checkValue(&$value)
{
if (parent::checkValue($value) === true) {
$value = trim($value);
if (in_array($value,
[
self::SELECTOR_ALL, self::SELECTOR_FIRST, self::SELECTOR_LEFT,
self::SELECTOR_RIGHT, self::SELECTOR_B... | [
"public",
"function",
"checkValue",
"(",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"parent",
"::",
"checkValue",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"if",
"(",
"in_array",
"(",
"$... | Checks the selector value.
@param string $value
@return bool | [
"Checks",
"the",
"selector",
"value",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtPage/PageSelector.php#L31-L47 |
awethemes/wp-session | src/Store.php | Store.start | public function start() {
$data = $this->handler->read( $this->get_id() );
if ( false !== $data && ! is_null( $data ) && is_array( $data ) ) {
$this->attributes = $data;
}
$this->started = true;
} | php | public function start() {
$data = $this->handler->read( $this->get_id() );
if ( false !== $data && ! is_null( $data ) && is_array( $data ) ) {
$this->attributes = $data;
}
$this->started = true;
} | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"handler",
"->",
"read",
"(",
"$",
"this",
"->",
"get_id",
"(",
")",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"data",
"&&",
"!",
"is_null",
"(",
"$",
"data",
")... | Start the session, reading the data from a handler.
@return void | [
"Start",
"the",
"session",
"reading",
"the",
"data",
"from",
"a",
"handler",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L63-L71 |
awethemes/wp-session | src/Store.php | Store.save | public function save() {
if ( ! $this->started ) {
return;
}
$this->age_flash_data();
/* @noinspection PhpParamsInspection */
$this->handler->write( $this->get_id(), $this->attributes );
$this->started = false;
} | php | public function save() {
if ( ! $this->started ) {
return;
}
$this->age_flash_data();
/* @noinspection PhpParamsInspection */
$this->handler->write( $this->get_id(), $this->attributes );
$this->started = false;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"age_flash_data",
"(",
")",
";",
"/* @noinspection PhpParamsInspection */",
"$",
"this",
"->",
"handler",
"->",
"w... | Save the session data to storage.
@return void | [
"Save",
"the",
"session",
"data",
"to",
"storage",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L78-L89 |
awethemes/wp-session | src/Store.php | Store.exists | public function exists( $key ) {
return ! collect( is_array( $key ) ? $key : func_get_args() )->contains(
function ( $key ) {
return ! Arr::exists( $this->attributes, $key );
}
);
} | php | public function exists( $key ) {
return ! collect( is_array( $key ) ? $key : func_get_args() )->contains(
function ( $key ) {
return ! Arr::exists( $this->attributes, $key );
}
);
} | [
"public",
"function",
"exists",
"(",
"$",
"key",
")",
"{",
"return",
"!",
"collect",
"(",
"is_array",
"(",
"$",
"key",
")",
"?",
"$",
"key",
":",
"func_get_args",
"(",
")",
")",
"->",
"contains",
"(",
"function",
"(",
"$",
"key",
")",
"{",
"return"... | Checks if a key exists.
@param string|array $key Key name or an array keys.
@return bool | [
"Checks",
"if",
"a",
"key",
"exists",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L106-L112 |
awethemes/wp-session | src/Store.php | Store.put | public function put( $key, $value = null ) {
if ( ! is_array( $key ) ) {
$key = [ $key => $value ];
}
foreach ( $key as $array_key => $array_value ) {
Arr::set( $this->attributes, $array_key, $array_value );
}
} | php | public function put( $key, $value = null ) {
if ( ! is_array( $key ) ) {
$key = [ $key => $value ];
}
foreach ( $key as $array_key => $array_value ) {
Arr::set( $this->attributes, $array_key, $array_value );
}
} | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"[",
"$",
"key",
"=>",
"$",
"value",
"]",
";",
"}",
"foreach",
"(",
"$",
"k... | Put a key/value pair or array of key/value pairs in the session.
@param string|array $key An array of key/value pairs or string key name.
@param mixed $value If $key is string, use this as value.
@return void | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"or",
"array",
"of",
"key",
"/",
"value",
"pairs",
"in",
"the",
"session",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L146-L154 |
awethemes/wp-session | src/Store.php | Store.flash | public function flash( $key, $value = true ) {
$this->put( $key, $value );
$this->push( '_flash.new', $key );
$this->remove_old_flash_data( [ $key ] );
} | php | public function flash( $key, $value = true ) {
$this->put( $key, $value );
$this->push( '_flash.new', $key );
$this->remove_old_flash_data( [ $key ] );
} | [
"public",
"function",
"flash",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"$",
"this",
"->",
"push",
"(",
"'_flash.new'",
",",
"$",
"key",
")",
";",
"$",
... | Flash a key / value pair to the session.
@param string $key The flash key.
@param mixed $value The flash value.
@return void | [
"Flash",
"a",
"key",
"/",
"value",
"pair",
"to",
"the",
"session",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L254-L260 |
awethemes/wp-session | src/Store.php | Store.keep | public function keep( $keys = null ) {
$keys = is_array( $keys ) ? $keys : func_get_args();
$this->merge_new_flashes( $keys );
$this->remove_old_flash_data( $keys );
} | php | public function keep( $keys = null ) {
$keys = is_array( $keys ) ? $keys : func_get_args();
$this->merge_new_flashes( $keys );
$this->remove_old_flash_data( $keys );
} | [
"public",
"function",
"keep",
"(",
"$",
"keys",
"=",
"null",
")",
"{",
"$",
"keys",
"=",
"is_array",
"(",
"$",
"keys",
")",
"?",
"$",
"keys",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"merge_new_flashes",
"(",
"$",
"keys",
")",
";",
... | Reflash a subset of the current flash data.
@param array|mixed $keys Keep flash keys.
@return void | [
"Reflash",
"a",
"subset",
"of",
"the",
"current",
"flash",
"data",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L292-L298 |
awethemes/wp-session | src/Store.php | Store.merge_new_flashes | protected function merge_new_flashes( array $keys ) {
$values = array_unique( array_merge( $this->get( '_flash.new', [] ), $keys ) );
$this->put( '_flash.new', $values );
} | php | protected function merge_new_flashes( array $keys ) {
$values = array_unique( array_merge( $this->get( '_flash.new', [] ), $keys ) );
$this->put( '_flash.new', $values );
} | [
"protected",
"function",
"merge_new_flashes",
"(",
"array",
"$",
"keys",
")",
"{",
"$",
"values",
"=",
"array_unique",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"get",
"(",
"'_flash.new'",
",",
"[",
"]",
")",
",",
"$",
"keys",
")",
")",
";",
"$",
"... | Merge new flash keys into the new flash array.
@param array $keys Merge flash keys.
@return void | [
"Merge",
"new",
"flash",
"keys",
"into",
"the",
"new",
"flash",
"array",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L306-L310 |
awethemes/wp-session | src/Store.php | Store.has_old_input | public function has_old_input( $key = null ) {
$old = $this->get_old_input( $key );
return is_null( $key ) ? count( $old ) > 0 : ! is_null( $old );
} | php | public function has_old_input( $key = null ) {
$old = $this->get_old_input( $key );
return is_null( $key ) ? count( $old ) > 0 : ! is_null( $old );
} | [
"public",
"function",
"has_old_input",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"old",
"=",
"$",
"this",
"->",
"get_old_input",
"(",
"$",
"key",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"count",
"(",
"$",
"old",
")",
">",
"0"... | Determine if the session contains old input.
@param string $key Old input key name.
@return bool | [
"Determine",
"if",
"the",
"session",
"contains",
"old",
"input",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L338-L342 |
awethemes/wp-session | src/Store.php | Store.age_flash_data | public function age_flash_data() {
$this->forget( $this->get( '_flash.old', [] ) );
$this->put( '_flash.old', $this->get( '_flash.new', [] ) );
$this->put( '_flash.new', [] );
} | php | public function age_flash_data() {
$this->forget( $this->get( '_flash.old', [] ) );
$this->put( '_flash.old', $this->get( '_flash.new', [] ) );
$this->put( '_flash.new', [] );
} | [
"public",
"function",
"age_flash_data",
"(",
")",
"{",
"$",
"this",
"->",
"forget",
"(",
"$",
"this",
"->",
"get",
"(",
"'_flash.old'",
",",
"[",
"]",
")",
")",
";",
"$",
"this",
"->",
"put",
"(",
"'_flash.old'",
",",
"$",
"this",
"->",
"get",
"(",... | Age the flash data for the session.
@access private
@return void | [
"Age",
"the",
"flash",
"data",
"for",
"the",
"session",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L362-L368 |
awethemes/wp-session | src/Store.php | Store.regenerate | public function regenerate( $destroy = false ) {
if ( $destroy ) {
$this->handler->destroy( $this->get_id() );
}
$this->set_id( $this->generate_session_id() );
return true;
} | php | public function regenerate( $destroy = false ) {
if ( $destroy ) {
$this->handler->destroy( $this->get_id() );
}
$this->set_id( $this->generate_session_id() );
return true;
} | [
"public",
"function",
"regenerate",
"(",
"$",
"destroy",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"destroy",
")",
"{",
"$",
"this",
"->",
"handler",
"->",
"destroy",
"(",
"$",
"this",
"->",
"get_id",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"se... | Generate a new session identifier.
@param bool $destroy Destroy current session.
@return bool | [
"Generate",
"a",
"new",
"session",
"identifier",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L387-L395 |
awethemes/wp-session | src/Store.php | Store.set_id | public function set_id( $id ) {
$this->id = $this->is_valid_id( $id ) ? $id : $this->generate_session_id();
} | php | public function set_id( $id ) {
$this->id = $this->is_valid_id( $id ) ? $id : $this->generate_session_id();
} | [
"public",
"function",
"set_id",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"this",
"->",
"is_valid_id",
"(",
"$",
"id",
")",
"?",
"$",
"id",
":",
"$",
"this",
"->",
"generate_session_id",
"(",
")",
";",
"}"
] | Set the session ID.
@param string $id A valid session ID.
@return void | [
"Set",
"the",
"session",
"ID",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L449-L451 |
awethemes/wp-session | src/Store.php | Store.generate_session_id | protected function generate_session_id() {
$length = 40;
require_once ABSPATH . 'wp-includes/class-phpass.php';
$bytes = ( new \PasswordHash( 8, false ) )->get_random_bytes( $length * 2 );
return substr( str_replace( [ '/', '+', '=' ], '', base64_encode( $bytes ) ), 0, $length );
} | php | protected function generate_session_id() {
$length = 40;
require_once ABSPATH . 'wp-includes/class-phpass.php';
$bytes = ( new \PasswordHash( 8, false ) )->get_random_bytes( $length * 2 );
return substr( str_replace( [ '/', '+', '=' ], '', base64_encode( $bytes ) ), 0, $length );
} | [
"protected",
"function",
"generate_session_id",
"(",
")",
"{",
"$",
"length",
"=",
"40",
";",
"require_once",
"ABSPATH",
".",
"'wp-includes/class-phpass.php'",
";",
"$",
"bytes",
"=",
"(",
"new",
"\\",
"PasswordHash",
"(",
"8",
",",
"false",
")",
")",
"->",
... | Get a new, random session ID.
@return string | [
"Get",
"a",
"new",
"random",
"session",
"ID",
"."
] | train | https://github.com/awethemes/wp-session/blob/4819c6392a0dbcbbf547027b70d5af88e7a89d61/src/Store.php#L468-L475 |
drunomics/service-utils | src/Core/Routing/CurrentRouteMatchTrait.php | CurrentRouteMatchTrait.getCurrentRouteMatch | public function getCurrentRouteMatch() {
if (empty($this->currentRouteMatch)) {
$this->currentRouteMatch = \Drupal::service('current_route_match');
}
return $this->currentRouteMatch;
} | php | public function getCurrentRouteMatch() {
if (empty($this->currentRouteMatch)) {
$this->currentRouteMatch = \Drupal::service('current_route_match');
}
return $this->currentRouteMatch;
} | [
"public",
"function",
"getCurrentRouteMatch",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"currentRouteMatch",
")",
")",
"{",
"$",
"this",
"->",
"currentRouteMatch",
"=",
"\\",
"Drupal",
"::",
"service",
"(",
"'current_route_match'",
")",
";",... | Gets the current route match.
@return \Drupal\Core\Routing\ResettableStackedRouteMatchInterface
The alias manager. | [
"Gets",
"the",
"current",
"route",
"match",
"."
] | train | https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/Core/Routing/CurrentRouteMatchTrait.php#L38-L43 |
GokulSrinivas/Sangria | src/Sangria/HelperFunctions.php | HelperFunctions.ddp | public static function ddp($obj = NULL)
{
try
{
$json_str = json_encode($obj, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
echo $json_str;
die();
}
catch(SangriaException $e)
{
/**
* Default to dd if there is an exception while encoding to JSON
*/
var_dump($obj);
die();
}
} | php | public static function ddp($obj = NULL)
{
try
{
$json_str = json_encode($obj, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
echo $json_str;
die();
}
catch(SangriaException $e)
{
/**
* Default to dd if there is an exception while encoding to JSON
*/
var_dump($obj);
die();
}
} | [
"public",
"static",
"function",
"ddp",
"(",
"$",
"obj",
"=",
"NULL",
")",
"{",
"try",
"{",
"$",
"json_str",
"=",
"json_encode",
"(",
"$",
"obj",
",",
"JSON_UNESCAPED_SLASHES",
"|",
"JSON_PRETTY_PRINT",
")",
";",
"echo",
"$",
"json_str",
";",
"die",
"(",
... | [ddp prints the json_encoded form of the variable and stops execution]
@param mixed $obj [the variable to be dumped]
@return void [returns nothing] | [
"[",
"ddp",
"prints",
"the",
"json_encoded",
"form",
"of",
"the",
"variable",
"and",
"stops",
"execution",
"]"
] | train | https://github.com/GokulSrinivas/Sangria/blob/e69076655da30ef74b9b6f4a7b7317b3d37d5710/src/Sangria/HelperFunctions.php#L28-L44 |
crossjoin/Css | src/Crossjoin/Css/Reader/CssString.php | CssString.setCssContent | protected function setCssContent($cssContent)
{
if (is_string($cssContent)) {
$this->content = $cssContent;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($cssContent). "' for argument 'cssContent' given."
);
}
... | php | protected function setCssContent($cssContent)
{
if (is_string($cssContent)) {
$this->content = $cssContent;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($cssContent). "' for argument 'cssContent' given."
);
}
... | [
"protected",
"function",
"setCssContent",
"(",
"$",
"cssContent",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"cssContent",
")",
")",
"{",
"$",
"this",
"->",
"content",
"=",
"$",
"cssContent",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgument... | Sets the CSS source content.
@param string $cssContent
@return $this | [
"Sets",
"the",
"CSS",
"source",
"content",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Reader/CssString.php#L26-L37 |
huasituo/hstcms | src/Libraries/Fields/Text.php | Text.input | public function input($cname, $name, $cfg, $value = NULL, $id = 0)
{
$cfg['validate']['tips'] = isset($cfg['validate']['tips']) ? $cfg['validate']['tips'] : "";
$text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>' : '').$cname;
// 表单附加参数
$attr = isse... | php | public function input($cname, $name, $cfg, $value = NULL, $id = 0)
{
$cfg['validate']['tips'] = isset($cfg['validate']['tips']) ? $cfg['validate']['tips'] : "";
$text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>' : '').$cname;
// 表单附加参数
$attr = isse... | [
"public",
"function",
"input",
"(",
"$",
"cname",
",",
"$",
"name",
",",
"$",
"cfg",
",",
"$",
"value",
"=",
"NULL",
",",
"$",
"id",
"=",
"0",
")",
"{",
"$",
"cfg",
"[",
"'validate'",
"]",
"[",
"'tips'",
"]",
"=",
"isset",
"(",
"$",
"cfg",
"[... | 字段表单输入
@param string $cname 字段别名
@param string $name 字段名称
@param array $cfg 字段配置
@param array $value 值
@param array $id 当前内容表的id(表示非发布操作)
@return string | [
"字段表单输入"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Text.php#L67-L91 |
huasituo/hstcms | src/Libraries/Fields/Text.php | Text.insert_value | public function insert_value(Request $request, $filed, $postData = [])
{
$value = $request->get($field['fieldname']);
$postData[$field['relatedtable']] = [
$fieldname=>htmlspecialchars($value)
];
return $postData;
} | php | public function insert_value(Request $request, $filed, $postData = [])
{
$value = $request->get($field['fieldname']);
$postData[$field['relatedtable']] = [
$fieldname=>htmlspecialchars($value)
];
return $postData;
} | [
"public",
"function",
"insert_value",
"(",
"Request",
"$",
"request",
",",
"$",
"filed",
",",
"$",
"postData",
"=",
"[",
"]",
")",
"{",
"$",
"value",
"=",
"$",
"request",
"->",
"get",
"(",
"$",
"field",
"[",
"'fieldname'",
"]",
")",
";",
"$",
"post... | 处理输入数据,提供给入库 | [
"处理输入数据,提供给入库"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Text.php#L96-L103 |
FrenchFrogs/framework | src/Table/Renderer/Csv.php | Csv.table | public function table(Table\Table $table)
{
// INitilisation du CSV
$csv = Writer::createFromFileObject(new \SplTempFileObject());
// gestion des colonne
$header = $columns = [];
foreach ($table->getColumns() as $index => $column) {
// Seule les colonnes Export... | php | public function table(Table\Table $table)
{
// INitilisation du CSV
$csv = Writer::createFromFileObject(new \SplTempFileObject());
// gestion des colonne
$header = $columns = [];
foreach ($table->getColumns() as $index => $column) {
// Seule les colonnes Export... | [
"public",
"function",
"table",
"(",
"Table",
"\\",
"Table",
"$",
"table",
")",
"{",
"// INitilisation du CSV",
"$",
"csv",
"=",
"Writer",
"::",
"createFromFileObject",
"(",
"new",
"\\",
"SplTempFileObject",
"(",
")",
")",
";",
"// gestion des colonne",
"$",
"h... | Overload render for array data output
@param \FrenchFrogs\Table\Table\Table $table
@return array | [
"Overload",
"render",
"for",
"array",
"data",
"output"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Renderer/Csv.php#L23-L55 |
rinvex/obsolete-module | src/Module.php | Module.migrate | protected function migrate()
{
if (! $this->container['migrator']->repositoryExists()) {
throw new Exception('Migration table not found.');
}
$this->container['migrator']->run($this->getAttribute('path').'/database/migrations');
} | php | protected function migrate()
{
if (! $this->container['migrator']->repositoryExists()) {
throw new Exception('Migration table not found.');
}
$this->container['migrator']->run($this->getAttribute('path').'/database/migrations');
} | [
"protected",
"function",
"migrate",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"[",
"'migrator'",
"]",
"->",
"repositoryExists",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Migration table not found.'",
")",
";",
"}",
"$",
... | Execute module migrations.
@throws \Exception
@return void | [
"Execute",
"module",
"migrations",
"."
] | train | https://github.com/rinvex/obsolete-module/blob/95e372ae97ecbe7071c3da397b0afd57f327361f/src/Module.php#L160-L167 |
rinvex/obsolete-module | src/Module.php | Module.rollback | protected function rollback()
{
if (! $this->container['migrator']->repositoryExists()) {
throw new Exception('Migration table not found.');
}
$this->container['migrator']->rollback($this->getAttribute('path').'/database/migrations');
} | php | protected function rollback()
{
if (! $this->container['migrator']->repositoryExists()) {
throw new Exception('Migration table not found.');
}
$this->container['migrator']->rollback($this->getAttribute('path').'/database/migrations');
} | [
"protected",
"function",
"rollback",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"[",
"'migrator'",
"]",
"->",
"repositoryExists",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Migration table not found.'",
")",
";",
"}",
"$",
... | Rollback module migrations.
@throws \Exception
@return void | [
"Rollback",
"module",
"migrations",
"."
] | train | https://github.com/rinvex/obsolete-module/blob/95e372ae97ecbe7071c3da397b0afd57f327361f/src/Module.php#L176-L183 |
rinvex/obsolete-module | src/Module.php | Module.seed | protected function seed()
{
$seederFilePath = $this->getAttribute('path').'/database/seeds/DatabaseSeeder.php';
if ($this->container['files']->exists($seederFilePath)) {
require_once $seederFilePath;
$namespace = $this->getAttribute('namespace').'Database\\Seeds\\DatabaseSe... | php | protected function seed()
{
$seederFilePath = $this->getAttribute('path').'/database/seeds/DatabaseSeeder.php';
if ($this->container['files']->exists($seederFilePath)) {
require_once $seederFilePath;
$namespace = $this->getAttribute('namespace').'Database\\Seeds\\DatabaseSe... | [
"protected",
"function",
"seed",
"(",
")",
"{",
"$",
"seederFilePath",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'path'",
")",
".",
"'/database/seeds/DatabaseSeeder.php'",
";",
"if",
"(",
"$",
"this",
"->",
"container",
"[",
"'files'",
"]",
"->",
"exists... | Seed the database with module seeders.
@return void | [
"Seed",
"the",
"database",
"with",
"module",
"seeders",
"."
] | train | https://github.com/rinvex/obsolete-module/blob/95e372ae97ecbe7071c3da397b0afd57f327361f/src/Module.php#L190-L203 |
acasademont/wurfl | WURFL/Request/GenericRequest.php | WURFL_Request_GenericRequest.getOriginalHeader | public function getOriginalHeader($name)
{
return array_key_exists($name, $this->_request)? $this->_request[$name]: null;
} | php | public function getOriginalHeader($name)
{
return array_key_exists($name, $this->_request)? $this->_request[$name]: null;
} | [
"public",
"function",
"getOriginalHeader",
"(",
"$",
"name",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_request",
")",
"?",
"$",
"this",
"->",
"_request",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
] | Get the original HTTP header value from the request
@param string $name
@return string | [
"Get",
"the",
"original",
"HTTP",
"header",
"value",
"from",
"the",
"request"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Request/GenericRequest.php#L97-L100 |
chris-schmitz/L5SimpleFM | src/L5SimpleFMBase.php | L5SimpleFMBase.primeCommandArray | protected function primeCommandArray()
{
if (empty($this->layoutName)) {
throw new LayoutNameIsMissingException('You must specify a layout name.');
}
$this->commandArray['-db'] = $this->adapter->getHostConnection()->getDbName();
$this->commandArray['-lay'] = $this->layout... | php | protected function primeCommandArray()
{
if (empty($this->layoutName)) {
throw new LayoutNameIsMissingException('You must specify a layout name.');
}
$this->commandArray['-db'] = $this->adapter->getHostConnection()->getDbName();
$this->commandArray['-lay'] = $this->layout... | [
"protected",
"function",
"primeCommandArray",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"layoutName",
")",
")",
"{",
"throw",
"new",
"LayoutNameIsMissingException",
"(",
"'You must specify a layout name.'",
")",
";",
"}",
"$",
"this",
"->",
"c... | Adds the default url parameters needed for any request.
@return none | [
"Adds",
"the",
"default",
"url",
"parameters",
"needed",
"for",
"any",
"request",
"."
] | train | https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFMBase.php#L39-L46 |
chris-schmitz/L5SimpleFM | src/L5SimpleFMBase.php | L5SimpleFMBase.addToCommandArray | protected function addToCommandArray($values)
{
foreach ($values as $key => $value) {
$this->commandArray[$key] = $value;
}
} | php | protected function addToCommandArray($values)
{
foreach ($values as $key => $value) {
$this->commandArray[$key] = $value;
}
} | [
"protected",
"function",
"addToCommandArray",
"(",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"commandArray",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}"
] | Adds additional Url parameters to the request.
@param array An associative array of url keys and values.
These are normally fields => values or additional FM XML flags => null | [
"Adds",
"additional",
"Url",
"parameters",
"to",
"the",
"request",
"."
] | train | https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFMBase.php#L54-L59 |
chris-schmitz/L5SimpleFM | src/L5SimpleFMBase.php | L5SimpleFMBase.executeCommand | public function executeCommand()
{
$this->adapter->setCommandArray($this->commandArray);
$result = $this->adapter->execute();
$commandArrayUsed = $this->adapter->getCommandArray();
$this->clearCommandArray();
$this->checkResultForError($result, $commandArrayUsed);
ret... | php | public function executeCommand()
{
$this->adapter->setCommandArray($this->commandArray);
$result = $this->adapter->execute();
$commandArrayUsed = $this->adapter->getCommandArray();
$this->clearCommandArray();
$this->checkResultForError($result, $commandArrayUsed);
ret... | [
"public",
"function",
"executeCommand",
"(",
")",
"{",
"$",
"this",
"->",
"adapter",
"->",
"setCommandArray",
"(",
"$",
"this",
"->",
"commandArray",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"adapter",
"->",
"execute",
"(",
")",
";",
"$",
"comm... | Performs the steps necessary to execute a SimpleFM query.
@return object The SimpleFM result Object | [
"Performs",
"the",
"steps",
"necessary",
"to",
"execute",
"a",
"SimpleFM",
"query",
"."
] | train | https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFMBase.php#L77-L85 |
chris-schmitz/L5SimpleFM | src/L5SimpleFMBase.php | L5SimpleFMBase.checkResultForError | protected function checkResultForError($result, $commandArrayUsed)
{
if (empty($result)) {
throw new NoResultReturnedException('The SimpleFM request did not return a result.');
}
if ($result->getErrorCode() == 401) {
throw new RecordsNotFoundException($result->getErro... | php | protected function checkResultForError($result, $commandArrayUsed)
{
if (empty($result)) {
throw new NoResultReturnedException('The SimpleFM request did not return a result.');
}
if ($result->getErrorCode() == 401) {
throw new RecordsNotFoundException($result->getErro... | [
"protected",
"function",
"checkResultForError",
"(",
"$",
"result",
",",
"$",
"commandArrayUsed",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"result",
")",
")",
"{",
"throw",
"new",
"NoResultReturnedException",
"(",
"'The SimpleFM request did not return a result.'",
")... | Parses the SimpleFM result and determines if a FileMaker error was thrown.
@param object A SimpleFM result object
@return none | [
"Parses",
"the",
"SimpleFM",
"result",
"and",
"determines",
"if",
"a",
"FileMaker",
"error",
"was",
"thrown",
"."
] | train | https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFMBase.php#L93-L105 |
link0/profiler | src/Link0/Profiler/PersistenceService.php | PersistenceService.persist | public function persist(ProfileInterface $profile)
{
foreach ($this->persistenceHandlers as $persistenceHandler) {
$persistenceHandler->persist($profile);
}
return $this;
} | php | public function persist(ProfileInterface $profile)
{
foreach ($this->persistenceHandlers as $persistenceHandler) {
$persistenceHandler->persist($profile);
}
return $this;
} | [
"public",
"function",
"persist",
"(",
"ProfileInterface",
"$",
"profile",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"persistenceHandlers",
"as",
"$",
"persistenceHandler",
")",
"{",
"$",
"persistenceHandler",
"->",
"persist",
"(",
"$",
"profile",
")",
";",
... | Persists data to the persistence handlers
@param ProfileInterface $profile
@return PersistenceService $this | [
"Persists",
"data",
"to",
"the",
"persistence",
"handlers"
] | train | https://github.com/link0/profiler/blob/0573073ff029743734de747619ab65ab2476052d/src/Link0/Profiler/PersistenceService.php#L77-L84 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/BaseField.php | BaseField.removeEval | public function removeEval($key)
{
if (array_key_exists($key, $this->eval)) {
unset($this->eval[$key]);
return true;
}
return false;
} | php | public function removeEval($key)
{
if (array_key_exists($key, $this->eval)) {
unset($this->eval[$key]);
return true;
}
return false;
} | [
"public",
"function",
"removeEval",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"eval",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"eval",
"[",
"$",
"key",
"]",
")",
";",
"return",
"true... | Remove an entry vom the eval array
Returns true if entry was removed and false if key was not found
@param string $key
@return bool | [
"Remove",
"an",
"entry",
"vom",
"the",
"eval",
"array",
"Returns",
"true",
"if",
"entry",
"was",
"removed",
"and",
"false",
"if",
"key",
"was",
"not",
"found"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/BaseField.php#L85-L95 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/BaseField.php | BaseField.modifyEval | public function modifyEval($key, $value)
{
if (array_key_exists($key, $this->eval)) {
$this->eval[$key] = $value;
}
} | php | public function modifyEval($key, $value)
{
if (array_key_exists($key, $this->eval)) {
$this->eval[$key] = $value;
}
} | [
"public",
"function",
"modifyEval",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"eval",
")",
")",
"{",
"$",
"this",
"->",
"eval",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
... | Set a new value to an existing eval entry
@param string $key
@param mixed $value | [
"Set",
"a",
"new",
"value",
"to",
"an",
"existing",
"eval",
"entry"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/BaseField.php#L103-L110 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/BaseField.php | BaseField.getEval | public function getEval($key)
{
if (array_key_exists($key, $this->eval)) {
return $this->eval[$key];
}
return false;
} | php | public function getEval($key)
{
if (array_key_exists($key, $this->eval)) {
return $this->eval[$key];
}
return false;
} | [
"public",
"function",
"getEval",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"eval",
")",
")",
"{",
"return",
"$",
"this",
"->",
"eval",
"[",
"$",
"key",
"]",
";",
"}",
"return",
"false",
";"... | Get an entry from the eval array
Returns the entry or false if key not found
@param string $key
@return mixed|bool | [
"Get",
"an",
"entry",
"from",
"the",
"eval",
"array",
"Returns",
"the",
"entry",
"or",
"false",
"if",
"key",
"not",
"found"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/BaseField.php#L119-L126 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Checker/TtlChecker.php | TtlChecker.add | public function add(Resource $resource)
{
$this->storer->add(
time() + $this->ttl,
$resource
);
} | php | public function add(Resource $resource)
{
$this->storer->add(
time() + $this->ttl,
$resource
);
} | [
"public",
"function",
"add",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"this",
"->",
"storer",
"->",
"add",
"(",
"time",
"(",
")",
"+",
"$",
"this",
"->",
"ttl",
",",
"$",
"resource",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Checker/TtlChecker.php#L38-L44 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Checker/TtlChecker.php | TtlChecker.check | public function check(Resource $resource)
{
if (!$this->storer->has($resource)) {
return false;
}
return $this->storer->get($resource) >= time();
} | php | public function check(Resource $resource)
{
if (!$this->storer->has($resource)) {
return false;
}
return $this->storer->get($resource) >= time();
} | [
"public",
"function",
"check",
"(",
"Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"storer",
"->",
"has",
"(",
"$",
"resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"storer",
"->",
"get... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Checker/TtlChecker.php#L49-L56 |
pageon/SlackWebhookMonolog | src/Slack/Attachment/ParametersAttachment.php | ParametersAttachment.parseParameter | private function parseParameter($parameter)
{
if (!is_array($parameter)) {
return print_r($parameter, true);
}
return $this->parseArrayParameter($parameter);
} | php | private function parseParameter($parameter)
{
if (!is_array($parameter)) {
return print_r($parameter, true);
}
return $this->parseArrayParameter($parameter);
} | [
"private",
"function",
"parseParameter",
"(",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"parameter",
")",
")",
"{",
"return",
"print_r",
"(",
"$",
"parameter",
",",
"true",
")",
";",
"}",
"return",
"$",
"this",
"->",
"parseArray... | Parse all the data into the markup of slack.
@param mixed $parameter
@return string | [
"Parse",
"all",
"the",
"data",
"into",
"the",
"markup",
"of",
"slack",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Attachment/ParametersAttachment.php#L53-L60 |
pageon/SlackWebhookMonolog | src/Slack/Attachment/ParametersAttachment.php | ParametersAttachment.parseArrayParameter | private function parseArrayParameter(array $parameter)
{
return "\n" . $this->formatter->arrayToKeyValueList(
array_map(
function ($item) {
return print_r($item, true);
},
$parameter
)
);
} | php | private function parseArrayParameter(array $parameter)
{
return "\n" . $this->formatter->arrayToKeyValueList(
array_map(
function ($item) {
return print_r($item, true);
},
$parameter
)
);
} | [
"private",
"function",
"parseArrayParameter",
"(",
"array",
"$",
"parameter",
")",
"{",
"return",
"\"\\n\"",
".",
"$",
"this",
"->",
"formatter",
"->",
"arrayToKeyValueList",
"(",
"array_map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"print_r",
... | @param array $parameter
@return string | [
"@param",
"array",
"$parameter"
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Attachment/ParametersAttachment.php#L67-L77 |
crossjoin/Css | src/Crossjoin/Css/Helper/Placeholder.php | Placeholder.replaceStringsAndComments | public static function replaceStringsAndComments($text)
{
if (is_string($text)) {
// Fast pre-check, to optimize performance
if (strpos($text, "'") !== false || strpos($text, '"') !== false) {
// Replace all strings in quotes (also in comments, but that's okay - remov... | php | public static function replaceStringsAndComments($text)
{
if (is_string($text)) {
// Fast pre-check, to optimize performance
if (strpos($text, "'") !== false || strpos($text, '"') !== false) {
// Replace all strings in quotes (also in comments, but that's okay - remov... | [
"public",
"static",
"function",
"replaceStringsAndComments",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"text",
")",
")",
"{",
"// Fast pre-check, to optimize performance",
"if",
"(",
"strpos",
"(",
"$",
"text",
",",
"\"'\"",
")",
"!==",
"... | Replaces all CSS strings and comments in the given text.
@param string $text
@return string | [
"Replaces",
"all",
"CSS",
"strings",
"and",
"comments",
"in",
"the",
"given",
"text",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Helper/Placeholder.php#L22-L67 |
crossjoin/Css | src/Crossjoin/Css/Helper/Placeholder.php | Placeholder.replaceStringPlaceholders | public static function replaceStringPlaceholders($text, $deletePlaceholders = false)
{
if (is_string($text)) {
// Fast pre-check, to optimize performance
if (strpos($text, "_") !== false) {
$replaceStringPlaceholders = function ($matches) use ($deletePlaceholders) {
... | php | public static function replaceStringPlaceholders($text, $deletePlaceholders = false)
{
if (is_string($text)) {
// Fast pre-check, to optimize performance
if (strpos($text, "_") !== false) {
$replaceStringPlaceholders = function ($matches) use ($deletePlaceholders) {
... | [
"public",
"static",
"function",
"replaceStringPlaceholders",
"(",
"$",
"text",
",",
"$",
"deletePlaceholders",
"=",
"false",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"text",
")",
")",
"{",
"// Fast pre-check, to optimize performance",
"if",
"(",
"strpos",
"("... | Replaces the string place holders wih the saved strings in a given text.
@param string $text
@param bool $deletePlaceholders
@return string | [
"Replaces",
"the",
"string",
"place",
"holders",
"wih",
"the",
"saved",
"strings",
"in",
"a",
"given",
"text",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Helper/Placeholder.php#L76-L104 |
crossjoin/Css | src/Crossjoin/Css/Helper/Placeholder.php | Placeholder.removeCommentPlaceholders | public static function removeCommentPlaceholders($text, $deletePlaceholders = false)
{
if (is_string($text)) {
// Fast pre-check, to optimize performance
if (strpos($text, "_") !== false) {
$removeStringPlaceholders = function ($matches) use ($deletePlaceholders) {
... | php | public static function removeCommentPlaceholders($text, $deletePlaceholders = false)
{
if (is_string($text)) {
// Fast pre-check, to optimize performance
if (strpos($text, "_") !== false) {
$removeStringPlaceholders = function ($matches) use ($deletePlaceholders) {
... | [
"public",
"static",
"function",
"removeCommentPlaceholders",
"(",
"$",
"text",
",",
"$",
"deletePlaceholders",
"=",
"false",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"text",
")",
")",
"{",
"// Fast pre-check, to optimize performance",
"if",
"(",
"strpos",
"("... | Removes the comment place holders from a given text.
@param string $text
@param bool $deletePlaceholders
@return string | [
"Removes",
"the",
"comment",
"place",
"holders",
"from",
"a",
"given",
"text",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Helper/Placeholder.php#L146-L167 |
crossjoin/Css | src/Crossjoin/Css/Helper/Placeholder.php | Placeholder.addReplacement | protected static function addReplacement($string, $prefix)
{
if (is_string($string)) {
if (is_string($prefix)) {
$hash = md5(self::$counter);
$placeholder = "_" . $prefix . "_" . $hash . "_";
self::$replacements[$hash] = $string;
se... | php | protected static function addReplacement($string, $prefix)
{
if (is_string($string)) {
if (is_string($prefix)) {
$hash = md5(self::$counter);
$placeholder = "_" . $prefix . "_" . $hash . "_";
self::$replacements[$hash] = $string;
se... | [
"protected",
"static",
"function",
"addReplacement",
"(",
"$",
"string",
",",
"$",
"prefix",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"prefix",
")",
")",
"{",
"$",
"hash",
"=",
"md5",
"(... | Adds a replacement to the internal list.
@param string $string
@param string $prefix
@return string | [
"Adds",
"a",
"replacement",
"to",
"the",
"internal",
"list",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Helper/Placeholder.php#L198-L218 |
axelitus/php-base | src/PropertyAccessible.php | PropertyAccessible.getRefClass | final private function getRefClass()
{
if ($this->refClass === null) {
$this->refClass = new \ReflectionClass($this);
}
return $this->refClass;
} | php | final private function getRefClass()
{
if ($this->refClass === null) {
$this->refClass = new \ReflectionClass($this);
}
return $this->refClass;
} | [
"final",
"private",
"function",
"getRefClass",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"refClass",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"refClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this... | Gets the ReflectionClass object for the current object.
The ReflectionClass object is created only once, then that value is returned for subsequent calls.
@return null|\ReflectionClass The ReflectionClass of the object. | [
"Gets",
"the",
"ReflectionClass",
"object",
"for",
"the",
"current",
"object",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/PropertyAccessible.php#L54-L61 |
axelitus/php-base | src/PropertyAccessible.php | PropertyAccessible.hasProperty | final public function hasProperty($property)
{
if (!Str::is($property)
|| !Str::match($property, "/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/")
|| $property == 'this'
) {
throw new \InvalidArgumentException(
"The \$property parameter must be a strin... | php | final public function hasProperty($property)
{
if (!Str::is($property)
|| !Str::match($property, "/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/")
|| $property == 'this'
) {
throw new \InvalidArgumentException(
"The \$property parameter must be a strin... | [
"final",
"public",
"function",
"hasProperty",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"Str",
"::",
"is",
"(",
"$",
"property",
")",
"||",
"!",
"Str",
"::",
"match",
"(",
"$",
"property",
",",
"\"/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/\"",
")",... | Checks if the object has the given property.
@param string $property The property to check.
@return bool Returns true if the property exists, false otherwise.
@see http://docs.php.net/manual/en/language.variables.basics.php
@throws \InvalidArgumentException | [
"Checks",
"if",
"the",
"object",
"has",
"the",
"given",
"property",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/PropertyAccessible.php#L143-L155 |
axelitus/php-base | src/PropertyAccessible.php | PropertyAccessible.hasMethod | final public function hasMethod($method)
{
if (!Str::is($method)
|| !Str::match($method, "/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/")
) {
throw new \InvalidArgumentException(
"The \$method parameter must be a string and follow the PHP rules of method naming."... | php | final public function hasMethod($method)
{
if (!Str::is($method)
|| !Str::match($method, "/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/")
) {
throw new \InvalidArgumentException(
"The \$method parameter must be a string and follow the PHP rules of method naming."... | [
"final",
"public",
"function",
"hasMethod",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"Str",
"::",
"is",
"(",
"$",
"method",
")",
"||",
"!",
"Str",
"::",
"match",
"(",
"$",
"method",
",",
"\"/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/\"",
")",
")",
... | Checks if the object has the given method.
@param string $method The method to check.
@return bool Returns true if the property exists, false otherwise.
@see http://docs.php.net/manual/en/function.user-defined.php
@throws \InvalidArgumentException | [
"Checks",
"if",
"the",
"object",
"has",
"the",
"given",
"method",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/PropertyAccessible.php#L167-L178 |
shakahl/hups-util-filedownloader | src/Hups/Util/FileDownloader.php | FileDownloader.download | public static function download($location, $filename = null, $mime = 'application/octet-stream', $speed = 1024, $disposition = 'attachment')
{
if (connection_status() != 0) return(false);
if(!is_file($location))
{
http_response_code(404);
exit();
}
i... | php | public static function download($location, $filename = null, $mime = 'application/octet-stream', $speed = 1024, $disposition = 'attachment')
{
if (connection_status() != 0) return(false);
if(!is_file($location))
{
http_response_code(404);
exit();
}
i... | [
"public",
"static",
"function",
"download",
"(",
"$",
"location",
",",
"$",
"filename",
"=",
"null",
",",
"$",
"mime",
"=",
"'application/octet-stream'",
",",
"$",
"speed",
"=",
"1024",
",",
"$",
"disposition",
"=",
"'attachment'",
")",
"{",
"if",
"(",
"... | Sends the file to the browser for download
@param string $location Path to the file
@param string|null $filename Filename to download as
@param string|null $mime Mime type. Set to null for autodetect.
@param int $speed Download speed
@param string $disposition Content disposit... | [
"Sends",
"the",
"file",
"to",
"the",
"browser",
"for",
"download"
] | train | https://github.com/shakahl/hups-util-filedownloader/blob/e9fa3a02f5ff3e31b4ead8f535362efd27c6cfac/src/Hups/Util/FileDownloader.php#L27-L112 |
shakahl/hups-util-filedownloader | src/Hups/Util/FileDownloader.php | FileDownloader.getFileMime | public static function getFileMime($filename, $default = 'application/octet-stream')
{
if(function_exists('mime_content_type'))
{
return mime_content_type($filename);
}
$mime_types = array(
'txt' => 'text/plain',
'htm' => 'text/html',
... | php | public static function getFileMime($filename, $default = 'application/octet-stream')
{
if(function_exists('mime_content_type'))
{
return mime_content_type($filename);
}
$mime_types = array(
'txt' => 'text/plain',
'htm' => 'text/html',
... | [
"public",
"static",
"function",
"getFileMime",
"(",
"$",
"filename",
",",
"$",
"default",
"=",
"'application/octet-stream'",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'mime_content_type'",
")",
")",
"{",
"return",
"mime_content_type",
"(",
"$",
"filename",
"... | Get file's mime type
@param string $filename
@param string $default Default value
@return string | [
"Get",
"file",
"s",
"mime",
"type"
] | train | https://github.com/shakahl/hups-util-filedownloader/blob/e9fa3a02f5ff3e31b4ead8f535362efd27c6cfac/src/Hups/Util/FileDownloader.php#L120-L198 |
slogsdon/staticwp | includes/staticwp-view.class.php | View.notice | public static function notice($slug, $type = null)
{
ob_start();
self::template($slug, 'notice');
$result = null;
if ($type == null) {
$result = ob_get_flush();
} else {
$result = array(
'message' => ob_get_flush(),
'ty... | php | public static function notice($slug, $type = null)
{
ob_start();
self::template($slug, 'notice');
$result = null;
if ($type == null) {
$result = ob_get_flush();
} else {
$result = array(
'message' => ob_get_flush(),
'ty... | [
"public",
"static",
"function",
"notice",
"(",
"$",
"slug",
",",
"$",
"type",
"=",
"null",
")",
"{",
"ob_start",
"(",
")",
";",
"self",
"::",
"template",
"(",
"$",
"slug",
",",
"'notice'",
")",
";",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"$"... | Loads notice templates.
@since 1.3.0
@param string $slug
@return string|array | [
"Loads",
"notice",
"templates",
"."
] | train | https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-view.class.php#L28-L44 |
fuelphp/display | src/Parser/Markdown.php | Markdown.parse | public function parse($file, array $data = [])
{
$contents = $file;
if (file_exists($file))
{
$contents = file_get_contents($file);
}
return $this->markdown->transformMarkdown($contents);
} | php | public function parse($file, array $data = [])
{
$contents = $file;
if (file_exists($file))
{
$contents = file_get_contents($file);
}
return $this->markdown->transformMarkdown($contents);
} | [
"public",
"function",
"parse",
"(",
"$",
"file",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"contents",
"=",
"$",
"file",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"$",
"contents",
"=",
"file_get_contents",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/Markdown.php#L59-L69 |
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | src/App/Normalizer/Component/TypeDocNormalizer.php | TypeDocNormalizer.normalize | public function normalize(TypeDoc $doc) : array
{
$siblingsDoc = $paramDocRequired = [];
$siblingsDoc = $this->appendArrayDoc($doc, $siblingsDoc);
list (
$siblingsDoc,
$paramDocRequired
) = $this->appendObjectDoc($doc, $siblingsDoc, $paramDocRequired);
... | php | public function normalize(TypeDoc $doc) : array
{
$siblingsDoc = $paramDocRequired = [];
$siblingsDoc = $this->appendArrayDoc($doc, $siblingsDoc);
list (
$siblingsDoc,
$paramDocRequired
) = $this->appendObjectDoc($doc, $siblingsDoc, $paramDocRequired);
... | [
"public",
"function",
"normalize",
"(",
"TypeDoc",
"$",
"doc",
")",
":",
"array",
"{",
"$",
"siblingsDoc",
"=",
"$",
"paramDocRequired",
"=",
"[",
"]",
";",
"$",
"siblingsDoc",
"=",
"$",
"this",
"->",
"appendArrayDoc",
"(",
"$",
"doc",
",",
"$",
"sibli... | @param TypeDoc $doc
@return array|mixed
@throws \ReflectionException | [
"@param",
"TypeDoc",
"$doc"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/TypeDocNormalizer.php#L37-L60 |
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | src/App/Normalizer/Component/TypeDocNormalizer.php | TypeDocNormalizer.getMinMaxDoc | protected function getMinMaxDoc(TypeDoc $doc) : array
{
$paramDocMinMax = [];
if ($doc instanceof StringDoc) {
$paramDocMinMax = $this->appendIfValueNotNull('minLength', $doc->getMinLength(), $paramDocMinMax);
$paramDocMinMax = $this->appendIfValueNotNull('maxLength', $doc->g... | php | protected function getMinMaxDoc(TypeDoc $doc) : array
{
$paramDocMinMax = [];
if ($doc instanceof StringDoc) {
$paramDocMinMax = $this->appendIfValueNotNull('minLength', $doc->getMinLength(), $paramDocMinMax);
$paramDocMinMax = $this->appendIfValueNotNull('maxLength', $doc->g... | [
"protected",
"function",
"getMinMaxDoc",
"(",
"TypeDoc",
"$",
"doc",
")",
":",
"array",
"{",
"$",
"paramDocMinMax",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"doc",
"instanceof",
"StringDoc",
")",
"{",
"$",
"paramDocMinMax",
"=",
"$",
"this",
"->",
"appendIfVa... | @param TypeDoc $doc
@return array | [
"@param",
"TypeDoc",
"$doc"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/TypeDocNormalizer.php#L67-L86 |
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | src/App/Normalizer/Component/TypeDocNormalizer.php | TypeDocNormalizer.appendArrayDoc | protected function appendArrayDoc(TypeDoc $doc, array $siblingsDoc) : array
{
// CollectionDoc should be managed as ArrayDoc
if (!$doc instanceof ArrayDoc && get_class($doc) !== CollectionDoc::class) {
return $siblingsDoc;
}
/** @var $doc ArrayDoc|CollectionDoc */
... | php | protected function appendArrayDoc(TypeDoc $doc, array $siblingsDoc) : array
{
// CollectionDoc should be managed as ArrayDoc
if (!$doc instanceof ArrayDoc && get_class($doc) !== CollectionDoc::class) {
return $siblingsDoc;
}
/** @var $doc ArrayDoc|CollectionDoc */
... | [
"protected",
"function",
"appendArrayDoc",
"(",
"TypeDoc",
"$",
"doc",
",",
"array",
"$",
"siblingsDoc",
")",
":",
"array",
"{",
"// CollectionDoc should be managed as ArrayDoc",
"if",
"(",
"!",
"$",
"doc",
"instanceof",
"ArrayDoc",
"&&",
"get_class",
"(",
"$",
... | @param TypeDoc $doc
@param array $siblingsDoc
@return array
@throws \ReflectionException | [
"@param",
"TypeDoc",
"$doc",
"@param",
"array",
"$siblingsDoc"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/TypeDocNormalizer.php#L96-L111 |
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | src/App/Normalizer/Component/TypeDocNormalizer.php | TypeDocNormalizer.appendObjectDoc | protected function appendObjectDoc(TypeDoc $doc, array $siblingsDoc, array $paramDocRequired) : array
{
if (!$doc instanceof ObjectDoc) {
return [$siblingsDoc, $paramDocRequired];
}
if (true === $doc->isAllowExtraSibling()) {
$siblingsDoc['additionalProperties']['des... | php | protected function appendObjectDoc(TypeDoc $doc, array $siblingsDoc, array $paramDocRequired) : array
{
if (!$doc instanceof ObjectDoc) {
return [$siblingsDoc, $paramDocRequired];
}
if (true === $doc->isAllowExtraSibling()) {
$siblingsDoc['additionalProperties']['des... | [
"protected",
"function",
"appendObjectDoc",
"(",
"TypeDoc",
"$",
"doc",
",",
"array",
"$",
"siblingsDoc",
",",
"array",
"$",
"paramDocRequired",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"doc",
"instanceof",
"ObjectDoc",
")",
"{",
"return",
"[",
"$",
... | @param TypeDoc $doc
@param array $siblingsDoc
@param array $paramDocRequired
@return array | [
"@param",
"TypeDoc",
"$doc",
"@param",
"array",
"$siblingsDoc",
"@param",
"array",
"$paramDocRequired"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/TypeDocNormalizer.php#L120-L158 |
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | src/App/Normalizer/Component/TypeDocNormalizer.php | TypeDocNormalizer.guessItemsType | protected function guessItemsType(array $siblingList) : string
{
$self = $this;
$uniqueTypeList = array_unique(
array_map(
function (TypeDoc $sibling) use ($self) {
return $self->schemaTypeNormalizer->normalize($sibling);
},
... | php | protected function guessItemsType(array $siblingList) : string
{
$self = $this;
$uniqueTypeList = array_unique(
array_map(
function (TypeDoc $sibling) use ($self) {
return $self->schemaTypeNormalizer->normalize($sibling);
},
... | [
"protected",
"function",
"guessItemsType",
"(",
"array",
"$",
"siblingList",
")",
":",
"string",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"$",
"uniqueTypeList",
"=",
"array_unique",
"(",
"array_map",
"(",
"function",
"(",
"TypeDoc",
"$",
"sibling",
")",
"u... | @param TypeDoc[] $siblingList
@return string | [
"@param",
"TypeDoc",
"[]",
"$siblingList"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/TypeDocNormalizer.php#L165-L183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.