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 |
|---|---|---|---|---|---|---|---|---|---|---|
webforge-labs/psc-cms | lib/Psc/URL/RequestBundle.php | RequestBundle.createRequest | public function createRequest($url, File $cookieJar = NULL) {
$loaded = FALSE;
$request = $this->requestsCache->load(array($url), $loaded);
if (!$loaded) {
$request = new Request($url, $cookieJar);
$request->getManager()->bind($this, Request::EVENT_PROCESSED); // stored dann wenn process() ... | php | public function createRequest($url, File $cookieJar = NULL) {
$loaded = FALSE;
$request = $this->requestsCache->load(array($url), $loaded);
if (!$loaded) {
$request = new Request($url, $cookieJar);
$request->getManager()->bind($this, Request::EVENT_PROCESSED); // stored dann wenn process() ... | [
"public",
"function",
"createRequest",
"(",
"$",
"url",
",",
"File",
"$",
"cookieJar",
"=",
"NULL",
")",
"{",
"$",
"loaded",
"=",
"FALSE",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"requestsCache",
"->",
"load",
"(",
"array",
"(",
"$",
"url",
")",... | Gibt entweder einen gecachten oder einen echten Request zurück | [
"Gibt",
"entweder",
"einen",
"gecachten",
"oder",
"einen",
"echten",
"Request",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/URL/RequestBundle.php#L44-L54 |
webforge-labs/psc-cms | lib/Psc/URL/RequestBundle.php | RequestBundle.trigger | public function trigger(Event $event) {
$request = $event->getTarget();
$cachedRequest = new CachedRequest($request->getURL());
$cachedRequest->setCachedResponse($event->getData()->response);
$cachedRequest->setHeaders($event->getData()->headers);
$this->addCachedRequest($cachedRequest);
... | php | public function trigger(Event $event) {
$request = $event->getTarget();
$cachedRequest = new CachedRequest($request->getURL());
$cachedRequest->setCachedResponse($event->getData()->response);
$cachedRequest->setHeaders($event->getData()->headers);
$this->addCachedRequest($cachedRequest);
... | [
"public",
"function",
"trigger",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getTarget",
"(",
")",
";",
"$",
"cachedRequest",
"=",
"new",
"CachedRequest",
"(",
"$",
"request",
"->",
"getURL",
"(",
")",
")",
";",
"$... | Bei processed fügt das bundle den Request alse Cache-Request hinzu | [
"Bei",
"processed",
"fügt",
"das",
"bundle",
"den",
"Request",
"alse",
"Cache",
"-",
"Request",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/URL/RequestBundle.php#L60-L68 |
yuncms/framework | src/widgets/BootstrapTypeAhead.php | BootstrapTypeAhead.registerClientScript | protected function registerClientScript()
{
$view = $this->getView();
BootstrapTypeAheadAsset::register($view);
$id = $this->options['id'];
$options = $this->clientOptions !== false && !empty($this->clientOptions) ? Json::encode($this->clientOptions) : 'null';
foreach($th... | php | protected function registerClientScript()
{
$view = $this->getView();
BootstrapTypeAheadAsset::register($view);
$id = $this->options['id'];
$options = $this->clientOptions !== false && !empty($this->clientOptions) ? Json::encode($this->clientOptions) : 'null';
foreach($th... | [
"protected",
"function",
"registerClientScript",
"(",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"BootstrapTypeAheadAsset",
"::",
"register",
"(",
"$",
"view",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"options",
"[",
"... | Registers Twitter TypeAhead Bootstrap plugin and the related events | [
"Registers",
"Twitter",
"TypeAhead",
"Bootstrap",
"plugin",
"and",
"the",
"related",
"events"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/widgets/BootstrapTypeAhead.php#L80-L109 |
magnus-eriksson/entity | src/Entity.php | Entity.setParam | protected function setParam($key, $value)
{
if (!array_key_exists($key, $this->_params)) {
if ($this->_ignoreExisting || $this->arrayGet($this->_setup, 'suppress_errors') === true) {
return;
}
throw new UnknownPropertyException("Unknown property: '{$key}'... | php | protected function setParam($key, $value)
{
if (!array_key_exists($key, $this->_params)) {
if ($this->_ignoreExisting || $this->arrayGet($this->_setup, 'suppress_errors') === true) {
return;
}
throw new UnknownPropertyException("Unknown property: '{$key}'... | [
"protected",
"function",
"setParam",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"_params",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_ignoreExisting",
"||",
"$",
"t... | Set a value in the parameter pool and cast it to the same type as
the default value
@param string $key
@param mixed $value
@throws UnknownPropertyException | [
"Set",
"a",
"value",
"in",
"the",
"parameter",
"pool",
"and",
"cast",
"it",
"to",
"the",
"same",
"type",
"as",
"the",
"default",
"value"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L159-L189 |
magnus-eriksson/entity | src/Entity.php | Entity.setDefaultDataTypes | protected function setDefaultDataTypes()
{
foreach ($this->_params as $key => $value) {
switch (gettype($value)) {
case "boolean":
$this->_types[$key] = 'boolean';
break;
case "integer":
$this->_types[$ke... | php | protected function setDefaultDataTypes()
{
foreach ($this->_params as $key => $value) {
switch (gettype($value)) {
case "boolean":
$this->_types[$key] = 'boolean';
break;
case "integer":
$this->_types[$ke... | [
"protected",
"function",
"setDefaultDataTypes",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"value",
")",
")",
"{",
"case",
"\"boolean\"",
":",
"$",
... | Get the default data types | [
"Get",
"the",
"default",
"data",
"types"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L195-L219 |
magnus-eriksson/entity | src/Entity.php | Entity.toArray | public function toArray($protect = null)
{
$protect = is_array($protect)
? $protect
: $this->_protect;
if ($protect) {
$new = $this->_params;
foreach ($protect as $key) {
unset($new[$key]);
}
// Do json encod... | php | public function toArray($protect = null)
{
$protect = is_array($protect)
? $protect
: $this->_protect;
if ($protect) {
$new = $this->_params;
foreach ($protect as $key) {
unset($new[$key]);
}
// Do json encod... | [
"public",
"function",
"toArray",
"(",
"$",
"protect",
"=",
"null",
")",
"{",
"$",
"protect",
"=",
"is_array",
"(",
"$",
"protect",
")",
"?",
"$",
"protect",
":",
"$",
"this",
"->",
"_protect",
";",
"if",
"(",
"$",
"protect",
")",
"{",
"$",
"new",
... | Return the params as array and remove the protected keys
@param array|null $protect
@return array | [
"Return",
"the",
"params",
"as",
"array",
"and",
"remove",
"the",
"protected",
"keys"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L258-L278 |
magnus-eriksson/entity | src/Entity.php | Entity.date | public function date($key, $format = "F j, Y")
{
if (is_numeric($this->_params[$key])) {
return date($format, $this->_params[$key]);
}
return date($format, strtotime($this->_params[$key]));
} | php | public function date($key, $format = "F j, Y")
{
if (is_numeric($this->_params[$key])) {
return date($format, $this->_params[$key]);
}
return date($format, strtotime($this->_params[$key]));
} | [
"public",
"function",
"date",
"(",
"$",
"key",
",",
"$",
"format",
"=",
"\"F j, Y\"",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"this",
"->",
"_params",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"date",
"(",
"$",
"format",
",",
"$",
"this... | Return a parameter as a formatted date string
@param string $key
@param string $format
@return string | [
"Return",
"a",
"parameter",
"as",
"a",
"formatted",
"date",
"string"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L300-L307 |
magnus-eriksson/entity | src/Entity.php | Entity.make | public static function make($data = null, $index = null, Closure $modifier = null)
{
if ($data instanceof Traversable) {
$data = iterator_to_array($data);
}
if (!is_array($data)) {
return null;
}
if (count($data) < 1) {
return [];
... | php | public static function make($data = null, $index = null, Closure $modifier = null)
{
if ($data instanceof Traversable) {
$data = iterator_to_array($data);
}
if (!is_array($data)) {
return null;
}
if (count($data) < 1) {
return [];
... | [
"public",
"static",
"function",
"make",
"(",
"$",
"data",
"=",
"null",
",",
"$",
"index",
"=",
"null",
",",
"Closure",
"$",
"modifier",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"Traversable",
")",
"{",
"$",
"data",
"=",
"iterator_... | Convert array to entities
@param array $data
@param string $index Set the value in this key as index
@param Closure $modifier Executed before the entity gets populated
@return Entity|array | [
"Convert",
"array",
"to",
"entities"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L332-L366 |
magnus-eriksson/entity | src/Entity.php | Entity.arrayGet | protected function arrayGet(&$source, $key, $default = null)
{
if (!$key) {
return $default;
}
if (array_key_exists($key, $source)) {
return $source[$key];
}
$current =& $source;
foreach (explode('.', $key) as $segment) {
if (!arr... | php | protected function arrayGet(&$source, $key, $default = null)
{
if (!$key) {
return $default;
}
if (array_key_exists($key, $source)) {
return $source[$key];
}
$current =& $source;
foreach (explode('.', $key) as $segment) {
if (!arr... | [
"protected",
"function",
"arrayGet",
"(",
"&",
"$",
"source",
",",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"key",
")",
"{",
"return",
"$",
"default",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
"... | Get a key value, using dot notation
@param array &$source
@param string $key
@param mixed $default
@return mixed | [
"Get",
"a",
"key",
"value",
"using",
"dot",
"notation"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L392-L411 |
magnus-eriksson/entity | src/Entity.php | Entity.arrayHasKey | protected function arrayHasKey(&$source, $key)
{
if (!$key || !is_array($source)) {
return false;
}
if (array_key_exists($key, $source)) {
return true;
}
$current =& $source;
foreach (explode('.', $key) as $segment) {
if (!array_k... | php | protected function arrayHasKey(&$source, $key)
{
if (!$key || !is_array($source)) {
return false;
}
if (array_key_exists($key, $source)) {
return true;
}
$current =& $source;
foreach (explode('.', $key) as $segment) {
if (!array_k... | [
"protected",
"function",
"arrayHasKey",
"(",
"&",
"$",
"source",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"$",
"key",
"||",
"!",
"is_array",
"(",
"$",
"source",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
... | Check if a key exists, using dot notation
@param array &$source
@param string $key
@return boolean | [
"Check",
"if",
"a",
"key",
"exists",
"using",
"dot",
"notation"
] | train | https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L422-L441 |
GrahamDeprecated/CMS-Core | src/Seeds/UsersTableSeeder.php | UsersTableSeeder.run | public function run()
{
DB::table('users')->delete();
$user = array(
'first_name' => 'CMS',
'last_name' => 'Admin',
'email' => 'admin@dsmg.co.uk',
'password' => 'password',
'activated' => 1,
'activated_at' =>... | php | public function run()
{
DB::table('users')->delete();
$user = array(
'first_name' => 'CMS',
'last_name' => 'Admin',
'email' => 'admin@dsmg.co.uk',
'password' => 'password',
'activated' => 1,
'activated_at' =>... | [
"public",
"function",
"run",
"(",
")",
"{",
"DB",
"::",
"table",
"(",
"'users'",
")",
"->",
"delete",
"(",
")",
";",
"$",
"user",
"=",
"array",
"(",
"'first_name'",
"=>",
"'CMS'",
",",
"'last_name'",
"=>",
"'Admin'",
",",
"'email'",
"=>",
"'admin@dsmg.... | Run the database seeding.
@return void | [
"Run",
"the",
"database",
"seeding",
"."
] | train | https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/Seeds/UsersTableSeeder.php#L40-L103 |
haldayne/boost | src/MapOfStrings.php | MapOfStrings.join | public function join($separator)
{
return $this->reduce(
function ($joined, $string) use ($separator) {
return ('' === $joined ? '' : $joined . $separator) . $string;
},
''
);
} | php | public function join($separator)
{
return $this->reduce(
function ($joined, $string) use ($separator) {
return ('' === $joined ? '' : $joined . $separator) . $string;
},
''
);
} | [
"public",
"function",
"join",
"(",
"$",
"separator",
")",
"{",
"return",
"$",
"this",
"->",
"reduce",
"(",
"function",
"(",
"$",
"joined",
",",
"$",
"string",
")",
"use",
"(",
"$",
"separator",
")",
"{",
"return",
"(",
"''",
"===",
"$",
"joined",
"... | Join all the strings in this map with the separator between them.
@param string $separator
@return string
@api | [
"Join",
"all",
"the",
"strings",
"in",
"this",
"map",
"with",
"the",
"separator",
"between",
"them",
"."
] | train | https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfStrings.php#L17-L25 |
haldayne/boost | src/MapOfStrings.php | MapOfStrings.letter_frequency | public function letter_frequency()
{
return $this->transform(
function ($frequencies, $word) {
foreach (count_chars($word, 1) as $byte => $frequency) {
$letter = chr($byte);
if ($frequencies->has($letter)) {
$frequen... | php | public function letter_frequency()
{
return $this->transform(
function ($frequencies, $word) {
foreach (count_chars($word, 1) as $byte => $frequency) {
$letter = chr($byte);
if ($frequencies->has($letter)) {
$frequen... | [
"public",
"function",
"letter_frequency",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"transform",
"(",
"function",
"(",
"$",
"frequencies",
",",
"$",
"word",
")",
"{",
"foreach",
"(",
"count_chars",
"(",
"$",
"word",
",",
"1",
")",
"as",
"$",
"byte",
... | Calculate frequency of letters in all strings.
Counts how many times each letter occurs within every string in this
map. Returns a new Map of letter to number of occurrences. Only
letters that appear will be in the resulting map.
@return \Haldayne\Boost\MapOfIntegers
@api | [
"Calculate",
"frequency",
"of",
"letters",
"in",
"all",
"strings",
"."
] | train | https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfStrings.php#L37-L52 |
AymDev/PPRR | src/PPRR.php | PPRR.buildRegex | private static function buildRegex(string $expression, bool $is_prefix = false) : string
{
$regex = self::REGEX_DELIMITER . '^';
$regex .= preg_replace(array_keys(self::$datatypes), self::$datatypes, $expression);
$regex .= $is_prefix ? '(.*)' : '';
$regex .= '$' . self::REGEX_DELIM... | php | private static function buildRegex(string $expression, bool $is_prefix = false) : string
{
$regex = self::REGEX_DELIMITER . '^';
$regex .= preg_replace(array_keys(self::$datatypes), self::$datatypes, $expression);
$regex .= $is_prefix ? '(.*)' : '';
$regex .= '$' . self::REGEX_DELIM... | [
"private",
"static",
"function",
"buildRegex",
"(",
"string",
"$",
"expression",
",",
"bool",
"$",
"is_prefix",
"=",
"false",
")",
":",
"string",
"{",
"$",
"regex",
"=",
"self",
"::",
"REGEX_DELIMITER",
".",
"'^'",
";",
"$",
"regex",
".=",
"preg_replace",
... | Build a complete regular expression
@param string $expression the route to evaluate
@param bool $is_prefix is the route a route prefix
@return string the complete regular expression | [
"Build",
"a",
"complete",
"regular",
"expression"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L63-L70 |
AymDev/PPRR | src/PPRR.php | PPRR.getParsingMode | private function getParsingMode(string &$route) : int
{
// Explicit regex mode
if (strpos($route, 'R>') === 0) {
$route = str_replace('R>', '', $route);
return self::MODE_REGEX;
}
// Explicit string mode
if (strpos($route, 'S>') === 0) {
$r... | php | private function getParsingMode(string &$route) : int
{
// Explicit regex mode
if (strpos($route, 'R>') === 0) {
$route = str_replace('R>', '', $route);
return self::MODE_REGEX;
}
// Explicit string mode
if (strpos($route, 'S>') === 0) {
$r... | [
"private",
"function",
"getParsingMode",
"(",
"string",
"&",
"$",
"route",
")",
":",
"int",
"{",
"// Explicit regex mode",
"if",
"(",
"strpos",
"(",
"$",
"route",
",",
"'R>'",
")",
"===",
"0",
")",
"{",
"$",
"route",
"=",
"str_replace",
"(",
"'R>'",
",... | Detect route parsing mode for specific route
@param string &$route route to check
@return int class constant mode | [
"Detect",
"route",
"parsing",
"mode",
"for",
"specific",
"route"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L83-L98 |
AymDev/PPRR | src/PPRR.php | PPRR.matchRoute | private function matchRoute(string $route, string $url, &$matches, $value = null)
{
switch ($this->getParsingMode($route)) {
case self::MODE_REGEX:
// Evaluate & remove first match (full route)
$matched = preg_match(self::buildRegex($route, !is_null($value)), $... | php | private function matchRoute(string $route, string $url, &$matches, $value = null)
{
switch ($this->getParsingMode($route)) {
case self::MODE_REGEX:
// Evaluate & remove first match (full route)
$matched = preg_match(self::buildRegex($route, !is_null($value)), $... | [
"private",
"function",
"matchRoute",
"(",
"string",
"$",
"route",
",",
"string",
"$",
"url",
",",
"&",
"$",
"matches",
",",
"$",
"value",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getParsingMode",
"(",
"$",
"route",
")",
")",
"{",
"... | Match url against route
@param string $route route to match against
@param string $url url to test
@param mixed &$matches variable to fill with matches
@param mixed $value route value (sub routes or callback) | [
"Match",
"url",
"against",
"route"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L111-L142 |
AymDev/PPRR | src/PPRR.php | PPRR.route | private function route() : void
{
// Parse route
$parsed = $this->parseRoute();
// Run error controller when no route matched
if (!$parsed && isset($this->error_controller)) {
call_user_func($this->error_controller);
}
} | php | private function route() : void
{
// Parse route
$parsed = $this->parseRoute();
// Run error controller when no route matched
if (!$parsed && isset($this->error_controller)) {
call_user_func($this->error_controller);
}
} | [
"private",
"function",
"route",
"(",
")",
":",
"void",
"{",
"// Parse route",
"$",
"parsed",
"=",
"$",
"this",
"->",
"parseRoute",
"(",
")",
";",
"// Run error controller when no route matched",
"if",
"(",
"!",
"$",
"parsed",
"&&",
"isset",
"(",
"$",
"this",... | Try to parse routes or call the error controller
@return void | [
"Try",
"to",
"parse",
"routes",
"or",
"call",
"the",
"error",
"controller"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L153-L162 |
AymDev/PPRR | src/PPRR.php | PPRR.parseRoute | private function parseRoute(?array $routes = null, ?string $to_parse = null, string ...$args) : bool
{
// Set variables in 1st call
$routes = $routes ?? $this->routes;
$url = $to_parse ?? $this->current_route;
// Loop through routes
foreach ($routes as $expr => $callback)... | php | private function parseRoute(?array $routes = null, ?string $to_parse = null, string ...$args) : bool
{
// Set variables in 1st call
$routes = $routes ?? $this->routes;
$url = $to_parse ?? $this->current_route;
// Loop through routes
foreach ($routes as $expr => $callback)... | [
"private",
"function",
"parseRoute",
"(",
"?",
"array",
"$",
"routes",
"=",
"null",
",",
"?",
"string",
"$",
"to_parse",
"=",
"null",
",",
"string",
"...",
"$",
"args",
")",
":",
"bool",
"{",
"// Set variables in 1st call",
"$",
"routes",
"=",
"$",
"rout... | Parse routes (recursively) and call the matching controller
@param null|array $routes routes array to loop through
@param null|string $to_parse the URL part to parse
@param array[string] $args arguments fetched from the URL
@return bool true if a route matched
@throws \UnexpectedValueException when ... | [
"Parse",
"routes",
"(",
"recursively",
")",
"and",
"call",
"the",
"matching",
"controller"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L179-L212 |
AymDev/PPRR | src/PPRR.php | PPRR.setDataTypes | public static function setDataTypes(array $types) : void
{
// Datatypes key validation
foreach ($types as $key => $value) {
if (!preg_match('/^[A-Za-z0-9-_]+$/', $key)) {
throw new \UnexpectedValueException("<b>$key</b> is not a valid datatype key", 1);
} els... | php | public static function setDataTypes(array $types) : void
{
// Datatypes key validation
foreach ($types as $key => $value) {
if (!preg_match('/^[A-Za-z0-9-_]+$/', $key)) {
throw new \UnexpectedValueException("<b>$key</b> is not a valid datatype key", 1);
} els... | [
"public",
"static",
"function",
"setDataTypes",
"(",
"array",
"$",
"types",
")",
":",
"void",
"{",
"// Datatypes key validation",
"foreach",
"(",
"$",
"types",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[A-Za-z0-... | Define data types (Regex shortcuts)
@param array $types the Regex shortcuts
@return void
@throws \UnexpectedValueException when datatype key is invalid
@throws \LogicException when datatype value is not a string | [
"Define",
"data",
"types",
"(",
"Regex",
"shortcuts",
")"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L228-L247 |
AymDev/PPRR | src/PPRR.php | PPRR.setDefaultMode | public static function setDefaultMode(int $mode) : void
{
if (in_array($mode, [self::MODE_REGEX, self::MODE_STRING])) {
self::$mode = $mode;
return;
}
// Unknown mode
throw new \UnexpectedValueException('Invalid route mode');
} | php | public static function setDefaultMode(int $mode) : void
{
if (in_array($mode, [self::MODE_REGEX, self::MODE_STRING])) {
self::$mode = $mode;
return;
}
// Unknown mode
throw new \UnexpectedValueException('Invalid route mode');
} | [
"public",
"static",
"function",
"setDefaultMode",
"(",
"int",
"$",
"mode",
")",
":",
"void",
"{",
"if",
"(",
"in_array",
"(",
"$",
"mode",
",",
"[",
"self",
"::",
"MODE_REGEX",
",",
"self",
"::",
"MODE_STRING",
"]",
")",
")",
"{",
"self",
"::",
"$",
... | Set the route parsing mode
@param int $mode a class MODE_* constant
@return void
@throws \UnexpectedValueException for unknown modes | [
"Set",
"the",
"route",
"parsing",
"mode"
] | train | https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L262-L271 |
cohesion/cohesion-core | src/Util/Autoloader.php | Autoloader.addClassPath | public function addClassPath($path) {
if(!is_array($path)) {
$path = array($path);
}
foreach($path as $item) {
$this->classPaths[] = $item;
}
} | php | public function addClassPath($path) {
if(!is_array($path)) {
$path = array($path);
}
foreach($path as $item) {
$this->classPaths[] = $item;
}
} | [
"public",
"function",
"addClassPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"array",
"(",
"$",
"path",
")",
";",
"}",
"foreach",
"(",
"$",
"path",
"as",
"$",
"item",
")",
"{",... | Adds a path to search in when looking for a class.
@param string $path
@return void | [
"Adds",
"a",
"path",
"to",
"search",
"in",
"when",
"looking",
"for",
"a",
"class",
"."
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L96-L103 |
cohesion/cohesion-core | src/Util/Autoloader.php | Autoloader.getCache | public function getCache() {
if($this->cacheBackend == null) {
$this->cacheBackend = Zend_Cache::factory('Core', 'Apc', array('automatic_serialization' => true));
}
return $this->cacheBackend;
} | php | public function getCache() {
if($this->cacheBackend == null) {
$this->cacheBackend = Zend_Cache::factory('Core', 'Apc', array('automatic_serialization' => true));
}
return $this->cacheBackend;
} | [
"public",
"function",
"getCache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheBackend",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"cacheBackend",
"=",
"Zend_Cache",
"::",
"factory",
"(",
"'Core'",
",",
"'Apc'",
",",
"array",
"(",
"'automatic_seri... | Return caching backend used; or create new one if none already defined
(Zend_Cache_Frontend_Core with APC backend). | [
"Return",
"caching",
"backend",
"used",
";",
"or",
"create",
"new",
"one",
"if",
"none",
"already",
"defined",
"(",
"Zend_Cache_Frontend_Core",
"with",
"APC",
"backend",
")",
"."
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L123-L128 |
cohesion/cohesion-core | src/Util/Autoloader.php | Autoloader.tryAndLoadClass | protected function tryAndLoadClass($name, $list) {
if(in_array($name, array_keys($list))) {
include_once $list[$name];
if(class_exists($name) || interface_exists($name)) {
//echo "Successfully loaded $name\n";
return true;
}
}
r... | php | protected function tryAndLoadClass($name, $list) {
if(in_array($name, array_keys($list))) {
include_once $list[$name];
if(class_exists($name) || interface_exists($name)) {
//echo "Successfully loaded $name\n";
return true;
}
}
r... | [
"protected",
"function",
"tryAndLoadClass",
"(",
"$",
"name",
",",
"$",
"list",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"array_keys",
"(",
"$",
"list",
")",
")",
")",
"{",
"include_once",
"$",
"list",
"[",
"$",
"name",
"]",
";",
"if... | Given a map of class names to absolute file paths, try and load the class.
If we get to including the file, we ensure that the class_exists after doing
so, otherwise we'll return false.
Also return false if we don't know where the class ($name) could be.
@param string $name the name of the class we wish to load.
@param... | [
"Given",
"a",
"map",
"of",
"class",
"names",
"to",
"absolute",
"file",
"paths",
"try",
"and",
"load",
"the",
"class",
".",
"If",
"we",
"get",
"to",
"including",
"the",
"file",
"we",
"ensure",
"that",
"the",
"class_exists",
"after",
"doing",
"so",
"otherw... | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L163-L172 |
cohesion/cohesion-core | src/Util/Autoloader.php | Autoloader.loadClass | public function loadClass($className) {
$cache = $this->getCache();
$entries = $cache->load($this->cacheKey);
if($entries == false) {
$entries = array();
}
$status = $this->tryAndLoadClass($className, $entries);
if($status) {
// class loaded
... | php | public function loadClass($className) {
$cache = $this->getCache();
$entries = $cache->load($this->cacheKey);
if($entries == false) {
$entries = array();
}
$status = $this->tryAndLoadClass($className, $entries);
if($status) {
// class loaded
... | [
"public",
"function",
"loadClass",
"(",
"$",
"className",
")",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"getCache",
"(",
")",
";",
"$",
"entries",
"=",
"$",
"cache",
"->",
"load",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"if",
"(",
"$",
"e... | Returns true if the class file was found and included, false if not.
@return boolean | [
"Returns",
"true",
"if",
"the",
"class",
"file",
"was",
"found",
"and",
"included",
"false",
"if",
"not",
"."
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L179-L205 |
cohesion/cohesion-core | src/Util/Autoloader.php | Autoloader.searchForClassFile | protected function searchForClassFile($className, $directory) {
if(is_dir($directory) && is_readable($directory)) {
$d = dir($directory);
while($f = $d->read()) {
$subPath = realpath($directory . DIRECTORY_SEPARATOR . $f);
//echo "Looking in $subPath for $... | php | protected function searchForClassFile($className, $directory) {
if(is_dir($directory) && is_readable($directory)) {
$d = dir($directory);
while($f = $d->read()) {
$subPath = realpath($directory . DIRECTORY_SEPARATOR . $f);
//echo "Looking in $subPath for $... | [
"protected",
"function",
"searchForClassFile",
"(",
"$",
"className",
",",
"$",
"directory",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"directory",
")",
"&&",
"is_readable",
"(",
"$",
"directory",
")",
")",
"{",
"$",
"d",
"=",
"dir",
"(",
"$",
"director... | Rummage recursively through all directories found within $directory for a
file matching ClassName.$suffix
@return string class name if one found; otherwise false. | [
"Rummage",
"recursively",
"through",
"all",
"directories",
"found",
"within",
"$directory",
"for",
"a",
"file",
"matching",
"ClassName",
".",
"$suffix"
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L212-L234 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildCreateIndex | public function buildCreateIndex(Query $query) {
return $this->renderStatement(Query::CREATE_INDEX, [
'index' => $this->formatTable($query->getAlias()),
'table' => $this->formatTable($query->getTable()),
'fields' => $this->formatFields($query)
] + $this->formatAttribu... | php | public function buildCreateIndex(Query $query) {
return $this->renderStatement(Query::CREATE_INDEX, [
'index' => $this->formatTable($query->getAlias()),
'table' => $this->formatTable($query->getTable()),
'fields' => $this->formatFields($query)
] + $this->formatAttribu... | [
"public",
"function",
"buildCreateIndex",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"CREATE_INDEX",
",",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"formatTable",
"(",
"$",
"query",
"->",
"getAl... | Build the CREATE INDEX query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"CREATE",
"INDEX",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L26-L32 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildCreateTable | public function buildCreateTable(Query $query) {
$schema = $query->getSchema();
if (!$schema) {
throw new InvalidSchemaException('Table creation requires a valid schema object');
}
return $this->renderStatement(Query::CREATE_TABLE, [
'table' => $this->formatTabl... | php | public function buildCreateTable(Query $query) {
$schema = $query->getSchema();
if (!$schema) {
throw new InvalidSchemaException('Table creation requires a valid schema object');
}
return $this->renderStatement(Query::CREATE_TABLE, [
'table' => $this->formatTabl... | [
"public",
"function",
"buildCreateTable",
"(",
"Query",
"$",
"query",
")",
"{",
"$",
"schema",
"=",
"$",
"query",
"->",
"getSchema",
"(",
")",
";",
"if",
"(",
"!",
"$",
"schema",
")",
"{",
"throw",
"new",
"InvalidSchemaException",
"(",
"'Table creation req... | Build the CREATE TABLE query. Requires a table schema object.
@param \Titon\Db\Query $query
@return string
@throws \Titon\Db\Exception\InvalidSchemaException | [
"Build",
"the",
"CREATE",
"TABLE",
"query",
".",
"Requires",
"a",
"table",
"schema",
"object",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L41-L54 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildDelete | public function buildDelete(Query $query) {
return $this->renderStatement(Query::DELETE, [
'table' => $this->formatTable($query->getTable(), $query->getAlias()),
'joins' => $this->formatJoins($query->getJoins()),
'where' => $this->formatWhere($query->getWhere()),
... | php | public function buildDelete(Query $query) {
return $this->renderStatement(Query::DELETE, [
'table' => $this->formatTable($query->getTable(), $query->getAlias()),
'joins' => $this->formatJoins($query->getJoins()),
'where' => $this->formatWhere($query->getWhere()),
... | [
"public",
"function",
"buildDelete",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"DELETE",
",",
"[",
"'table'",
"=>",
"$",
"this",
"->",
"formatTable",
"(",
"$",
"query",
"->",
"getTable",
"("... | Build the DELETE query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"DELETE",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L62-L70 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildDropIndex | public function buildDropIndex(Query $query) {
return $this->renderStatement(Query::DROP_INDEX, [
'index' => $this->formatTable($query->getAlias()),
'table' => $this->formatTable($query->getTable())
] + $this->formatAttributes($query->getAttributes()));
} | php | public function buildDropIndex(Query $query) {
return $this->renderStatement(Query::DROP_INDEX, [
'index' => $this->formatTable($query->getAlias()),
'table' => $this->formatTable($query->getTable())
] + $this->formatAttributes($query->getAttributes()));
} | [
"public",
"function",
"buildDropIndex",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"DROP_INDEX",
",",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"formatTable",
"(",
"$",
"query",
"->",
"getAlias"... | Build the DROP INDEX query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"DROP",
"INDEX",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L78-L83 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildDropTable | public function buildDropTable(Query $query) {
return $this->renderStatement(Query::DROP_TABLE, [
'table' => $this->formatTable($query->getTable())
] + $this->formatAttributes($query->getAttributes()));
} | php | public function buildDropTable(Query $query) {
return $this->renderStatement(Query::DROP_TABLE, [
'table' => $this->formatTable($query->getTable())
] + $this->formatAttributes($query->getAttributes()));
} | [
"public",
"function",
"buildDropTable",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"DROP_TABLE",
",",
"[",
"'table'",
"=>",
"$",
"this",
"->",
"formatTable",
"(",
"$",
"query",
"->",
"getTable"... | Build the DROP TABLE query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"DROP",
"TABLE",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L91-L95 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildMultiInsert | public function buildMultiInsert(Query $query) {
return $this->renderStatement(Query::INSERT, [
'table' => $this->formatTable($query->getTable()),
'fields' => $this->formatFields($query),
'values' => $this->formatValues($query)
] + $this->formatAttributes($query->getA... | php | public function buildMultiInsert(Query $query) {
return $this->renderStatement(Query::INSERT, [
'table' => $this->formatTable($query->getTable()),
'fields' => $this->formatFields($query),
'values' => $this->formatValues($query)
] + $this->formatAttributes($query->getA... | [
"public",
"function",
"buildMultiInsert",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"INSERT",
",",
"[",
"'table'",
"=>",
"$",
"this",
"->",
"formatTable",
"(",
"$",
"query",
"->",
"getTable",
... | Build the INSERT query with multiple record support.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"INSERT",
"query",
"with",
"multiple",
"record",
"support",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L117-L123 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildSelect | public function buildSelect(Query $query) {
return $this->renderStatement(Query::SELECT, [
'fields' => $this->formatFields($query),
'table' => $this->formatTable($query->getTable(), $query->getAlias()),
'joins' => $this->formatJoins($query->getJoins()),
'where' =>... | php | public function buildSelect(Query $query) {
return $this->renderStatement(Query::SELECT, [
'fields' => $this->formatFields($query),
'table' => $this->formatTable($query->getTable(), $query->getAlias()),
'joins' => $this->formatJoins($query->getJoins()),
'where' =>... | [
"public",
"function",
"buildSelect",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"SELECT",
",",
"[",
"'fields'",
"=>",
"$",
"this",
"->",
"formatFields",
"(",
"$",
"query",
")",
",",
"'table'"... | Build the SELECT query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"SELECT",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L131-L143 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildTruncate | public function buildTruncate(Query $query) {
return $this->renderStatement(Query::TRUNCATE, [
'table' => $this->formatTable($query->getTable())
] + $this->formatAttributes($query->getAttributes()));
} | php | public function buildTruncate(Query $query) {
return $this->renderStatement(Query::TRUNCATE, [
'table' => $this->formatTable($query->getTable())
] + $this->formatAttributes($query->getAttributes()));
} | [
"public",
"function",
"buildTruncate",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"TRUNCATE",
",",
"[",
"'table'",
"=>",
"$",
"this",
"->",
"formatTable",
"(",
"$",
"query",
"->",
"getTable",
... | Build the TRUNCATE query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"TRUNCATE",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L151-L155 |
titon/db | src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php | AbstractPdoDialect.buildUpdate | public function buildUpdate(Query $query) {
return $this->renderStatement(Query::UPDATE, [
'fields' => $this->formatFields($query),
'table' => $this->formatTable($query->getTable(), $query->getAlias()),
'joins' => $this->formatJoins($query->getJoins()),
'where' =>... | php | public function buildUpdate(Query $query) {
return $this->renderStatement(Query::UPDATE, [
'fields' => $this->formatFields($query),
'table' => $this->formatTable($query->getTable(), $query->getAlias()),
'joins' => $this->formatJoins($query->getJoins()),
'where' =>... | [
"public",
"function",
"buildUpdate",
"(",
"Query",
"$",
"query",
")",
"{",
"return",
"$",
"this",
"->",
"renderStatement",
"(",
"Query",
"::",
"UPDATE",
",",
"[",
"'fields'",
"=>",
"$",
"this",
"->",
"formatFields",
"(",
"$",
"query",
")",
",",
"'table'"... | Build the UPDATE query.
@param \Titon\Db\Query $query
@return string | [
"Build",
"the",
"UPDATE",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L163-L172 |
whisller/IrcBotBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('whisnet_irc_bot');
$rootNode
->children()
->scalarNode('connection_class')->defaultValue('Whisnet\IrcBotBundle\Connection\Socket')->end()
->... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('whisnet_irc_bot');
$rootNode
->children()
->scalarNode('connection_class')->defaultValue('Whisnet\IrcBotBundle\Connection\Socket')->end()
->... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'whisnet_irc_bot'",
")",
";",
"$",
"rootNode",
"->",
"children",
"(",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/whisller/IrcBotBundle/blob/d8bcafc1599cbbc7756b0a59f51ee988a2de0f2e/DependencyInjection/Configuration.php#L18-L53 |
php-rise/rise | src/Template/Blocks/Block.php | Block.extend | public function extend($template, $data = [], $paramName = 'body') {
$this->extendedTemplate = $this->resolveTemplatePath($template);
if (is_array($data)) {
$this->extendedData = $data;
}
if (is_string($paramName) && $paramName) {
$this->extendedParamName = $paramName;
}
} | php | public function extend($template, $data = [], $paramName = 'body') {
$this->extendedTemplate = $this->resolveTemplatePath($template);
if (is_array($data)) {
$this->extendedData = $data;
}
if (is_string($paramName) && $paramName) {
$this->extendedParamName = $paramName;
}
} | [
"public",
"function",
"extend",
"(",
"$",
"template",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"paramName",
"=",
"'body'",
")",
"{",
"$",
"this",
"->",
"extendedTemplate",
"=",
"$",
"this",
"->",
"resolveTemplatePath",
"(",
"$",
"template",
")",
";",... | Set extended template and data.
@param string $template
@param array $data Optional.
@param string $paramName Optional. Variable name of the variable storing the content of this block, default to "body". | [
"Set",
"extended",
"template",
"and",
"data",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L111-L119 |
php-rise/rise | src/Template/Blocks/Block.php | Block.translate | public function translate($key, $defaultValue = '', $locale = null) {
return $this->translation->translate($key, $defaultValue, $locale);
} | php | public function translate($key, $defaultValue = '', $locale = null) {
return $this->translation->translate($key, $defaultValue, $locale);
} | [
"public",
"function",
"translate",
"(",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"''",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"translation",
"->",
"translate",
"(",
"$",
"key",
",",
"$",
"defaultValue",
",",
"$",
"l... | Helper function for translation.
@param string $key
@param string $defaultValue
@param string $locale
@return string | [
"Helper",
"function",
"for",
"translation",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L176-L178 |
php-rise/rise | src/Template/Blocks/Block.php | Block.render | public function render() {
$html = $this->renderToHtml();
if (!empty($this->extendedTemplate)) {
$data = [$this->extendedParamName => $html] + $this->extendedData + $this->data;
$html = $this->templateService->render($this->extendedTemplate, $data);
}
return $html;
} | php | public function render() {
$html = $this->renderToHtml();
if (!empty($this->extendedTemplate)) {
$data = [$this->extendedParamName => $html] + $this->extendedData + $this->data;
$html = $this->templateService->render($this->extendedTemplate, $data);
}
return $html;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"renderToHtml",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"extendedTemplate",
")",
")",
"{",
"$",
"data",
"=",
"[",
"$",
"this",
"->",
"exte... | Render a template.
@return self | [
"Render",
"a",
"template",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L185-L194 |
php-rise/rise | src/Template/Blocks/Block.php | Block.resolveTemplatePath | protected function resolveTemplatePath($path) {
switch ($path[0]) {
case '/':
break;
case '.':
$path = realpath(dirname($this->template) . '/' . $path . '.phtml');
break;
default:
$path = realpath($this->pathService->getTemplatesPath() . '/' . $path . '.phtml');
break;
}
if ($path === false)... | php | protected function resolveTemplatePath($path) {
switch ($path[0]) {
case '/':
break;
case '.':
$path = realpath(dirname($this->template) . '/' . $path . '.phtml');
break;
default:
$path = realpath($this->pathService->getTemplatesPath() . '/' . $path . '.phtml');
break;
}
if ($path === false)... | [
"protected",
"function",
"resolveTemplatePath",
"(",
"$",
"path",
")",
"{",
"switch",
"(",
"$",
"path",
"[",
"0",
"]",
")",
"{",
"case",
"'/'",
":",
"break",
";",
"case",
"'.'",
":",
"$",
"path",
"=",
"realpath",
"(",
"dirname",
"(",
"$",
"this",
"... | Resolve template path.
@param string $path
@return string | [
"Resolve",
"template",
"path",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L222-L239 |
php-rise/rise | src/Template/Blocks/Block.php | Block.renderToHtml | protected function renderToHtml() {
extract($this->data, EXTR_SKIP);
ob_start();
set_error_handler([$this, 'handleError']);
include $this->template;
restore_error_handler();
$html = ob_get_clean();
return $html;
} | php | protected function renderToHtml() {
extract($this->data, EXTR_SKIP);
ob_start();
set_error_handler([$this, 'handleError']);
include $this->template;
restore_error_handler();
$html = ob_get_clean();
return $html;
} | [
"protected",
"function",
"renderToHtml",
"(",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"data",
",",
"EXTR_SKIP",
")",
";",
"ob_start",
"(",
")",
";",
"set_error_handler",
"(",
"[",
"$",
"this",
",",
"'handleError'",
"]",
")",
";",
"include",
"$",
"... | Render this block to HTML string.
@return string | [
"Render",
"this",
"block",
"to",
"HTML",
"string",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L246-L254 |
php-rise/rise | src/Template/Blocks/Block.php | Block.handleError | protected function handleError($errno, $errstr, $errfile, $errline) {
ob_end_clean();
throw new BlockException($errstr, 0, $errno, $errfile, $errline);
} | php | protected function handleError($errno, $errstr, $errfile, $errline) {
ob_end_clean();
throw new BlockException($errstr, 0, $errno, $errfile, $errline);
} | [
"protected",
"function",
"handleError",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"ob_end_clean",
"(",
")",
";",
"throw",
"new",
"BlockException",
"(",
"$",
"errstr",
",",
"0",
",",
"$",
"errno",
",",
... | Error handler. | [
"Error",
"handler",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L259-L262 |
OwlyCode/StreamingBird | src/StreamReader.php | StreamReader.consume | public function consume(callable $handler)
{
$this->running = true;
while ($this->running) {
$this->consumeOnce($handler);
}
} | php | public function consume(callable $handler)
{
$this->running = true;
while ($this->running) {
$this->consumeOnce($handler);
}
} | [
"public",
"function",
"consume",
"(",
"callable",
"$",
"handler",
")",
"{",
"$",
"this",
"->",
"running",
"=",
"true",
";",
"while",
"(",
"$",
"this",
"->",
"running",
")",
"{",
"$",
"this",
"->",
"consumeOnce",
"(",
"$",
"handler",
")",
";",
"}",
... | Consume from the streaming API.
Will retry on any connection loss.
@param callable $handler | [
"Consume",
"from",
"the",
"streaming",
"API",
"."
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/StreamReader.php#L86-L93 |
OwlyCode/StreamingBird | src/StreamReader.php | StreamReader.consumeOnce | protected function consumeOnce(callable $handler)
{
$this->connection = $this->connect();
$lastStreamActivity = time();
$this->connection->read(function ($tweet) use (&$lastStreamActivity, $handler) {
$idle = (time() - $lastStreamActivity);
$this->monitor->stat('ma... | php | protected function consumeOnce(callable $handler)
{
$this->connection = $this->connect();
$lastStreamActivity = time();
$this->connection->read(function ($tweet) use (&$lastStreamActivity, $handler) {
$idle = (time() - $lastStreamActivity);
$this->monitor->stat('ma... | [
"protected",
"function",
"consumeOnce",
"(",
"callable",
"$",
"handler",
")",
"{",
"$",
"this",
"->",
"connection",
"=",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"lastStreamActivity",
"=",
"time",
"(",
")",
";",
"$",
"this",
"->",
"connection",
... | Consume from the streaming API.
Will not retry on connection loss.
@param callable $handler | [
"Consume",
"from",
"the",
"streaming",
"API",
"."
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/StreamReader.php#L108-L127 |
OwlyCode/StreamingBird | src/StreamReader.php | StreamReader.connect | protected function connect($timeout = 5, $attempts = 10)
{
$url = $this->endpoints[$this->method];
$urlParts = parse_url($url);
$scheme = $urlParts['scheme'] == 'https' ? 'ssl://' : 'tcp://';
$port = $urlParts['scheme'] == 'https' ? 443 : 80;
$requestParams = [];
... | php | protected function connect($timeout = 5, $attempts = 10)
{
$url = $this->endpoints[$this->method];
$urlParts = parse_url($url);
$scheme = $urlParts['scheme'] == 'https' ? 'ssl://' : 'tcp://';
$port = $urlParts['scheme'] == 'https' ? 443 : 80;
$requestParams = [];
... | [
"protected",
"function",
"connect",
"(",
"$",
"timeout",
"=",
"5",
",",
"$",
"attempts",
"=",
"10",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"endpoints",
"[",
"$",
"this",
"->",
"method",
"]",
";",
"$",
"urlParts",
"=",
"parse_url",
"(",
"$",
... | @param int $timeout
@param int $attempts
@return Connection | [
"@param",
"int",
"$timeout",
"@param",
"int",
"$attempts"
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/StreamReader.php#L135-L167 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/Generator/DiProxyGenerator.php | DiProxyGenerator.compile | public function compile()
{
$indent = ' ';
$caseStatements = array();
$getters = array();
$instances = $this->dumper->getAllInjectedDefinitions();
/* @var $instance GeneratorInstance */
foreach ($instances as $name => $instance) {
$... | php | public function compile()
{
$indent = ' ';
$caseStatements = array();
$getters = array();
$instances = $this->dumper->getAllInjectedDefinitions();
/* @var $instance GeneratorInstance */
foreach ($instances as $name => $instance) {
$... | [
"public",
"function",
"compile",
"(",
")",
"{",
"$",
"indent",
"=",
"' '",
";",
"$",
"caseStatements",
"=",
"array",
"(",
")",
";",
"$",
"getters",
"=",
"array",
"(",
")",
";",
"$",
"instances",
"=",
"$",
"this",
"->",
"dumper",
"->",
"getAllInjec... | Compiles a Di Definitions to a in a service locator, that extends Zend\Di\Di and writes it to disk
It uses Zend\Code\Generator\FileGenerator
@return FileGenerator
@throws InvalidArgumentException | [
"Compiles",
"a",
"Di",
"Definitions",
"to",
"a",
"in",
"a",
"service",
"locator",
"that",
"extends",
"Zend",
"\\",
"Di",
"\\",
"Di",
"and",
"writes",
"it",
"to",
"disk"
] | train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiProxyGenerator.php#L176-L350 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/Generator/DiProxyGenerator.php | DiProxyGenerator.normalizeAlias | protected function normalizeAlias($alias)
{
$normalized = preg_replace('/[^a-zA-Z0-9]/', ' ', $alias);
$normalized = 'new' . str_replace(' ', '', ucwords($normalized));
return $normalized;
} | php | protected function normalizeAlias($alias)
{
$normalized = preg_replace('/[^a-zA-Z0-9]/', ' ', $alias);
$normalized = 'new' . str_replace(' ', '', ucwords($normalized));
return $normalized;
} | [
"protected",
"function",
"normalizeAlias",
"(",
"$",
"alias",
")",
"{",
"$",
"normalized",
"=",
"preg_replace",
"(",
"'/[^a-zA-Z0-9]/'",
",",
"' '",
",",
"$",
"alias",
")",
";",
"$",
"normalized",
"=",
"'new'",
".",
"str_replace",
"(",
"' '",
",",
"''",
... | Normalize an alias to a new instance method name
@param string $alias
@return string | [
"Normalize",
"an",
"alias",
"to",
"a",
"new",
"instance",
"method",
"name"
] | train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiProxyGenerator.php#L375-L380 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Style.php | Style.addStyleId | public function addStyleId($styleId)
{
$styleId = (string)$styleId;
if (!in_array($styleId, $this->styleIds)) {
array_push($this->styleIds, $styleId);
}
return $this;
} | php | public function addStyleId($styleId)
{
$styleId = (string)$styleId;
if (!in_array($styleId, $this->styleIds)) {
array_push($this->styleIds, $styleId);
}
return $this;
} | [
"public",
"function",
"addStyleId",
"(",
"$",
"styleId",
")",
"{",
"$",
"styleId",
"=",
"(",
"string",
")",
"$",
"styleId",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"styleId",
",",
"$",
"this",
"->",
"styleIds",
")",
")",
"{",
"array_push",
"(",
... | Add style Id
@api
@param string $styleId Style Id
@return static | [
"Add",
"style",
"Id"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Style.php#L114-L121 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Style.php | Style.addStyleClass | public function addStyleClass($styleClass)
{
$styleClass = (string)$styleClass;
if (!in_array($styleClass, $this->styleClasses)) {
array_push($this->styleClasses, $styleClass);
}
return $this;
} | php | public function addStyleClass($styleClass)
{
$styleClass = (string)$styleClass;
if (!in_array($styleClass, $this->styleClasses)) {
array_push($this->styleClasses, $styleClass);
}
return $this;
} | [
"public",
"function",
"addStyleClass",
"(",
"$",
"styleClass",
")",
"{",
"$",
"styleClass",
"=",
"(",
"string",
")",
"$",
"styleClass",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"styleClass",
",",
"$",
"this",
"->",
"styleClasses",
")",
")",
"{",
"arr... | Add style class
@api
@param string $styleClass Style class
@return static | [
"Add",
"style",
"class"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Style.php#L193-L200 |
webforge-labs/psc-cms | lib/Psc/Code/MultiValueCounter.php | MultiValueCounter.& | public function &c() {
$args = func_get_args();
if (count($args) > $this->argsCount) {
$rel = array_pop($args); // rel ist übergeben worden
} else {
$rel = 0;
}
for ($i=0; $i < $this->argsCount; $i++) {
$this->values[$i][] = $args[$i];
}
$key = $this->getKey($args);
if... | php | public function &c() {
$args = func_get_args();
if (count($args) > $this->argsCount) {
$rel = array_pop($args); // rel ist übergeben worden
} else {
$rel = 0;
}
for ($i=0; $i < $this->argsCount; $i++) {
$this->values[$i][] = $args[$i];
}
$key = $this->getKey($args);
if... | [
"public",
"function",
"&",
"c",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
">",
"$",
"this",
"->",
"argsCount",
")",
"{",
"$",
"rel",
"=",
"array_pop",
"(",
"$",
"args",
")",
";",... | Gibt die Referenz auf den Counter für die genannte Dimension zurück
example:
$v =& $mv->c('foo','bar');
$v++;
$mv->c('foo','bar'); // ist jetzt eins höher | [
"Gibt",
"die",
"Referenz",
"auf",
"den",
"Counter",
"für",
"die",
"genannte",
"Dimension",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/MultiValueCounter.php#L34-L52 |
webforge-labs/psc-cms | lib/Psc/Doctrine/CollectionSynchronizer.php | CollectionSynchronizer.init | public function init(Entity $entity, Closure $adder = NULL, Closure $remover = NULL) {
parent::init($entity);
list($add, $remove) = $this->getRelationInterface();
if (!$adder) {
$adder = function ($entity, $toEntity, $repository) use ($add) {
$repository->persist($toEntity);
... | php | public function init(Entity $entity, Closure $adder = NULL, Closure $remover = NULL) {
parent::init($entity);
list($add, $remove) = $this->getRelationInterface();
if (!$adder) {
$adder = function ($entity, $toEntity, $repository) use ($add) {
$repository->persist($toEntity);
... | [
"public",
"function",
"init",
"(",
"Entity",
"$",
"entity",
",",
"Closure",
"$",
"adder",
"=",
"NULL",
",",
"Closure",
"$",
"remover",
"=",
"NULL",
")",
"{",
"parent",
"::",
"init",
"(",
"$",
"entity",
")",
";",
"list",
"(",
"$",
"add",
",",
"$",
... | Kompiliert den Synchronizer und initialisiert
wenn angegeben $add angegben wird, wird diese Closure mit $entity (der Parameter der init() Funktion) und $otherEntity aufgerufen
bei $add ist $otherEntity ein Entity aus der $toCollection welches nicht in der $fromColleciton ist
bei $remove ist $otherEntity ein Entity aus... | [
"Kompiliert",
"den",
"Synchronizer",
"und",
"initialisiert"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/CollectionSynchronizer.php#L51-L89 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php | ServerPublisher.postPublicNotification | function postPublicNotification($message, $link = null, $iconStyle = null, $iconSubstyle = null, $titleIdString = null, $mediaURL = null, $group = null)
{
$n = new Notification();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$n->message = $message;
$n->link = $link;
$n->iconStyle = $... | php | function postPublicNotification($message, $link = null, $iconStyle = null, $iconSubstyle = null, $titleIdString = null, $mediaURL = null, $group = null)
{
$n = new Notification();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$n->message = $message;
$n->link = $link;
$n->iconStyle = $... | [
"function",
"postPublicNotification",
"(",
"$",
"message",
",",
"$",
"link",
"=",
"null",
",",
"$",
"iconStyle",
"=",
"null",
",",
"$",
"iconSubstyle",
"=",
"null",
",",
"$",
"titleIdString",
"=",
"null",
",",
"$",
"mediaURL",
"=",
"null",
",",
"$",
"g... | Send a public notification to every player that bookmarked your server.
@param string $message The message itself. If you send a public notification to a player, the
message will be prepended with its nickname. Max length is 255 chars, you
can use Maniaplanet special chars.
@param string $link Link when the player cli... | [
"Send",
"a",
"public",
"notification",
"to",
"every",
"player",
"that",
"bookmarked",
"your",
"server",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L48-L60 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php | ServerPublisher.postPrivateNotification | function postPrivateNotification($message, $receiverName, $link = null, $titleIdString = null)
{
$n = new Notification();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$n->message = $message;
$n->link = $link;
$n->receiverName = $receiverName;
$n->isPrivate = true;
$n->titleId = $... | php | function postPrivateNotification($message, $receiverName, $link = null, $titleIdString = null)
{
$n = new Notification();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$n->message = $message;
$n->link = $link;
$n->receiverName = $receiverName;
$n->isPrivate = true;
$n->titleId = $... | [
"function",
"postPrivateNotification",
"(",
"$",
"message",
",",
"$",
"receiverName",
",",
"$",
"link",
"=",
"null",
",",
"$",
"titleIdString",
"=",
"null",
")",
"{",
"$",
"n",
"=",
"new",
"Notification",
"(",
")",
";",
"$",
"n",
"->",
"senderName",
"=... | Send a private message to a player (specified in
Notification::$receiverName).
@param string $message The message itself. If you send a public notification to a player, the
message will be prepended with its nickname. Max length is 255 chars, you
can use Maniaplanet special chars.
@param string $receiverName The receiv... | [
"Send",
"a",
"private",
"message",
"to",
"a",
"player",
"(",
"specified",
"in",
"Notification",
"::",
"$receiverName",
")",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L103-L113 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php | ServerPublisher.postPrivateEvent | function postPrivateEvent($message, $eventDate, $receiverName, $link = null, $titleIdString = null, $mediaURL = null)
{
$e = new Event();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$e->message = $message;
$e->link = $link;
$e->receiverName = $receiverName;
$e->eventDate = $eventD... | php | function postPrivateEvent($message, $eventDate, $receiverName, $link = null, $titleIdString = null, $mediaURL = null)
{
$e = new Event();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$e->message = $message;
$e->link = $link;
$e->receiverName = $receiverName;
$e->eventDate = $eventD... | [
"function",
"postPrivateEvent",
"(",
"$",
"message",
",",
"$",
"eventDate",
",",
"$",
"receiverName",
",",
"$",
"link",
"=",
"null",
",",
"$",
"titleIdString",
"=",
"null",
",",
"$",
"mediaURL",
"=",
"null",
")",
"{",
"$",
"e",
"=",
"new",
"Event",
"... | Create an event visible only by the receivers. To create an event for many players just give an array of login as
receiverName.
@param string $message The message itself. If you send a public notification to a player, the
message will be prepended with its nickname. Max length is 255 chars, you
can use Maniaplanet spe... | [
"Create",
"an",
"event",
"visible",
"only",
"by",
"the",
"receivers",
".",
"To",
"create",
"an",
"event",
"for",
"many",
"players",
"just",
"give",
"an",
"array",
"of",
"login",
"as",
"receiverName",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L127-L139 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php | ServerPublisher.postPublicEvent | function postPublicEvent($message, $eventDate, $link = null, $titleIdString = null, $mediaURL = null)
{
$e = new Event();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$e->message = $message;
$e->link = $link;
$e->eventDate = $eventDate;
$n->titleId = $titleIdString;
$n->mediaURL ... | php | function postPublicEvent($message, $eventDate, $link = null, $titleIdString = null, $mediaURL = null)
{
$e = new Event();
$n->senderName = (object) array('serverLogin' => $this->serverLogin);
$e->message = $message;
$e->link = $link;
$e->eventDate = $eventDate;
$n->titleId = $titleIdString;
$n->mediaURL ... | [
"function",
"postPublicEvent",
"(",
"$",
"message",
",",
"$",
"eventDate",
",",
"$",
"link",
"=",
"null",
",",
"$",
"titleIdString",
"=",
"null",
",",
"$",
"mediaURL",
"=",
"null",
")",
"{",
"$",
"e",
"=",
"new",
"Event",
"(",
")",
";",
"$",
"n",
... | Create an event visible by all players who bookmarked your server
@param string $message The message itself. If you send a public notification to a player, the
@param string message will be prepended with its nickname. Max length is 255 chars, you
can use Maniaplanet special chars.
@param int $eventDate The UNIX Timest... | [
"Create",
"an",
"event",
"visible",
"by",
"all",
"players",
"who",
"bookmarked",
"your",
"server"
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L150-L160 |
devmobgroup/postcodes | src/Util/Uri.php | Uri.create | public static function create(string $baseUri, array $query = []): string
{
if (count($query) === 0) {
return $baseUri;
}
return sprintf('%s/?%s', $baseUri, http_build_query($query));
} | php | public static function create(string $baseUri, array $query = []): string
{
if (count($query) === 0) {
return $baseUri;
}
return sprintf('%s/?%s', $baseUri, http_build_query($query));
} | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"baseUri",
",",
"array",
"$",
"query",
"=",
"[",
"]",
")",
":",
"string",
"{",
"if",
"(",
"count",
"(",
"$",
"query",
")",
"===",
"0",
")",
"{",
"return",
"$",
"baseUri",
";",
"}",
"re... | Create request url based on base uri and request parameters.
@param string $baseUri
@param array $query
@return string | [
"Create",
"request",
"url",
"based",
"on",
"base",
"uri",
"and",
"request",
"parameters",
"."
] | train | https://github.com/devmobgroup/postcodes/blob/1a8438fd960a8f50ec28d61af94560892b529f12/src/Util/Uri.php#L14-L21 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper.file | public function file($fieldName, array $options = [])
{
$errorSuffix = null;
$error = $this->error($fieldName);
$content = parent::file($fieldName, $options);
if ($this->getConfig('materializeCss', false) === false) {
return $content;
}
$option... | php | public function file($fieldName, array $options = [])
{
$errorSuffix = null;
$error = $this->error($fieldName);
$content = parent::file($fieldName, $options);
if ($this->getConfig('materializeCss', false) === false) {
return $content;
}
$option... | [
"public",
"function",
"file",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"errorSuffix",
"=",
"null",
";",
"$",
"error",
"=",
"$",
"this",
"->",
"error",
"(",
"$",
"fieldName",
")",
";",
"$",
"content",
"=",
... | Creates file input widget.
@param string $fieldName Name of a field, in the form "modelname.fieldname"
@param array $options Array of HTML attributes.
@return string A generated file input. | [
"Creates",
"file",
"input",
"widget",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L112-L138 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper.switcher | public function switcher($fieldName, array $options = [])
{
$input = parent::checkbox($fieldName, $options);
if ($this->getConfig('materializeCss', false) === false) {
return $input;
}
$options += [
'before' => __d('backend', 'Off'),
'after' => ... | php | public function switcher($fieldName, array $options = [])
{
$input = parent::checkbox($fieldName, $options);
if ($this->getConfig('materializeCss', false) === false) {
return $input;
}
$options += [
'before' => __d('backend', 'Off'),
'after' => ... | [
"public",
"function",
"switcher",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"input",
"=",
"parent",
"::",
"checkbox",
"(",
"$",
"fieldName",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getC... | Form switcher.
@param string $fieldName
@param array $options
@return string | [
"Form",
"switcher",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L147-L175 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper.button | public function button($title, array $options = [])
{
$options = $this->addClass($options, $this->_class(__FUNCTION__));
$options = $this->_getBtnClass($options);
$options = $this->_getToolTipAttr($options);
list($title, $options) = $this->_createIcon($this->Html, $title, $options);... | php | public function button($title, array $options = [])
{
$options = $this->addClass($options, $this->_class(__FUNCTION__));
$options = $this->_getBtnClass($options);
$options = $this->_getToolTipAttr($options);
list($title, $options) = $this->_createIcon($this->Html, $title, $options);... | [
"public",
"function",
"button",
"(",
"$",
"title",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"addClass",
"(",
"$",
"options",
",",
"$",
"this",
"->",
"_class",
"(",
"__FUNCTION__",
")",
")",
";",... | Creates a `<button>` tag.
@param string $title
@param array $options
@return string | [
"Creates",
"a",
"<button",
">",
"tag",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L184-L193 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper.create | public function create($model = null, array $options = [])
{
$options += ['process' => false, 'jsForm' => false];
$options = $this->addClass($options, $this->_class('form'));
$isProcess = $options['process'];
if ($isProcess !== false) {
$_options = [
'ur... | php | public function create($model = null, array $options = [])
{
$options += ['process' => false, 'jsForm' => false];
$options = $this->addClass($options, $this->_class('form'));
$isProcess = $options['process'];
if ($isProcess !== false) {
$_options = [
'ur... | [
"public",
"function",
"create",
"(",
"$",
"model",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'process'",
"=>",
"false",
",",
"'jsForm'",
"=>",
"false",
"]",
";",
"$",
"options",
"=",
"$",
"this"... | Create html form.
@param mixed $model
@param array $options
@return string | [
"Create",
"html",
"form",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L212-L241 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper.end | public function end(array $secureAttributes = [])
{
if ($this->_isJsForm) {
return implode('', [
$this->hidden('action', ['value' => '', 'class' => 'jsFormAction']),
parent::end($secureAttributes)
]);
}
return parent::end($secureAttrib... | php | public function end(array $secureAttributes = [])
{
if ($this->_isJsForm) {
return implode('', [
$this->hidden('action', ['value' => '', 'class' => 'jsFormAction']),
parent::end($secureAttributes)
]);
}
return parent::end($secureAttrib... | [
"public",
"function",
"end",
"(",
"array",
"$",
"secureAttributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isJsForm",
")",
"{",
"return",
"implode",
"(",
"''",
",",
"[",
"$",
"this",
"->",
"hidden",
"(",
"'action'",
",",
"[",
"'va... | End html form.
@param array $secureAttributes
@return string | [
"End",
"html",
"form",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L249-L259 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper._addDefaultContextProviders | protected function _addDefaultContextProviders()
{
$this->addContextProvider('orm', function ($request, $data) {
if (is_array($data['entity']) || $data['entity'] instanceof \Traversable) {
$pass = (new Collection($data['entity']))->first() !== null;
if ($pass) {
... | php | protected function _addDefaultContextProviders()
{
$this->addContextProvider('orm', function ($request, $data) {
if (is_array($data['entity']) || $data['entity'] instanceof \Traversable) {
$pass = (new Collection($data['entity']))->first() !== null;
if ($pass) {
... | [
"protected",
"function",
"_addDefaultContextProviders",
"(",
")",
"{",
"$",
"this",
"->",
"addContextProvider",
"(",
"'orm'",
",",
"function",
"(",
"$",
"request",
",",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
"[",
"'entity'",
"]",
... | Add the default suite of context providers provided.
@return void | [
"Add",
"the",
"default",
"suite",
"of",
"context",
"providers",
"provided",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L278-L293 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper._inputContainerTemplate | protected function _inputContainerTemplate($options)
{
$inputContainerTemplate = $options['options']['type'] . 'Container' . $options['errorSuffix'];
if (!$this->templater()->get($inputContainerTemplate)) {
$inputContainerTemplate = 'inputContainer' . $options['errorSuffix'];
}
... | php | protected function _inputContainerTemplate($options)
{
$inputContainerTemplate = $options['options']['type'] . 'Container' . $options['errorSuffix'];
if (!$this->templater()->get($inputContainerTemplate)) {
$inputContainerTemplate = 'inputContainer' . $options['errorSuffix'];
}
... | [
"protected",
"function",
"_inputContainerTemplate",
"(",
"$",
"options",
")",
"{",
"$",
"inputContainerTemplate",
"=",
"$",
"options",
"[",
"'options'",
"]",
"[",
"'type'",
"]",
".",
"'Container'",
".",
"$",
"options",
"[",
"'errorSuffix'",
"]",
";",
"if",
"... | Generates an input container template
@param array $options The options for input container template
@return string The generated input container template | [
"Generates",
"an",
"input",
"container",
"template"
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L301-L321 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper._addEntityContent | protected function _addEntityContent($request, $data)
{
if ($data['entity'] instanceof EntityInterface) {
return new EntityContext($request, $data);
}
if (is_array($data['entity']) && empty($data['entity']['schema'])) {
return new EntityContext($request, $data);
... | php | protected function _addEntityContent($request, $data)
{
if ($data['entity'] instanceof EntityInterface) {
return new EntityContext($request, $data);
}
if (is_array($data['entity']) && empty($data['entity']['schema'])) {
return new EntityContext($request, $data);
... | [
"protected",
"function",
"_addEntityContent",
"(",
"$",
"request",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"'entity'",
"]",
"instanceof",
"EntityInterface",
")",
"{",
"return",
"new",
"EntityContext",
"(",
"$",
"request",
",",
"$",
"data",... | Add the entity suite of context providers provided.
@param $request
@param $data
@return EntityContext | [
"Add",
"the",
"entity",
"suite",
"of",
"context",
"providers",
"provided",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L330-L339 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper._addFormArrayProvider | protected function _addFormArrayProvider()
{
$this->addContextProvider('array', function ($request, $data) {
if (is_array($data['entity']) && isset($data['entity']['schema'])) {
return new ArrayContext($request, $data['entity']);
}
});
} | php | protected function _addFormArrayProvider()
{
$this->addContextProvider('array', function ($request, $data) {
if (is_array($data['entity']) && isset($data['entity']['schema'])) {
return new ArrayContext($request, $data['entity']);
}
});
} | [
"protected",
"function",
"_addFormArrayProvider",
"(",
")",
"{",
"$",
"this",
"->",
"addContextProvider",
"(",
"'array'",
",",
"function",
"(",
"$",
"request",
",",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
"[",
"'entity'",
"]",
")"... | Add the array suite of context providers provided.
@return void | [
"Add",
"the",
"array",
"suite",
"of",
"context",
"providers",
"provided",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L346-L353 |
CakeCMS/Core | src/View/Helper/FormHelper.php | FormHelper._addFormContextProvider | protected function _addFormContextProvider()
{
$this->addContextProvider('form', function ($request, $data) {
if ($data['entity'] instanceof Form) {
return new FormContext($request, $data);
}
});
} | php | protected function _addFormContextProvider()
{
$this->addContextProvider('form', function ($request, $data) {
if ($data['entity'] instanceof Form) {
return new FormContext($request, $data);
}
});
} | [
"protected",
"function",
"_addFormContextProvider",
"(",
")",
"{",
"$",
"this",
"->",
"addContextProvider",
"(",
"'form'",
",",
"function",
"(",
"$",
"request",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"'entity'",
"]",
"instanceof",
"Form",... | Add the form suite of context providers provided.
@return void | [
"Add",
"the",
"form",
"suite",
"of",
"context",
"providers",
"provided",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L360-L367 |
iocaste/microservice-foundation | src/Http/Requests/Parameter/ValidatesParameters.php | ValidatesParameters.rules | public function rules(): array
{
$input = array_keys($this->request->all());
return Parameter::whereIn('id', $input)
->get()
->mapWithKeys(function ($item) {
return [$item['id'] => $item->rules];
})->all();
} | php | public function rules(): array
{
$input = array_keys($this->request->all());
return Parameter::whereIn('id', $input)
->get()
->mapWithKeys(function ($item) {
return [$item['id'] => $item->rules];
})->all();
} | [
"public",
"function",
"rules",
"(",
")",
":",
"array",
"{",
"$",
"input",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"request",
"->",
"all",
"(",
")",
")",
";",
"return",
"Parameter",
"::",
"whereIn",
"(",
"'id'",
",",
"$",
"input",
")",
"->",
"get... | Get the validation rules that apply to the request.
@return array | [
"Get",
"the",
"validation",
"rules",
"that",
"apply",
"to",
"the",
"request",
"."
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Requests/Parameter/ValidatesParameters.php#L28-L37 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.defineTask | public function defineTask($name, $object)
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
if ($this->started)
throw new \Exception("Define tasks before start()ing the daemon not after");
if (! $object instanceof AbstractTask)
throw ... | php | public function defineTask($name, $object)
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
if ($this->started)
throw new \Exception("Define tasks before start()ing the daemon not after");
if (! $object instanceof AbstractTask)
throw ... | [
"public",
"function",
"defineTask",
"(",
"$",
"name",
",",
"$",
"object",
")",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
")",
";",
"$",
"debug",
"=",
"@",
"$",
"options",
"[",
"'debug'",
"]",
"===",
"true",
";",
"if",
"(",
"$",
... | Add task to the list of known tasks
@param string $name
@param AbstractTask $object
@return TaskDaemon | [
"Add",
"task",
"to",
"the",
"list",
"of",
"known",
"tasks"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L94-L112 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.runTask | public function runTask($name, $data = null, $allowDuplicates = false)
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
if ($debug)
echo "==> Trying to run task: $name" . PHP_EOL;
$function = $options['namespace'] . '-' . $name;
$data = j... | php | public function runTask($name, $data = null, $allowDuplicates = false)
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
if ($debug)
echo "==> Trying to run task: $name" . PHP_EOL;
$function = $options['namespace'] . '-' . $name;
$data = j... | [
"public",
"function",
"runTask",
"(",
"$",
"name",
",",
"$",
"data",
"=",
"null",
",",
"$",
"allowDuplicates",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
")",
";",
"$",
"debug",
"=",
"@",
"$",
"options",
"[",
"'... | Add known task to the run queue
@param string $name
@param mixed $data
@param boolean $allowDuplicates
@return TaskDaemon | [
"Add",
"known",
"task",
"to",
"the",
"run",
"queue"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L122-L146 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.ping | public function ping()
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
$gmClient = new GearmanClient();
$gmClient->addServer($options['gearman']['host'], $options['gearman']['port']);
$ping = $gmClient->ping(self::generateUnique());
if ($de... | php | public function ping()
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
$gmClient = new GearmanClient();
$gmClient->addServer($options['gearman']['host'], $options['gearman']['port']);
$ping = $gmClient->ping(self::generateUnique());
if ($de... | [
"public",
"function",
"ping",
"(",
")",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
")",
";",
"$",
"debug",
"=",
"@",
"$",
"options",
"[",
"'debug'",
"]",
"===",
"true",
";",
"$",
"gmClient",
"=",
"new",
"GearmanClient",
"(",
")",
... | Ping job servers
@return TaskDaemon | [
"Ping",
"job",
"servers"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L153-L171 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.getPid | public function getPid()
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
$pidFile = $options['pid_file'];
if (!$pidFile)
throw new \Exception("No pid_file in the config");
$fpPid = fopen($pidFile, "c");
if (!$fpPid)
t... | php | public function getPid()
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
$pidFile = $options['pid_file'];
if (!$pidFile)
throw new \Exception("No pid_file in the config");
$fpPid = fopen($pidFile, "c");
if (!$fpPid)
t... | [
"public",
"function",
"getPid",
"(",
")",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
")",
";",
"$",
"debug",
"=",
"@",
"$",
"options",
"[",
"'debug'",
"]",
"===",
"true",
";",
"$",
"pidFile",
"=",
"$",
"options",
"[",
"'pid_file'",
... | Get daemon PID
@return integer|false Returns false if there is no daemon running | [
"Get",
"daemon",
"PID"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L178-L200 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.start | public function start()
{
if (count($this->tasks) == 0)
throw new \Exception("There are no tasks defined - can not start");
$this->started = true;
$options = static::getOptions();
$debug = @$options['debug'] === true;
$pidFile = $options['pid_file'];
if... | php | public function start()
{
if (count($this->tasks) == 0)
throw new \Exception("There are no tasks defined - can not start");
$this->started = true;
$options = static::getOptions();
$debug = @$options['debug'] === true;
$pidFile = $options['pid_file'];
if... | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"tasks",
")",
"==",
"0",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"\"There are no tasks defined - can not start\"",
")",
";",
"$",
"this",
"->",
"started",
"=",
... | Start the daemon with workers (by fork()ing)
@return TaskDaemon | [
"Start",
"the",
"daemon",
"with",
"workers",
"(",
"by",
"fork",
"()",
"ing",
")"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L207-L351 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.stop | public function stop()
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
$pidFile = $options['pid_file'];
if (!$pidFile)
throw new \Exception("No pid_file in the config");
$fpPid = fopen($pidFile, "c");
if (!$fpPid)
thr... | php | public function stop()
{
$options = static::getOptions();
$debug = @$options['debug'] === true;
$pidFile = $options['pid_file'];
if (!$pidFile)
throw new \Exception("No pid_file in the config");
$fpPid = fopen($pidFile, "c");
if (!$fpPid)
thr... | [
"public",
"function",
"stop",
"(",
")",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
")",
";",
"$",
"debug",
"=",
"@",
"$",
"options",
"[",
"'debug'",
"]",
"===",
"true",
";",
"$",
"pidFile",
"=",
"$",
"options",
"[",
"'pid_file'",
... | Stop the daemon
@return TaskDaemon | [
"Stop",
"the",
"daemon"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L358-L386 |
basarevych/task-daemon | library/TaskDaemon/TaskDaemon.php | TaskDaemon.restart | public function restart()
{
if (count($this->tasks) == 0)
throw new \Exception("There are no tasks defined - can not restart");
$this->stop();
do {
sleep(1);
} while ($this->getPid() !== false);
$this->start();
} | php | public function restart()
{
if (count($this->tasks) == 0)
throw new \Exception("There are no tasks defined - can not restart");
$this->stop();
do {
sleep(1);
} while ($this->getPid() !== false);
$this->start();
} | [
"public",
"function",
"restart",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"tasks",
")",
"==",
"0",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"\"There are no tasks defined - can not restart\"",
")",
";",
"$",
"this",
"->",
"stop",
"(",
... | Restart the daemon
@return TaskDaemon | [
"Restart",
"the",
"daemon"
] | train | https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L393-L405 |
sparwelt/imgix-lib | src/Components/CdnSelector.php | CdnSelector.getCdnForImage | public function getCdnForImage($originalUr)
{
if (0 === strpos($originalUr, 'data:')) {
throw new ResolutionException('Encoded image are not resolvable');
}
foreach ($this->cdnConfigurations as $configuration) {
$originalPath = parse_url($originalUr, PHP_URL_PATH);
... | php | public function getCdnForImage($originalUr)
{
if (0 === strpos($originalUr, 'data:')) {
throw new ResolutionException('Encoded image are not resolvable');
}
foreach ($this->cdnConfigurations as $configuration) {
$originalPath = parse_url($originalUr, PHP_URL_PATH);
... | [
"public",
"function",
"getCdnForImage",
"(",
"$",
"originalUr",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"originalUr",
",",
"'data:'",
")",
")",
"{",
"throw",
"new",
"ResolutionException",
"(",
"'Encoded image are not resolvable'",
")",
";",
"}",
... | @param string $originalUr
@return CdnConfiguration
@throws \Sparwelt\ImgixLib\Exception\ResolutionException | [
"@param",
"string",
"$originalUr"
] | train | https://github.com/sparwelt/imgix-lib/blob/330e1db2bed71bc283e5a2da6246528f240939ec/src/Components/CdnSelector.php#L32-L58 |
sparwelt/imgix-lib | src/Components/CdnSelector.php | CdnSelector.isDomainMatch | private function isDomainMatch($imageHost, array $sourceDomains)
{
if (null === $imageHost) {
return empty($sourceDomains) || in_array(null, $sourceDomains);
}
if (in_array($imageHost, $sourceDomains)) {
return true;
}
// check sub domain
$im... | php | private function isDomainMatch($imageHost, array $sourceDomains)
{
if (null === $imageHost) {
return empty($sourceDomains) || in_array(null, $sourceDomains);
}
if (in_array($imageHost, $sourceDomains)) {
return true;
}
// check sub domain
$im... | [
"private",
"function",
"isDomainMatch",
"(",
"$",
"imageHost",
",",
"array",
"$",
"sourceDomains",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"imageHost",
")",
"{",
"return",
"empty",
"(",
"$",
"sourceDomains",
")",
"||",
"in_array",
"(",
"null",
",",
"$",... | @param string $imageHost
@param array $sourceDomains
@return bool | [
"@param",
"string",
"$imageHost",
"@param",
"array",
"$sourceDomains"
] | train | https://github.com/sparwelt/imgix-lib/blob/330e1db2bed71bc283e5a2da6246528f240939ec/src/Components/CdnSelector.php#L66-L83 |
sparwelt/imgix-lib | src/Components/CdnSelector.php | CdnSelector.isPatternMatch | protected function isPatternMatch(CdnConfiguration $configuration, $imagePath)
{
if (empty($configuration->getPathPatterns())) {
return true;
}
foreach ($configuration->getPathPatterns() as $pattern) {
if (preg_match(sprintf('~%s~', $pattern), $imagePath)) {
... | php | protected function isPatternMatch(CdnConfiguration $configuration, $imagePath)
{
if (empty($configuration->getPathPatterns())) {
return true;
}
foreach ($configuration->getPathPatterns() as $pattern) {
if (preg_match(sprintf('~%s~', $pattern), $imagePath)) {
... | [
"protected",
"function",
"isPatternMatch",
"(",
"CdnConfiguration",
"$",
"configuration",
",",
"$",
"imagePath",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"configuration",
"->",
"getPathPatterns",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"foreach",... | @param CdnConfiguration $configuration
@param string $imagePath
@return bool | [
"@param",
"CdnConfiguration",
"$configuration",
"@param",
"string",
"$imagePath"
] | train | https://github.com/sparwelt/imgix-lib/blob/330e1db2bed71bc283e5a2da6246528f240939ec/src/Components/CdnSelector.php#L91-L104 |
ruvents/ruwork-upload-bundle | Form/Saver/Saver.php | Saver.save | public function save(): void
{
/** @var FormInterface $form */
foreach ($this->storage as $key => [$form, $saver]) {
unset($this->storage[$key]);
$upload = $form->getData();
if (null === $upload || !$form->isValid() || $form->getRoot()->isValid()) {
... | php | public function save(): void
{
/** @var FormInterface $form */
foreach ($this->storage as $key => [$form, $saver]) {
unset($this->storage[$key]);
$upload = $form->getData();
if (null === $upload || !$form->isValid() || $form->getRoot()->isValid()) {
... | [
"public",
"function",
"save",
"(",
")",
":",
"void",
"{",
"/** @var FormInterface $form */",
"foreach",
"(",
"$",
"this",
"->",
"storage",
"as",
"$",
"key",
"=>",
"[",
"$",
"form",
",",
"$",
"saver",
"]",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"s... | {@inheritdoc} | [
"{"
] | train | https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/Form/Saver/Saver.php#L24-L38 |
inpsyde/inpsyde-filter | src/WordPress/SanitizeTextField.php | SanitizeTextField.filter | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return sanitize_text_field( $value );
} | php | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return sanitize_text_field( $value );
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not string or empty.'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/SanitizeTextField.php#L18-L27 |
phpmob/changmin | src/PhpMob/CmsBundle/Twig/TemplateLoader.php | TemplateLoader.exists | public function exists($name)
{
$name = (string)$name;
if (isset($this->hits[$name])) {
return true;
}
try {
$this->hits[$name] = $this->findTemplate($name);
} catch (\Twig_Error_Loader $e) {
return false;
}
return true;
... | php | public function exists($name)
{
$name = (string)$name;
if (isset($this->hits[$name])) {
return true;
}
try {
$this->hits[$name] = $this->findTemplate($name);
} catch (\Twig_Error_Loader $e) {
return false;
}
return true;
... | [
"public",
"function",
"exists",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"(",
"string",
")",
"$",
"name",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"hits",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"try",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Twig/TemplateLoader.php#L80-L95 |
phpmob/changmin | src/PhpMob/CmsBundle/Twig/TemplateLoader.php | TemplateLoader.getLastUpdated | private function getLastUpdated(string $name)
{
if (!isset($this->hits[$name])) {
$this->hits[$name] = $this->findTemplate($name);
}
return $this->hits[$name]
->getUpdatedAt()
->getTimestamp();
} | php | private function getLastUpdated(string $name)
{
if (!isset($this->hits[$name])) {
$this->hits[$name] = $this->findTemplate($name);
}
return $this->hits[$name]
->getUpdatedAt()
->getTimestamp();
} | [
"private",
"function",
"getLastUpdated",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"hits",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"hits",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"-... | @param $name
@return integer | [
"@param",
"$name"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Twig/TemplateLoader.php#L102-L111 |
phpmob/changmin | src/PhpMob/CmsBundle/Twig/TemplateLoader.php | TemplateLoader.findTemplate | private function findTemplate(string $name)
{
if (!preg_match(sprintf('|^%s|', preg_quote(self::PREFIX)), $name)) {
$prefix = self::PREFIX;
throw new \Twig_Error_Loader("Only supported template starts with $prefix.");
}
if ($template = $this->repository->findTemplate... | php | private function findTemplate(string $name)
{
if (!preg_match(sprintf('|^%s|', preg_quote(self::PREFIX)), $name)) {
$prefix = self::PREFIX;
throw new \Twig_Error_Loader("Only supported template starts with $prefix.");
}
if ($template = $this->repository->findTemplate... | [
"private",
"function",
"findTemplate",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"sprintf",
"(",
"'|^%s|'",
",",
"preg_quote",
"(",
"self",
"::",
"PREFIX",
")",
")",
",",
"$",
"name",
")",
")",
"{",
"$",
"prefix",
"=",
... | @param string $name
@return null|object|TemplateInterface
@throws \Twig_Error_Loader | [
"@param",
"string",
"$name"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Twig/TemplateLoader.php#L129-L143 |
PortaText/php-sdk | src/PortaText/Command/Api/Campaigns.php | Campaigns.getEndpoint | protected function getEndpoint($method)
{
$endpoint = "campaigns";
$campaignId = $this->getArgument("id");
if (!is_null($campaignId)) {
$endpoint .= "/$campaignId";
$this->delArgument("id");
$this->delArgument("type");
}
$contacts = $this->... | php | protected function getEndpoint($method)
{
$endpoint = "campaigns";
$campaignId = $this->getArgument("id");
if (!is_null($campaignId)) {
$endpoint .= "/$campaignId";
$this->delArgument("id");
$this->delArgument("type");
}
$contacts = $this->... | [
"protected",
"function",
"getEndpoint",
"(",
"$",
"method",
")",
"{",
"$",
"endpoint",
"=",
"\"campaigns\"",
";",
"$",
"campaignId",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"id\"",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"campaignId",
")",
... | Returns a string with the endpoint for the given command.
@param string $method Method for this command.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"endpoint",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Campaigns.php#L173-L212 |
PortaText/php-sdk | src/PortaText/Command/Api/Campaigns.php | Campaigns.setSetting | protected function setSetting($name, $value)
{
$args = $this->getArgument("settings");
if (is_null($args)) {
$args = array();
}
$args[$name] = $value;
return $this->setArgument("settings", $args);
} | php | protected function setSetting($name, $value)
{
$args = $this->getArgument("settings");
if (is_null($args)) {
$args = array();
}
$args[$name] = $value;
return $this->setArgument("settings", $args);
} | [
"protected",
"function",
"setSetting",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"settings\"",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"args",
")",
")",
"{",
"$",
"args",
"=",
"array... | Set a campaign setting.
@param string $name Setting name.
@param mixed $value Setting value.
@return PortaText\Command\ICommand | [
"Set",
"a",
"campaign",
"setting",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Campaigns.php#L222-L230 |
cordoval/TodoList | lib/Fazer/TodoList.php | TodoList.initSQLs | private function initSQLs($listName)
{
$this->create = 'CREATE TABLE IF NOT EXISTS '.$listName.' (name VARCHAR(32) PRIMARY KEY, status INT)';
$this->select = 'SELECT * FROM '.$listName;
$this->insert = 'INSERT INTO '.$listName.' VALUES (?,?)';
$this->update = 'UPDATE '.$listName.' SE... | php | private function initSQLs($listName)
{
$this->create = 'CREATE TABLE IF NOT EXISTS '.$listName.' (name VARCHAR(32) PRIMARY KEY, status INT)';
$this->select = 'SELECT * FROM '.$listName;
$this->insert = 'INSERT INTO '.$listName.' VALUES (?,?)';
$this->update = 'UPDATE '.$listName.' SE... | [
"private",
"function",
"initSQLs",
"(",
"$",
"listName",
")",
"{",
"$",
"this",
"->",
"create",
"=",
"'CREATE TABLE IF NOT EXISTS '",
".",
"$",
"listName",
".",
"' (name VARCHAR(32) PRIMARY KEY, status INT)'",
";",
"$",
"this",
"->",
"select",
"=",
"'SELECT * FROM '... | initialize SQLs
@param $listName | [
"initialize",
"SQLs"
] | train | https://github.com/cordoval/TodoList/blob/a7864768e99c0c2f7ea1f7b6a5186cfeed1c0011/lib/Fazer/TodoList.php#L47-L54 |
phpmob/changmin | src/PhpMob/MediaBundle/Model/File.php | File.setFile | public function setFile(\SplFileInfo $file)
{
$this->file = $file;
$this->updatedAt = new \DateTime();
if ($this->owner) {
$this->owner->setUpdatedAt($this->updatedAt);
$this->basePath = $this->owner->getFileBasePath();
}
} | php | public function setFile(\SplFileInfo $file)
{
$this->file = $file;
$this->updatedAt = new \DateTime();
if ($this->owner) {
$this->owner->setUpdatedAt($this->updatedAt);
$this->basePath = $this->owner->getFileBasePath();
}
} | [
"public",
"function",
"setFile",
"(",
"\\",
"SplFileInfo",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"file",
"=",
"$",
"file",
";",
"$",
"this",
"->",
"updatedAt",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"owner",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Model/File.php#L84-L93 |
phpmob/changmin | src/PhpMob/MediaBundle/Model/File.php | File.setOwner | public function setOwner(FileAwareInterface $owner)
{
$this->owner = $owner;
$this->basePath = $owner->getFileBasePath();
$owner->setUpdatedAt($this->updatedAt = new \DateTime());
} | php | public function setOwner(FileAwareInterface $owner)
{
$this->owner = $owner;
$this->basePath = $owner->getFileBasePath();
$owner->setUpdatedAt($this->updatedAt = new \DateTime());
} | [
"public",
"function",
"setOwner",
"(",
"FileAwareInterface",
"$",
"owner",
")",
"{",
"$",
"this",
"->",
"owner",
"=",
"$",
"owner",
";",
"$",
"this",
"->",
"basePath",
"=",
"$",
"owner",
"->",
"getFileBasePath",
"(",
")",
";",
"$",
"owner",
"->",
"setU... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Model/File.php#L154-L159 |
benmanu/silverstripe-knowledgebase | code/controller/KnowledgebasePage_Controller.php | KnowledgebasePage_Controller.getSearchQuery | protected function getSearchQuery($keywords)
{
$query = parent::getSearchQuery($keywords);
// add hook to modify search query
$this->extend('updateSearchQuery', $query);
return $query;
} | php | protected function getSearchQuery($keywords)
{
$query = parent::getSearchQuery($keywords);
// add hook to modify search query
$this->extend('updateSearchQuery', $query);
return $query;
} | [
"protected",
"function",
"getSearchQuery",
"(",
"$",
"keywords",
")",
"{",
"$",
"query",
"=",
"parent",
"::",
"getSearchQuery",
"(",
"$",
"keywords",
")",
";",
"// add hook to modify search query",
"$",
"this",
"->",
"extend",
"(",
"'updateSearchQuery'",
",",
"$... | Builds a search query from a given search term.
Also has an extension hook which allows you to modify the parameters
of the query.
@param string $keywords
@return SearchQuery | [
"Builds",
"a",
"search",
"query",
"from",
"a",
"given",
"search",
"term",
"."
] | train | https://github.com/benmanu/silverstripe-knowledgebase/blob/db19bfd4836f43da17ab52e8b53e72a11be64210/code/controller/KnowledgebasePage_Controller.php#L34-L42 |
benmanu/silverstripe-knowledgebase | code/controller/KnowledgebasePage_Controller.php | KnowledgebasePage_Controller.parseSearchResults | protected function parseSearchResults($results, $suggestion, $keywords)
{
$renderData = parent::parseSearchResults($results, $suggestion, $keywords);
// adding hook to allow checks or additional data to be passed to the Search Results
$this->extend('updateParseSearchResults', $renderData);
... | php | protected function parseSearchResults($results, $suggestion, $keywords)
{
$renderData = parent::parseSearchResults($results, $suggestion, $keywords);
// adding hook to allow checks or additional data to be passed to the Search Results
$this->extend('updateParseSearchResults', $renderData);
... | [
"protected",
"function",
"parseSearchResults",
"(",
"$",
"results",
",",
"$",
"suggestion",
",",
"$",
"keywords",
")",
"{",
"$",
"renderData",
"=",
"parent",
"::",
"parseSearchResults",
"(",
"$",
"results",
",",
"$",
"suggestion",
",",
"$",
"keywords",
")",
... | Overloading view method purely to provide a hook for others to add extra
checks or pass additional data to the Search Results.
@param array $results
@param array $suggestion
@param string $keywords
@return array | [
"Overloading",
"view",
"method",
"purely",
"to",
"provide",
"a",
"hook",
"for",
"others",
"to",
"add",
"extra",
"checks",
"or",
"pass",
"additional",
"data",
"to",
"the",
"Search",
"Results",
"."
] | train | https://github.com/benmanu/silverstripe-knowledgebase/blob/db19bfd4836f43da17ab52e8b53e72a11be64210/code/controller/KnowledgebasePage_Controller.php#L70-L78 |
ruvents/ruwork-upload-bundle | Metadata/MetadataFactory.php | MetadataFactory.getMetadata | public function getMetadata(string $class): Metadata
{
$reflection = new \ReflectionClass($class);
$pathProperty = null;
$attributes = [];
foreach ($reflection->getProperties() as $reflectionProperty) {
$property = $reflectionProperty->getName();
foreach ($t... | php | public function getMetadata(string $class): Metadata
{
$reflection = new \ReflectionClass($class);
$pathProperty = null;
$attributes = [];
foreach ($reflection->getProperties() as $reflectionProperty) {
$property = $reflectionProperty->getName();
foreach ($t... | [
"public",
"function",
"getMetadata",
"(",
"string",
"$",
"class",
")",
":",
"Metadata",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"pathProperty",
"=",
"null",
";",
"$",
"attributes",
"=",
"[",
"]",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/Metadata/MetadataFactory.php#L24-L47 |
phrest/sdk | src/PhrestSDK.php | PhrestSDK.setApp | public function setApp(PhrestAPI $app)
{
$this->app = $app;
$this->app->isInternalRequest = true;
return $this;
} | php | public function setApp(PhrestAPI $app)
{
$this->app = $app;
$this->app->isInternalRequest = true;
return $this;
} | [
"public",
"function",
"setApp",
"(",
"PhrestAPI",
"$",
"app",
")",
"{",
"$",
"this",
"->",
"app",
"=",
"$",
"app",
";",
"$",
"this",
"->",
"app",
"->",
"isInternalRequest",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}"
] | Set the API instance
@param PhrestAPI $app
@return $this | [
"Set",
"the",
"API",
"instance"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L87-L93 |
phrest/sdk | src/PhrestSDK.php | PhrestSDK.getRawResponse | private function getRawResponse(
$method,
$path,
RequestOptions $options = null
)
{
// Backup super globals
$request = $_REQUEST;
$post = $_POST;
$get = $_GET;
$server = $_SERVER;
// Override the request params
$_GET = $options ? $options->getGetParams() : [];
$_POST = $... | php | private function getRawResponse(
$method,
$path,
RequestOptions $options = null
)
{
// Backup super globals
$request = $_REQUEST;
$post = $_POST;
$get = $_GET;
$server = $_SERVER;
// Override the request params
$_GET = $options ? $options->getGetParams() : [];
$_POST = $... | [
"private",
"function",
"getRawResponse",
"(",
"$",
"method",
",",
"$",
"path",
",",
"RequestOptions",
"$",
"options",
"=",
"null",
")",
"{",
"// Backup super globals",
"$",
"request",
"=",
"$",
"_REQUEST",
";",
"$",
"post",
"=",
"$",
"_POST",
";",
"$",
"... | Gets a raw response from the internal API
This will trick Phalcon into thinking its a
real PUT, POST, PATCH, GET or DELETE request
It will override the Default DI (Which will be the current site)
and will restore everything after the request
It seems hacky, but I am not sure if there is any better way, please
submit a ... | [
"Gets",
"a",
"raw",
"response",
"from",
"the",
"internal",
"API",
"This",
"will",
"trick",
"Phalcon",
"into",
"thinking",
"its",
"a",
"real",
"PUT",
"POST",
"PATCH",
"GET",
"or",
"DELETE",
"request",
"It",
"will",
"override",
"the",
"Default",
"DI",
"(",
... | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L126-L198 |
phrest/sdk | src/PhrestSDK.php | PhrestSDK.getResponse | public static function getResponse(
$method,
$path,
RequestOptions $options = null
)
{
$instance = static::getInstance();
if ($options)
{
// Get via HTTP
if (isset($instance->url) && $options->isHttp())
{
return $instance->getHTTPResponse($method, $path, $options);... | php | public static function getResponse(
$method,
$path,
RequestOptions $options = null
)
{
$instance = static::getInstance();
if ($options)
{
// Get via HTTP
if (isset($instance->url) && $options->isHttp())
{
return $instance->getHTTPResponse($method, $path, $options);... | [
"public",
"static",
"function",
"getResponse",
"(",
"$",
"method",
",",
"$",
"path",
",",
"RequestOptions",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"instance",
"=",
"static",
"::",
"getInstance",
"(",
")",
";",
"if",
"(",
"$",
"options",
")",
"{",
... | @param $method
@param $path
@param RequestOptions $options
@return Response|string
@throws \Phalcon\Exception | [
"@param",
"$method",
"@param",
"$path",
"@param",
"RequestOptions",
"$options"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L208-L236 |
phrest/sdk | src/PhrestSDK.php | PhrestSDK.get | public static function get($path, RequestOptions $options = null)
{
return self::getResponse(RequestMethodEnum::GET, $path, $options);
} | php | public static function get($path, RequestOptions $options = null)
{
return self::getResponse(RequestMethodEnum::GET, $path, $options);
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"path",
",",
"RequestOptions",
"$",
"options",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"getResponse",
"(",
"RequestMethodEnum",
"::",
"GET",
",",
"$",
"path",
",",
"$",
"options",
")",
";",
"}"
] | Makes a GET call based on path/url
@param $path
@return Response | [
"Makes",
"a",
"GET",
"call",
"based",
"on",
"path",
"/",
"url"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L245-L248 |
phrest/sdk | src/PhrestSDK.php | PhrestSDK.getHTTPResponse | private function getHTTPResponse(
$method,
$path,
RequestOptions $options = null
)
{
$client = new Client();
// Build body
$body = new PostBody();
if ($options)
{
foreach ($options->getPostParams() as $name => $value)
{
$body->setField($name, $value);
}
... | php | private function getHTTPResponse(
$method,
$path,
RequestOptions $options = null
)
{
$client = new Client();
// Build body
$body = new PostBody();
if ($options)
{
foreach ($options->getPostParams() as $name => $value)
{
$body->setField($name, $value);
}
... | [
"private",
"function",
"getHTTPResponse",
"(",
"$",
"method",
",",
"$",
"path",
",",
"RequestOptions",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"// Build body",
"$",
"body",
"=",
"new",
"PostBody",
"(",
... | Makes a cURL HTTP request to the API and returns the response
todo this needs to also handle PUT, POST, DELETE
@param string $method
@param $path
@param RequestOptions $options
@throws \Exception
@return string | [
"Makes",
"a",
"cURL",
"HTTP",
"request",
"to",
"the",
"API",
"and",
"returns",
"the",
"response",
"todo",
"this",
"needs",
"to",
"also",
"handle",
"PUT",
"POST",
"DELETE"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L314-L354 |
lelivrescolaire/SQSBundle | Model/Queue.php | Queue.getARN | public function getARN()
{
if (!$this->arn) {
$this->arn = $this->sqs->getClient()->getQueueArn($this->url);
}
return $this->arn;
} | php | public function getARN()
{
if (!$this->arn) {
$this->arn = $this->sqs->getClient()->getQueueArn($this->url);
}
return $this->arn;
} | [
"public",
"function",
"getARN",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"arn",
")",
"{",
"$",
"this",
"->",
"arn",
"=",
"$",
"this",
"->",
"sqs",
"->",
"getClient",
"(",
")",
"->",
"getQueueArn",
"(",
"$",
"this",
"->",
"url",
")",
";... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/Queue.php#L66-L73 |
lelivrescolaire/SQSBundle | Model/Queue.php | Queue.getUrl | public function getUrl()
{
if (!$this->url) {
$this->url = trim($this->sqs->getClient()->getQueueUrl(array(
'QueueName' => $this->getName(),
))->get('QueueUrl'));
}
return $this->url;
} | php | public function getUrl()
{
if (!$this->url) {
$this->url = trim($this->sqs->getClient()->getQueueUrl(array(
'QueueName' => $this->getName(),
))->get('QueueUrl'));
}
return $this->url;
} | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"url",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"trim",
"(",
"$",
"this",
"->",
"sqs",
"->",
"getClient",
"(",
")",
"->",
"getQueueUrl",
"(",
"array",
"(",
"'QueueN... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/Queue.php#L88-L97 |
lelivrescolaire/SQSBundle | Model/Queue.php | Queue.addPermission | public function addPermission($label, array $awsAccountId, array $actionName)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'Label' => $label,
'AWSAccountIds' => $awsAccountId,
'Actions' => $actionName,
);
$this->sqs... | php | public function addPermission($label, array $awsAccountId, array $actionName)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'Label' => $label,
'AWSAccountIds' => $awsAccountId,
'Actions' => $actionName,
);
$this->sqs... | [
"public",
"function",
"addPermission",
"(",
"$",
"label",
",",
"array",
"$",
"awsAccountId",
",",
"array",
"$",
"actionName",
")",
"{",
"$",
"arguments",
"=",
"array",
"(",
"'QueueUrl'",
"=>",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"'Label'",
"=>",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/Queue.php#L112-L125 |
lelivrescolaire/SQSBundle | Model/Queue.php | Queue.removePermission | public function removePermission($label)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'Label' => $label
);
$this->sqs->getClient()->removePermission($arguments);
return $this;
} | php | public function removePermission($label)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'Label' => $label
);
$this->sqs->getClient()->removePermission($arguments);
return $this;
} | [
"public",
"function",
"removePermission",
"(",
"$",
"label",
")",
"{",
"$",
"arguments",
"=",
"array",
"(",
"'QueueUrl'",
"=>",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"'Label'",
"=>",
"$",
"label",
")",
";",
"$",
"this",
"->",
"sqs",
"->",
"getC... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/Queue.php#L130-L141 |
lelivrescolaire/SQSBundle | Model/Queue.php | Queue.deleteMessage | public function deleteMessage(MessageInterface $message)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'ReceiptHandle' => $message->getReceiptHandle()
);
$this->sqs->getClient()
->deleteMessage($arguments);
return $this;
} | php | public function deleteMessage(MessageInterface $message)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'ReceiptHandle' => $message->getReceiptHandle()
);
$this->sqs->getClient()
->deleteMessage($arguments);
return $this;
} | [
"public",
"function",
"deleteMessage",
"(",
"MessageInterface",
"$",
"message",
")",
"{",
"$",
"arguments",
"=",
"array",
"(",
"'QueueUrl'",
"=>",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"'ReceiptHandle'",
"=>",
"$",
"message",
"->",
"getReceiptHandle",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/Queue.php#L146-L157 |
lelivrescolaire/SQSBundle | Model/Queue.php | Queue.setAttributes | public function setAttributes(array $attributes)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'Attributes' => $attributes
);
$this->sqs->getClient()->setQueueAttributes($arguments);
return $this;
} | php | public function setAttributes(array $attributes)
{
$arguments = array(
'QueueUrl' => $this->getUrl(),
'Attributes' => $attributes
);
$this->sqs->getClient()->setQueueAttributes($arguments);
return $this;
} | [
"public",
"function",
"setAttributes",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"arguments",
"=",
"array",
"(",
"'QueueUrl'",
"=>",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"'Attributes'",
"=>",
"$",
"attributes",
")",
";",
"$",
"this",
"->",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/Queue.php#L162-L172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.