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 |
|---|---|---|---|---|---|---|---|---|---|---|
psecio/propauth | src/Policy.php | Policy.check | private function check($matchType, $type, $name, $args)
{
$value = array_shift($args);
if (!isset($args[0])) {
$args[0] = ['rule' => Policy::ANY];
}
// see what other options we've been given
if (is_string($args[0]) && ($args[0] === Policy::ANY || $args[0] === Pol... | php | private function check($matchType, $type, $name, $args)
{
$value = array_shift($args);
if (!isset($args[0])) {
$args[0] = ['rule' => Policy::ANY];
}
// see what other options we've been given
if (is_string($args[0]) && ($args[0] === Policy::ANY || $args[0] === Pol... | [
"private",
"function",
"check",
"(",
"$",
"matchType",
",",
"$",
"type",
",",
"$",
"name",
",",
"$",
"args",
")",
"{",
"$",
"value",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
... | Add a new check to the current set for the policy
@param string $matchType Match type
@param string $type Type of check
@param string $name Name for the check
@param array $args Additional arguments for the check | [
"Add",
"a",
"new",
"check",
"to",
"the",
"current",
"set",
"for",
"the",
"policy"
] | train | https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Policy.php#L172-L189 |
psecio/propauth | src/Policy.php | Policy.cannotCheck | private function cannotCheck($type, $name, $args)
{
if (isset($args[0]) && (is_object($args[0]) && get_class($args[0]) === 'Closure')) {
$type = 'closure';
$args[1] = $args[0];
} elseif (is_string($args[0]) && strpos($args[0], '::') !== false) {
$type = 'method';
... | php | private function cannotCheck($type, $name, $args)
{
if (isset($args[0]) && (is_object($args[0]) && get_class($args[0]) === 'Closure')) {
$type = 'closure';
$args[1] = $args[0];
} elseif (is_string($args[0]) && strpos($args[0], '::') !== false) {
$type = 'method';
... | [
"private",
"function",
"cannotCheck",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"args",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
"&&",
"(",
"is_object",
"(",
"$",
"args",
"[",
"0",
"]",
")",
"&&",
"get_class",
"("... | Add a "cannot" check to the set
@param string $type Check type
@param string $name Name for the check
@param array $args Additional arguments | [
"Add",
"a",
"cannot",
"check",
"to",
"the",
"set"
] | train | https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Policy.php#L228-L238 |
terdia/legato-framework | src/Routing/Route.php | Route.add | public static function add($method, $target, $handler, $name = null)
{
array_push(static::$prefixRoutes, [
'method' => $method, 'target' => $target,
'handler' => $handler, 'name' => $name,
]);
} | php | public static function add($method, $target, $handler, $name = null)
{
array_push(static::$prefixRoutes, [
'method' => $method, 'target' => $target,
'handler' => $handler, 'name' => $name,
]);
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"method",
",",
"$",
"target",
",",
"$",
"handler",
",",
"$",
"name",
"=",
"null",
")",
"{",
"array_push",
"(",
"static",
"::",
"$",
"prefixRoutes",
",",
"[",
"'method'",
"=>",
"$",
"method",
",",
"'tar... | Support method to add group of routes.
@param $method, HTTP Request method
@param $target, the route
@param $handler, Closure | Controller@method
@param $name, route name optional | [
"Support",
"method",
"to",
"add",
"group",
"of",
"routes",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Routing/Route.php#L61-L67 |
terdia/legato-framework | src/Routing/Route.php | Route.group | public static function group($prefix, Closure $callback)
{
$callback->call(new static());
foreach (static::$prefixRoutes as $key => $prefixRoute) {
$target = $prefix.$prefixRoute['target'];
$handler = $prefixRoute['handler'];
$name = $prefixRoute['name'];
... | php | public static function group($prefix, Closure $callback)
{
$callback->call(new static());
foreach (static::$prefixRoutes as $key => $prefixRoute) {
$target = $prefix.$prefixRoute['target'];
$handler = $prefixRoute['handler'];
$name = $prefixRoute['name'];
... | [
"public",
"static",
"function",
"group",
"(",
"$",
"prefix",
",",
"Closure",
"$",
"callback",
")",
"{",
"$",
"callback",
"->",
"call",
"(",
"new",
"static",
"(",
")",
")",
";",
"foreach",
"(",
"static",
"::",
"$",
"prefixRoutes",
"as",
"$",
"key",
"=... | Route Group.
@param $prefix
@param \Closure $callback | [
"Route",
"Group",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Routing/Route.php#L75-L90 |
terdia/legato-framework | src/Routing/Route.php | Route.resource | public static function resource($target, $handler)
{
$route = $target;
$sanitized = str_replace('/', '', $target);
static::get($route, $handler.'@index', $sanitized.'_index');
static::get($target.'/create', $handler.'@showCreateForm', $sanitized.'_create_form');
static::post... | php | public static function resource($target, $handler)
{
$route = $target;
$sanitized = str_replace('/', '', $target);
static::get($route, $handler.'@index', $sanitized.'_index');
static::get($target.'/create', $handler.'@showCreateForm', $sanitized.'_create_form');
static::post... | [
"public",
"static",
"function",
"resource",
"(",
"$",
"target",
",",
"$",
"handler",
")",
"{",
"$",
"route",
"=",
"$",
"target",
";",
"$",
"sanitized",
"=",
"str_replace",
"(",
"'/'",
",",
"''",
",",
"$",
"target",
")",
";",
"static",
"::",
"get",
... | Create a Rest Resource.
@param $target
@param $handler | [
"Create",
"a",
"Rest",
"Resource",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Routing/Route.php#L98-L110 |
terdia/legato-framework | src/Routing/Route.php | Route.all | public static function all()
{
$router = new AltoRouter();
foreach (static::$routes as $route) {
isset($route['name']) ? $name = $route['name'] : $name = null;
$router->map($route['method'], $route['target'], $route['handler'], $name);
}
return $router;
... | php | public static function all()
{
$router = new AltoRouter();
foreach (static::$routes as $route) {
isset($route['name']) ? $name = $route['name'] : $name = null;
$router->map($route['method'], $route['target'], $route['handler'], $name);
}
return $router;
... | [
"public",
"static",
"function",
"all",
"(",
")",
"{",
"$",
"router",
"=",
"new",
"AltoRouter",
"(",
")",
";",
"foreach",
"(",
"static",
"::",
"$",
"routes",
"as",
"$",
"route",
")",
"{",
"isset",
"(",
"$",
"route",
"[",
"'name'",
"]",
")",
"?",
"... | Register routes.
@throws \Exception
@return AltoRouter | [
"Register",
"routes",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Routing/Route.php#L119-L129 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/File.php | File.file_save_data | function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
return file_save_data($data, $destination, $replace);
} | php | function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
return file_save_data($data, $destination, $replace);
} | [
"function",
"file_save_data",
"(",
"$",
"data",
",",
"$",
"destination",
"=",
"NULL",
",",
"$",
"replace",
"=",
"FILE_EXISTS_RENAME",
")",
"{",
"return",
"file_save_data",
"(",
"$",
"data",
",",
"$",
"destination",
",",
"$",
"replace",
")",
";",
"}"
] | Saves a file to the specified destination and creates a database entry.
@param $data
A string containing the contents of the file.
@param $destination
A string containing the destination URI. This must be a stream wrapper URI.
If no value is provided, a randomized name will be generated and the file
will be saved usin... | [
"Saves",
"a",
"file",
"to",
"the",
"specified",
"destination",
"and",
"creates",
"a",
"database",
"entry",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/File.php#L133-L135 |
terdia/legato-framework | src/Console/StartPhpInbuiltServer.php | StartPhpInbuiltServer.execute | public function execute(InputInterface $input, OutputInterface $output)
{
chdir('public');
/*
* check for user supplied hostname option
*/
if ($input->hasOption('hostname') && $input->getOption('hostname') != null) {
$this->hostname = $input->getOption('hostnam... | php | public function execute(InputInterface $input, OutputInterface $output)
{
chdir('public');
/*
* check for user supplied hostname option
*/
if ($input->hasOption('hostname') && $input->getOption('hostname') != null) {
$this->hostname = $input->getOption('hostnam... | [
"public",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"chdir",
"(",
"'public'",
")",
";",
"/*\n * check for user supplied hostname option\n */",
"if",
"(",
"$",
"input",
"->",
"hasOption"... | You command logic.
@param InputInterface $input
@param OutputInterface $output
@return void | [
"You",
"command",
"logic",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Console/StartPhpInbuiltServer.php#L56-L85 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php | HTMLPurifier_Injector.prepare | public function prepare($config, $context) {
$this->htmlDefinition = $config->getHTMLDefinition();
// Even though this might fail, some unit tests ignore this and
// still test checkNeeded, so be careful. Maybe get rid of that
// dependency.
$result = $this->checkNeeded($config);... | php | public function prepare($config, $context) {
$this->htmlDefinition = $config->getHTMLDefinition();
// Even though this might fail, some unit tests ignore this and
// still test checkNeeded, so be careful. Maybe get rid of that
// dependency.
$result = $this->checkNeeded($config);... | [
"public",
"function",
"prepare",
"(",
"$",
"config",
",",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"htmlDefinition",
"=",
"$",
"config",
"->",
"getHTMLDefinition",
"(",
")",
";",
"// Even though this might fail, some unit tests ignore this and",
"// still test che... | Prepares the injector by giving it the config and context objects:
this allows references to important variables to be made within
the injector. This function also checks if the HTML environment
will work with the Injector (see checkNeeded()).
@param $config Instance of HTMLPurifier_Config
@param $context Instance of H... | [
"Prepares",
"the",
"injector",
"by",
"giving",
"it",
"the",
"config",
"and",
"context",
"objects",
":",
"this",
"allows",
"references",
"to",
"important",
"variables",
"to",
"be",
"made",
"within",
"the",
"injector",
".",
"This",
"function",
"also",
"checks",
... | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php#L90-L101 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php | HTMLPurifier_Injector.forward | protected function forward(&$i, &$current) {
if ($i === null) $i = $this->inputIndex + 1;
else $i++;
if (!isset($this->inputTokens[$i])) return false;
$current = $this->inputTokens[$i];
return true;
} | php | protected function forward(&$i, &$current) {
if ($i === null) $i = $this->inputIndex + 1;
else $i++;
if (!isset($this->inputTokens[$i])) return false;
$current = $this->inputTokens[$i];
return true;
} | [
"protected",
"function",
"forward",
"(",
"&",
"$",
"i",
",",
"&",
"$",
"current",
")",
"{",
"if",
"(",
"$",
"i",
"===",
"null",
")",
"$",
"i",
"=",
"$",
"this",
"->",
"inputIndex",
"+",
"1",
";",
"else",
"$",
"i",
"++",
";",
"if",
"(",
"!",
... | Iterator function, which starts with the next token and continues until
you reach the end of the input tokens.
@warning Please prevent previous references from interfering with this
functions by setting $i = null beforehand!
@param &$i Current integer index variable for inputTokens
@param &$current Current token variab... | [
"Iterator",
"function",
"which",
"starts",
"with",
"the",
"next",
"token",
"and",
"continues",
"until",
"you",
"reach",
"the",
"end",
"of",
"the",
"input",
"tokens",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php#L157-L163 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php | HTMLPurifier_Injector.forwardUntilEndToken | protected function forwardUntilEndToken(&$i, &$current, &$nesting) {
$result = $this->forward($i, $current);
if (!$result) return false;
if ($nesting === null) $nesting = 0;
if ($current instanceof HTMLPurifier_Token_Start) $nesting++;
elseif ($current instanceof HTMLPurifier... | php | protected function forwardUntilEndToken(&$i, &$current, &$nesting) {
$result = $this->forward($i, $current);
if (!$result) return false;
if ($nesting === null) $nesting = 0;
if ($current instanceof HTMLPurifier_Token_Start) $nesting++;
elseif ($current instanceof HTMLPurifier... | [
"protected",
"function",
"forwardUntilEndToken",
"(",
"&",
"$",
"i",
",",
"&",
"$",
"current",
",",
"&",
"$",
"nesting",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"forward",
"(",
"$",
"i",
",",
"$",
"current",
")",
";",
"if",
"(",
"!",
"$"... | Similar to _forward, but accepts a third parameter $nesting (which
should be initialized at 0) and stops when we hit the end tag
for the node $this->inputIndex starts in. | [
"Similar",
"to",
"_forward",
"but",
"accepts",
"a",
"third",
"parameter",
"$nesting",
"(",
"which",
"should",
"be",
"initialized",
"at",
"0",
")",
"and",
"stops",
"when",
"we",
"hit",
"the",
"end",
"tag",
"for",
"the",
"node",
"$this",
"-",
">",
"inputIn... | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php#L170-L180 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php | HTMLPurifier_Injector.backward | protected function backward(&$i, &$current) {
if ($i === null) $i = $this->inputIndex - 1;
else $i--;
if ($i < 0) return false;
$current = $this->inputTokens[$i];
return true;
} | php | protected function backward(&$i, &$current) {
if ($i === null) $i = $this->inputIndex - 1;
else $i--;
if ($i < 0) return false;
$current = $this->inputTokens[$i];
return true;
} | [
"protected",
"function",
"backward",
"(",
"&",
"$",
"i",
",",
"&",
"$",
"current",
")",
"{",
"if",
"(",
"$",
"i",
"===",
"null",
")",
"$",
"i",
"=",
"$",
"this",
"->",
"inputIndex",
"-",
"1",
";",
"else",
"$",
"i",
"--",
";",
"if",
"(",
"$",
... | Iterator function, starts with the previous token and continues until
you reach the beginning of input tokens.
@warning Please prevent previous references from interfering with this
functions by setting $i = null beforehand!
@param &$i Current integer index variable for inputTokens
@param &$current Current token variab... | [
"Iterator",
"function",
"starts",
"with",
"the",
"previous",
"token",
"and",
"continues",
"until",
"you",
"reach",
"the",
"beginning",
"of",
"input",
"tokens",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php#L190-L196 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php | HTMLPurifier_Injector.current | protected function current(&$i, &$current) {
if ($i === null) $i = $this->inputIndex;
$current = $this->inputTokens[$i];
} | php | protected function current(&$i, &$current) {
if ($i === null) $i = $this->inputIndex;
$current = $this->inputTokens[$i];
} | [
"protected",
"function",
"current",
"(",
"&",
"$",
"i",
",",
"&",
"$",
"current",
")",
"{",
"if",
"(",
"$",
"i",
"===",
"null",
")",
"$",
"i",
"=",
"$",
"this",
"->",
"inputIndex",
";",
"$",
"current",
"=",
"$",
"this",
"->",
"inputTokens",
"[",
... | Initializes the iterator at the current position. Use in a do {} while;
loop to force the _forward and _backward functions to start at the
current location.
@warning Please prevent previous references from interfering with this
functions by setting $i = null beforehand!
@param &$i Current integer index variable for inp... | [
"Initializes",
"the",
"iterator",
"at",
"the",
"current",
"position",
".",
"Use",
"in",
"a",
"do",
"{}",
"while",
";",
"loop",
"to",
"force",
"the",
"_forward",
"and",
"_backward",
"functions",
"to",
"start",
"at",
"the",
"current",
"location",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Injector.php#L207-L210 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer.php | HTMLPurifier_Printer.row | protected function row($name, $value) {
if (is_bool($value)) $value = $value ? 'On' : 'Off';
return
$this->start('tr') . "\n" .
$this->element('th', $name) . "\n" .
$this->element('td', $value) . "\n" .
$this->end('tr')
;
} | php | protected function row($name, $value) {
if (is_bool($value)) $value = $value ? 'On' : 'Off';
return
$this->start('tr') . "\n" .
$this->element('th', $name) . "\n" .
$this->element('td', $value) . "\n" .
$this->end('tr')
;
} | [
"protected",
"function",
"row",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"value",
")",
")",
"$",
"value",
"=",
"$",
"value",
"?",
"'On'",
":",
"'Off'",
";",
"return",
"$",
"this",
"->",
"start",
"(",
"'tr'",
... | Prints a simple key/value row in a table.
@param $name Key
@param $value Value | [
"Prints",
"a",
"simple",
"key",
"/",
"value",
"row",
"in",
"a",
"table",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer.php#L91-L99 |
transfer-framework/transfer | src/Transfer/Console/Command/Manifest/ListCommand.php | ListCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
$manifests = $this->chain->getManifests();
$rows = array();
/** @var ManifestInterface $manifest */
foreach ($manifests as $manifest) {
$rows[] = arra... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
$manifests = $this->chain->getManifests();
$rows = array();
/** @var ManifestInterface $manifest */
foreach ($manifests as $manifest) {
$rows[] = arra... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"parent",
"::",
"execute",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"manifests",
"=",
"$",
"this",
"->",
"chain",
"->",... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/ListCommand.php#L37-L56 |
webbuilders-group/silverstripe-gridfield-deleted-items | src/Forms/GridFieldDeletedToggle.php | GridFieldDeletedToggle.getHTMLFragments | public function getHTMLFragments($gridField) {
if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) {
user_error($gridField->getModelClass().' does not have the Versioned extension', E_USER_WARNING);
return;
}
$button=GridFie... | php | public function getHTMLFragments($gridField) {
if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) {
user_error($gridField->getModelClass().' does not have the Versioned extension', E_USER_WARNING);
return;
}
$button=GridFie... | [
"public",
"function",
"getHTMLFragments",
"(",
"$",
"gridField",
")",
"{",
"if",
"(",
"!",
"DataObject",
"::",
"has_extension",
"(",
"$",
"gridField",
"->",
"getModelClass",
"(",
")",
",",
"Versioned",
"::",
"class",
")",
")",
"{",
"user_error",
"(",
"$",
... | Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
@param GridField $gridField Grid Field Reference
@return array | [
"Returns",
"a",
"map",
"where",
"the",
"keys",
"are",
"fragment",
"names",
"and",
"the",
"values",
"are",
"pieces",
"of",
"HTML",
"to",
"add",
"to",
"these",
"fragments",
"."
] | train | https://github.com/webbuilders-group/silverstripe-gridfield-deleted-items/blob/fd4e90701357de00acf06f4b820b745817f4ce9c/src/Forms/GridFieldDeletedToggle.php#L28-L52 |
webbuilders-group/silverstripe-gridfield-deleted-items | src/Forms/GridFieldDeletedToggle.php | GridFieldDeletedToggle.handleAction | public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
if($actionName=='gf-toggle-deleted') {
if($gridField->State->ListDisplayMode->ShowDeletedItems=='Y') {
$gridField->State->ListDisplayMode->ShowDeletedItems='N';
}else {
$g... | php | public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
if($actionName=='gf-toggle-deleted') {
if($gridField->State->ListDisplayMode->ShowDeletedItems=='Y') {
$gridField->State->ListDisplayMode->ShowDeletedItems='N';
}else {
$g... | [
"public",
"function",
"handleAction",
"(",
"GridField",
"$",
"gridField",
",",
"$",
"actionName",
",",
"$",
"arguments",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"actionName",
"==",
"'gf-toggle-deleted'",
")",
"{",
"if",
"(",
"$",
"gridField",
"->",
"... | Handle an action on the given {@link GridField}.
@param GridField $gridField Grid Field Reference
@param string Action identifier, see {@link getActions()}.
@param array Arguments relevant for this
@param array All form data | [
"Handle",
"an",
"action",
"on",
"the",
"given",
"{"
] | train | https://github.com/webbuilders-group/silverstripe-gridfield-deleted-items/blob/fd4e90701357de00acf06f4b820b745817f4ce9c/src/Forms/GridFieldDeletedToggle.php#L70-L78 |
iP1SMS/ip1-php-sdk | src/Core/ClassValidationArray.php | ClassValidationArray.offsetSet | public function offsetSet($index, $value): void
{
if (!is_object($value)) {
throw new \InvalidArgumentException("Excepcted object, got ". gettype($value));
}
if (!isset($this->class)) {
$this->class = get_class($value);
}
if (get_class($value) === $thi... | php | public function offsetSet($index, $value): void
{
if (!is_object($value)) {
throw new \InvalidArgumentException("Excepcted object, got ". gettype($value));
}
if (!isset($this->class)) {
$this->class = get_class($value);
}
if (get_class($value) === $thi... | [
"public",
"function",
"offsetSet",
"(",
"$",
"index",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Excepcted object, got \"",
".",
"gettyp... | Sets the value at the specified index to value if value's class matches the one set.
If a class has not been set it will set the given object's class as the only allowed class.
@param mixed $index The index to put the value in.
@param object $value The object that should be added.
@return void
@throws \InvalidArgument... | [
"Sets",
"the",
"value",
"at",
"the",
"specified",
"index",
"to",
"value",
"if",
"value",
"s",
"class",
"matches",
"the",
"one",
"set",
".",
"If",
"a",
"class",
"has",
"not",
"been",
"set",
"it",
"will",
"set",
"the",
"given",
"object",
"s",
"class",
... | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/ClassValidationArray.php#L79-L92 |
iP1SMS/ip1-php-sdk | src/Core/ClassValidationArray.php | ClassValidationArray.jsonSerialize | public function jsonSerialize(): array
{
$returnArray = [];
foreach ($this->getArrayCopy() as $value) {
$returnArray[] = $value->JsonSerialize();
}
return $returnArray;
} | php | public function jsonSerialize(): array
{
$returnArray = [];
foreach ($this->getArrayCopy() as $value) {
$returnArray[] = $value->JsonSerialize();
}
return $returnArray;
} | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"array",
"{",
"$",
"returnArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getArrayCopy",
"(",
")",
"as",
"$",
"value",
")",
"{",
"$",
"returnArray",
"[",
"]",
"=",
"$",
"value",
... | Serializes the object to a value that can be serialized natively by json_encode().
@return array Associative.
@link http://php.net/manual/en/jsonserializable.jsonserialize.php | [
"Serializes",
"the",
"object",
"to",
"a",
"value",
"that",
"can",
"be",
"serialized",
"natively",
"by",
"json_encode",
"()",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Core/ClassValidationArray.php#L106-L113 |
reinvanoyen/aegis | lib/Aegis/Runtime/Node/ArgumentListNode.php | ArgumentListNode.compile | public function compile(CompilerInterface $compiler)
{
$i = 0;
foreach ($this->getChildren() as $c) {
$c->compile($compiler);
++$i;
if ($i < count($this->getChildren())) {
$compiler->write(', ');
}
}
} | php | public function compile(CompilerInterface $compiler)
{
$i = 0;
foreach ($this->getChildren() as $c) {
$c->compile($compiler);
++$i;
if ($i < count($this->getChildren())) {
$compiler->write(', ');
}
}
} | [
"public",
"function",
"compile",
"(",
"CompilerInterface",
"$",
"compiler",
")",
"{",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getChildren",
"(",
")",
"as",
"$",
"c",
")",
"{",
"$",
"c",
"->",
"compile",
"(",
"$",
"compiler",
")... | Compiles the node
@param CompilerInterface $compiler | [
"Compiles",
"the",
"node"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Runtime/Node/ArgumentListNode.php#L42-L55 |
venta/framework | src/Container/src/Exception/UnresolvableDependencyException.php | UnresolvableDependencyException.formatParameter | private function formatParameter(ReflectionParameter $parameter): string
{
return $parameter->hasType() ?
sprintf('%s $%s', $parameter->getType(), $parameter->getName()) :
sprintf('$%s', $parameter->getName());
} | php | private function formatParameter(ReflectionParameter $parameter): string
{
return $parameter->hasType() ?
sprintf('%s $%s', $parameter->getType(), $parameter->getName()) :
sprintf('$%s', $parameter->getName());
} | [
"private",
"function",
"formatParameter",
"(",
"ReflectionParameter",
"$",
"parameter",
")",
":",
"string",
"{",
"return",
"$",
"parameter",
"->",
"hasType",
"(",
")",
"?",
"sprintf",
"(",
"'%s $%s'",
",",
"$",
"parameter",
"->",
"getType",
"(",
")",
",",
... | Formats parameter depending on type
@param ReflectionParameter $parameter
@return string | [
"Formats",
"parameter",
"depending",
"on",
"type"
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/Exception/UnresolvableDependencyException.php#L61-L66 |
transfer-framework/transfer | src/Transfer/Storage/FileStorage.php | FileStorage.add | public function add($object, $id = null)
{
if ($id === null) {
$id = $this->hashingStrategy->hash($object);
}
file_put_contents(sprintf('%s/%s', $this->directory, $id), serialize($object));
return true;
} | php | public function add($object, $id = null)
{
if ($id === null) {
$id = $this->hashingStrategy->hash($object);
}
file_put_contents(sprintf('%s/%s', $this->directory, $id), serialize($object));
return true;
} | [
"public",
"function",
"add",
"(",
"$",
"object",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"null",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"hashingStrategy",
"->",
"hash",
"(",
"$",
"object",
")",
";",
"}",
"file_... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/FileStorage.php#L39-L48 |
transfer-framework/transfer | src/Transfer/Storage/FileStorage.php | FileStorage.findById | public function findById($id)
{
if (!$this->containsId($id)) {
throw new ObjectNotFoundException($id);
}
return unserialize(file_get_contents(sprintf('%s/%s', $this->directory, $id)));
} | php | public function findById($id)
{
if (!$this->containsId($id)) {
throw new ObjectNotFoundException($id);
}
return unserialize(file_get_contents(sprintf('%s/%s', $this->directory, $id)));
} | [
"public",
"function",
"findById",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"containsId",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"ObjectNotFoundException",
"(",
"$",
"id",
")",
";",
"}",
"return",
"unserialize",
"(",
"file_... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/FileStorage.php#L69-L76 |
terdia/legato-framework | src/Console/CommandTemplate.php | CommandTemplate.controller | public function controller()
{
if ($this->restful) {
return filesystem()->exists(realpath(__DIR__.'/../../../../../app/controllers')) ?
realpath(__DIR__.'/../Templates/controller/restful.stub') :
realpath(__DIR__.'/../Templates/controller/restful.core.stub');
... | php | public function controller()
{
if ($this->restful) {
return filesystem()->exists(realpath(__DIR__.'/../../../../../app/controllers')) ?
realpath(__DIR__.'/../Templates/controller/restful.stub') :
realpath(__DIR__.'/../Templates/controller/restful.core.stub');
... | [
"public",
"function",
"controller",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"restful",
")",
"{",
"return",
"filesystem",
"(",
")",
"->",
"exists",
"(",
"realpath",
"(",
"__DIR__",
".",
"'/../../../../../app/controllers'",
")",
")",
"?",
"realpath",
"(... | Get the template for creating a controller.
@return bool|string | [
"Get",
"the",
"template",
"for",
"creating",
"a",
"controller",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Console/CommandTemplate.php#L22-L33 |
geniv/nette-thumbnail | src/Bridges/Nette/Extension.php | Extension.beforeCompile | public function beforeCompile()
{
$builder = $this->getContainerBuilder();
$config = $this->validateConfig($this->defaults);
$builder->addDefinition($this->prefix('default'))
->setFactory(Thumbnail::class, [$config]);
// load macro to latte
$latteFactory = $buil... | php | public function beforeCompile()
{
$builder = $this->getContainerBuilder();
$config = $this->validateConfig($this->defaults);
$builder->addDefinition($this->prefix('default'))
->setFactory(Thumbnail::class, [$config]);
// load macro to latte
$latteFactory = $buil... | [
"public",
"function",
"beforeCompile",
"(",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getContainerBuilder",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"validateConfig",
"(",
"$",
"this",
"->",
"defaults",
")",
";",
"$",
"builder",
"... | Before Compile. | [
"Before",
"Compile",
"."
] | train | https://github.com/geniv/nette-thumbnail/blob/408fc61e0df99113a873ca1ec463e4fc85016eed/src/Bridges/Nette/Extension.php#L36-L47 |
dphn/ScContent | src/ScContent/Listener/Installation/InstallationInspector.php | InstallationInspector.setup | public function setup($moduleName, $options)
{
if (is_array($options)) {
$this->queue[] = InstallationOptionsFactory::make($moduleName, $options);
return $this;
}
if ($options instanceof Installation) {
$this->queue[] = $options;
return $this;
... | php | public function setup($moduleName, $options)
{
if (is_array($options)) {
$this->queue[] = InstallationOptionsFactory::make($moduleName, $options);
return $this;
}
if ($options instanceof Installation) {
$this->queue[] = $options;
return $this;
... | [
"public",
"function",
"setup",
"(",
"$",
"moduleName",
",",
"$",
"options",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"queue",
"[",
"]",
"=",
"InstallationOptionsFactory",
"::",
"make",
"(",
"$",
"moduleNam... | @api
@param string $moduleName
@param \ScContent\Options\Installation\Installation|array $options
@return InstallationInspector | [
"@api"
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Installation/InstallationInspector.php#L127-L140 |
guillaumemonet/Rad | src/Rad/Utils/StringUtils.php | StringUtils.removeAccents | public static function removeAccents($str) {
$str = str_replace(' & ', ' ', $str);
$str = htmlentities($str);
$str = preg_replace('#&([A-Za-z])(?:acute|grave|cedil|circ|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-Za-z]{2})(?:lig);#', '\1', $str);
... | php | public static function removeAccents($str) {
$str = str_replace(' & ', ' ', $str);
$str = htmlentities($str);
$str = preg_replace('#&([A-Za-z])(?:acute|grave|cedil|circ|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-Za-z]{2})(?:lig);#', '\1', $str);
... | [
"public",
"static",
"function",
"removeAccents",
"(",
"$",
"str",
")",
"{",
"$",
"str",
"=",
"str_replace",
"(",
"' & '",
",",
"' '",
",",
"$",
"str",
")",
";",
"$",
"str",
"=",
"htmlentities",
"(",
"$",
"str",
")",
";",
"$",
"str",
"=",
"preg_repl... | @pre1 <code>$str="abcd";</code>
@post1 <code>$result="abcd";</code>
@pre2 <code>$str="éàçù";</code>
@post2 <code>$result="eacu";</code>
@param string $str
@return string | [
"@pre1",
"<code",
">",
"$str",
"=",
"abcd",
";",
"<",
"/",
"code",
">",
"@post1",
"<code",
">",
"$result",
"=",
"abcd",
";",
"<",
"/",
"code",
">"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Utils/StringUtils.php#L93-L101 |
guillaumemonet/Rad | src/Rad/Utils/StringUtils.php | StringUtils.strContains | public static function strContains($haystack, $needle, $cs = false) {
if ($cs) {
return strpos($haystack, $needle) !== false;
} else {
return stripos($haystack, $needle) !== false;
}
} | php | public static function strContains($haystack, $needle, $cs = false) {
if ($cs) {
return strpos($haystack, $needle) !== false;
} else {
return stripos($haystack, $needle) !== false;
}
} | [
"public",
"static",
"function",
"strContains",
"(",
"$",
"haystack",
",",
"$",
"needle",
",",
"$",
"cs",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"cs",
")",
"{",
"return",
"strpos",
"(",
"$",
"haystack",
",",
"$",
"needle",
")",
"!==",
"false",
";",... | Check if a string contains another string.
@pre1 <code>$haystack = "totoleheros";$needle="Heros";$cs=false;</code>
@post1 <code>$result=true;</code>
@pre2 <code>$haystack = "totoleHeros";$needle="heros";$cs=false;</code>
@post2 <code>$result=true;</code>
@pre3 <code>$haystack = "totoleHeros";$needle="heros";$cs=true;</... | [
"Check",
"if",
"a",
"string",
"contains",
"another",
"string",
".",
"@pre1",
"<code",
">",
"$haystack",
"=",
"totoleheros",
";",
"$needle",
"=",
"Heros",
";",
"$cs",
"=",
"false",
";",
"<",
"/",
"code",
">",
"@post1",
"<code",
">",
"$result",
"=",
"tru... | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Utils/StringUtils.php#L182-L188 |
guillaumemonet/Rad | src/Rad/Utils/StringUtils.php | StringUtils.parseComments | public static function parseComments($comments) {
$ret = [];
//trim(str_replace(array('/', '*', '**'), '', substr($comments, 0, strpos($comments, '@'))));
$comments = str_replace(array('/*', '*', '**'), '', $comments);
$array_comments = explode("\n", $comments);
foreach ($ar... | php | public static function parseComments($comments) {
$ret = [];
//trim(str_replace(array('/', '*', '**'), '', substr($comments, 0, strpos($comments, '@'))));
$comments = str_replace(array('/*', '*', '**'), '', $comments);
$array_comments = explode("\n", $comments);
foreach ($ar... | [
"public",
"static",
"function",
"parseComments",
"(",
"$",
"comments",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"//trim(str_replace(array('/', '*', '**'), '', substr($comments, 0, strpos($comments, '@'))));\r",
"$",
"comments",
"=",
"str_replace",
"(",
"array",
"(",
"'... | Parse comment, used only when generate php
@param string $comments | [
"Parse",
"comment",
"used",
"only",
"when",
"generate",
"php"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Utils/StringUtils.php#L194-L208 |
DevGroup-ru/yii2-data-structure-tools | src/search/base/BaseSearch.php | BaseSearch.search | public function search($mainEntityClassname, $config = [])
{
return Yii::$container->get(SearchQuery::class, [$mainEntityClassname, $this, $config]);
} | php | public function search($mainEntityClassname, $config = [])
{
return Yii::$container->get(SearchQuery::class, [$mainEntityClassname, $this, $config]);
} | [
"public",
"function",
"search",
"(",
"$",
"mainEntityClassname",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"return",
"Yii",
"::",
"$",
"container",
"->",
"get",
"(",
"SearchQuery",
"::",
"class",
",",
"[",
"$",
"mainEntityClassname",
",",
"$",
"this",... | @param string $mainEntityClassname
@param array $config array to pass to SearchQuery constructor
@return SearchQuery | [
"@param",
"string",
"$mainEntityClassname"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/search/base/BaseSearch.php#L37-L40 |
DevGroup-ru/yii2-data-structure-tools | src/search/base/BaseSearch.php | BaseSearch.searchFromJson | public function searchFromJson($json)
{
if (is_string($json)) {
$json = yii\helpers\Json::decode($json);
}
if (isset($json['mainEntityClassName'], $json['searchQuery']) === false) {
throw new \RuntimeException("mainEntityClassName and searchQuery needed to be in json ... | php | public function searchFromJson($json)
{
if (is_string($json)) {
$json = yii\helpers\Json::decode($json);
}
if (isset($json['mainEntityClassName'], $json['searchQuery']) === false) {
throw new \RuntimeException("mainEntityClassName and searchQuery needed to be in json ... | [
"public",
"function",
"searchFromJson",
"(",
"$",
"json",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"json",
")",
")",
"{",
"$",
"json",
"=",
"yii",
"\\",
"helpers",
"\\",
"Json",
"::",
"decode",
"(",
"$",
"json",
")",
";",
"}",
"if",
"(",
"isse... | @param string|array $json
@return \DevGroup\DataStructure\search\base\SearchQuery | [
"@param",
"string|array",
"$json"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/search/base/BaseSearch.php#L47-L59 |
mimmi20/Wurfl | src/Handlers/CatchAllMozillaHandler.php | CatchAllMozillaHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
//High accuracy mode
$tolerance = Utils::firstCloseParen($userAgent);
return $this->getDeviceIDFromRIS($userAgent, $tolerance);
} | php | public function applyConclusiveMatch($userAgent)
{
//High accuracy mode
$tolerance = Utils::firstCloseParen($userAgent);
return $this->getDeviceIDFromRIS($userAgent, $tolerance);
} | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"//High accuracy mode",
"$",
"tolerance",
"=",
"Utils",
"::",
"firstCloseParen",
"(",
"$",
"userAgent",
")",
";",
"return",
"$",
"this",
"->",
"getDeviceIDFromRIS",
"(",
"$",
"userAge... | If UA starts with Mozilla, apply LD with tollerance 5.
@param string $userAgent
@return string | [
"If",
"UA",
"starts",
"with",
"Mozilla",
"apply",
"LD",
"with",
"tollerance",
"5",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/CatchAllMozillaHandler.php#L50-L56 |
skeeks-cms/cms-rbac | src/controllers/AdminRoleController.php | AdminRoleController.actionIndex | public function actionIndex()
{
$searchModel = new AuthItemSearch(['type' => Item::TYPE_ROLE]);
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
return $this->render('index', [
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
... | php | public function actionIndex()
{
$searchModel = new AuthItemSearch(['type' => Item::TYPE_ROLE]);
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
return $this->render('index', [
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"searchModel",
"=",
"new",
"AuthItemSearch",
"(",
"[",
"'type'",
"=>",
"Item",
"::",
"TYPE_ROLE",
"]",
")",
";",
"$",
"dataProvider",
"=",
"$",
"searchModel",
"->",
"search",
"(",
"Yii",
"::",
"$",... | Lists all AuthItem models.
@return mixed | [
"Lists",
"all",
"AuthItem",
"models",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminRoleController.php#L92-L101 |
skeeks-cms/cms-rbac | src/controllers/AdminRoleController.php | AdminRoleController.actionView | public function actionView()
{
$model = $this->model;
$id = $model->name;
$model = $this->findModel($id);
$authManager = Yii::$app->getAuthManager();
$avaliable = $assigned = [
'Roles' => [],
'Permission' => [],
'Routes' => [],
];
... | php | public function actionView()
{
$model = $this->model;
$id = $model->name;
$model = $this->findModel($id);
$authManager = Yii::$app->getAuthManager();
$avaliable = $assigned = [
'Roles' => [],
'Permission' => [],
'Routes' => [],
];
... | [
"public",
"function",
"actionView",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
";",
"$",
"id",
"=",
"$",
"model",
"->",
"name",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"$",
"authManager... | Displays a single AuthItem model.
@param string $id
@return mixed | [
"Displays",
"a",
"single",
"AuthItem",
"model",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminRoleController.php#L108-L150 |
skeeks-cms/cms-rbac | src/controllers/AdminRoleController.php | AdminRoleController.actionCreate | public function actionCreate()
{
$model = new AuthItem(null);
$model->type = Item::TYPE_ROLE;
if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
$model->load(\Yii::$app->request->post());
\Yii::$app->response->format = Response::FORMAT_JSON;
... | php | public function actionCreate()
{
$model = new AuthItem(null);
$model->type = Item::TYPE_ROLE;
if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
$model->load(\Yii::$app->request->post());
\Yii::$app->response->format = Response::FORMAT_JSON;
... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"AuthItem",
"(",
"null",
")",
";",
"$",
"model",
"->",
"type",
"=",
"Item",
"::",
"TYPE_ROLE",
";",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"isA... | Creates a new AuthItem model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed | [
"Creates",
"a",
"new",
"AuthItem",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminRoleController.php#L157-L171 |
skeeks-cms/cms-rbac | src/controllers/AdminRoleController.php | AdminRoleController.actionRoleSearch | public function actionRoleSearch($id, $target, $term = '')
{
$result = [
'Roles' => [],
'Permission' => [],
'Routes' => [],
];
$authManager = Yii::$app->authManager;
if ($target == 'avaliable') {
$children = array_keys($authManager->get... | php | public function actionRoleSearch($id, $target, $term = '')
{
$result = [
'Roles' => [],
'Permission' => [],
'Routes' => [],
];
$authManager = Yii::$app->authManager;
if ($target == 'avaliable') {
$children = array_keys($authManager->get... | [
"public",
"function",
"actionRoleSearch",
"(",
"$",
"id",
",",
"$",
"target",
",",
"$",
"term",
"=",
"''",
")",
"{",
"$",
"result",
"=",
"[",
"'Roles'",
"=>",
"[",
"]",
",",
"'Permission'",
"=>",
"[",
"]",
",",
"'Routes'",
"=>",
"[",
"]",
",",
"]... | Search role
@param string $id
@param string $target
@param string $term
@return array | [
"Search",
"role"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminRoleController.php#L286-L329 |
skeeks-cms/cms-rbac | src/controllers/AdminRoleController.php | AdminRoleController.findModel | protected function findModel($id)
{
$item = Yii::$app->getAuthManager()->getRole($id);
if ($item) {
return new AuthItem($item);
} else {
throw new NotFoundHttpException(\Yii::t('app', 'The requested page does not exist.'));
}
} | php | protected function findModel($id)
{
$item = Yii::$app->getAuthManager()->getRole($id);
if ($item) {
return new AuthItem($item);
} else {
throw new NotFoundHttpException(\Yii::t('app', 'The requested page does not exist.'));
}
} | [
"protected",
"function",
"findModel",
"(",
"$",
"id",
")",
"{",
"$",
"item",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getAuthManager",
"(",
")",
"->",
"getRole",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"item",
")",
"{",
"return",
"new",
"AuthItem",
... | Finds the AuthItem model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param string $id
@return AuthItem the loaded model
@throws HttpException if the model cannot be found | [
"Finds",
"the",
"AuthItem",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminRoleController.php#L338-L346 |
rfdy/imagemagick | Image/Url.php | Url.getImageData | public function getImageData() {
if ($this->imageData === null) {
$this->imageData = $this->download($this->url);
}
return $this->imageData;
} | php | public function getImageData() {
if ($this->imageData === null) {
$this->imageData = $this->download($this->url);
}
return $this->imageData;
} | [
"public",
"function",
"getImageData",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"imageData",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"imageData",
"=",
"$",
"this",
"->",
"download",
"(",
"$",
"this",
"->",
"url",
")",
";",
"}",
"return",
"$"... | Returns the complete image data, wherever it may have come from.
@return string | [
"Returns",
"the",
"complete",
"image",
"data",
"wherever",
"it",
"may",
"have",
"come",
"from",
"."
] | train | https://github.com/rfdy/imagemagick/blob/dd1e52fbd66093828dd013e64c53dc7d68f1bc91/Image/Url.php#L28-L33 |
activecollab/bootstrap | src/Command/DevCommand/BuildStructureCommand.php | BuildStructureCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var ConnectionInterface $connection */
$connection = $this->getContainer()->get('connection');
/** @var StructureInterface $structure */
$structure = $this->getContainer()->get('structure');
$... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var ConnectionInterface $connection */
$connection = $this->getContainer()->get('connection');
/** @var StructureInterface $structure */
$structure = $this->getContainer()->get('structure');
$... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var ConnectionInterface $connection */",
"$",
"connection",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'connec... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Command/DevCommand/BuildStructureCommand.php#L34-L85 |
MissAllSunday/Ohara | src/Suki/Db.php | Db.create | public function create($data, $table = '')
{
global $smcFunc;
// What table should be updated? defaults to $this->_schema[0] if no table was specified.
$table = isset($this->_schema[$table]) ? $table : (isset($this->_schema[0]) ? key($this->_schema) : '');
// We need to make sure you defined this table's co... | php | public function create($data, $table = '')
{
global $smcFunc;
// What table should be updated? defaults to $this->_schema[0] if no table was specified.
$table = isset($this->_schema[$table]) ? $table : (isset($this->_schema[0]) ? key($this->_schema) : '');
// We need to make sure you defined this table's co... | [
"public",
"function",
"create",
"(",
"$",
"data",
",",
"$",
"table",
"=",
"''",
")",
"{",
"global",
"$",
"smcFunc",
";",
"// What table should be updated? defaults to $this->_schema[0] if no table was specified.",
"$",
"table",
"=",
"isset",
"(",
"$",
"this",
"->",... | Creates a new entry on x table.
Uses {@link $_schema}
Uses {@link $_tableKeys}
@access public
@param array $data An array of data to be inserted, array('column' => 'value')
@param string $table The table name, if left empty and $this->_schema is defined, it will use the first table on it.
@return mixed The new inserte... | [
"Creates",
"a",
"new",
"entry",
"on",
"x",
"table",
".",
"Uses",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Db.php#L50-L74 |
MissAllSunday/Ohara | src/Suki/Db.php | Db.read | public function read($params, $data, $key = false, $single = false)
{
global $smcFunc;
$dataResult = [];
$query = $smcFunc['db_query']('', '
SELECT ' . $params['rows'] .'
FROM {db_prefix}' . $params['table'] .'
'. (!empty($params['join']) ? 'LEFT JOIN '. $params['join'] : '') .'
'. (!empty($params['w... | php | public function read($params, $data, $key = false, $single = false)
{
global $smcFunc;
$dataResult = [];
$query = $smcFunc['db_query']('', '
SELECT ' . $params['rows'] .'
FROM {db_prefix}' . $params['table'] .'
'. (!empty($params['join']) ? 'LEFT JOIN '. $params['join'] : '') .'
'. (!empty($params['w... | [
"public",
"function",
"read",
"(",
"$",
"params",
",",
"$",
"data",
",",
"$",
"key",
"=",
"false",
",",
"$",
"single",
"=",
"false",
")",
"{",
"global",
"$",
"smcFunc",
";",
"$",
"dataResult",
"=",
"[",
"]",
";",
"$",
"query",
"=",
"$",
"smcFunc"... | Reads data from a table.
@param array $params An array with all the params for the query
@param array $data An array to pass to $smcFunc casting array
@param bool $key A boolean value to asign a row as key on the returning array
@param bool $single A bool to tell the query to return a single value instead of An array... | [
"Reads",
"data",
"from",
"a",
"table",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Db.php#L85-L116 |
MissAllSunday/Ohara | src/Suki/Db.php | Db.update | public function update($ids = [], $params = [], $table = '', $column = '')
{
global $smcFunc;
// Basic checks.
if (!$this->_schema || (empty($params) || !is_array($params)) || empty($ids))
return false;
// Work with arrays.
$ids = (array) $ids;
// What table should be updated? defaults to $this->_sc... | php | public function update($ids = [], $params = [], $table = '', $column = '')
{
global $smcFunc;
// Basic checks.
if (!$this->_schema || (empty($params) || !is_array($params)) || empty($ids))
return false;
// Work with arrays.
$ids = (array) $ids;
// What table should be updated? defaults to $this->_sc... | [
"public",
"function",
"update",
"(",
"$",
"ids",
"=",
"[",
"]",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"table",
"=",
"''",
",",
"$",
"column",
"=",
"''",
")",
"{",
"global",
"$",
"smcFunc",
";",
"// Basic checks.",
"if",
"(",
"!",
"$",
"t... | Updates data in x table.
Uses {@link $_schema}
@access public
@param array $ids An array of ids to check against, can also use an int.
@param array $params An array of params (oh rly???) $column => $value pair.
@param string $table The table name, if left empty and $this->_schema is defined, it will use the first table... | [
"Updates",
"data",
"in",
"x",
"table",
".",
"Uses",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Db.php#L128-L168 |
MissAllSunday/Ohara | src/Suki/Db.php | Db.delete | public function delete($value, $table = '', $column = '')
{
global $smcFunc;
if (empty($id) || empty($table) || empty($column))
return false;
// Perform.
return $smcFunc['db_query']('', '
DELETE FROM {db_prefix}' . ($table) . '
WHERE '. ($column) .' = '. ($value) .'', array());
} | php | public function delete($value, $table = '', $column = '')
{
global $smcFunc;
if (empty($id) || empty($table) || empty($column))
return false;
// Perform.
return $smcFunc['db_query']('', '
DELETE FROM {db_prefix}' . ($table) . '
WHERE '. ($column) .' = '. ($value) .'', array());
} | [
"public",
"function",
"delete",
"(",
"$",
"value",
",",
"$",
"table",
"=",
"''",
",",
"$",
"column",
"=",
"''",
")",
"{",
"global",
"$",
"smcFunc",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"empty",
"(",
"$",
"table",
")",
"||",
"empt... | Deletes an entry from X table.
@access public
@param mixed $value The table name.
@param string $table The table name, if left empty and $this->_schema is defined, it will use the first table on it.
@param string $column The column name, if left empty and $this->_schema[$table] is defined, it will use the first column ... | [
"Deletes",
"an",
"entry",
"from",
"X",
"table",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Db.php#L178-L189 |
mybb/standards | MyBB2/Sniffs/General/TraitConventionSniff.php | MyBB2_Sniffs_General_TraitConventionSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// Only work on level 1 "use", means including traits
if ($tokens[$stackPtr]['level' ] != 1) {
return;
}
$nextComma = $phpcsFile->findNext(T_COMMA, $stackPtr);
$nextSemi = $phpcsFile->findNext(T_... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// Only work on level 1 "use", means including traits
if ($tokens[$stackPtr]['level' ] != 1) {
return;
}
$nextComma = $phpcsFile->findNext(T_COMMA, $stackPtr);
$nextSemi = $phpcsFile->findNext(T_... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"// Only work on level 1 \"use\", means including traits",
"if",
"(",
"$",
"toke... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The current file being processed.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/mybb/standards/blob/78beaef4c8940f251bc62fdb7998566fe3a20be0/MyBB2/Sniffs/General/TraitConventionSniff.php#L35-L51 |
ionutmilica/laravel-settings | src/Drivers/Json.php | Json.save | public function save(array $data = [], array $dirt = [])
{
if ($dirt != null) {
file_put_contents($this->filePath, json_encode($data));
return true;
}
return false;
} | php | public function save(array $data = [], array $dirt = [])
{
if ($dirt != null) {
file_put_contents($this->filePath, json_encode($data));
return true;
}
return false;
} | [
"public",
"function",
"save",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"dirt",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"dirt",
"!=",
"null",
")",
"{",
"file_put_contents",
"(",
"$",
"this",
"->",
"filePath",
",",
"json_encode",... | Save dirty data into the data source
@param array $data
@param array $dirt
@return bool | [
"Save",
"dirty",
"data",
"into",
"the",
"data",
"source"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Json.php#L30-L38 |
ionutmilica/laravel-settings | src/Drivers/Json.php | Json.load | public function load()
{
$data = [];
if (is_file($this->filePath)) {
$data = json_decode(file_get_contents($this->filePath), true);
}
return $data;
} | php | public function load()
{
$data = [];
if (is_file($this->filePath)) {
$data = json_decode(file_get_contents($this->filePath), true);
}
return $data;
} | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"is_file",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
"{",
"$",
"data",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"filePath",
")... | Prepare the data for driver operations | [
"Prepare",
"the",
"data",
"for",
"driver",
"operations"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Json.php#L43-L52 |
ronan-gloo/jade-php | src/Jade/Lexer.php | Lexer.setInput | public function setInput($input)
{
$this->input = preg_replace("/\r\n|\r/", "\n", $input);
$this->lineno = 1;
$this->deferred = array();
$this->indentStack = array();
$this->stash = array();
} | php | public function setInput($input)
{
$this->input = preg_replace("/\r\n|\r/", "\n", $input);
$this->lineno = 1;
$this->deferred = array();
$this->indentStack = array();
$this->stash = array();
} | [
"public",
"function",
"setInput",
"(",
"$",
"input",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"preg_replace",
"(",
"\"/\\r\\n|\\r/\"",
",",
"\"\\n\"",
",",
"$",
"input",
")",
";",
"$",
"this",
"->",
"lineno",
"=",
"1",
";",
"$",
"this",
"->",
"defe... | Set lexer input.
@param string $input input string | [
"Set",
"lexer",
"input",
"."
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Lexer.php#L52-L59 |
ronan-gloo/jade-php | src/Jade/Lexer.php | Lexer.scan | protected function scan($regex, $type)
{
if (preg_match($regex, $this->input, $matches)) {
$this->consume($matches[0]);
return $this->token($type, isset($matches[1]) && mb_strlen($matches[1]) > 0 ? $matches[1] : '');
}
} | php | protected function scan($regex, $type)
{
if (preg_match($regex, $this->input, $matches)) {
$this->consume($matches[0]);
return $this->token($type, isset($matches[1]) && mb_strlen($matches[1]) > 0 ? $matches[1] : '');
}
} | [
"protected",
"function",
"scan",
"(",
"$",
"regex",
",",
"$",
"type",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"regex",
",",
"$",
"this",
"->",
"input",
",",
"$",
"matches",
")",
")",
"{",
"$",
"this",
"->",
"consume",
"(",
"$",
"matches",
"[... | Helper to create tokens | [
"Helper",
"to",
"create",
"tokens"
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Lexer.php#L111-L118 |
ronan-gloo/jade-php | src/Jade/Lexer.php | Lexer.lookahead | public function lookahead($number = 1)
{
$fetch = $number - count($this->stash);
while ($fetch-- > 0) {
$this->stash[] = $this->next();
}
return $this->stash[--$number];
} | php | public function lookahead($number = 1)
{
$fetch = $number - count($this->stash);
while ($fetch-- > 0) {
$this->stash[] = $this->next();
}
return $this->stash[--$number];
} | [
"public",
"function",
"lookahead",
"(",
"$",
"number",
"=",
"1",
")",
"{",
"$",
"fetch",
"=",
"$",
"number",
"-",
"count",
"(",
"$",
"this",
"->",
"stash",
")",
";",
"while",
"(",
"$",
"fetch",
"--",
">",
"0",
")",
"{",
"$",
"this",
"->",
"stas... | Lookahead token 'n'.
@param integer $number number of tokens to predict
@return Object predicted token | [
"Lookahead",
"token",
"n",
"."
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Lexer.php#L137-L146 |
ronan-gloo/jade-php | src/Jade/Lexer.php | Lexer.scanEOS | protected function scanEOS()
{
if (!$this->length()) {
if (count($this->indentStack)) {
array_shift($this->indentStack);
return $this->token('outdent');
}
return $this->token('eos');
}
} | php | protected function scanEOS()
{
if (!$this->length()) {
if (count($this->indentStack)) {
array_shift($this->indentStack);
return $this->token('outdent');
}
return $this->token('eos');
}
} | [
"protected",
"function",
"scanEOS",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"length",
"(",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"indentStack",
")",
")",
"{",
"array_shift",
"(",
"$",
"this",
"->",
"indentStack",
")",... | Scan EOS from input & return it if found.
@return Object|null | [
"Scan",
"EOS",
"from",
"input",
"&",
"return",
"it",
"if",
"found",
"."
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Lexer.php#L196-L208 |
ronan-gloo/jade-php | src/Jade/Lexer.php | Lexer.scanComment | protected function scanComment()
{
if (preg_match('/^ *\/\/(-)?([^\n]*)/', $this->input, $matches)) {
$this->consume($matches[0]);
$token = $this->token('comment', isset($matches[2]) ? $matches[2] : '');
$token->buffer = '-' !== $matches[1];
return $t... | php | protected function scanComment()
{
if (preg_match('/^ *\/\/(-)?([^\n]*)/', $this->input, $matches)) {
$this->consume($matches[0]);
$token = $this->token('comment', isset($matches[2]) ? $matches[2] : '');
$token->buffer = '-' !== $matches[1];
return $t... | [
"protected",
"function",
"scanComment",
"(",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^ *\\/\\/(-)?([^\\n]*)/'",
",",
"$",
"this",
"->",
"input",
",",
"$",
"matches",
")",
")",
"{",
"$",
"this",
"->",
"consume",
"(",
"$",
"matches",
"[",
"0",
"]",
")... | Scan comment from input & return it if found.
@return Object|null | [
"Scan",
"comment",
"from",
"input",
"&",
"return",
"it",
"if",
"found",
"."
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Lexer.php#L233-L242 |
yosmanyga/validation | src/Yosmanyga/Validation/Validator/PropertyValidator.php | PropertyValidator.validate | public function validate($object, $property)
{
$this->validators = $this->fixValidators($this->validators);
$errors = [];
$value = $this->propertyAccessor->getValue($object, $property);
foreach ($this->validators as $validator) {
$validatorErrors = $validator->validate... | php | public function validate($object, $property)
{
$this->validators = $this->fixValidators($this->validators);
$errors = [];
$value = $this->propertyAccessor->getValue($object, $property);
foreach ($this->validators as $validator) {
$validatorErrors = $validator->validate... | [
"public",
"function",
"validate",
"(",
"$",
"object",
",",
"$",
"property",
")",
"{",
"$",
"this",
"->",
"validators",
"=",
"$",
"this",
"->",
"fixValidators",
"(",
"$",
"this",
"->",
"validators",
")",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/PropertyValidator.php#L33-L49 |
antarestupin/Accessible | lib/Accessible/Reader/ConstraintsReader.php | ConstraintsReader.isConstraintsValidationEnabled | public static function isConstraintsValidationEnabled($objectClasses, $annotationReader)
{
$enabled = Configuration::isConstraintsValidationEnabled();
foreach ($objectClasses as $class) {
if ($annotationReader->getClassAnnotation($class, self::$disableConstraintsValidationAnnotationClas... | php | public static function isConstraintsValidationEnabled($objectClasses, $annotationReader)
{
$enabled = Configuration::isConstraintsValidationEnabled();
foreach ($objectClasses as $class) {
if ($annotationReader->getClassAnnotation($class, self::$disableConstraintsValidationAnnotationClas... | [
"public",
"static",
"function",
"isConstraintsValidationEnabled",
"(",
"$",
"objectClasses",
",",
"$",
"annotationReader",
")",
"{",
"$",
"enabled",
"=",
"Configuration",
"::",
"isConstraintsValidationEnabled",
"(",
")",
";",
"foreach",
"(",
"$",
"objectClasses",
"a... | Indicates wether the constraints validation is enabled or not for the given object.
@param array $objectClasses The classes of the object to read.
@param \Doctrine\Common\Annotations\Reader $annotationReader The annotation reader to use.
@return boolean True if the validation is enabled, else false. | [
"Indicates",
"wether",
"the",
"constraints",
"validation",
"is",
"enabled",
"or",
"not",
"for",
"the",
"given",
"object",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/ConstraintsReader.php#L31-L47 |
antarestupin/Accessible | lib/Accessible/Reader/ConstraintsReader.php | ConstraintsReader.validatePropertyValue | public static function validatePropertyValue($object, $property, $value)
{
return Configuration::getConstraintsValidator()->validatePropertyValue($object, $property, $value);
} | php | public static function validatePropertyValue($object, $property, $value)
{
return Configuration::getConstraintsValidator()->validatePropertyValue($object, $property, $value);
} | [
"public",
"static",
"function",
"validatePropertyValue",
"(",
"$",
"object",
",",
"$",
"property",
",",
"$",
"value",
")",
"{",
"return",
"Configuration",
"::",
"getConstraintsValidator",
"(",
")",
"->",
"validatePropertyValue",
"(",
"$",
"object",
",",
"$",
"... | Validates the given value compared to given property constraints.
If the value is valid, a call to `count` to the object returned
by this method should give 0.
@param object $object The object to compare.
@param string $property The name of the reference property.
@param mixed $value The value to check.
@return... | [
"Validates",
"the",
"given",
"value",
"compared",
"to",
"given",
"property",
"constraints",
".",
"If",
"the",
"value",
"is",
"valid",
"a",
"call",
"to",
"count",
"to",
"the",
"object",
"returned",
"by",
"this",
"method",
"should",
"give",
"0",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/ConstraintsReader.php#L61-L64 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.onBeforeWrite | protected function onBeforeWrite() {
parent::onBeforeWrite();
// Changes in 2.4 mean that $this->Content can now become polluted with UTF-8 HTML entitised garbage
// we'll leave this legacy conversion in for now?
$this->Content = str_replace(' ', '', $this->Content);
$formatter = $this->getFormatter();
... | php | protected function onBeforeWrite() {
parent::onBeforeWrite();
// Changes in 2.4 mean that $this->Content can now become polluted with UTF-8 HTML entitised garbage
// we'll leave this legacy conversion in for now?
$this->Content = str_replace(' ', '', $this->Content);
$formatter = $this->getFormatter();
... | [
"protected",
"function",
"onBeforeWrite",
"(",
")",
"{",
"parent",
"::",
"onBeforeWrite",
"(",
")",
";",
"// Changes in 2.4 mean that $this->Content can now become polluted with UTF-8 HTML entitised garbage",
"// we'll leave this legacy conversion in for now?",
"$",
"this",
"->",
"... | Before writing, convert any page links to appropriate
new, non-published, pages
@see sapphire/core/model/SiteTree#onBeforeWrite() | [
"Before",
"writing",
"convert",
"any",
"page",
"links",
"to",
"appropriate",
"new",
"non",
"-",
"published",
"pages"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L84-L103 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.getCMSFields | public function getCMSFields() {
$fields = parent::getCMSFields();
$options = $this->getEditorTypeOptions();
$fields->addFieldToTab('Root.Behaviour', new OptionsetField('EditorType', _t('WikiPage.EDITORTYPE', 'Editor Type'), $options));
// if we're not using the HTML editor type, we should just use a textar... | php | public function getCMSFields() {
$fields = parent::getCMSFields();
$options = $this->getEditorTypeOptions();
$fields->addFieldToTab('Root.Behaviour', new OptionsetField('EditorType', _t('WikiPage.EDITORTYPE', 'Editor Type'), $options));
// if we're not using the HTML editor type, we should just use a textar... | [
"public",
"function",
"getCMSFields",
"(",
")",
"{",
"$",
"fields",
"=",
"parent",
"::",
"getCMSFields",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"getEditorTypeOptions",
"(",
")",
";",
"$",
"fields",
"->",
"addFieldToTab",
"(",
"'Root.Behavio... | Get the CMS fields
@see sapphire/core/model/SiteTree#getCMSFields() | [
"Get",
"the",
"CMS",
"fields"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L125-L138 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.getActualEditorType | public function getActualEditorType() {
if ($this->EditorType && $this->EditorType != 'Inherit') {
return $this->EditorType;
}
$parent = $this->getParent();
$editorType = 'Wiki';
while ($parent != null && $parent instanceof WikiPage) {
if ($parent->EditorType && $parent->EditorType != 'Inherit') {
... | php | public function getActualEditorType() {
if ($this->EditorType && $this->EditorType != 'Inherit') {
return $this->EditorType;
}
$parent = $this->getParent();
$editorType = 'Wiki';
while ($parent != null && $parent instanceof WikiPage) {
if ($parent->EditorType && $parent->EditorType != 'Inherit') {
... | [
"public",
"function",
"getActualEditorType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"EditorType",
"&&",
"$",
"this",
"->",
"EditorType",
"!=",
"'Inherit'",
")",
"{",
"return",
"$",
"this",
"->",
"EditorType",
";",
"}",
"$",
"parent",
"=",
"$",
"t... | Return the editor type to use for this item. Will interrogate
parents if needbe
@return String | [
"Return",
"the",
"editor",
"type",
"to",
"use",
"for",
"this",
"item",
".",
"Will",
"interrogate",
"parents",
"if",
"needbe"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L155-L170 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.getFormatter | public function getFormatter($formatter=null) {
if (!$formatter) {
$formatter = $this->getActualEditorType();
}
if (!isset(self::$registered_formatters[$formatter])) {
throw new Exception("Formatter $formatter does not exist");
}
return self::$registered_formatters[$formatter];
} | php | public function getFormatter($formatter=null) {
if (!$formatter) {
$formatter = $this->getActualEditorType();
}
if (!isset(self::$registered_formatters[$formatter])) {
throw new Exception("Formatter $formatter does not exist");
}
return self::$registered_formatters[$formatter];
} | [
"public",
"function",
"getFormatter",
"(",
"$",
"formatter",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"formatter",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getActualEditorType",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"self",... | Gets the formatter for a given type. If none specified, gets the current formatter
@return SimpleWikiFormatter | [
"Gets",
"the",
"formatter",
"for",
"a",
"given",
"type",
".",
"If",
"none",
"specified",
"gets",
"the",
"current",
"formatter"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L177-L187 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.ParsedContent | public function ParsedContent() {
$formatter = $this->getFormatter();
$content = $formatter->formatContent($this);
// purify the output - we don't want people breaking pages if we set purify=true
if (self::$purify_output) {
include_once SIMPLEWIKI_DIR . '/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurif... | php | public function ParsedContent() {
$formatter = $this->getFormatter();
$content = $formatter->formatContent($this);
// purify the output - we don't want people breaking pages if we set purify=true
if (self::$purify_output) {
include_once SIMPLEWIKI_DIR . '/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurif... | [
"public",
"function",
"ParsedContent",
"(",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"content",
"=",
"$",
"formatter",
"->",
"formatContent",
"(",
"$",
"this",
")",
";",
"// purify the output - we don't want peopl... | Retrieves the page's content, passed through any necessary parsing
eg Wiki based content
@return String | [
"Retrieves",
"the",
"page",
"s",
"content",
"passed",
"through",
"any",
"necessary",
"parsing",
"eg",
"Wiki",
"based",
"content"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L195-L208 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.getWikiRoot | public function getWikiRoot() {
$current = $this;
$parent = $current->Parent();
while ($parent instanceof WikiPage) {
$current = $parent;
$parent = $current->Parent();
}
return $current;
} | php | public function getWikiRoot() {
$current = $this;
$parent = $current->Parent();
while ($parent instanceof WikiPage) {
$current = $parent;
$parent = $current->Parent();
}
return $current;
} | [
"public",
"function",
"getWikiRoot",
"(",
")",
"{",
"$",
"current",
"=",
"$",
"this",
";",
"$",
"parent",
"=",
"$",
"current",
"->",
"Parent",
"(",
")",
";",
"while",
"(",
"$",
"parent",
"instanceof",
"WikiPage",
")",
"{",
"$",
"current",
"=",
"$",
... | Get the root of the wiki that this wiki page exists in
@return WikiPage | [
"Get",
"the",
"root",
"of",
"the",
"wiki",
"that",
"this",
"wiki",
"page",
"exists",
"in"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L225-L233 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.lock | public function lock($member = null) {
if (!$member) {
$member = Member::currentUser();
}
// set the updated lock expiry based on now + lock timeout
$this->WikiLastEditor = $member->Email;
$this->WikiLockExpiry = date('Y-m-d H:i:s', time() + $this->config()->get('lock_time'));
// save it with us as the... | php | public function lock($member = null) {
if (!$member) {
$member = Member::currentUser();
}
// set the updated lock expiry based on now + lock timeout
$this->WikiLastEditor = $member->Email;
$this->WikiLockExpiry = date('Y-m-d H:i:s', time() + $this->config()->get('lock_time'));
// save it with us as the... | [
"public",
"function",
"lock",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"member",
")",
"{",
"$",
"member",
"=",
"Member",
"::",
"currentUser",
"(",
")",
";",
"}",
"// set the updated lock expiry based on now + lock timeout",
"$",
"this"... | Lock the page for the current user
@param Member $member
The user to lock the page for | [
"Lock",
"the",
"page",
"for",
"the",
"current",
"user"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L241-L252 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.LinkPickerForm | public function LinkPickerForm()
{
$fields = FieldList::create(
new OptionsetField(
$name = "Type",
$title = "Link to a",
$source = array(
"page" => "Page on this site",
"file" => "File or image on this site",
"external" => "External URL"
),
$va... | php | public function LinkPickerForm()
{
$fields = FieldList::create(
new OptionsetField(
$name = "Type",
$title = "Link to a",
$source = array(
"page" => "Page on this site",
"file" => "File or image on this site",
"external" => "External URL"
),
$va... | [
"public",
"function",
"LinkPickerForm",
"(",
")",
"{",
"$",
"fields",
"=",
"FieldList",
"::",
"create",
"(",
"new",
"OptionsetField",
"(",
"$",
"name",
"=",
"\"Type\"",
",",
"$",
"title",
"=",
"\"Link to a\"",
",",
"$",
"source",
"=",
"array",
"(",
"\"pa... | /*
Form for the insert link dialog box | [
"/",
"*",
"Form",
"for",
"the",
"insert",
"link",
"dialog",
"box"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L258-L281 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage.ImagePickerForm | public function ImagePickerForm()
{
$fields = FieldList::create(
new OptionsetField(
$name = "Type",
$title = "Image source",
$source = array(
"new" => "Upload from your computer",
"existing" => "Existing image in the file system"
),
$value = "new"
),
... | php | public function ImagePickerForm()
{
$fields = FieldList::create(
new OptionsetField(
$name = "Type",
$title = "Image source",
$source = array(
"new" => "Upload from your computer",
"existing" => "Existing image in the file system"
),
$value = "new"
),
... | [
"public",
"function",
"ImagePickerForm",
"(",
")",
"{",
"$",
"fields",
"=",
"FieldList",
"::",
"create",
"(",
"new",
"OptionsetField",
"(",
"$",
"name",
"=",
"\"Type\"",
",",
"$",
"title",
"=",
"\"Image source\"",
",",
"$",
"source",
"=",
"array",
"(",
"... | /*
Form for the insert image dialog box | [
"/",
"*",
"Form",
"for",
"the",
"insert",
"image",
"dialog",
"box"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L287-L312 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.edit | public function edit() {
HtmlEditorField::include_js();
// Requirements::javascript('simplewiki/javascript/sslinks/editor_plugin_src.js');
$existing = $this->getEditingLocks($this->data(), true);
// oops, we've somehow got here even though we shouldn't have
if ($existing && $existing['user'] != Member::curren... | php | public function edit() {
HtmlEditorField::include_js();
// Requirements::javascript('simplewiki/javascript/sslinks/editor_plugin_src.js');
$existing = $this->getEditingLocks($this->data(), true);
// oops, we've somehow got here even though we shouldn't have
if ($existing && $existing['user'] != Member::curren... | [
"public",
"function",
"edit",
"(",
")",
"{",
"HtmlEditorField",
"::",
"include_js",
"(",
")",
";",
"//\t\tRequirements::javascript('simplewiki/javascript/sslinks/editor_plugin_src.js');",
"$",
"existing",
"=",
"$",
"this",
"->",
"getEditingLocks",
"(",
"$",
"this",
"->"... | Action handler for editing this wiki page
Creates a form that's used for editing the page's content,
as well as adding in a couple of additional toolbar actions
for adding a simple link and a simple image | [
"Action",
"handler",
"for",
"editing",
"this",
"wiki",
"page"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L387-L405 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.EditForm | public function EditForm() {
// make sure to load fresh from db
$record = DataObject::get_by_id('WikiPage', $this->data()->ID);
$formatter = $record->getFormatter();
$editorField = $formatter->getEditingField($record);
$helpLink = $formatter->getHelpUrl();
$fields = FieldList::create(
new LiteralFi... | php | public function EditForm() {
// make sure to load fresh from db
$record = DataObject::get_by_id('WikiPage', $this->data()->ID);
$formatter = $record->getFormatter();
$editorField = $formatter->getEditingField($record);
$helpLink = $formatter->getHelpUrl();
$fields = FieldList::create(
new LiteralFi... | [
"public",
"function",
"EditForm",
"(",
")",
"{",
"// make sure to load fresh from db",
"$",
"record",
"=",
"DataObject",
"::",
"get_by_id",
"(",
"'WikiPage'",
",",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"ID",
")",
";",
"$",
"formatter",
"=",
"$",
"reco... | Creates the form used for editing the page's content
@return Form | [
"Creates",
"the",
"form",
"used",
"for",
"editing",
"the",
"page",
"s",
"content"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L412-L462 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.CreatePageForm | public function CreatePageForm() {
$createOptions = array(
'child' => 'As a child of the selected page',
'sibling' => 'As a sibling of the selected page',
);
$pageTree = new TreeDropdownField('CreateContext', _t('WikiPage.CREATE_CONTEXT', 'Select an existing page'), 'WikiPage');
$pageTree->setValue($this... | php | public function CreatePageForm() {
$createOptions = array(
'child' => 'As a child of the selected page',
'sibling' => 'As a sibling of the selected page',
);
$pageTree = new TreeDropdownField('CreateContext', _t('WikiPage.CREATE_CONTEXT', 'Select an existing page'), 'WikiPage');
$pageTree->setValue($this... | [
"public",
"function",
"CreatePageForm",
"(",
")",
"{",
"$",
"createOptions",
"=",
"array",
"(",
"'child'",
"=>",
"'As a child of the selected page'",
",",
"'sibling'",
"=>",
"'As a sibling of the selected page'",
",",
")",
";",
"$",
"pageTree",
"=",
"new",
"TreeDrop... | Returns the form used to create new pages. If the current form is not set
(ie the user is NOT currently editing), then we just return null.
@return Form | [
"Returns",
"the",
"form",
"used",
"to",
"create",
"new",
"pages",
".",
"If",
"the",
"current",
"form",
"is",
"not",
"set",
"(",
"ie",
"the",
"user",
"is",
"NOT",
"currently",
"editing",
")",
"then",
"we",
"just",
"return",
"null",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L470-L488 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.revert | public function revert() {
if ($this->data()->IsModifiedOnStage) {
$this->data()->doRevertToLive();
}
return $this->redirect($this->data()->Link() . '?stage=Live');
} | php | public function revert() {
if ($this->data()->IsModifiedOnStage) {
$this->data()->doRevertToLive();
}
return $this->redirect($this->data()->Link() . '?stage=Live');
} | [
"public",
"function",
"revert",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"IsModifiedOnStage",
")",
"{",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"doRevertToLive",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"redir... | Option for the user to revert the changes made since it was last published | [
"Option",
"for",
"the",
"user",
"to",
"revert",
"the",
"changes",
"made",
"since",
"it",
"was",
"last",
"published"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L501-L506 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.delete | public function delete() {
$page = $this->data();
/* @var $page Page */
if ($page) {
$parent = $page->Parent();
$ID = $page->ID;
$page->deleteFromStage('Live');
// only fully delete if we're autopublishing stuff.. a bit counter
// intuitive, but works pretty well
if (WikiPage::$auto_publish) {... | php | public function delete() {
$page = $this->data();
/* @var $page Page */
if ($page) {
$parent = $page->Parent();
$ID = $page->ID;
$page->deleteFromStage('Live');
// only fully delete if we're autopublishing stuff.. a bit counter
// intuitive, but works pretty well
if (WikiPage::$auto_publish) {... | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"data",
"(",
")",
";",
"/* @var $page Page */",
"if",
"(",
"$",
"page",
")",
"{",
"$",
"parent",
"=",
"$",
"page",
"->",
"Parent",
"(",
")",
";",
"$",
"ID",
"=",
... | Deletes the current page and returns the user to the parent
of the now deleted page. | [
"Deletes",
"the",
"current",
"page",
"and",
"returns",
"the",
"user",
"to",
"the",
"parent",
"of",
"the",
"now",
"deleted",
"page",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L513-L534 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.addpage | public function addpage($args) {
if (!Permission::check(MANAGE_WIKI_PAGES)) {
return Security::permissionFailure($this);
}
$pageName = trim($args['NewPageName']);
$createType = $args['CreateType'] ? $args['CreateType'] : 'child';
if (!strlen($pageName)) {
throw new Exception("Invalid page name");
}
... | php | public function addpage($args) {
if (!Permission::check(MANAGE_WIKI_PAGES)) {
return Security::permissionFailure($this);
}
$pageName = trim($args['NewPageName']);
$createType = $args['CreateType'] ? $args['CreateType'] : 'child';
if (!strlen($pageName)) {
throw new Exception("Invalid page name");
}
... | [
"public",
"function",
"addpage",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"!",
"Permission",
"::",
"check",
"(",
"MANAGE_WIKI_PAGES",
")",
")",
"{",
"return",
"Security",
"::",
"permissionFailure",
"(",
"$",
"this",
")",
";",
"}",
"$",
"pageName",
"=",
"... | Creates an entirely new page as a child of the current page, or
'after' a selected page. | [
"Creates",
"an",
"entirely",
"new",
"page",
"as",
"a",
"child",
"of",
"the",
"current",
"page",
"or",
"after",
"a",
"selected",
"page",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L540-L586 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.save | public function save($data, $form) {
if (!$this->data()->canEdit()) {
return Security::permissionFailure($this);
}
$existing = $this->getEditingLocks($this->data(), true);
// oops, we've somehow got here even though we shouldn't have
if ($existing && $existing['user'] != Member::currentUser()->Email) {
... | php | public function save($data, $form) {
if (!$this->data()->canEdit()) {
return Security::permissionFailure($this);
}
$existing = $this->getEditingLocks($this->data(), true);
// oops, we've somehow got here even though we shouldn't have
if ($existing && $existing['user'] != Member::currentUser()->Email) {
... | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"canEdit",
"(",
")",
")",
"{",
"return",
"Security",
"::",
"permissionFailure",
"(",
"$",
"this",
")",
";",
"}"... | Save the submitted data
@return | [
"Save",
"the",
"submitted",
"data"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L608-L626 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.done | public function done($data, $form) {
if (!$this->data()->canEdit()) {
return Security::permissionFailure($this);
}
// save stuff then reuse the edit action
$this->savePage($this->data(), $form);
return $this->redirect($this->data()->Link() . '?stage=Stage');
} | php | public function done($data, $form) {
if (!$this->data()->canEdit()) {
return Security::permissionFailure($this);
}
// save stuff then reuse the edit action
$this->savePage($this->data(), $form);
return $this->redirect($this->data()->Link() . '?stage=Stage');
} | [
"public",
"function",
"done",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"canEdit",
"(",
")",
")",
"{",
"return",
"Security",
"::",
"permissionFailure",
"(",
"$",
"this",
")",
";",
"}"... | Complete editing and publish the data
@param mixed $data
@param Form $form | [
"Complete",
"editing",
"and",
"publish",
"the",
"data"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L634-L642 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.publish | public function publish($data, $form) {
if (!$this->data()->canEdit()) {
return Security::permissionFailure($this);
}
// save stuff then reuse the edit action
$this->savePage($this->data(), $form);
$this->data()->doPublish();
// Make sure we're on the live content now
Versioned::reading_stage('Live');... | php | public function publish($data, $form) {
if (!$this->data()->canEdit()) {
return Security::permissionFailure($this);
}
// save stuff then reuse the edit action
$this->savePage($this->data(), $form);
$this->data()->doPublish();
// Make sure we're on the live content now
Versioned::reading_stage('Live');... | [
"public",
"function",
"publish",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"canEdit",
"(",
")",
")",
"{",
"return",
"Security",
"::",
"permissionFailure",
"(",
"$",
"this",
")",
";",
... | Complete editing and publish the data
@param mixed $data
@param Form $form | [
"Complete",
"editing",
"and",
"publish",
"the",
"data"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L650-L663 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.Form | public function Form() {
// The editing form hasn't been put in place by the 'edit' action
// so lets just show the status form
$append = '';
if (!$this->form) {
if (WikiPage::$show_edit_button || $this->data()->canEdit()) {
// create the information form
$this->form = $this->StatusForm();
}
} ... | php | public function Form() {
// The editing form hasn't been put in place by the 'edit' action
// so lets just show the status form
$append = '';
if (!$this->form) {
if (WikiPage::$show_edit_button || $this->data()->canEdit()) {
// create the information form
$this->form = $this->StatusForm();
}
} ... | [
"public",
"function",
"Form",
"(",
")",
"{",
"// The editing form hasn't been put in place by the 'edit' action",
"// so lets just show the status form",
"$",
"append",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"form",
")",
"{",
"if",
"(",
"WikiPage",
"::",... | Return the form to the user if it exists, otherwise some information
about who is currently editing
@return Form | [
"Return",
"the",
"form",
"to",
"the",
"user",
"if",
"it",
"exists",
"otherwise",
"some",
"information",
"about",
"who",
"is",
"currently",
"editing"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L685-L703 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.StatusForm | public function StatusForm() {
$existing = $this->getEditingLocks($this->data());
if ($existing && $existing['user'] != Member::currentUser()->Email) {
$fields = FieldList::create(
new ReadonlyField('ExistingEditor', '', _t('WikiPage.EXISTINGEDITOR', 'This page is currently locked for editing by ' . $exi... | php | public function StatusForm() {
$existing = $this->getEditingLocks($this->data());
if ($existing && $existing['user'] != Member::currentUser()->Email) {
$fields = FieldList::create(
new ReadonlyField('ExistingEditor', '', _t('WikiPage.EXISTINGEDITOR', 'This page is currently locked for editing by ' . $exi... | [
"public",
"function",
"StatusForm",
"(",
")",
"{",
"$",
"existing",
"=",
"$",
"this",
"->",
"getEditingLocks",
"(",
"$",
"this",
"->",
"data",
"(",
")",
")",
";",
"if",
"(",
"$",
"existing",
"&&",
"$",
"existing",
"[",
"'user'",
"]",
"!=",
"Member",
... | Gets the status form that is used by users to trigger the editing mode
if they have the relevant access to it.
@return Form | [
"Gets",
"the",
"status",
"form",
"that",
"is",
"used",
"by",
"users",
"to",
"trigger",
"the",
"editing",
"mode",
"if",
"they",
"have",
"the",
"relevant",
"access",
"to",
"it",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L711-L727 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.updatelock | public function updatelock($data) {
if ($this->data()->ID && $this->data()->canEdit()) {
$lock = $this->getEditingLocks($this->data(), true);
$response = new stdClass();
$response->status = 1;
if ($lock != null && $lock['user'] != Member::currentUser()->Email) {
// someone else has stolen it !
$re... | php | public function updatelock($data) {
if ($this->data()->ID && $this->data()->canEdit()) {
$lock = $this->getEditingLocks($this->data(), true);
$response = new stdClass();
$response->status = 1;
if ($lock != null && $lock['user'] != Member::currentUser()->Email) {
// someone else has stolen it !
$re... | [
"public",
"function",
"updatelock",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"ID",
"&&",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"canEdit",
"(",
")",
")",
"{",
"$",
"lock",
"=",
"$",
"this",
"->",
"... | Updates the lock timeout for the given object
@param <type> $data | [
"Updates",
"the",
"lock",
"timeout",
"for",
"the",
"given",
"object"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L734-L746 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.getEditingLocks | protected function getEditingLocks($page, $doLock=false) {
$currentStage = Versioned::current_stage();
Versioned::reading_stage('Stage');
$filter = array(
'WikiPage.ID' => $page->ID,
'WikiLockExpiry' => date('Y-m-d H:i:s'),
);
$user = Member::currentUser();
$currentLock = WikiPage::get()->filter($f... | php | protected function getEditingLocks($page, $doLock=false) {
$currentStage = Versioned::current_stage();
Versioned::reading_stage('Stage');
$filter = array(
'WikiPage.ID' => $page->ID,
'WikiLockExpiry' => date('Y-m-d H:i:s'),
);
$user = Member::currentUser();
$currentLock = WikiPage::get()->filter($f... | [
"protected",
"function",
"getEditingLocks",
"(",
"$",
"page",
",",
"$",
"doLock",
"=",
"false",
")",
"{",
"$",
"currentStage",
"=",
"Versioned",
"::",
"current_stage",
"(",
")",
";",
"Versioned",
"::",
"reading_stage",
"(",
"'Stage'",
")",
";",
"$",
"filte... | Lock the page for editing
@param SiteTree $page
The page being edited
@param boolean $doLock
Whether to actually lock the page for ourselves
@return array
The names of any existing editors | [
"Lock",
"the",
"page",
"for",
"editing"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L758-L790 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.objectdetails | public function objectdetails() {
$response = new stdClass;
if (isset($_GET['ID'])) {
$type = null;
if (isset($_GET['type'])) {
$type = $_GET['type'] == 'href' ? 'SiteTree' : 'File';
} else {
$type = 'SiteTree';
}
$object = DataObject::get_by_id($type, $_GET['ID']);
$response->Title = $o... | php | public function objectdetails() {
$response = new stdClass;
if (isset($_GET['ID'])) {
$type = null;
if (isset($_GET['type'])) {
$type = $_GET['type'] == 'href' ? 'SiteTree' : 'File';
} else {
$type = 'SiteTree';
}
$object = DataObject::get_by_id($type, $_GET['ID']);
$response->Title = $o... | [
"public",
"function",
"objectdetails",
"(",
")",
"{",
"$",
"response",
"=",
"new",
"stdClass",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"'ID'",
"]",
")",
")",
"{",
"$",
"type",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
... | Retrieves information about a selected image for the frontend
image insertion tool - hacky for now, ideally need to pull through the
backend ImageForm
@return string | [
"Retrieves",
"information",
"about",
"a",
"selected",
"image",
"for",
"the",
"frontend",
"image",
"insertion",
"tool",
"-",
"hacky",
"for",
"now",
"ideally",
"need",
"to",
"pull",
"through",
"the",
"backend",
"ImageForm"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L843-L871 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.livepreview | public function livepreview(){
$content = $_POST['content'];
if($formatter = $this->data()->getFormatter()){
$content = $formatter->formatRaw($content);
}
return $content;
} | php | public function livepreview(){
$content = $_POST['content'];
if($formatter = $this->data()->getFormatter()){
$content = $formatter->formatRaw($content);
}
return $content;
} | [
"public",
"function",
"livepreview",
"(",
")",
"{",
"$",
"content",
"=",
"$",
"_POST",
"[",
"'content'",
"]",
";",
"if",
"(",
"$",
"formatter",
"=",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"getFormatter",
"(",
")",
")",
"{",
"$",
"content",
"=",... | /*
returns a formatted version of the users content field for preview | [
"/",
"*",
"returns",
"a",
"formatted",
"version",
"of",
"the",
"users",
"content",
"field",
"for",
"preview"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L877-L883 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.linklist | public function linklist(){
$term = trim(Convert::raw2sql($this->request->getVar('term')));
$type = Convert::raw2sql($this->request->getVar('type'));
if($type == 'file' || $type == 'image'){
$filter ="Title LIKE '%$term%'";
if($type == 'image'){
$filter .= " AND ClassName = 'Image'";
}
if($fi... | php | public function linklist(){
$term = trim(Convert::raw2sql($this->request->getVar('term')));
$type = Convert::raw2sql($this->request->getVar('type'));
if($type == 'file' || $type == 'image'){
$filter ="Title LIKE '%$term%'";
if($type == 'image'){
$filter .= " AND ClassName = 'Image'";
}
if($fi... | [
"public",
"function",
"linklist",
"(",
")",
"{",
"$",
"term",
"=",
"trim",
"(",
"Convert",
"::",
"raw2sql",
"(",
"$",
"this",
"->",
"request",
"->",
"getVar",
"(",
"'term'",
")",
")",
")",
";",
"$",
"type",
"=",
"Convert",
"::",
"raw2sql",
"(",
"$"... | /*
gets a list of files or pages for the dialogs autocomplete field | [
"/",
"*",
"gets",
"a",
"list",
"of",
"files",
"or",
"pages",
"for",
"the",
"dialogs",
"autocomplete",
"field"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L905-L953 |
nyeholt/silverstripe-simplewiki | code/pages/WikiPage.php | WikiPage_Controller.imageupload | public function imageupload(){
if (!Member::currentUserID()) {
$return = array(
'error' => 1,
'text' => "Cannot upload there"
);
return Convert::raw2json($return);
}
if(isset($_FILES['NewImage']) && $tempfile = $_FILES['NewImage']){
// validate //
$allowed = array('jpg', 'jpeg', 'gif', ... | php | public function imageupload(){
if (!Member::currentUserID()) {
$return = array(
'error' => 1,
'text' => "Cannot upload there"
);
return Convert::raw2json($return);
}
if(isset($_FILES['NewImage']) && $tempfile = $_FILES['NewImage']){
// validate //
$allowed = array('jpg', 'jpeg', 'gif', ... | [
"public",
"function",
"imageupload",
"(",
")",
"{",
"if",
"(",
"!",
"Member",
"::",
"currentUserID",
"(",
")",
")",
"{",
"$",
"return",
"=",
"array",
"(",
"'error'",
"=>",
"1",
",",
"'text'",
"=>",
"\"Cannot upload there\"",
")",
";",
"return",
"Convert"... | /*
handles the upload of an image via ajax in the insert image dialog | [
"/",
"*",
"handles",
"the",
"upload",
"of",
"an",
"image",
"via",
"ajax",
"in",
"the",
"insert",
"image",
"dialog"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/pages/WikiPage.php#L958-L1007 |
ionutmilica/laravel-settings | database/migrations/9999_12_20_142530_CreateSettingsTable.php | CreateSettingsTable.up | public function up()
{
Schema::create($this->getTableName(), function (Blueprint $table) {
$table->string('id', 191);
$table->text('value')->nullable();
});
} | php | public function up()
{
Schema::create($this->getTableName(), function (Blueprint $table) {
$table->string('id', 191);
$table->text('value')->nullable();
});
} | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"$",
"this",
"->",
"getTableName",
"(",
")",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"string",
"(",
"'id'",
",",
"191",
")",
";",
"$",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/database/migrations/9999_12_20_142530_CreateSettingsTable.php#L14-L20 |
itrnka/ha-framework | src/ha/Component/Password/PasswordDefault.php | PasswordDefault.setValue | public function setValue(string $rawValue) : void
{
if (strlen($rawValue) < 8) {
throw new PasswordPolicyException('Password is too short@' . __METHOD__);
}
$this->rawValue = $rawValue;
} | php | public function setValue(string $rawValue) : void
{
if (strlen($rawValue) < 8) {
throw new PasswordPolicyException('Password is too short@' . __METHOD__);
}
$this->rawValue = $rawValue;
} | [
"public",
"function",
"setValue",
"(",
"string",
"$",
"rawValue",
")",
":",
"void",
"{",
"if",
"(",
"strlen",
"(",
"$",
"rawValue",
")",
"<",
"8",
")",
"{",
"throw",
"new",
"PasswordPolicyException",
"(",
"'Password is too short@'",
".",
"__METHOD__",
")",
... | Set password value.
@param string $rawValue
@throws PasswordPolicyException | [
"Set",
"password",
"value",
"."
] | train | https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Component/Password/PasswordDefault.php#L34-L40 |
itrnka/ha-framework | src/ha/Component/Password/PasswordDefault.php | PasswordDefault.getHash | public function getHash(int $cost = null, string $salt = null) : string
{
if (is_null($cost)) $cost = 10;
if (is_null($this->rawValue)) {
throw new PasswordEmptyException('Password value not found@' . __METHOD__);
}
$hash = password_hash($this->rawValue, PASSWORD_DEFAULT,... | php | public function getHash(int $cost = null, string $salt = null) : string
{
if (is_null($cost)) $cost = 10;
if (is_null($this->rawValue)) {
throw new PasswordEmptyException('Password value not found@' . __METHOD__);
}
$hash = password_hash($this->rawValue, PASSWORD_DEFAULT,... | [
"public",
"function",
"getHash",
"(",
"int",
"$",
"cost",
"=",
"null",
",",
"string",
"$",
"salt",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"is_null",
"(",
"$",
"cost",
")",
")",
"$",
"cost",
"=",
"10",
";",
"if",
"(",
"is_null",
"(",
"... | Get hashed version (this version can be stored in DB).
@param int $cost
@param string|null $salt
@return string
@throws PasswordEmptyException
@throws PasswordHashException | [
"Get",
"hashed",
"version",
"(",
"this",
"version",
"can",
"be",
"stored",
"in",
"DB",
")",
"."
] | train | https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Component/Password/PasswordDefault.php#L52-L63 |
itrnka/ha-framework | src/ha/Component/Password/PasswordDefault.php | PasswordDefault.verify | public function verify(string $hash) : bool
{
if (is_null($this->rawValue)) {
return false;
}
return password_verify($this->rawValue, $hash);
} | php | public function verify(string $hash) : bool
{
if (is_null($this->rawValue)) {
return false;
}
return password_verify($this->rawValue, $hash);
} | [
"public",
"function",
"verify",
"(",
"string",
"$",
"hash",
")",
":",
"bool",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"rawValue",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"password_verify",
"(",
"$",
"this",
"->",
"rawValue",
... | Verify password hash
@param string $hash
@return bool | [
"Verify",
"password",
"hash"
] | train | https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Component/Password/PasswordDefault.php#L72-L78 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.matches | public function matches(Request $request, $includingMethod = true)
{
// Create compiled route
$this->compileRoute();
foreach ($this->getValidators() as $validator) {
// Check for method validator explicitly
if (!$includingMethod && $validator instanceof MethodValidat... | php | public function matches(Request $request, $includingMethod = true)
{
// Create compiled route
$this->compileRoute();
foreach ($this->getValidators() as $validator) {
// Check for method validator explicitly
if (!$includingMethod && $validator instanceof MethodValidat... | [
"public",
"function",
"matches",
"(",
"Request",
"$",
"request",
",",
"$",
"includingMethod",
"=",
"true",
")",
"{",
"// Create compiled route",
"$",
"this",
"->",
"compileRoute",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getValidators",
"(",
")",
... | Determine if the route matches given request.
@param Request $request
@param bool $includingMethod
@return bool
@throws LogicException | [
"Determine",
"if",
"the",
"route",
"matches",
"given",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L121-L140 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.replaceDefaults | protected function replaceDefaults(array $parameters)
{
foreach ($parameters as $key => &$value) {
$value = isset($value) ? $value : ArrayHelper::get($this->defaults, $key);
}
foreach ($this->defaults as $key => $value) {
if (!isset($parameters[$key])) {
... | php | protected function replaceDefaults(array $parameters)
{
foreach ($parameters as $key => &$value) {
$value = isset($value) ? $value : ArrayHelper::get($this->defaults, $key);
}
foreach ($this->defaults as $key => $value) {
if (!isset($parameters[$key])) {
... | [
"protected",
"function",
"replaceDefaults",
"(",
"array",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"isset",
"(",
"$",
"value",
")",
"?",
"$",
"value",
":",... | Replace null parameters with their defaults.
@param array $parameters
@return array | [
"Replace",
"null",
"parameters",
"with",
"their",
"defaults",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L243-L255 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.getParameterNames | public function getParameterNames()
{
if (isset($this->parameterNames)) {
return $this->parameterNames;
}
return $this->parameterNames = $this->compileParameterNames();
} | php | public function getParameterNames()
{
if (isset($this->parameterNames)) {
return $this->parameterNames;
}
return $this->parameterNames = $this->compileParameterNames();
} | [
"public",
"function",
"getParameterNames",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"parameterNames",
")",
")",
"{",
"return",
"$",
"this",
"->",
"parameterNames",
";",
"}",
"return",
"$",
"this",
"->",
"parameterNames",
"=",
"$",
"this... | Get all of the parameter names for the route.
@return array | [
"Get",
"all",
"of",
"the",
"parameter",
"names",
"for",
"the",
"route",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L262-L269 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.getParameter | public function getParameter($name, $default = null)
{
try {
return ArrayHelper::get($this->getParameters(), $name, $default);
} catch (Exception $ex) {
return $default;
}
} | php | public function getParameter($name, $default = null)
{
try {
return ArrayHelper::get($this->getParameters(), $name, $default);
} catch (Exception $ex) {
return $default;
}
} | [
"public",
"function",
"getParameter",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"try",
"{",
"return",
"ArrayHelper",
"::",
"get",
"(",
"$",
"this",
"->",
"getParameters",
"(",
")",
",",
"$",
"name",
",",
"$",
"default",
")",
";",
... | Get a given parameter from the route.
@param string $name
@param mixed $default
@return string|object | [
"Get",
"a",
"given",
"parameter",
"from",
"the",
"route",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L293-L300 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.compileRoute | protected function compileRoute()
{
$uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->uri);
$this->compiled = (new SymfonyRoute($uri, $optionals = [], $requirements = [], [], $domain = ''))->compile();
} | php | protected function compileRoute()
{
$uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->uri);
$this->compiled = (new SymfonyRoute($uri, $optionals = [], $requirements = [], [], $domain = ''))->compile();
} | [
"protected",
"function",
"compileRoute",
"(",
")",
"{",
"$",
"uri",
"=",
"preg_replace",
"(",
"'/\\{(\\w+?)\\?\\}/'",
",",
"'{$1}'",
",",
"$",
"this",
"->",
"uri",
")",
";",
"$",
"this",
"->",
"compiled",
"=",
"(",
"new",
"SymfonyRoute",
"(",
"$",
"uri",... | Compile the current route.
@throws LogicException | [
"Compile",
"the",
"current",
"route",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L377-L382 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.run | public function run(Request $request)
{
$this->container = $this->container ?: Application::getInstance();
$this->container->set(Request::class, $request);
// Check and run controller
if ($this->isControllerAction()) {
return $this->runController();
}
re... | php | public function run(Request $request)
{
$this->container = $this->container ?: Application::getInstance();
$this->container->set(Request::class, $request);
// Check and run controller
if ($this->isControllerAction()) {
return $this->runController();
}
re... | [
"public",
"function",
"run",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"container",
"=",
"$",
"this",
"->",
"container",
"?",
":",
"Application",
"::",
"getInstance",
"(",
")",
";",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
... | Run the route action and return the response.
@param Request $request
@return mixed
@throws LogicException
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \InvalidArgumentException | [
"Run",
"the",
"route",
"action",
"and",
"return",
"the",
"response",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L414-L425 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.runCallable | protected function runCallable()
{
$parameters = $this->resolveMethodDependencies(
$this->getParametersWithoutNulls(), new ReflectionFunction($this->action['uses'])
);
$callable = $this->action['uses'];
return call_user_func_array($callable, $parameters);
} | php | protected function runCallable()
{
$parameters = $this->resolveMethodDependencies(
$this->getParametersWithoutNulls(), new ReflectionFunction($this->action['uses'])
);
$callable = $this->action['uses'];
return call_user_func_array($callable, $parameters);
} | [
"protected",
"function",
"runCallable",
"(",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"resolveMethodDependencies",
"(",
"$",
"this",
"->",
"getParametersWithoutNulls",
"(",
")",
",",
"new",
"ReflectionFunction",
"(",
"$",
"this",
"->",
"action",
"[... | Run the route action as callable and return the response.
@return mixed
@throws LogicException | [
"Run",
"the",
"route",
"action",
"as",
"callable",
"and",
"return",
"the",
"response",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L443-L452 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.getController | protected function getController()
{
list($class) = explode('@', $this->action['uses']);
if (!$this->controller) {
$this->controller = $this->container->make($class);
}
return $this->controller;
} | php | protected function getController()
{
list($class) = explode('@', $this->action['uses']);
if (!$this->controller) {
$this->controller = $this->container->make($class);
}
return $this->controller;
} | [
"protected",
"function",
"getController",
"(",
")",
"{",
"list",
"(",
"$",
"class",
")",
"=",
"explode",
"(",
"'@'",
",",
"$",
"this",
"->",
"action",
"[",
"'uses'",
"]",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"controller",
")",
"{",
"$",
"... | Get the controller instance for the route.
@return mixed
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \InvalidArgumentException | [
"Get",
"the",
"controller",
"instance",
"for",
"the",
"route",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L478-L486 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.parseAction | protected function parseAction($action)
{
// No action has been set for this route
if (is_null($action)) {
return ['uses' => function () {
throw new LogicException("Route for [{$this->uri}] has no action.");
}];
}
// The action is a normal Clo... | php | protected function parseAction($action)
{
// No action has been set for this route
if (is_null($action)) {
return ['uses' => function () {
throw new LogicException("Route for [{$this->uri}] has no action.");
}];
}
// The action is a normal Clo... | [
"protected",
"function",
"parseAction",
"(",
"$",
"action",
")",
"{",
"// No action has been set for this route",
"if",
"(",
"is_null",
"(",
"$",
"action",
")",
")",
"{",
"return",
"[",
"'uses'",
"=>",
"function",
"(",
")",
"{",
"throw",
"new",
"LogicException... | Parse the route action into a standard array.
@param callable|array|null $action
@throws UnexpectedValueException
@return array | [
"Parse",
"the",
"route",
"action",
"into",
"a",
"standard",
"array",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L507-L532 |
PandaPlatform/framework | src/Panda/Routing/Route.php | Route.findCallable | protected function findCallable(array $action)
{
return ArrayHelper::filter($action, function ($key, $value) {
return is_callable($value) && is_numeric($key);
});
} | php | protected function findCallable(array $action)
{
return ArrayHelper::filter($action, function ($key, $value) {
return is_callable($value) && is_numeric($key);
});
} | [
"protected",
"function",
"findCallable",
"(",
"array",
"$",
"action",
")",
"{",
"return",
"ArrayHelper",
"::",
"filter",
"(",
"$",
"action",
",",
"function",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"is_callable",
"(",
"$",
"value",
")",
... | Find the callable in an action array.
@param array $action
@return callable | [
"Find",
"the",
"callable",
"in",
"an",
"action",
"array",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Route.php#L541-L546 |
o2system/parser | src/Template/Collection.php | Collection.load | public function load($engine, array $config = [])
{
if (class_exists($adapter = '\O2System\Parser\Template\Adapters\\' . $engine)) {
$this->register((new $adapter())->setConfig($config), $adapter);
return $this->__isset($adapter);
}
return false;
} | php | public function load($engine, array $config = [])
{
if (class_exists($adapter = '\O2System\Parser\Template\Adapters\\' . $engine)) {
$this->register((new $adapter())->setConfig($config), $adapter);
return $this->__isset($adapter);
}
return false;
} | [
"public",
"function",
"load",
"(",
"$",
"engine",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"adapter",
"=",
"'\\O2System\\Parser\\Template\\Adapters\\\\'",
".",
"$",
"engine",
")",
")",
"{",
"$",
"this",
"... | Collection::load
@param string $engine
@param array $config
@return bool | [
"Collection",
"::",
"load"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Collection.php#L74-L84 |
o2system/parser | src/Template/Collection.php | Collection.parse | public function parse($string, array $vars = [])
{
$output = $string;
if(is_file($string)) {
$output = file_get_contents($string);
}
if($this->count()) {
foreach($this->registry as $adapter) {
if($adapter instanceof Abstracts\AbstractAdapter)... | php | public function parse($string, array $vars = [])
{
$output = $string;
if(is_file($string)) {
$output = file_get_contents($string);
}
if($this->count()) {
foreach($this->registry as $adapter) {
if($adapter instanceof Abstracts\AbstractAdapter)... | [
"public",
"function",
"parse",
"(",
"$",
"string",
",",
"array",
"$",
"vars",
"=",
"[",
"]",
")",
"{",
"$",
"output",
"=",
"$",
"string",
";",
"if",
"(",
"is_file",
"(",
"$",
"string",
")",
")",
"{",
"$",
"output",
"=",
"file_get_contents",
"(",
... | Collection::parse
@param string $string
@param array $vars
@return string | [
"Collection",
"::",
"parse"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Collection.php#L96-L117 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.getBatchSerial | public function getBatchSerial($namespace) {
if (empty($this->serials[$namespace])) {
$batch = $this->getBatch($namespace);
unset($batch['DefinitionRev']);
$this->serials[$namespace] = md5(serialize($batch));
}
return $this->serials[$namespace];
} | php | public function getBatchSerial($namespace) {
if (empty($this->serials[$namespace])) {
$batch = $this->getBatch($namespace);
unset($batch['DefinitionRev']);
$this->serials[$namespace] = md5(serialize($batch));
}
return $this->serials[$namespace];
} | [
"public",
"function",
"getBatchSerial",
"(",
"$",
"namespace",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"serials",
"[",
"$",
"namespace",
"]",
")",
")",
"{",
"$",
"batch",
"=",
"$",
"this",
"->",
"getBatch",
"(",
"$",
"namespace",
")",
... | Returns a md5 signature of a segment of the configuration object
that uniquely identifies that particular configuration
@note Revision is handled specially and is removed from the batch
before processing!
@param $namespace Namespace to get serial for | [
"Returns",
"a",
"md5",
"signature",
"of",
"a",
"segment",
"of",
"the",
"configuration",
"object",
"that",
"uniquely",
"identifies",
"that",
"particular",
"configuration"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L197-L204 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.getSerial | public function getSerial() {
if (empty($this->serial)) {
$this->serial = md5(serialize($this->getAll()));
}
return $this->serial;
} | php | public function getSerial() {
if (empty($this->serial)) {
$this->serial = md5(serialize($this->getAll()));
}
return $this->serial;
} | [
"public",
"function",
"getSerial",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"serial",
")",
")",
"{",
"$",
"this",
"->",
"serial",
"=",
"md5",
"(",
"serialize",
"(",
"$",
"this",
"->",
"getAll",
"(",
")",
")",
")",
";",
"}",
"r... | Returns a md5 signature for the entire configuration object
that uniquely identifies that particular configuration | [
"Returns",
"a",
"md5",
"signature",
"for",
"the",
"entire",
"configuration",
"object",
"that",
"uniquely",
"identifies",
"that",
"particular",
"configuration"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L210-L215 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.getAll | public function getAll() {
if (!$this->finalized) $this->autoFinalize();
$ret = array();
foreach ($this->plist->squash() as $name => $value) {
list($ns, $key) = explode('.', $name, 2);
$ret[$ns][$key] = $value;
}
return $ret;
} | php | public function getAll() {
if (!$this->finalized) $this->autoFinalize();
$ret = array();
foreach ($this->plist->squash() as $name => $value) {
list($ns, $key) = explode('.', $name, 2);
$ret[$ns][$key] = $value;
}
return $ret;
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"finalized",
")",
"$",
"this",
"->",
"autoFinalize",
"(",
")",
";",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"plist",
"->",
"squa... | Retrieves all directives, organized by namespace
@warning This is a pretty inefficient function, avoid if you can | [
"Retrieves",
"all",
"directives",
"organized",
"by",
"namespace"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L221-L229 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.getDefinition | public function getDefinition($type, $raw = false) {
if (!$this->finalized) $this->autoFinalize();
// temporarily suspend locks, so we can handle recursive definition calls
$lock = $this->lock;
$this->lock = null;
$factory = HTMLPurifier_DefinitionCacheFactory::instance();
... | php | public function getDefinition($type, $raw = false) {
if (!$this->finalized) $this->autoFinalize();
// temporarily suspend locks, so we can handle recursive definition calls
$lock = $this->lock;
$this->lock = null;
$factory = HTMLPurifier_DefinitionCacheFactory::instance();
... | [
"public",
"function",
"getDefinition",
"(",
"$",
"type",
",",
"$",
"raw",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"finalized",
")",
"$",
"this",
"->",
"autoFinalize",
"(",
")",
";",
"// temporarily suspend locks, so we can handle recursive d... | Retrieves a definition
@param $type Type of definition: HTML, CSS, etc
@param $raw Whether or not definition should be returned raw | [
"Retrieves",
"a",
"definition"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L340-L395 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.