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 |
|---|---|---|---|---|---|---|---|---|---|---|
mattsparks/the-stringler | src/Manipulator.php | Manipulator.htmlEntities | public function htmlEntities($flags = ENT_HTML5, string $encoding = 'UTF-8', bool $doubleEncode = true) : Manipulator
{
return new static(htmlentities($this->string, $flags, $encoding, $doubleEncode));
} | php | public function htmlEntities($flags = ENT_HTML5, string $encoding = 'UTF-8', bool $doubleEncode = true) : Manipulator
{
return new static(htmlentities($this->string, $flags, $encoding, $doubleEncode));
} | [
"public",
"function",
"htmlEntities",
"(",
"$",
"flags",
"=",
"ENT_HTML5",
",",
"string",
"$",
"encoding",
"=",
"'UTF-8'",
",",
"bool",
"$",
"doubleEncode",
"=",
"true",
")",
":",
"Manipulator",
"{",
"return",
"new",
"static",
"(",
"htmlentities",
"(",
"$"... | HTML Entities
@param constant $flags
@param string $encoding
@param boolean $doubleEncode
@return object|Manipulator | [
"HTML",
"Entities"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L174-L177 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.htmlSpecialCharacters | public function htmlSpecialCharacters($flags = ENT_HTML5, string $encoding = 'UTF-8', bool $doubleEncode = true) : Manipulator
{
return new static(htmlspecialchars($this->string, $flags, $encoding, $doubleEncode));
} | php | public function htmlSpecialCharacters($flags = ENT_HTML5, string $encoding = 'UTF-8', bool $doubleEncode = true) : Manipulator
{
return new static(htmlspecialchars($this->string, $flags, $encoding, $doubleEncode));
} | [
"public",
"function",
"htmlSpecialCharacters",
"(",
"$",
"flags",
"=",
"ENT_HTML5",
",",
"string",
"$",
"encoding",
"=",
"'UTF-8'",
",",
"bool",
"$",
"doubleEncode",
"=",
"true",
")",
":",
"Manipulator",
"{",
"return",
"new",
"static",
"(",
"htmlspecialchars",... | HTML Special Characters
@param constant $flags
@param string $encoding
@param boolean $doubleEncode
@return object|Manipulator | [
"HTML",
"Special",
"Characters"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L187-L190 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.pad | public function pad(int $length, string $string, $type = null) : Manipulator
{
return new static(str_pad($this->string, $length, $string, $type));
} | php | public function pad(int $length, string $string, $type = null) : Manipulator
{
return new static(str_pad($this->string, $length, $string, $type));
} | [
"public",
"function",
"pad",
"(",
"int",
"$",
"length",
",",
"string",
"$",
"string",
",",
"$",
"type",
"=",
"null",
")",
":",
"Manipulator",
"{",
"return",
"new",
"static",
"(",
"str_pad",
"(",
"$",
"this",
"->",
"string",
",",
"$",
"length",
",",
... | Pad
@param int
@param string
@param constant
@return object|Manipulator | [
"Pad"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L223-L226 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.pluralize | public function pluralize($items = null) : Manipulator
{
/**
* Optional parameter to determine if a string
* should be pluralized.
*/
if (!is_null($items)) {
$count = is_numeric($items) ? $items : count($items);
if ($count <= 1) {
r... | php | public function pluralize($items = null) : Manipulator
{
/**
* Optional parameter to determine if a string
* should be pluralized.
*/
if (!is_null($items)) {
$count = is_numeric($items) ? $items : count($items);
if ($count <= 1) {
r... | [
"public",
"function",
"pluralize",
"(",
"$",
"items",
"=",
"null",
")",
":",
"Manipulator",
"{",
"/**\n * Optional parameter to determine if a string\n * should be pluralized.\n */",
"if",
"(",
"!",
"is_null",
"(",
"$",
"items",
")",
")",
"{",
"$... | Pluralize String
@param mixed
@return object|Manipulator | [
"Pluralize",
"String"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L234-L249 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.nthCharacter | public function nthCharacter(int $nth, \Closure $closure) : Manipulator
{
$count = 1;
$modifiedString = '';
foreach (str_split($this->string) as $character) {
$modifiedString .= $count === $nth ? $closure($character) : $character;
$count++;
}
return ... | php | public function nthCharacter(int $nth, \Closure $closure) : Manipulator
{
$count = 1;
$modifiedString = '';
foreach (str_split($this->string) as $character) {
$modifiedString .= $count === $nth ? $closure($character) : $character;
$count++;
}
return ... | [
"public",
"function",
"nthCharacter",
"(",
"int",
"$",
"nth",
",",
"\\",
"Closure",
"$",
"closure",
")",
":",
"Manipulator",
"{",
"$",
"count",
"=",
"1",
";",
"$",
"modifiedString",
"=",
"''",
";",
"foreach",
"(",
"str_split",
"(",
"$",
"this",
"->",
... | Perfrom an action on the nth character.
@param int
@param Closure
@return object|Manipulator | [
"Perfrom",
"an",
"action",
"on",
"the",
"nth",
"character",
"."
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L269-L280 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.nthWord | public function nthWord(int $nth, \Closure $closure, bool $preserveSpaces = true) : Manipulator
{
$count = 1;
$modifiedString = '';
foreach (explode(' ', $this->string) as $word) {
$modifiedString .= $count === $nth ? $closure($word) : $word;
$modifiedString .= $pres... | php | public function nthWord(int $nth, \Closure $closure, bool $preserveSpaces = true) : Manipulator
{
$count = 1;
$modifiedString = '';
foreach (explode(' ', $this->string) as $word) {
$modifiedString .= $count === $nth ? $closure($word) : $word;
$modifiedString .= $pres... | [
"public",
"function",
"nthWord",
"(",
"int",
"$",
"nth",
",",
"\\",
"Closure",
"$",
"closure",
",",
"bool",
"$",
"preserveSpaces",
"=",
"true",
")",
":",
"Manipulator",
"{",
"$",
"count",
"=",
"1",
";",
"$",
"modifiedString",
"=",
"''",
";",
"foreach",... | Perform an action on the nth word.
@param int
@param Closure
@param boolean
@return object|Manipulator | [
"Perform",
"an",
"action",
"on",
"the",
"nth",
"word",
"."
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L290-L302 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.remove | public function remove(string $string, bool $caseSensitive = true) : Manipulator
{
return new static($this->replace($string, '', $caseSensitive)->toString());
} | php | public function remove(string $string, bool $caseSensitive = true) : Manipulator
{
return new static($this->replace($string, '', $caseSensitive)->toString());
} | [
"public",
"function",
"remove",
"(",
"string",
"$",
"string",
",",
"bool",
"$",
"caseSensitive",
"=",
"true",
")",
":",
"Manipulator",
"{",
"return",
"new",
"static",
"(",
"$",
"this",
"->",
"replace",
"(",
"$",
"string",
",",
"''",
",",
"$",
"caseSens... | Remove from string.
@param string
@param boolean
@return object|Manipulator | [
"Remove",
"from",
"string",
"."
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L311-L314 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.removeSpecialCharacters | public function removeSpecialCharacters(array $exceptions = []) : Manipulator
{
$regEx = "/";
$regEx .= "[^\w\d";
foreach ($exceptions as $exception) {
$regEx .= "\\" . $exception;
}
$regEx .= "]/";
$modifiedString = preg_replace($regEx, '', $this->str... | php | public function removeSpecialCharacters(array $exceptions = []) : Manipulator
{
$regEx = "/";
$regEx .= "[^\w\d";
foreach ($exceptions as $exception) {
$regEx .= "\\" . $exception;
}
$regEx .= "]/";
$modifiedString = preg_replace($regEx, '', $this->str... | [
"public",
"function",
"removeSpecialCharacters",
"(",
"array",
"$",
"exceptions",
"=",
"[",
"]",
")",
":",
"Manipulator",
"{",
"$",
"regEx",
"=",
"\"/\"",
";",
"$",
"regEx",
".=",
"\"[^\\w\\d\"",
";",
"foreach",
"(",
"$",
"exceptions",
"as",
"$",
"exceptio... | Remove non-alphanumeric characters.
@param array
@return object|Manipulator | [
"Remove",
"non",
"-",
"alphanumeric",
"characters",
"."
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L322-L336 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.replace | public function replace(string $find, string $replace = '', bool $caseSensitive = true) : Manipulator
{
$replaced = $caseSensitive ? str_replace($find, $replace, $this->string) :
str_ireplace($find, $replace, $this->string);
return new static($replaced);
} | php | public function replace(string $find, string $replace = '', bool $caseSensitive = true) : Manipulator
{
$replaced = $caseSensitive ? str_replace($find, $replace, $this->string) :
str_ireplace($find, $replace, $this->string);
return new static($replaced);
} | [
"public",
"function",
"replace",
"(",
"string",
"$",
"find",
",",
"string",
"$",
"replace",
"=",
"''",
",",
"bool",
"$",
"caseSensitive",
"=",
"true",
")",
":",
"Manipulator",
"{",
"$",
"replaced",
"=",
"$",
"caseSensitive",
"?",
"str_replace",
"(",
"$",... | Replace
@param string $find
@param string $replace
@param bool $caseSensitive
@return object|Manipulator | [
"Replace"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L357-L363 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.snakeToCamel | public function snakeToCamel() : Manipulator
{
$modifiedString = $this->replace('_', ' ')
->capitalizeEach()
->lowercaseFirst()
->remove(' ')
->toString();
return new static($modifiedString);
} | php | public function snakeToCamel() : Manipulator
{
$modifiedString = $this->replace('_', ' ')
->capitalizeEach()
->lowercaseFirst()
->remove(' ')
->toString();
return new static($modifiedString);
} | [
"public",
"function",
"snakeToCamel",
"(",
")",
":",
"Manipulator",
"{",
"$",
"modifiedString",
"=",
"$",
"this",
"->",
"replace",
"(",
"'_'",
",",
"' '",
")",
"->",
"capitalizeEach",
"(",
")",
"->",
"lowercaseFirst",
"(",
")",
"->",
"remove",
"(",
"' '"... | Convert snake-case to camel-case.
@return object|Manipulator | [
"Convert",
"snake",
"-",
"case",
"to",
"camel",
"-",
"case",
"."
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L380-L389 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.snakeToClass | public function snakeToClass() : Manipulator
{
$modifiedString = $this->replace('_', ' ')
->toLower()
->capitalizeEach()
->replace(' ', '')
->toString();
return new static($modifiedString);
} | php | public function snakeToClass() : Manipulator
{
$modifiedString = $this->replace('_', ' ')
->toLower()
->capitalizeEach()
->replace(' ', '')
->toString();
return new static($modifiedString);
} | [
"public",
"function",
"snakeToClass",
"(",
")",
":",
"Manipulator",
"{",
"$",
"modifiedString",
"=",
"$",
"this",
"->",
"replace",
"(",
"'_'",
",",
"' '",
")",
"->",
"toLower",
"(",
")",
"->",
"capitalizeEach",
"(",
")",
"->",
"replace",
"(",
"' '",
",... | snakeToClass
@return object|Manipulator | [
"snakeToClass"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L396-L405 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.toCamelCase | public function toCamelCase() : Manipulator
{
$modifiedString = '';
foreach (explode(' ', $this->string) as $word) {
$modifiedString .= self::make($word)->toLower()->capitalize()->toString();
}
$final = self::make($modifiedString)
->replace(' ', '')
... | php | public function toCamelCase() : Manipulator
{
$modifiedString = '';
foreach (explode(' ', $this->string) as $word) {
$modifiedString .= self::make($word)->toLower()->capitalize()->toString();
}
$final = self::make($modifiedString)
->replace(' ', '')
... | [
"public",
"function",
"toCamelCase",
"(",
")",
":",
"Manipulator",
"{",
"$",
"modifiedString",
"=",
"''",
";",
"foreach",
"(",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"string",
")",
"as",
"$",
"word",
")",
"{",
"$",
"modifiedString",
".=",
"self... | Convert a string to camel-case.
@return object|Manipulator | [
"Convert",
"a",
"string",
"to",
"camel",
"-",
"case",
"."
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L423-L437 |
mattsparks/the-stringler | src/Manipulator.php | Manipulator.truncate | public function truncate(int $length = 100, string $append = '...') : Manipulator
{
return new static(mb_substr($this->string, 0, $length) . $append);
} | php | public function truncate(int $length = 100, string $append = '...') : Manipulator
{
return new static(mb_substr($this->string, 0, $length) . $append);
} | [
"public",
"function",
"truncate",
"(",
"int",
"$",
"length",
"=",
"100",
",",
"string",
"$",
"append",
"=",
"'...'",
")",
":",
"Manipulator",
"{",
"return",
"new",
"static",
"(",
"mb_substr",
"(",
"$",
"this",
"->",
"string",
",",
"0",
",",
"$",
"len... | Truncate
@param int $length
@param string $append
@return object|Manipulator | [
"Truncate"
] | train | https://github.com/mattsparks/the-stringler/blob/bc11319ae4330b8ee1ed7333934ff180423b5218/src/Manipulator.php#L547-L550 |
yuncms/framework | src/user/models/UserProfile.php | UserProfile.getCurrentName | public function getCurrentName()
{
switch ($this->current) {
case self::CURRENT_OTHER:
$currentName = Yii::t('yuncms', 'Other');
break;
case self::CURRENT_WORK:
$currentName = Yii::t('yuncms', 'Work');
break;
... | php | public function getCurrentName()
{
switch ($this->current) {
case self::CURRENT_OTHER:
$currentName = Yii::t('yuncms', 'Other');
break;
case self::CURRENT_WORK:
$currentName = Yii::t('yuncms', 'Work');
break;
... | [
"public",
"function",
"getCurrentName",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"current",
")",
"{",
"case",
"self",
"::",
"CURRENT_OTHER",
":",
"$",
"currentName",
"=",
"Yii",
"::",
"t",
"(",
"'yuncms'",
",",
"'Other'",
")",
";",
"break",
";"... | 获取职业的字符串标识
@return string | [
"获取职业的字符串标识"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/UserProfile.php#L189-L217 |
yuncms/framework | src/user/models/UserProfile.php | UserProfile.validateTimeZone | public function validateTimeZone($attribute)
{
if (!in_array($this->$attribute, timezone_identifiers_list())) {
$this->addError($attribute, Yii::t('yuncms', 'Time zone is not valid'));
}
} | php | public function validateTimeZone($attribute)
{
if (!in_array($this->$attribute, timezone_identifiers_list())) {
$this->addError($attribute, Yii::t('yuncms', 'Time zone is not valid'));
}
} | [
"public",
"function",
"validateTimeZone",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"$",
"attribute",
",",
"timezone_identifiers_list",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"attribut... | 验证时区
Adds an error when the specified time zone doesn't exist.
@param string $attribute the attribute being validated
@return void | [
"验证时区",
"Adds",
"an",
"error",
"when",
"the",
"specified",
"time",
"zone",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/UserProfile.php#L250-L255 |
inpsyde/inpsyde-filter | src/WordPress/StripTags.php | StripTags.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;
}
$strict = (bool) $this->options[ 'strict' ];
return wp_strip_all_tags( $v... | 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;
}
$strict = (bool) $this->options[ 'strict' ];
return wp_strip_all_tags( $v... | [
"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/StripTags.php#L25-L36 |
phpmob/changmin | src/PhpMob/CoreBundle/Context/ParameterContext.php | ParameterContext.get | public function get(string $parameter, $default = null)
{
if (false === $this->container->hasParameter($parameter)) {
return $default;
}
if (null === $value = $this->container->getParameter($parameter)) {
return $default;
}
return $value;
} | php | public function get(string $parameter, $default = null)
{
if (false === $this->container->hasParameter($parameter)) {
return $default;
}
if (null === $value = $this->container->getParameter($parameter)) {
return $default;
}
return $value;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"parameter",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"container",
"->",
"hasParameter",
"(",
"$",
"parameter",
")",
")",
"{",
"return",
"$",
"default",
... | @param string $parameter
@param null $default
@return mixed|null | [
"@param",
"string",
"$parameter",
"@param",
"null",
"$default"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Context/ParameterContext.php#L36-L47 |
GrahamDeprecated/CMS-Core | src/Classes/Viewer.php | Viewer.make | public function make($view, array $data = array(), $type = 'default')
{
if ($this->credentials->check()) {
if ($type === 'admin') {
if ($this->credentials->hasAccess('admin')) {
$data['site_name'] = 'Admin Panel';
$data['navigation'] = $thi... | php | public function make($view, array $data = array(), $type = 'default')
{
if ($this->credentials->check()) {
if ($type === 'admin') {
if ($this->credentials->hasAccess('admin')) {
$data['site_name'] = 'Admin Panel';
$data['navigation'] = $thi... | [
"public",
"function",
"make",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"type",
"=",
"'default'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"credentials",
"->",
"check",
"(",
")",
")",
"{",
"if",
"(",
"$",
"ty... | Get a evaluated view contents for the given view.
@param string $view
@param array $data
@param string $type
@return \Illuminate\View\View | [
"Get",
"a",
"evaluated",
"view",
"contents",
"for",
"the",
"given",
"view",
"."
] | train | https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/Classes/Viewer.php#L101-L122 |
yuncms/framework | src/broadcast/BaseMessage.php | BaseMessage.send | public function send(BroadcastInterface $broadcast = null)
{
if ($broadcast === null && $this->broadcast === null) {
$broadcast = Yii::$app->getBroadcast();
} elseif ($broadcast === null) {
$broadcast = $this->broadcast;
}
return $broadcast->send($this);
... | php | public function send(BroadcastInterface $broadcast = null)
{
if ($broadcast === null && $this->broadcast === null) {
$broadcast = Yii::$app->getBroadcast();
} elseif ($broadcast === null) {
$broadcast = $this->broadcast;
}
return $broadcast->send($this);
... | [
"public",
"function",
"send",
"(",
"BroadcastInterface",
"$",
"broadcast",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"broadcast",
"===",
"null",
"&&",
"$",
"this",
"->",
"broadcast",
"===",
"null",
")",
"{",
"$",
"broadcast",
"=",
"Yii",
"::",
"$",
"app",... | Sends this broadcast message.
@param BroadcastInterface $broadcast the broadcast that should be used to send this message.
If no broadcast is given it will first check if [[broadcast]] is set and if not,
the "broadcast" application component will be used instead.
@return bool whether this message is sent successfully. | [
"Sends",
"this",
"broadcast",
"message",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/broadcast/BaseMessage.php#L111-L120 |
drsdre/yii2-xmlsoccer | models/League.php | League.beforeSave | public function beforeSave($insert)
{
$this->latest_match = strtotime($this->latest_match);
return parent::beforeSave($insert);
} | php | public function beforeSave($insert)
{
$this->latest_match = strtotime($this->latest_match);
return parent::beforeSave($insert);
} | [
"public",
"function",
"beforeSave",
"(",
"$",
"insert",
")",
"{",
"$",
"this",
"->",
"latest_match",
"=",
"strtotime",
"(",
"$",
"this",
"->",
"latest_match",
")",
";",
"return",
"parent",
"::",
"beforeSave",
"(",
"$",
"insert",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/models/League.php#L98-L102 |
drsdre/yii2-xmlsoccer | models/League.php | League.afterFind | public function afterFind()
{
if (\Yii::$app->has('formatter')) {
$this->latest_match = \Yii::$app->formatter->asDatetime($this->latest_match);
}
return parent::afterFind();
} | php | public function afterFind()
{
if (\Yii::$app->has('formatter')) {
$this->latest_match = \Yii::$app->formatter->asDatetime($this->latest_match);
}
return parent::afterFind();
} | [
"public",
"function",
"afterFind",
"(",
")",
"{",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"has",
"(",
"'formatter'",
")",
")",
"{",
"$",
"this",
"->",
"latest_match",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"formatter",
"->",
"asDatetime",
... | {@inheritdoc}
@throws \yii\base\InvalidConfigException | [
"{"
] | train | https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/models/League.php#L108-L114 |
inpsyde/inpsyde-filter | src/WordPress/Unslash.php | Unslash.filter | public function filter( $value ) {
if ( ! is_scalar( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not scalar or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return wp_unslash( $value );
} | php | public function filter( $value ) {
if ( ! is_scalar( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not scalar or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return wp_unslash( $value );
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not scalar or empty.'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/Unslash.php#L17-L26 |
arsengoian/viper-framework | src/Viper/Core/Model/DB/Common/SQL.php | SQL.search | public function search(string $table, string $columns = "*", string $condition = "1",
string $key = "", string $appendix = "", string $appendixkey = "") : ?array {
$this -> normalizeSelectVals($columns, $condition);
$key = substr($this -> quote("%".$key."%"), 1, -1);
... | php | public function search(string $table, string $columns = "*", string $condition = "1",
string $key = "", string $appendix = "", string $appendixkey = "") : ?array {
$this -> normalizeSelectVals($columns, $condition);
$key = substr($this -> quote("%".$key."%"), 1, -1);
... | [
"public",
"function",
"search",
"(",
"string",
"$",
"table",
",",
"string",
"$",
"columns",
"=",
"\"*\"",
",",
"string",
"$",
"condition",
"=",
"\"1\"",
",",
"string",
"$",
"key",
"=",
"\"\"",
",",
"string",
"$",
"appendix",
"=",
"\"\"",
",",
"string",... | TODO allow appendix keys for all | [
"TODO",
"allow",
"appendix",
"keys",
"for",
"all"
] | train | https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Core/Model/DB/Common/SQL.php#L34-L58 |
miisieq/InfaktClient | src/Infakt/Mapper/BankAccountMapper.php | BankAccountMapper.map | public function map($data)
{
return (new BankAccount())
->setId((int) $data['id'])
->setBankName($data['bank_name'])
->setAccountNumber(str_replace(' ', '', $data['account_number']))
->setSwift($data['swift'] ?: null)
->setDefault($data['default'])... | php | public function map($data)
{
return (new BankAccount())
->setId((int) $data['id'])
->setBankName($data['bank_name'])
->setAccountNumber(str_replace(' ', '', $data['account_number']))
->setSwift($data['swift'] ?: null)
->setDefault($data['default'])... | [
"public",
"function",
"map",
"(",
"$",
"data",
")",
"{",
"return",
"(",
"new",
"BankAccount",
"(",
")",
")",
"->",
"setId",
"(",
"(",
"int",
")",
"$",
"data",
"[",
"'id'",
"]",
")",
"->",
"setBankName",
"(",
"$",
"data",
"[",
"'bank_name'",
"]",
... | {@inheritdoc}
@param $data
@return BankAccount | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Mapper/BankAccountMapper.php#L18-L26 |
ixocreate/application | src/Http/Middleware/RootRequestWrapperMiddleware.php | RootRequestWrapperMiddleware.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$rootRequest = new RootRequest($request);
return $handler->handle($rootRequest);
} | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$rootRequest = new RootRequest($request);
return $handler->handle($rootRequest);
} | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"$",
"rootRequest",
"=",
"new",
"RootRequest",
"(",
"$",
"request",
")",
";",
"return",
"$",
"hand... | Process an incoming server request and return a response, optionally delegating
response creation to a handler. | [
"Process",
"an",
"incoming",
"server",
"request",
"and",
"return",
"a",
"response",
"optionally",
"delegating",
"response",
"creation",
"to",
"a",
"handler",
"."
] | train | https://github.com/ixocreate/application/blob/6b0ef355ecf96af63d0dd5b901b4c9a5a69daf05/src/Http/Middleware/RootRequestWrapperMiddleware.php#L24-L28 |
GrafiteInc/Mission-Control-Package | src/PerformanceService.php | PerformanceService.sendPerformance | public function sendPerformance()
{
$headers = [
'token' => $this->token,
];
if (is_null($this->token)) {
throw new Exception("Missing token", 1);
}
$query = $this->getPerformance();
$response = $this->curl::post($this->missionControlUrl, $h... | php | public function sendPerformance()
{
$headers = [
'token' => $this->token,
];
if (is_null($this->token)) {
throw new Exception("Missing token", 1);
}
$query = $this->getPerformance();
$response = $this->curl::post($this->missionControlUrl, $h... | [
"public",
"function",
"sendPerformance",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"'token'",
"=>",
"$",
"this",
"->",
"token",
",",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"token",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\... | Send the exception to Mission control.
@param Exeption $exception
@return bool | [
"Send",
"the",
"exception",
"to",
"Mission",
"control",
"."
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/PerformanceService.php#L35-L54 |
GrafiteInc/Mission-Control-Package | src/PerformanceService.php | PerformanceService.getPerformance | public function getPerformance()
{
try {
return [
'memory' => $this->performanceAnalyzer->getMemory(),
'storage' => $this->performanceAnalyzer->getStorage(),
'cpu' => $this->performanceAnalyzer->getCpu(),
];
} catch (Exception $... | php | public function getPerformance()
{
try {
return [
'memory' => $this->performanceAnalyzer->getMemory(),
'storage' => $this->performanceAnalyzer->getStorage(),
'cpu' => $this->performanceAnalyzer->getCpu(),
];
} catch (Exception $... | [
"public",
"function",
"getPerformance",
"(",
")",
"{",
"try",
"{",
"return",
"[",
"'memory'",
"=>",
"$",
"this",
"->",
"performanceAnalyzer",
"->",
"getMemory",
"(",
")",
",",
"'storage'",
"=>",
"$",
"this",
"->",
"performanceAnalyzer",
"->",
"getStorage",
"... | Collect data and set report details.
@return array | [
"Collect",
"data",
"and",
"set",
"report",
"details",
"."
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/PerformanceService.php#L61-L72 |
yuncms/framework | src/broadcast/BaseBroadcast.php | BaseBroadcast.createMessage | public function createMessage($message, $tag = null, array $attributes = []): MessageInterface
{
$config = [
'class' => $this->messageClass,
'broadcast' => $this,
'body' => $message,
'tag' => $tag,
'attributes' => $attributes
];
ret... | php | public function createMessage($message, $tag = null, array $attributes = []): MessageInterface
{
$config = [
'class' => $this->messageClass,
'broadcast' => $this,
'body' => $message,
'tag' => $tag,
'attributes' => $attributes
];
ret... | [
"public",
"function",
"createMessage",
"(",
"$",
"message",
",",
"$",
"tag",
"=",
"null",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
":",
"MessageInterface",
"{",
"$",
"config",
"=",
"[",
"'class'",
"=>",
"$",
"this",
"->",
"messageClass",
",... | Creates a new message instance and optionally composes its body content via view rendering.
@param array|object $message message payload.
@param string|array|null $tag message tag
@param array $attributes
@return MessageInterface|object message instance.
@throws \yii\base\InvalidConfigException | [
"Creates",
"a",
"new",
"message",
"instance",
"and",
"optionally",
"composes",
"its",
"body",
"content",
"via",
"view",
"rendering",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/broadcast/BaseBroadcast.php#L71-L81 |
yuncms/framework | src/broadcast/BaseBroadcast.php | BaseBroadcast.PublishMessage | public function PublishMessage($message, $tag = null, $attributes = null)
{
return $this->createMessage($message, $tag, $attributes)->send();
} | php | public function PublishMessage($message, $tag = null, $attributes = null)
{
return $this->createMessage($message, $tag, $attributes)->send();
} | [
"public",
"function",
"PublishMessage",
"(",
"$",
"message",
",",
"$",
"tag",
"=",
"null",
",",
"$",
"attributes",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createMessage",
"(",
"$",
"message",
",",
"$",
"tag",
",",
"$",
"attributes",
")",
... | 快速推送一条消息
@param array|object $message
@param string|array|null $tag
@param array|null $attributes
@return bool
@throws \yii\base\InvalidConfigException | [
"快速推送一条消息"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/broadcast/BaseBroadcast.php#L91-L94 |
yuncms/framework | src/broadcast/BaseBroadcast.php | BaseBroadcast.send | public function send($message)
{
if (!$this->beforeSend($message)) {
return false;
}
Yii::info('Sending broadcast :' . $message->toJson(), __METHOD__);
if ($this->useFileTransport) {
$isSuccessful = $this->saveMessage($message);
} else {
$... | php | public function send($message)
{
if (!$this->beforeSend($message)) {
return false;
}
Yii::info('Sending broadcast :' . $message->toJson(), __METHOD__);
if ($this->useFileTransport) {
$isSuccessful = $this->saveMessage($message);
} else {
$... | [
"public",
"function",
"send",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"beforeSend",
"(",
"$",
"message",
")",
")",
"{",
"return",
"false",
";",
"}",
"Yii",
"::",
"info",
"(",
"'Sending broadcast :'",
".",
"$",
"message",
"->... | Sends the given broadcast message.
This method will log a message about the broadcast being sent.
If [[useFileTransport]] is true, it will save the broadcast as a file under [[fileTransportPath]].
Otherwise, it will call [[sendMessage()]] to send the broadcast to its recipient(s).
Child classes should implement [[sendM... | [
"Sends",
"the",
"given",
"broadcast",
"message",
".",
"This",
"method",
"will",
"log",
"a",
"message",
"about",
"the",
"broadcast",
"being",
"sent",
".",
"If",
"[[",
"useFileTransport",
"]]",
"is",
"true",
"it",
"will",
"save",
"the",
"broadcast",
"as",
"a... | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/broadcast/BaseBroadcast.php#L105-L120 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getEntityName | public function getEntityName($input) {
if (is_string($input)) {
if (array_key_exists($input,$names = $this->getEntityNames())) {
$name = $names[$input];
} elseif (mb_strpos($input,'\\') === FALSE) {
$name = \Webforge\Common\String::ucfirst($input);
} else {
$name = ... | php | public function getEntityName($input) {
if (is_string($input)) {
if (array_key_exists($input,$names = $this->getEntityNames())) {
$name = $names[$input];
} elseif (mb_strpos($input,'\\') === FALSE) {
$name = \Webforge\Common\String::ucfirst($input);
} else {
$name = ... | [
"public",
"function",
"getEntityName",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"input",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"input",
",",
"$",
"names",
"=",
"$",
"this",
"->",
"getEntityNames",
"(",
")",
")"... | Gibt die Klasse (den vollen Namen) eines Entities zurück
speaker => 'projectNamespace\Entities\Speaker'
oid => 'projectNamespace\Entities\OID'
Dies wird z.B. für die Umwandlung von entity-bezeichnern in URLs in echte Klassen gebraucht.
Irreguläre Namen (sowas wie OID) können in $this->getEntityNames() eingetragen wer... | [
"Gibt",
"die",
"Klasse",
"(",
"den",
"vollen",
"Namen",
")",
"eines",
"Entities",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L138-L153 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getEntityMeta | public function getEntityMeta($entityName, $classMetadataInjection = NULL) {
$entityClass = $this->getEntityName($entityName); // normalize
// cache
if (!array_key_exists($entityClass, $this->entityMetas)) {
if ($classMetadataInjection instanceof EntityManager) {
$classMetadata = $classMe... | php | public function getEntityMeta($entityName, $classMetadataInjection = NULL) {
$entityClass = $this->getEntityName($entityName); // normalize
// cache
if (!array_key_exists($entityClass, $this->entityMetas)) {
if ($classMetadataInjection instanceof EntityManager) {
$classMetadata = $classMe... | [
"public",
"function",
"getEntityMeta",
"(",
"$",
"entityName",
",",
"$",
"classMetadataInjection",
"=",
"NULL",
")",
"{",
"$",
"entityClass",
"=",
"$",
"this",
"->",
"getEntityName",
"(",
"$",
"entityName",
")",
";",
"// normalize",
"// cache",
"if",
"(",
"!... | Gibt ein Entity-Meta für ein Entity zurück
ein EntityMeta enthält jede Menge Labels, URLs, und weitere Infos über das Entity im CMS (in verschiedenen Contexten)
Ich habe lange überlegt, wo die "zentrale" Stelle für die EntityMetas sein soll und mich für das Modul entschieden, da es sowohl im DCPackage ist (und damit ... | [
"Gibt",
"ein",
"Entity",
"-",
"Meta",
"für",
"ein",
"Entity",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L175-L196 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.bootstrap | public function bootstrap($bootFlags = 0x000000) {
if (!isset($this->configuration))
$this->configuration = new Configuration();
/* Custom Functions */
$this->configuration->addCustomDatetimeFunction('month', 'Psc\Doctrine\Functions\Month');
$this->configuration->addCustomDatetimeFunction('ye... | php | public function bootstrap($bootFlags = 0x000000) {
if (!isset($this->configuration))
$this->configuration = new Configuration();
/* Custom Functions */
$this->configuration->addCustomDatetimeFunction('month', 'Psc\Doctrine\Functions\Month');
$this->configuration->addCustomDatetimeFunction('ye... | [
"public",
"function",
"bootstrap",
"(",
"$",
"bootFlags",
"=",
"0x000000",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configuration",
")",
")",
"$",
"this",
"->",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"/* Custom Fu... | Lädt alle für Doctrine wichtigen Klassen und Objekte | [
"Lädt",
"alle",
"für",
"Doctrine",
"wichtigen",
"Klassen",
"und",
"Objekte"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L204-L252 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getConnectionOptions | public function getConnectionOptions($con) {
if (!isset($con)) $con = $this->getConnectionName();
$conf = $this->project->getConfiguration();
$connectionOptions = array(
'dbname' => $conf->req(array('db',$con,'database')),
'user' => $conf->req(array('db',$con,'user')),
'password' => $co... | php | public function getConnectionOptions($con) {
if (!isset($con)) $con = $this->getConnectionName();
$conf = $this->project->getConfiguration();
$connectionOptions = array(
'dbname' => $conf->req(array('db',$con,'database')),
'user' => $conf->req(array('db',$con,'user')),
'password' => $co... | [
"public",
"function",
"getConnectionOptions",
"(",
"$",
"con",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"con",
")",
")",
"$",
"con",
"=",
"$",
"this",
"->",
"getConnectionName",
"(",
")",
";",
"$",
"conf",
"=",
"$",
"this",
"->",
"project",
"->... | Gibt die Credentials + Optionen für eine Connection zurück
Credentials werden in der ProjektConfiguration eingetragen
@return array | [
"Gibt",
"die",
"Credentials",
"+",
"Optionen",
"für",
"eine",
"Connection",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L305-L318 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.registerType | public function registerType($class) {
$name = str_replace('\\','',$class);
\Doctrine\DBAL\Types\Type::addType($name, $class);
return $this;
} | php | public function registerType($class) {
$name = str_replace('\\','',$class);
\Doctrine\DBAL\Types\Type::addType($name, $class);
return $this;
} | [
"public",
"function",
"registerType",
"(",
"$",
"class",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"''",
",",
"$",
"class",
")",
";",
"\\",
"Doctrine",
"\\",
"DBAL",
"\\",
"Types",
"\\",
"Type",
"::",
"addType",
"(",
"$",
"name",... | Registriert einen Custom Mapping Type für Doctrine
beim Registieren wird der Name der TypeClass umgewandelt. Jeder \\ wird gelöscht und der Gesamte FQN benutzt
z. B.:
SerienLoader\Status => SerienLoaderStatus
@param $class unbedingt ohne \ davor | [
"Registriert",
"einen",
"Custom",
"Mapping",
"Type",
"für",
"Doctrine"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L340-L344 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.registerDefaultTypes | protected function registerDefaultTypes() {
foreach (array('Psc.DateTime'=>'Psc\Doctrine\DateTimeType', // legacy wegen dem .
'PscDateTime'=>'Psc\Doctrine\DateTimeType', // das ist das neue "richtige" Format
'PscDate'=>'Psc\Doctrine\DateType',
'WebforgeDateTi... | php | protected function registerDefaultTypes() {
foreach (array('Psc.DateTime'=>'Psc\Doctrine\DateTimeType', // legacy wegen dem .
'PscDateTime'=>'Psc\Doctrine\DateTimeType', // das ist das neue "richtige" Format
'PscDate'=>'Psc\Doctrine\DateType',
'WebforgeDateTi... | [
"protected",
"function",
"registerDefaultTypes",
"(",
")",
"{",
"foreach",
"(",
"array",
"(",
"'Psc.DateTime'",
"=>",
"'Psc\\Doctrine\\DateTimeType'",
",",
"// legacy wegen dem .",
"'PscDateTime'",
"=>",
"'Psc\\Doctrine\\DateTimeType'",
",",
"// das ist das neue \"richtige\" Fo... | Registriert die Common Custom Mapping Types (fürs Psc-CMS) | [
"Registriert",
"die",
"Common",
"Custom",
"Mapping",
"Types",
"(",
"fürs",
"Psc",
"-",
"CMS",
")"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L350-L362 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.registerMetadataDriver | public function registerMetadataDriver(\Doctrine\Common\Persistence\Mapping\Driver\MappingDriver $driver, $driverNamespace = NULL) {
$this->driverChain->addDriver($driver, $driverNamespace);
return $this;
} | php | public function registerMetadataDriver(\Doctrine\Common\Persistence\Mapping\Driver\MappingDriver $driver, $driverNamespace = NULL) {
$this->driverChain->addDriver($driver, $driverNamespace);
return $this;
} | [
"public",
"function",
"registerMetadataDriver",
"(",
"\\",
"Doctrine",
"\\",
"Common",
"\\",
"Persistence",
"\\",
"Mapping",
"\\",
"Driver",
"\\",
"MappingDriver",
"$",
"driver",
",",
"$",
"driverNamespace",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"driverCha... | Fügt einen weiteren MetadataDriver hinzu
muss nach bootstrap() aufgerufen werden
MetadataDriver verwalten MetaDaten zu Entities. Dies sind die MetaDaten von Doctrine und haben mit den EntityMetas dieses Modules wenig zu tun.
in den Tests wird ein weiterer MetadataDriver (this->getEntityClassesMetadataDriver) benutzt u... | [
"Fügt",
"einen",
"weiteren",
"MetadataDriver",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L380-L383 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.registerEntityClassesMetadataDriver | public function registerEntityClassesMetadataDriver(Array $classes = array(), $namespace = 'Psc', \Doctrine\Common\Annotations\Reader $reader = NULL) {
if (!isset($this->entityClassesMetadataDriver)) {
if (!isset($reader)) {
$reader = $this->createAnnotationReader();
}
$this->entityClasses... | php | public function registerEntityClassesMetadataDriver(Array $classes = array(), $namespace = 'Psc', \Doctrine\Common\Annotations\Reader $reader = NULL) {
if (!isset($this->entityClassesMetadataDriver)) {
if (!isset($reader)) {
$reader = $this->createAnnotationReader();
}
$this->entityClasses... | [
"public",
"function",
"registerEntityClassesMetadataDriver",
"(",
"Array",
"$",
"classes",
"=",
"array",
"(",
")",
",",
"$",
"namespace",
"=",
"'Psc'",
",",
"\\",
"Doctrine",
"\\",
"Common",
"\\",
"Annotations",
"\\",
"Reader",
"$",
"reader",
"=",
"NULL",
")... | Erstellt den EntityClassesMetadataDriver
mehrmals aufrufen ist nicht tragisch, jedoch wird dann natürlihc $classes und $namspace sowie $reader keinen effect haben
@see getEntityClassesMetadataDriver
@chainable | [
"Erstellt",
"den",
"EntityClassesMetadataDriver"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L406-L416 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.createAnnotationReader | public function createAnnotationReader($simple = TRUE, Array $ignoredAnnotations = array()) {
if ($simple) {
$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
$reader->addNamespace('Doctrine\ORM\Mapping');
} else {
$reader = new \Doctrine\Common\Annotations\AnnotationReader(... | php | public function createAnnotationReader($simple = TRUE, Array $ignoredAnnotations = array()) {
if ($simple) {
$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
$reader->addNamespace('Doctrine\ORM\Mapping');
} else {
$reader = new \Doctrine\Common\Annotations\AnnotationReader(... | [
"public",
"function",
"createAnnotationReader",
"(",
"$",
"simple",
"=",
"TRUE",
",",
"Array",
"$",
"ignoredAnnotations",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"simple",
")",
"{",
"$",
"reader",
"=",
"new",
"\\",
"Doctrine",
"\\",
"Common",
... | Gibt einen neuen SimpleAnnotationReader zurück
der Namespace Doctrine\ORM\Mapping wird automatisch hinzugefügt
es wird der interne Cache benutzt
@return Doctrine\Common\Annotations\SimpleAnnotationReader() | [
"Gibt",
"einen",
"neuen",
"SimpleAnnotationReader",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L425-L440 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getDefaultAnnotationReader | public function getDefaultAnnotationReader() {
if (!isset($this->defaultAnnotationReader)) {
$this->defaultAnnotationReader = $this->createAnnotationReader(FALSE, array('todo','TODO','compiled')); // nie simple: jetzt neu
}
return $this->defaultAnnotationReader;
} | php | public function getDefaultAnnotationReader() {
if (!isset($this->defaultAnnotationReader)) {
$this->defaultAnnotationReader = $this->createAnnotationReader(FALSE, array('todo','TODO','compiled')); // nie simple: jetzt neu
}
return $this->defaultAnnotationReader;
} | [
"public",
"function",
"getDefaultAnnotationReader",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"defaultAnnotationReader",
")",
")",
"{",
"$",
"this",
"->",
"defaultAnnotationReader",
"=",
"$",
"this",
"->",
"createAnnotationReader",
"(",
"... | Ein (Simple-)Annotation Reader benutzt von Doctrine
@v2: AnnotationReader | [
"Ein",
"(",
"Simple",
"-",
")",
"Annotation",
"Reader",
"benutzt",
"von",
"Doctrine"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L447-L453 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getAnnotationDriver | public function getAnnotationDriver() {
if (!isset($this->annotationDriver)) {
$this->annotationDriver = new AnnotationDriver($this->getDefaultAnnotationReader(),
array((string) $this->getEntitiesPath())
)... | php | public function getAnnotationDriver() {
if (!isset($this->annotationDriver)) {
$this->annotationDriver = new AnnotationDriver($this->getDefaultAnnotationReader(),
array((string) $this->getEntitiesPath())
)... | [
"public",
"function",
"getAnnotationDriver",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"annotationDriver",
")",
")",
"{",
"$",
"this",
"->",
"annotationDriver",
"=",
"new",
"AnnotationDriver",
"(",
"$",
"this",
"->",
"getDefaultAnnotati... | Der AnnotationDriver für Doctrine, Psc, Whatever
@return Doctrine\ORM\Mapping\Driver\AnnotationDriver | [
"Der",
"AnnotationDriver",
"für",
"Doctrine",
"Psc",
"Whatever"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L460-L468 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getEntitiesPath | public function getEntitiesPath() {
if (!isset($this->entitiesPath))
$this->entitiesPath = Code::namespaceToPath($this->entitiesNamespace, $this->project->dir('lib'));
return $this->entitiesPath;
} | php | public function getEntitiesPath() {
if (!isset($this->entitiesPath))
$this->entitiesPath = Code::namespaceToPath($this->entitiesNamespace, $this->project->dir('lib'));
return $this->entitiesPath;
} | [
"public",
"function",
"getEntitiesPath",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"entitiesPath",
")",
")",
"$",
"this",
"->",
"entitiesPath",
"=",
"Code",
"::",
"namespaceToPath",
"(",
"$",
"this",
"->",
"entitiesNamespace",
",",
... | Gibt Pfad für den Namespace der Entities zurück
@return Webforge\Common\System\Dir | [
"Gibt",
"Pfad",
"für",
"den",
"Namespace",
"der",
"Entities",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L475-L480 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getCache | public function getCache() {
if (!isset($this->cache))
$this->cache = new \Doctrine\Common\Cache\ArrayCache;
return $this->cache;
} | php | public function getCache() {
if (!isset($this->cache))
$this->cache = new \Doctrine\Common\Cache\ArrayCache;
return $this->cache;
} | [
"public",
"function",
"getCache",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
")",
")",
"$",
"this",
"->",
"cache",
"=",
"new",
"\\",
"Doctrine",
"\\",
"Common",
"\\",
"Cache",
"\\",
"ArrayCache",
";",
"return",
"$",
"t... | Gibt den internen Cache für Queries + Meta zurück
(wenn APC irgendwann mal so richtig stabil wäre, könnte man hier in Production einen APCCache benutzen) | [
"Gibt",
"den",
"internen",
"Cache",
"für",
"Queries",
"+",
"Meta",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L502-L507 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.useCache | public function useCache($type = self::CACHE_APC) {
if ($type === self::CACHE_APC) {
$this->setCache(new \Doctrine\Common\Cache\ApcCache);
} else {
$this->setCache(new \Doctrine\Common\Cache\ArrayCache);
}
} | php | public function useCache($type = self::CACHE_APC) {
if ($type === self::CACHE_APC) {
$this->setCache(new \Doctrine\Common\Cache\ApcCache);
} else {
$this->setCache(new \Doctrine\Common\Cache\ArrayCache);
}
} | [
"public",
"function",
"useCache",
"(",
"$",
"type",
"=",
"self",
"::",
"CACHE_APC",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"self",
"::",
"CACHE_APC",
")",
"{",
"$",
"this",
"->",
"setCache",
"(",
"new",
"\\",
"Doctrine",
"\\",
"Common",
"\\",
"Cach... | Overwrites the current cache | [
"Overwrites",
"the",
"current",
"cache"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L512-L518 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Module.php | Module.getResultCache | public function getResultCache() {
if (!isset($this->resultCache))
$this->resultCache = new \Doctrine\Common\Cache\ArrayCache;
return $this->resultCache;
} | php | public function getResultCache() {
if (!isset($this->resultCache))
$this->resultCache = new \Doctrine\Common\Cache\ArrayCache;
return $this->resultCache;
} | [
"public",
"function",
"getResultCache",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resultCache",
")",
")",
"$",
"this",
"->",
"resultCache",
"=",
"new",
"\\",
"Doctrine",
"\\",
"Common",
"\\",
"Cache",
"\\",
"ArrayCache",
";",
"re... | Gibt den internen Cache für Results zurück
@return Doctrine\Common\Cache\Cache | [
"Gibt",
"den",
"internen",
"Cache",
"für",
"Results",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Module.php#L530-L535 |
fkooman/php-cert-parser | src/fkooman/X509/CertParser.php | CertParser.fromEncodedDer | public static function fromEncodedDer($encodedDerCert)
{
$pemCert = sprintf(
'-----BEGIN CERTIFICATE-----%s-----END CERTIFICATE-----',
PHP_EOL.wordwrap($encodedDerCert, 64, "\n", true).PHP_EOL
);
return new self($pemCert);
} | php | public static function fromEncodedDer($encodedDerCert)
{
$pemCert = sprintf(
'-----BEGIN CERTIFICATE-----%s-----END CERTIFICATE-----',
PHP_EOL.wordwrap($encodedDerCert, 64, "\n", true).PHP_EOL
);
return new self($pemCert);
} | [
"public",
"static",
"function",
"fromEncodedDer",
"(",
"$",
"encodedDerCert",
")",
"{",
"$",
"pemCert",
"=",
"sprintf",
"(",
"'-----BEGIN CERTIFICATE-----%s-----END CERTIFICATE-----'",
",",
"PHP_EOL",
".",
"wordwrap",
"(",
"$",
"encodedDerCert",
",",
"64",
",",
"\"\... | Create a new CertParser object from the Base 64 encoded DER, i.e. a
base64_encode of a binary string. | [
"Create",
"a",
"new",
"CertParser",
"object",
"from",
"the",
"Base",
"64",
"encoded",
"DER",
"i",
".",
"e",
".",
"a",
"base64_encode",
"of",
"a",
"binary",
"string",
"."
] | train | https://github.com/fkooman/php-cert-parser/blob/29bf69b49ee06011fb1c4f4c40cdd16a7f63e8bc/src/fkooman/X509/CertParser.php#L41-L49 |
fkooman/php-cert-parser | src/fkooman/X509/CertParser.php | CertParser.toDer | private function toDer()
{
$pattern = '/.*-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----.*/msU';
$replacement = '${1}';
$plainPemData = preg_replace($pattern, $replacement, $this->pemCert);
if (null === $plainPemData) {
throw new RuntimeException('unable to ext... | php | private function toDer()
{
$pattern = '/.*-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----.*/msU';
$replacement = '${1}';
$plainPemData = preg_replace($pattern, $replacement, $this->pemCert);
if (null === $plainPemData) {
throw new RuntimeException('unable to ext... | [
"private",
"function",
"toDer",
"(",
")",
"{",
"$",
"pattern",
"=",
"'/.*-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----.*/msU'",
";",
"$",
"replacement",
"=",
"'${1}'",
";",
"$",
"plainPemData",
"=",
"preg_replace",
"(",
"$",
"pattern",
",",
"$",
"replacem... | Get the DER format of the certificate. | [
"Get",
"the",
"DER",
"format",
"of",
"the",
"certificate",
"."
] | train | https://github.com/fkooman/php-cert-parser/blob/29bf69b49ee06011fb1c4f4c40cdd16a7f63e8bc/src/fkooman/X509/CertParser.php#L105-L121 |
fkooman/php-cert-parser | src/fkooman/X509/CertParser.php | CertParser.getFingerprint | public function getFingerprint($alg = 'sha256')
{
if (!in_array($alg, hash_algos())) {
throw new RuntimeException(
sprintf(
'unsupported algorithm "%s"',
$alg
)
);
}
return hash($alg, $this->toDe... | php | public function getFingerprint($alg = 'sha256')
{
if (!in_array($alg, hash_algos())) {
throw new RuntimeException(
sprintf(
'unsupported algorithm "%s"',
$alg
)
);
}
return hash($alg, $this->toDe... | [
"public",
"function",
"getFingerprint",
"(",
"$",
"alg",
"=",
"'sha256'",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"alg",
",",
"hash_algos",
"(",
")",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"sprintf",
"(",
"'unsupported algorithm \"... | Get the raw fingerprint of the certificate.
@param string $alg the algorithm to use
@return string the raw fingerprint of the certificate as binary string
@see http://php.net/manual/en/function.hash-algos.php | [
"Get",
"the",
"raw",
"fingerprint",
"of",
"the",
"certificate",
"."
] | train | https://github.com/fkooman/php-cert-parser/blob/29bf69b49ee06011fb1c4f4c40cdd16a7f63e8bc/src/fkooman/X509/CertParser.php#L132-L144 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/BaseFileController.php | BaseFileController.run | public function run() {
$this->trigger('run.before');
/* wir validieren die Datei */
$this->file = new File($this->getDirectory(), $this->getFileName());
$fDir = $this->file->getDirectory();
$incDir = $this->getDirectory();
if (!$this->file->exists() || !$incDir->equals($fDir) && !$fD... | php | public function run() {
$this->trigger('run.before');
/* wir validieren die Datei */
$this->file = new File($this->getDirectory(), $this->getFileName());
$fDir = $this->file->getDirectory();
$incDir = $this->getDirectory();
if (!$this->file->exists() || !$incDir->equals($fDir) && !$fD... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"trigger",
"(",
"'run.before'",
")",
";",
"/* wir validieren die Datei */",
"$",
"this",
"->",
"file",
"=",
"new",
"File",
"(",
"$",
"this",
"->",
"getDirectory",
"(",
")",
",",
"$",
"this",
... | Lädt die Controller Datei
macht require $this->getFileName()
getFileName darf einen relativen Pfad zu $this->getDirectory() zurückgeben | [
"Lädt",
"die",
"Controller",
"Datei"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/BaseFileController.php#L70-L98 |
qcubed/orm | src/Query/Node/Table.php | Table.join | public function join(
Builder $objBuilder,
$blnExpandSelection = false,
iCondition $objJoinCondition = null,
Clause\Select $objSelect = null
) {
$objParentNode = $this->objParentNode;
if (!$objParentNode) {
if ($this->strTableName != $objBuilder->RootTable... | php | public function join(
Builder $objBuilder,
$blnExpandSelection = false,
iCondition $objJoinCondition = null,
Clause\Select $objSelect = null
) {
$objParentNode = $this->objParentNode;
if (!$objParentNode) {
if ($this->strTableName != $objBuilder->RootTable... | [
"public",
"function",
"join",
"(",
"Builder",
"$",
"objBuilder",
",",
"$",
"blnExpandSelection",
"=",
"false",
",",
"iCondition",
"$",
"objJoinCondition",
"=",
"null",
",",
"Clause",
"\\",
"Select",
"$",
"objSelect",
"=",
"null",
")",
"{",
"$",
"objParentNod... | Join the node to the query.
Otherwise, its a straightforward
one-to-one join. Conditional joins in this situation are really only useful when combined with condition
clauses that select out rows that were not joined (null FK).
@param Builder $objBuilder
@param bool $blnExpandSelection
@param iCondition|null $objJoinCo... | [
"Join",
"the",
"node",
"to",
"the",
"query",
".",
"Otherwise",
"its",
"a",
"straightforward",
"one",
"-",
"to",
"-",
"one",
"join",
".",
"Conditional",
"joins",
"in",
"this",
"situation",
"are",
"really",
"only",
"useful",
"when",
"combined",
"with",
"cond... | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/Node/Table.php#L64-L109 |
krzysztofmazur/php-object-mapper | src/KrzysztofMazur/ObjectMapper/Mapping/Field/ValueWriter/MethodValueWriter.php | MethodValueWriter.writeValue | protected function writeValue($object, $value)
{
Reflection::getMethod(get_class($object), $this->methodName)->invokeArgs($object, [$value]);
} | php | protected function writeValue($object, $value)
{
Reflection::getMethod(get_class($object), $this->methodName)->invokeArgs($object, [$value]);
} | [
"protected",
"function",
"writeValue",
"(",
"$",
"object",
",",
"$",
"value",
")",
"{",
"Reflection",
"::",
"getMethod",
"(",
"get_class",
"(",
"$",
"object",
")",
",",
"$",
"this",
"->",
"methodName",
")",
"->",
"invokeArgs",
"(",
"$",
"object",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/krzysztofmazur/php-object-mapper/blob/2c22acad9634cfe8e9a75d72e665d450ada8d4e3/src/KrzysztofMazur/ObjectMapper/Mapping/Field/ValueWriter/MethodValueWriter.php#L37-L40 |
arsengoian/viper-framework | src/Viper/Daemon/Router.php | Router.spawn | public function spawn(int $sleep) : void
{
if (isset($this -> storage['id']) && $this -> isAlive())
throw new DaemonException('It\'s alive anyway!');
$this -> actionLog('Spawning process with frequency '.$sleep);
$this -> actionLog('See shell output.');
$thisfile = __FI... | php | public function spawn(int $sleep) : void
{
if (isset($this -> storage['id']) && $this -> isAlive())
throw new DaemonException('It\'s alive anyway!');
$this -> actionLog('Spawning process with frequency '.$sleep);
$this -> actionLog('See shell output.');
$thisfile = __FI... | [
"public",
"function",
"spawn",
"(",
"int",
"$",
"sleep",
")",
":",
"void",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"'id'",
"]",
")",
"&&",
"$",
"this",
"->",
"isAlive",
"(",
")",
")",
"throw",
"new",
"DaemonException",
"(",... | Create new daemon instance (system-dependent).
Creates a loop which keeps executing Daemon::run.
@param int $sleep in seconds
@throws DaemonException | [
"Create",
"new",
"daemon",
"instance",
"(",
"system",
"-",
"dependent",
")",
".",
"Creates",
"a",
"loop",
"which",
"keeps",
"executing",
"Daemon",
"::",
"run",
"."
] | train | https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Daemon/Router.php#L45-L70 |
arsengoian/viper-framework | src/Viper/Daemon/Router.php | Router.restart | public function restart(int $sleep) : void
{
$this -> storage['sentenced'] = 'rewind';
$this -> storage['sleep'] = $sleep;
$this -> store($this -> storage);
} | php | public function restart(int $sleep) : void
{
$this -> storage['sentenced'] = 'rewind';
$this -> storage['sleep'] = $sleep;
$this -> store($this -> storage);
} | [
"public",
"function",
"restart",
"(",
"int",
"$",
"sleep",
")",
":",
"void",
"{",
"$",
"this",
"->",
"storage",
"[",
"'sentenced'",
"]",
"=",
"'rewind'",
";",
"$",
"this",
"->",
"storage",
"[",
"'sleep'",
"]",
"=",
"$",
"sleep",
";",
"$",
"this",
"... | Gently stops daemon and starts it with new frequency
@param int $sleep | [
"Gently",
"stops",
"daemon",
"and",
"starts",
"it",
"with",
"new",
"frequency"
] | train | https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Daemon/Router.php#L76-L81 |
arsengoian/viper-framework | src/Viper/Daemon/Router.php | Router.exec | public function exec() : void
{
$this -> actionLog('Script successfully entered');
$sentence = $this -> storage['sentenced'];
$response = NULL;
if (method_exists($this, $sentence))
$response = $this -> $sentence();
else $this -> errorLog('Unknown method '.$senten... | php | public function exec() : void
{
$this -> actionLog('Script successfully entered');
$sentence = $this -> storage['sentenced'];
$response = NULL;
if (method_exists($this, $sentence))
$response = $this -> $sentence();
else $this -> errorLog('Unknown method '.$senten... | [
"public",
"function",
"exec",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"actionLog",
"(",
"'Script successfully entered'",
")",
";",
"$",
"sentence",
"=",
"$",
"this",
"->",
"storage",
"[",
"'sentenced'",
"]",
";",
"$",
"response",
"=",
"NULL",
";",... | Makes preparations for run method
Also stores memory used by daemon to be recovered | [
"Makes",
"preparations",
"for",
"run",
"method",
"Also",
"stores",
"memory",
"used",
"by",
"daemon",
"to",
"be",
"recovered"
] | train | https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Daemon/Router.php#L95-L110 |
arsengoian/viper-framework | src/Viper/Daemon/Router.php | Router.route | public static function route(string $command, array $args) : void {
$object = new static('test');
echo "\n";
if (method_exists(static::class, $command)) {
$response = call_user_func_array([$object, $command], $args);
if ($response === NULL)
echo "SUCCESS";... | php | public static function route(string $command, array $args) : void {
$object = new static('test');
echo "\n";
if (method_exists(static::class, $command)) {
$response = call_user_func_array([$object, $command], $args);
if ($response === NULL)
echo "SUCCESS";... | [
"public",
"static",
"function",
"route",
"(",
"string",
"$",
"command",
",",
"array",
"$",
"args",
")",
":",
"void",
"{",
"$",
"object",
"=",
"new",
"static",
"(",
"'test'",
")",
";",
"echo",
"\"\\n\"",
";",
"if",
"(",
"method_exists",
"(",
"static",
... | Start a command to services
@param string $command
@param array $args | [
"Start",
"a",
"command",
"to",
"services"
] | train | https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Daemon/Router.php#L191-L209 |
ClanCats/Core | src/bundles/Database/Handler.php | Handler._init | public static function _init()
{
if ( \ClanCats::in_development() )
{
// add a hook to the main resposne
\CCEvent::mind( 'response.output', function( $output ) {
if ( strpos( $output, '</body>' ) === false )
{
return $output;
}
$table = \UI\Table::create( array(
'sty... | php | public static function _init()
{
if ( \ClanCats::in_development() )
{
// add a hook to the main resposne
\CCEvent::mind( 'response.output', function( $output ) {
if ( strpos( $output, '</body>' ) === false )
{
return $output;
}
$table = \UI\Table::create( array(
'sty... | [
"public",
"static",
"function",
"_init",
"(",
")",
"{",
"if",
"(",
"\\",
"ClanCats",
"::",
"in_development",
"(",
")",
")",
"{",
"// add a hook to the main resposne",
"\\",
"CCEvent",
"::",
"mind",
"(",
"'response.output'",
",",
"function",
"(",
"$",
"output",... | Static init
When we are in development then we append the qurey log to body
@codeCoverageIgnore
@return void | [
"Static",
"init",
"When",
"we",
"are",
"in",
"development",
"then",
"we",
"append",
"the",
"qurey",
"log",
"to",
"body"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Handler.php#L43-L76 |
ClanCats/Core | src/bundles/Database/Handler.php | Handler.connect | protected function connect( $name )
{
if ( $this->_connected )
{
return true;
}
// check if the name is an array. This way we can
// pass the configuration directly. We need this
// to create for example an handler without having
// the configuration in the database conf file.
if ( is_array( ... | php | protected function connect( $name )
{
if ( $this->_connected )
{
return true;
}
// check if the name is an array. This way we can
// pass the configuration directly. We need this
// to create for example an handler without having
// the configuration in the database conf file.
if ( is_array( ... | [
"protected",
"function",
"connect",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_connected",
")",
"{",
"return",
"true",
";",
"}",
"// check if the name is an array. This way we can",
"// pass the configuration directly. We need this ",
"// to create for ex... | Try to etablish a connetion to the database. Also assign the connection
and query builder to the current DB driver.
@param string|array $name When passing an array it will be uesed as configuration.
@return void | [
"Try",
"to",
"etablish",
"a",
"connetion",
"to",
"the",
"database",
".",
"Also",
"assign",
"the",
"connection",
"and",
"query",
"builder",
"to",
"the",
"current",
"DB",
"driver",
"."
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Handler.php#L218-L275 |
ClanCats/Core | src/bundles/Database/Handler.php | Handler.statement | public function statement( $query, $params = array() )
{
// we alway prepare the query even if we dont have parameters
$sth = $this->driver()->connection()->prepare( $query );
// because we set pdo the throw exception on db errors
// we catch them here to throw our own exception.
try
{
$sth->execute... | php | public function statement( $query, $params = array() )
{
// we alway prepare the query even if we dont have parameters
$sth = $this->driver()->connection()->prepare( $query );
// because we set pdo the throw exception on db errors
// we catch them here to throw our own exception.
try
{
$sth->execute... | [
"public",
"function",
"statement",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"// we alway prepare the query even if we dont have parameters",
"$",
"sth",
"=",
"$",
"this",
"->",
"driver",
"(",
")",
"->",
"connection",
"(",
")",
... | Run the query and return the PDO statement
@param string $query
@param array $params
@return array | [
"Run",
"the",
"query",
"and",
"return",
"the",
"PDO",
"statement"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Handler.php#L294-L329 |
ClanCats/Core | src/bundles/Database/Handler.php | Handler.fetch | public function fetch( $query, $params = array(), $arguments = array( 'obj' ) )
{
$sth = $this->statement( $query, $params );
$args = null;
foreach( $arguments as $argument )
{
$args |= constant( "\PDO::FETCH_".strtoupper( $argument ) );
}
return $sth->fetchAll( $args );
} | php | public function fetch( $query, $params = array(), $arguments = array( 'obj' ) )
{
$sth = $this->statement( $query, $params );
$args = null;
foreach( $arguments as $argument )
{
$args |= constant( "\PDO::FETCH_".strtoupper( $argument ) );
}
return $sth->fetchAll( $args );
} | [
"public",
"function",
"fetch",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"arguments",
"=",
"array",
"(",
"'obj'",
")",
")",
"{",
"$",
"sth",
"=",
"$",
"this",
"->",
"statement",
"(",
"$",
"query",
",",
"$",
"params"... | Run the query and fetch the results
You can pass arguments on the third parameter.
These parameter are just the normal PDO ones but in short.
obj = \PDO::FETCH_OBJ
assoc = \PDO::FETCH_ASSOC
@param string $query
@param array $params
@return array | [
"Run",
"the",
"query",
"and",
"fetch",
"the",
"results"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Handler.php#L344-L356 |
ClanCats/Core | src/bundles/Database/Handler.php | Handler.run | public function run( $query, $params = array() )
{
$sth = $this->statement( $query, $params );
$type = strtolower( substr( $query, 0, strpos( $query, ' ' ) ) );
switch ( $type )
{
case 'update':
case 'delete':
return $sth->rowCount();
break;
case 'insert':
return $this->driver()->... | php | public function run( $query, $params = array() )
{
$sth = $this->statement( $query, $params );
$type = strtolower( substr( $query, 0, strpos( $query, ' ' ) ) );
switch ( $type )
{
case 'update':
case 'delete':
return $sth->rowCount();
break;
case 'insert':
return $this->driver()->... | [
"public",
"function",
"run",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sth",
"=",
"$",
"this",
"->",
"statement",
"(",
"$",
"query",
",",
"$",
"params",
")",
";",
"$",
"type",
"=",
"strtolower",
"(",
"substr",... | Run the query and get the correct response
INSERT -> last id
UPDATE -> affected rows
DELETE -> affected rows
etc...
@param string $query
@param array $params
@return array | [
"Run",
"the",
"query",
"and",
"get",
"the",
"correct",
"response"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Handler.php#L370-L389 |
rayrutjes/domain-foundation | src/Command/Bus/SimpleCommandBus.php | SimpleCommandBus.dispatch | public function dispatch(Command $command, CommandCallback $callback = null)
{
$command = $this->intercept($command);
$handler = $this->handlerRegistry->findCommandHandlerFor($command);
$this->unitOfWork->start();
$interceptorChain = new DefaultInterceptorChain($command, $this->uni... | php | public function dispatch(Command $command, CommandCallback $callback = null)
{
$command = $this->intercept($command);
$handler = $this->handlerRegistry->findCommandHandlerFor($command);
$this->unitOfWork->start();
$interceptorChain = new DefaultInterceptorChain($command, $this->uni... | [
"public",
"function",
"dispatch",
"(",
"Command",
"$",
"command",
",",
"CommandCallback",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"intercept",
"(",
"$",
"command",
")",
";",
"$",
"handler",
"=",
"$",
"this",
"->"... | @param Command $command
@param CommandCallback $callback
@throws \Exception | [
"@param",
"Command",
"$command",
"@param",
"CommandCallback",
"$callback"
] | train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Command/Bus/SimpleCommandBus.php#L51-L77 |
rayrutjes/domain-foundation | src/Command/Bus/SimpleCommandBus.php | SimpleCommandBus.intercept | private function intercept(Command $command)
{
foreach ($this->dispatchInterceptors as $dispatchInterceptor) {
$command = $dispatchInterceptor->handle($command);
}
return $command;
} | php | private function intercept(Command $command)
{
foreach ($this->dispatchInterceptors as $dispatchInterceptor) {
$command = $dispatchInterceptor->handle($command);
}
return $command;
} | [
"private",
"function",
"intercept",
"(",
"Command",
"$",
"command",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"dispatchInterceptors",
"as",
"$",
"dispatchInterceptor",
")",
"{",
"$",
"command",
"=",
"$",
"dispatchInterceptor",
"->",
"handle",
"(",
"$",
"c... | @param Command $command
@return Command | [
"@param",
"Command",
"$command"
] | train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Command/Bus/SimpleCommandBus.php#L84-L91 |
vench/venus-fw | src/vsapp/Request.php | Request.get | public function get($name) {
$query = $this->queryAll();
return isset($query[$name]) ? $query[$name] : null;
} | php | public function get($name) {
$query = $this->queryAll();
return isset($query[$name]) ? $query[$name] : null;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"queryAll",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"query",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"query",
"[",
"$",
"name",
"]",
":",
"null",
... | Get value from GET params
@param string $name
@return mixed | [
"Get",
"value",
"from",
"GET",
"params"
] | train | https://github.com/vench/venus-fw/blob/9075ab6062551c022d145ac20640438074d5cb85/src/vsapp/Request.php#L43-L46 |
CakeCMS/Core | src/Toolbar/ToolbarItem.php | ToolbarItem.fetchId | public function fetchId($type, $name)
{
return Inflector::dasherize($this->_parent->getName()) . '-' . Str::slug($type);
} | php | public function fetchId($type, $name)
{
return Inflector::dasherize($this->_parent->getName()) . '-' . Str::slug($type);
} | [
"public",
"function",
"fetchId",
"(",
"$",
"type",
",",
"$",
"name",
")",
"{",
"return",
"Inflector",
"::",
"dasherize",
"(",
"$",
"this",
"->",
"_parent",
"->",
"getName",
"(",
")",
")",
".",
"'-'",
".",
"Str",
"::",
"slug",
"(",
"$",
"type",
")",... | Fetch button id.
@param string $type
@param string $name
@return string
@SuppressWarnings("unused") | [
"Fetch",
"button",
"id",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarItem.php#L64-L67 |
CakeCMS/Core | src/Toolbar/ToolbarItem.php | ToolbarItem.render | public function render(&$node)
{
$id = call_user_func_array([&$this, 'fetchId'], $node);
$output = call_user_func_array([&$this, 'fetchItem'], $node);
list ($source) = $node;
list ($plugin) = pluginSplit($source);
$options = [
'id' => $id,
'output... | php | public function render(&$node)
{
$id = call_user_func_array([&$this, 'fetchId'], $node);
$output = call_user_func_array([&$this, 'fetchItem'], $node);
list ($source) = $node;
list ($plugin) = pluginSplit($source);
$options = [
'id' => $id,
'output... | [
"public",
"function",
"render",
"(",
"&",
"$",
"node",
")",
"{",
"$",
"id",
"=",
"call_user_func_array",
"(",
"[",
"&",
"$",
"this",
",",
"'fetchId'",
"]",
",",
"$",
"node",
")",
";",
"$",
"output",
"=",
"call_user_func_array",
"(",
"[",
"&",
"$",
... | Render toolbar html.
@param array $node
@return string | [
"Render",
"toolbar",
"html",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarItem.php#L82-L101 |
helthe/Chronos | Field/AbstractField.php | AbstractField.matches | public function matches(\DateTime $date)
{
if ('*' === $this->value) {
return true;
}
$dateValue = $this->getFieldValueFromDate($date);
$values = $this->getValueArray();
$found = false;
foreach ($values as $value) {
if ($found) {
... | php | public function matches(\DateTime $date)
{
if ('*' === $this->value) {
return true;
}
$dateValue = $this->getFieldValueFromDate($date);
$values = $this->getValueArray();
$found = false;
foreach ($values as $value) {
if ($found) {
... | [
"public",
"function",
"matches",
"(",
"\\",
"DateTime",
"$",
"date",
")",
"{",
"if",
"(",
"'*'",
"===",
"$",
"this",
"->",
"value",
")",
"{",
"return",
"true",
";",
"}",
"$",
"dateValue",
"=",
"$",
"this",
"->",
"getFieldValueFromDate",
"(",
"$",
"da... | {@inheritdoc} | [
"{"
] | train | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/Field/AbstractField.php#L59-L84 |
helthe/Chronos | Field/AbstractField.php | AbstractField.isInIncrementsOfRange | protected function isInIncrementsOfRange($increments, $value)
{
$incrementsParts = explode('/', $increments);
if ('*' === $incrementsParts[0]) {
return (int) $value % $incrementsParts[1] === 0;
}
if (!$this->isInRange($incrementsParts[0], $value)) {
return f... | php | protected function isInIncrementsOfRange($increments, $value)
{
$incrementsParts = explode('/', $increments);
if ('*' === $incrementsParts[0]) {
return (int) $value % $incrementsParts[1] === 0;
}
if (!$this->isInRange($incrementsParts[0], $value)) {
return f... | [
"protected",
"function",
"isInIncrementsOfRange",
"(",
"$",
"increments",
",",
"$",
"value",
")",
"{",
"$",
"incrementsParts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"increments",
")",
";",
"if",
"(",
"'*'",
"===",
"$",
"incrementsParts",
"[",
"0",
"]",
"... | Checks if the given value is in the given increments of range.
@param string $increments
@param string $value
@return Boolean | [
"Checks",
"if",
"the",
"given",
"value",
"is",
"in",
"the",
"given",
"increments",
"of",
"range",
"."
] | train | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/Field/AbstractField.php#L134-L155 |
helthe/Chronos | Field/AbstractField.php | AbstractField.isInRange | protected function isInRange($range, $value)
{
$parts = explode('-', $range);
return $value >= $parts[0] && $value <= $parts[1];
} | php | protected function isInRange($range, $value)
{
$parts = explode('-', $range);
return $value >= $parts[0] && $value <= $parts[1];
} | [
"protected",
"function",
"isInRange",
"(",
"$",
"range",
",",
"$",
"value",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'-'",
",",
"$",
"range",
")",
";",
"return",
"$",
"value",
">=",
"$",
"parts",
"[",
"0",
"]",
"&&",
"$",
"value",
"<=",
"$",... | Checks if the given value is in the given range.
@param string $range
@param string $value
@return Boolean | [
"Checks",
"if",
"the",
"given",
"value",
"is",
"in",
"the",
"given",
"range",
"."
] | train | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/Field/AbstractField.php#L165-L170 |
vench/venus-fw | src/vsapp/controller/ApiController.php | ApiController.actionFac | public function actionFac($n) {
$f = function($v) use(&$f){
if($v <= 0) {
return 1;
}
return $v -- * $f( $v );
};
return ['input' => $n, 'output' => $f($n)];
} | php | public function actionFac($n) {
$f = function($v) use(&$f){
if($v <= 0) {
return 1;
}
return $v -- * $f( $v );
};
return ['input' => $n, 'output' => $f($n)];
} | [
"public",
"function",
"actionFac",
"(",
"$",
"n",
")",
"{",
"$",
"f",
"=",
"function",
"(",
"$",
"v",
")",
"use",
"(",
"&",
"$",
"f",
")",
"{",
"if",
"(",
"$",
"v",
"<=",
"0",
")",
"{",
"return",
"1",
";",
"}",
"return",
"$",
"v",
"--",
"... | Factorialis
try /api/fac?n=4
@proxy_exec \vsapp\proxy\filters\controller\JSONResult
@proxy_exec \vsapp\proxy\filters\controller\RequestMethod {"types": ["GET"]}
@proxy_exec \vsapp\proxy\filters\arg\Filter {"rules": [[["0"], ["int"]]]}
@proxy_exec \vsapp\proxy\filters\arg\Validator {"rules": [[["0"], ["int"]]]} | [
"Factorialis",
"try",
"/",
"api",
"/",
"fac?n",
"=",
"4"
] | train | https://github.com/vench/venus-fw/blob/9075ab6062551c022d145ac20640438074d5cb85/src/vsapp/controller/ApiController.php#L63-L73 |
yuncms/framework | src/filesystem/Cache.php | Cache.load | public function load()
{
$contents = $this->cache->get($this->key);
if ($contents !== false) {
$this->setFromStorage($contents);
}
} | php | public function load()
{
$contents = $this->cache->get($this->key);
if ($contents !== false) {
$this->setFromStorage($contents);
}
} | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"cache",
"->",
"get",
"(",
"$",
"this",
"->",
"key",
")",
";",
"if",
"(",
"$",
"contents",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"setFromStorage",
"(",
"... | Load the cache. | [
"Load",
"the",
"cache",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/Cache.php#L57-L64 |
yuncms/framework | src/filesystem/Cache.php | Cache.save | public function save()
{
$contents = $this->getForStorage();
if (!is_null($this->expire)) {
$this->cache->set($this->key, $contents, $this->expire);
} else {
$this->cache->set($this->key, $contents);
}
} | php | public function save()
{
$contents = $this->getForStorage();
if (!is_null($this->expire)) {
$this->cache->set($this->key, $contents, $this->expire);
} else {
$this->cache->set($this->key, $contents);
}
} | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"getForStorage",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"expire",
")",
")",
"{",
"$",
"this",
"->",
"cache",
"->",
"set",
"(",
"$",
... | Persist the cache. | [
"Persist",
"the",
"cache",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/Cache.php#L69-L78 |
spiral-modules/scaffolder | source/Scaffolder/Commands/Database/Traits/SourceDeclarationTrait.php | SourceDeclarationTrait.sourceDeclaration | private function sourceDeclaration(string $name, string $type, string $model): SourceDeclaration
{
return new SourceDeclaration(
$this->getConfig()->className('source', $name),
$type,
$model
);
} | php | private function sourceDeclaration(string $name, string $type, string $model): SourceDeclaration
{
return new SourceDeclaration(
$this->getConfig()->className('source', $name),
$type,
$model
);
} | [
"private",
"function",
"sourceDeclaration",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"type",
",",
"string",
"$",
"model",
")",
":",
"SourceDeclaration",
"{",
"return",
"new",
"SourceDeclaration",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
... | @param string $name
@param string $type
@param string $model
@return \Spiral\Scaffolder\Declarations\Database\SourceDeclaration | [
"@param",
"string",
"$name",
"@param",
"string",
"$type",
"@param",
"string",
"$model"
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Commands/Database/Traits/SourceDeclarationTrait.php#L22-L29 |
whisller/IrcBotBundle | EventListener/Plugins/Commands/HelpCommandListener.php | HelpCommandListener.onCommand | public function onCommand(BotCommandFoundEvent $event)
{
$this->sendMessage(array($event->getNickname()), 'IrcBotBundle (https://github.com/whisller/IrcBotBundle)');
$this->sendMessage(array($event->getNickname()), 'Available commands:');
$this->commandsHolder->rewind();
while ($thi... | php | public function onCommand(BotCommandFoundEvent $event)
{
$this->sendMessage(array($event->getNickname()), 'IrcBotBundle (https://github.com/whisller/IrcBotBundle)');
$this->sendMessage(array($event->getNickname()), 'Available commands:');
$this->commandsHolder->rewind();
while ($thi... | [
"public",
"function",
"onCommand",
"(",
"BotCommandFoundEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"sendMessage",
"(",
"array",
"(",
"$",
"event",
"->",
"getNickname",
"(",
")",
")",
",",
"'IrcBotBundle (https://github.com/whisller/IrcBotBundle)'",
")",
";... | {@inheritdoc} | [
"{"
] | train | https://github.com/whisller/IrcBotBundle/blob/d8bcafc1599cbbc7756b0a59f51ee988a2de0f2e/EventListener/Plugins/Commands/HelpCommandListener.php#L37-L53 |
lmammino/e-foundation | src/Cart/Model/CartItemAdjustment.php | CartItemAdjustment.setAdjustable | public function setAdjustable(AdjustableInterface $adjustable = null)
{
$this->adjustable = $this->cartItem = $adjustable;
return $this;
} | php | public function setAdjustable(AdjustableInterface $adjustable = null)
{
$this->adjustable = $this->cartItem = $adjustable;
return $this;
} | [
"public",
"function",
"setAdjustable",
"(",
"AdjustableInterface",
"$",
"adjustable",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"adjustable",
"=",
"$",
"this",
"->",
"cartItem",
"=",
"$",
"adjustable",
";",
"return",
"$",
"this",
";",
"}"
] | {@inheritDoc} | [
"{"
] | train | https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Cart/Model/CartItemAdjustment.php#L39-L44 |
barebone-php/barebone-core | lib/Log.php | Log.instance | public static function instance()
{
if (null === self::$_instance) {
$logger = new Monolog(Config::read('app.id'));
$file_handler = new StreamHandler(self::getFilepath());
$logger->pushHandler($file_handler);
self::$_instance = $logger;
}
retu... | php | public static function instance()
{
if (null === self::$_instance) {
$logger = new Monolog(Config::read('app.id'));
$file_handler = new StreamHandler(self::getFilepath());
$logger->pushHandler($file_handler);
self::$_instance = $logger;
}
retu... | [
"public",
"static",
"function",
"instance",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"_instance",
")",
"{",
"$",
"logger",
"=",
"new",
"Monolog",
"(",
"Config",
"::",
"read",
"(",
"'app.id'",
")",
")",
";",
"$",
"file_handler",
"="... | Instantiate Monolog
@return Monolog | [
"Instantiate",
"Monolog"
] | train | https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/Log.php#L46-L56 |
steeffeen/FancyManiaLinks | FML/Script/Features/PlayerProfile.php | PlayerProfile.setControl | public function setControl(Control $control)
{
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
} | php | public function setControl(Control $control)
{
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
} | [
"public",
"function",
"setControl",
"(",
"Control",
"$",
"control",
")",
"{",
"$",
"control",
"->",
"checkId",
"(",
")",
";",
"if",
"(",
"$",
"control",
"instanceof",
"Scriptable",
")",
"{",
"$",
"control",
"->",
"setScriptEvents",
"(",
"true",
")",
";",... | Set the Profile Control
@api
@param Control $control Profile Control
@return static | [
"Set",
"the",
"Profile",
"Control"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/PlayerProfile.php#L99-L107 |
steeffeen/FancyManiaLinks | FML/Script/Features/PlayerProfile.php | PlayerProfile.getScriptText | protected function getScriptText()
{
$login = Builder::escapeText($this->login);
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
return "
if (Event.Control.ControlId == {$controlId}) {
ShowProfile({$login});
}";
... | php | protected function getScriptText()
{
$login = Builder::escapeText($this->login);
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
return "
if (Event.Control.ControlId == {$controlId}) {
ShowProfile({$login});
}";
... | [
"protected",
"function",
"getScriptText",
"(",
")",
"{",
"$",
"login",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"login",
")",
";",
"if",
"(",
"$",
"this",
"->",
"control",
")",
"{",
"// Control event",
"$",
"controlId",
"=",
"Builder",... | Get the script text
@return string | [
"Get",
"the",
"script",
"text"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/PlayerProfile.php#L147-L163 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php | BrandRepository.getBrandCollection | public function getBrandCollection(BrandCollectionTransfer $brandCollectionTransfer): BrandCollectionTransfer
{
$brandQuery = $this->getFactory()
->createBrandQuery();
$brandQuery = $this->applyFilterToQuery($brandQuery, $brandCollectionTransfer->getFilter());
$brandQuery = $thi... | php | public function getBrandCollection(BrandCollectionTransfer $brandCollectionTransfer): BrandCollectionTransfer
{
$brandQuery = $this->getFactory()
->createBrandQuery();
$brandQuery = $this->applyFilterToQuery($brandQuery, $brandCollectionTransfer->getFilter());
$brandQuery = $thi... | [
"public",
"function",
"getBrandCollection",
"(",
"BrandCollectionTransfer",
"$",
"brandCollectionTransfer",
")",
":",
"BrandCollectionTransfer",
"{",
"$",
"brandQuery",
"=",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createBrandQuery",
"(",
")",
";",
"$",
"... | @param \Generated\Shared\Transfer\BrandCollectionTransfer $brandCollectionTransfer
@return \Generated\Shared\Transfer\BrandCollectionTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandCollectionTransfer",
"$brandCollectionTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php#L26-L37 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php | BrandRepository.findBrandByName | public function findBrandByName(string $name): ?BrandTransfer
{
$spyBrand = $this->getFactory()
->createBrandQuery()
->filterByName($name)
->findOne();
if ($spyBrand === null) {
return null;
}
$brand = (new BrandTransfer())->fromArray... | php | public function findBrandByName(string $name): ?BrandTransfer
{
$spyBrand = $this->getFactory()
->createBrandQuery()
->filterByName($name)
->findOne();
if ($spyBrand === null) {
return null;
}
$brand = (new BrandTransfer())->fromArray... | [
"public",
"function",
"findBrandByName",
"(",
"string",
"$",
"name",
")",
":",
"?",
"BrandTransfer",
"{",
"$",
"spyBrand",
"=",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createBrandQuery",
"(",
")",
"->",
"filterByName",
"(",
"$",
"name",
")",
"-... | @param string $name
@return \Generated\Shared\Transfer\BrandTransfer|null | [
"@param",
"string",
"$name"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php#L44-L61 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php | BrandRepository.applyFilterToQuery | protected function applyFilterToQuery(FosBrandQuery $fosBrandQuery, ?FilterTransfer $filterTransfer): FosBrandQuery
{
$criteria = new Criteria();
if ($filterTransfer !== null) {
$criteria = (new PropelFilterCriteria($filterTransfer))
->toCriteria();
}
$fo... | php | protected function applyFilterToQuery(FosBrandQuery $fosBrandQuery, ?FilterTransfer $filterTransfer): FosBrandQuery
{
$criteria = new Criteria();
if ($filterTransfer !== null) {
$criteria = (new PropelFilterCriteria($filterTransfer))
->toCriteria();
}
$fo... | [
"protected",
"function",
"applyFilterToQuery",
"(",
"FosBrandQuery",
"$",
"fosBrandQuery",
",",
"?",
"FilterTransfer",
"$",
"filterTransfer",
")",
":",
"FosBrandQuery",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
")",
";",
"if",
"(",
"$",
"filterTransfer"... | @param \Orm\Zed\Brand\Persistence\FosBrandQuery $fosBrandQuery
@param \Generated\Shared\Transfer\FilterTransfer|null $filterTransfer
@return \Orm\Zed\Brand\Persistence\FosBrandQuery | [
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Brand",
"\\",
"Persistence",
"\\",
"FosBrandQuery",
"$fosBrandQuery",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"FilterTransfer|null",
"$filterTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php#L69-L80 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php | BrandRepository.applyPagination | protected function applyPagination(FosBrandQuery $fosBrandQuery, ?PaginationTransfer $paginationTransfer = null): FosBrandQuery
{
if (empty($paginationTransfer)) {
return $fosBrandQuery;
}
$page = $paginationTransfer
->requirePage()
->getPage();
... | php | protected function applyPagination(FosBrandQuery $fosBrandQuery, ?PaginationTransfer $paginationTransfer = null): FosBrandQuery
{
if (empty($paginationTransfer)) {
return $fosBrandQuery;
}
$page = $paginationTransfer
->requirePage()
->getPage();
... | [
"protected",
"function",
"applyPagination",
"(",
"FosBrandQuery",
"$",
"fosBrandQuery",
",",
"?",
"PaginationTransfer",
"$",
"paginationTransfer",
"=",
"null",
")",
":",
"FosBrandQuery",
"{",
"if",
"(",
"empty",
"(",
"$",
"paginationTransfer",
")",
")",
"{",
"re... | @param \Orm\Zed\Brand\Persistence\FosBrandQuery $fosBrandQuery
@param \Generated\Shared\Transfer\PaginationTransfer|null $paginationTransfer
@return \Orm\Zed\Brand\Persistence\FosBrandQuery | [
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Brand",
"\\",
"Persistence",
"\\",
"FosBrandQuery",
"$fosBrandQuery",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"PaginationTransfer|null",
"$paginationTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php#L88-L113 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php | BrandRepository.hydrateBrandListWithBrands | protected function hydrateBrandListWithBrands(BrandCollectionTransfer $brandListTransfer, array $brands): void
{
$brandCollection = new ArrayObject();
foreach ($brands as $brand) {
$brandCollection->append(
$this->getFactory()
->createBrandMapper()
... | php | protected function hydrateBrandListWithBrands(BrandCollectionTransfer $brandListTransfer, array $brands): void
{
$brandCollection = new ArrayObject();
foreach ($brands as $brand) {
$brandCollection->append(
$this->getFactory()
->createBrandMapper()
... | [
"protected",
"function",
"hydrateBrandListWithBrands",
"(",
"BrandCollectionTransfer",
"$",
"brandListTransfer",
",",
"array",
"$",
"brands",
")",
":",
"void",
"{",
"$",
"brandCollection",
"=",
"new",
"ArrayObject",
"(",
")",
";",
"foreach",
"(",
"$",
"brands",
... | @param \Generated\Shared\Transfer\BrandCollectionTransfer $brandListTransfer
@param array $brands
@return void | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandCollectionTransfer",
"$brandListTransfer",
"@param",
"array",
"$brands"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php#L121-L134 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php | BrandRepository.getActiveBrands | public function getActiveBrands(): BrandCollectionTransfer
{
$query = $this->getFactory()
->createBrandQuery()
->filterByIsActive(true);
$brandEntityCollectionTransfer = $this->buildQueryFromCriteria($query)->find();
return $this->getFactory()->createBrandMapper()->... | php | public function getActiveBrands(): BrandCollectionTransfer
{
$query = $this->getFactory()
->createBrandQuery()
->filterByIsActive(true);
$brandEntityCollectionTransfer = $this->buildQueryFromCriteria($query)->find();
return $this->getFactory()->createBrandMapper()->... | [
"public",
"function",
"getActiveBrands",
"(",
")",
":",
"BrandCollectionTransfer",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createBrandQuery",
"(",
")",
"->",
"filterByIsActive",
"(",
"true",
")",
";",
"$",
"brandEntityCollecti... | @throws
@return \Generated\Shared\Transfer\BrandCollectionTransfer | [
"@throws"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/BrandRepository.php#L141-L150 |
xinix-technology/norm | src/Norm/Cursor/SQLServerCursor.php | SQLServerCursor.count | public function count($foundOnly = false)
{
$data = array();
$sql = $this->connection->getDialect()->grammarCount($this, $foundOnly, $data);
$statement = $this->connection->prepare($sql,$data);
$count_data = mssql_query($statement,$this->connection->getRaw());
$co... | php | public function count($foundOnly = false)
{
$data = array();
$sql = $this->connection->getDialect()->grammarCount($this, $foundOnly, $data);
$statement = $this->connection->prepare($sql,$data);
$count_data = mssql_query($statement,$this->connection->getRaw());
$co... | [
"public",
"function",
"count",
"(",
"$",
"foundOnly",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"sql",
"=",
"$",
"this",
"->",
"connection",
"->",
"getDialect",
"(",
")",
"->",
"grammarCount",
"(",
"$",
"this",
",",
"$"... | {@inheritDoc} | [
"{"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/SQLServerCursor.php#L44-L59 |
xinix-technology/norm | src/Norm/Cursor/SQLServerCursor.php | SQLServerCursor.getStatement | public function getStatement($type = null)
{
// $this->buffer = array();
// $this->next = false;
$sql = "SELECT * FROM [{$this->collection->getName()}]";
$wheres = array();
$data = array();
foreach ($this->criteria as $key => $value) {
$wheres[... | php | public function getStatement($type = null)
{
// $this->buffer = array();
// $this->next = false;
$sql = "SELECT * FROM [{$this->collection->getName()}]";
$wheres = array();
$data = array();
foreach ($this->criteria as $key => $value) {
$wheres[... | [
"public",
"function",
"getStatement",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"// $this->buffer = array();",
"// $this->next = false;",
"$",
"sql",
"=",
"\"SELECT * FROM [{$this->collection->getName()}]\"",
";",
"$",
"wheres",
"=",
"array",
"(",
")",
";",
"$",
"dat... | Get query statement of current cursor.
@param mixed $type
@return \PDOStatement | [
"Get",
"query",
"statement",
"of",
"current",
"cursor",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/SQLServerCursor.php#L140-L206 |
xinix-technology/norm | src/Norm/Cursor/SQLServerCursor.php | SQLServerCursor.distinct | public function distinct($key)
{
$sql = $this->connection->getDialect()->grammarDistinct($this,$key);
$statement = $this->connection->getRaw()->prepare($sql);
$statement->execute(array());
$result = array();
while($row = $statement->fetch(\PDO::FETCH_ASSOC)){
$re... | php | public function distinct($key)
{
$sql = $this->connection->getDialect()->grammarDistinct($this,$key);
$statement = $this->connection->getRaw()->prepare($sql);
$statement->execute(array());
$result = array();
while($row = $statement->fetch(\PDO::FETCH_ASSOC)){
$re... | [
"public",
"function",
"distinct",
"(",
"$",
"key",
")",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"connection",
"->",
"getDialect",
"(",
")",
"->",
"grammarDistinct",
"(",
"$",
"this",
",",
"$",
"key",
")",
";",
"$",
"statement",
"=",
"$",
"this",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/SQLServerCursor.php#L211-L223 |
Double-Opt-in/php-client-api | src/Security/SlowAES/cryptoHelpers.php | cryptoHelpers.toHex | public static function toHex($args){
if(func_num_args() != 1 || !is_array($args)){
$args = func_get_args();
}
$ret = '';
for($i = 0; $i < count($args) ;$i++)
$ret .= sprintf('%02x', $args[$i]);
return $ret;
} | php | public static function toHex($args){
if(func_num_args() != 1 || !is_array($args)){
$args = func_get_args();
}
$ret = '';
for($i = 0; $i < count($args) ;$i++)
$ret .= sprintf('%02x', $args[$i]);
return $ret;
} | [
"public",
"static",
"function",
"toHex",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"!=",
"1",
"||",
"!",
"is_array",
"(",
"$",
"args",
")",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"}",
"$",
"ret",
"=",
... | convert a number array to a hex string | [
"convert",
"a",
"number",
"array",
"to",
"a",
"hex",
"string"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/cryptoHelpers.php#L34-L42 |
Double-Opt-in/php-client-api | src/Security/SlowAES/cryptoHelpers.php | cryptoHelpers.toNumbers | public static function toNumbers($s){
$ret = array();
for($i=0; $i<strlen($s); $i+=2){
$ret[] = hexdec(substr($s, $i, 2));
}
return $ret;
} | php | public static function toNumbers($s){
$ret = array();
for($i=0; $i<strlen($s); $i+=2){
$ret[] = hexdec(substr($s, $i, 2));
}
return $ret;
} | [
"public",
"static",
"function",
"toNumbers",
"(",
"$",
"s",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"strlen",
"(",
"$",
"s",
")",
";",
"$",
"i",
"+=",
"2",
")",
"{",
"$",
"ret... | convert a hex string to a number array | [
"convert",
"a",
"hex",
"string",
"to",
"a",
"number",
"array"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/cryptoHelpers.php#L45-L51 |
Double-Opt-in/php-client-api | src/Security/SlowAES/cryptoHelpers.php | cryptoHelpers.getRandom | public static function getRandom($min,$max){
if($min === null)
$min = 0;
if($max === null)
$max = 1;
return mt_rand($min, $max);
} | php | public static function getRandom($min,$max){
if($min === null)
$min = 0;
if($max === null)
$max = 1;
return mt_rand($min, $max);
} | [
"public",
"static",
"function",
"getRandom",
"(",
"$",
"min",
",",
"$",
"max",
")",
"{",
"if",
"(",
"$",
"min",
"===",
"null",
")",
"$",
"min",
"=",
"0",
";",
"if",
"(",
"$",
"max",
"===",
"null",
")",
"$",
"max",
"=",
"1",
";",
"return",
"mt... | get a random number in the range [min,max] | [
"get",
"a",
"random",
"number",
"in",
"the",
"range",
"[",
"min",
"max",
"]"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/cryptoHelpers.php#L54-L60 |
phpmob/changmin | src/PhpMob/WidgetBundle/Controller/WidgetController.php | WidgetController.renderAction | public function renderAction(Request $request)
{
$twig = $this->get('twig');
$widget = $request->get('widget', []);
$widgetName = null;
if (!$notFound = empty($widget['name'])) {
$widgetName = $this->get('phpmob.widget.registry')->getWidgetClass($widget['name']);
... | php | public function renderAction(Request $request)
{
$twig = $this->get('twig');
$widget = $request->get('widget', []);
$widgetName = null;
if (!$notFound = empty($widget['name'])) {
$widgetName = $this->get('phpmob.widget.registry')->getWidgetClass($widget['name']);
... | [
"public",
"function",
"renderAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"twig",
"=",
"$",
"this",
"->",
"get",
"(",
"'twig'",
")",
";",
"$",
"widget",
"=",
"$",
"request",
"->",
"get",
"(",
"'widget'",
",",
"[",
"]",
")",
";",
"$",
"... | @param Request $request
@return Response | [
"@param",
"Request",
"$request"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/WidgetBundle/Controller/WidgetController.php#L32-L71 |
yuncms/framework | src/user/models/SettingsForm.php | SettingsForm.save | public function save()
{
if ($this->validate()) {
$this->user->scenario = 'settings';
$this->user->username = $this->username;
$this->user->nickname = $this->nickname;
$this->user->password = $this->new_password;
if ($this->email == $this->user->em... | php | public function save()
{
if ($this->validate()) {
$this->user->scenario = 'settings';
$this->user->username = $this->username;
$this->user->nickname = $this->nickname;
$this->user->password = $this->new_password;
if ($this->email == $this->user->em... | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"$",
"this",
"->",
"user",
"->",
"scenario",
"=",
"'settings'",
";",
"$",
"this",
"->",
"user",
"->",
"username",
"=",
"$",
"this",
"->",
"... | Saves new account settings.
@return boolean | [
"Saves",
"new",
"account",
"settings",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/SettingsForm.php#L132-L159 |
yuncms/framework | src/user/models/SettingsForm.php | SettingsForm.insecureEmailChange | protected function insecureEmailChange()
{
$this->user->email = $this->email;
Yii::$app->session->setFlash('success', Yii::t('yuncms', 'Your email address has been changed'));
} | php | protected function insecureEmailChange()
{
$this->user->email = $this->email;
Yii::$app->session->setFlash('success', Yii::t('yuncms', 'Your email address has been changed'));
} | [
"protected",
"function",
"insecureEmailChange",
"(",
")",
"{",
"$",
"this",
"->",
"user",
"->",
"email",
"=",
"$",
"this",
"->",
"email",
";",
"Yii",
"::",
"$",
"app",
"->",
"session",
"->",
"setFlash",
"(",
"'success'",
",",
"Yii",
"::",
"t",
"(",
"... | Changes user's email address to given without any confirmation. | [
"Changes",
"user",
"s",
"email",
"address",
"to",
"given",
"without",
"any",
"confirmation",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/SettingsForm.php#L164-L168 |
yuncms/framework | src/user/models/SettingsForm.php | SettingsForm.defaultEmailChange | protected function defaultEmailChange()
{
$this->user->unconfirmed_email = $this->email;
/** @var UserToken $token */
$token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_CONFIRM_NEW_EMAIL]);
$token->save(false);
Yii::$app->sendMail($this->user->unc... | php | protected function defaultEmailChange()
{
$this->user->unconfirmed_email = $this->email;
/** @var UserToken $token */
$token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_CONFIRM_NEW_EMAIL]);
$token->save(false);
Yii::$app->sendMail($this->user->unc... | [
"protected",
"function",
"defaultEmailChange",
"(",
")",
"{",
"$",
"this",
"->",
"user",
"->",
"unconfirmed_email",
"=",
"$",
"this",
"->",
"email",
";",
"/** @var UserToken $token */",
"$",
"token",
"=",
"new",
"UserToken",
"(",
"[",
"'user_id'",
"=>",
"$",
... | Sends a confirmation message to user's email address with link to confirm changing of email. | [
"Sends",
"a",
"confirmation",
"message",
"to",
"user",
"s",
"email",
"address",
"with",
"link",
"to",
"confirm",
"changing",
"of",
"email",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/SettingsForm.php#L173-L181 |
yuncms/framework | src/user/models/SettingsForm.php | SettingsForm.secureEmailChange | protected function secureEmailChange()
{
$this->defaultEmailChange();
/** @var UserToken $token */
$token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_CONFIRM_OLD_EMAIL]);
$token->save(false);
Yii::$app->sendMail($this->user->email, Yii::t('yuncms'... | php | protected function secureEmailChange()
{
$this->defaultEmailChange();
/** @var UserToken $token */
$token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_CONFIRM_OLD_EMAIL]);
$token->save(false);
Yii::$app->sendMail($this->user->email, Yii::t('yuncms'... | [
"protected",
"function",
"secureEmailChange",
"(",
")",
"{",
"$",
"this",
"->",
"defaultEmailChange",
"(",
")",
";",
"/** @var UserToken $token */",
"$",
"token",
"=",
"new",
"UserToken",
"(",
"[",
"'user_id'",
"=>",
"$",
"this",
"->",
"user",
"->",
"id",
",... | Sends a confirmation message to both old and new email addresses with link to confirm changing of email. | [
"Sends",
"a",
"confirmation",
"message",
"to",
"both",
"old",
"and",
"new",
"email",
"addresses",
"with",
"link",
"to",
"confirm",
"changing",
"of",
"email",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/SettingsForm.php#L186-L198 |
amostajo/wordpress-plugin-core | src/psr4/Config.php | Config.get | public function get( $key, $sub = null )
{
if ( empty( $sub ) ) $sub = $this->raw;
$keys = explode( '.', $key );
if ( empty( $keys ) ) return;
if ( array_key_exists( $keys[0], $sub ) ) {
if ( count( $keys ) == 1 ) {
return $sub[$keys[0]];
} else if ( is_array( $sub[$keys[0]] ) ) {
$sub = $sub[$... | php | public function get( $key, $sub = null )
{
if ( empty( $sub ) ) $sub = $this->raw;
$keys = explode( '.', $key );
if ( empty( $keys ) ) return;
if ( array_key_exists( $keys[0], $sub ) ) {
if ( count( $keys ) == 1 ) {
return $sub[$keys[0]];
} else if ( is_array( $sub[$keys[0]] ) ) {
$sub = $sub[$... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"sub",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sub",
")",
")",
"$",
"sub",
"=",
"$",
"this",
"->",
"raw",
";",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
"... | Returns value stored in given key.
Can acces multidimenssional array values with a DOT(.)
i.e. paypal.client_id
@since 1.0
@param string $key Key.
@param string $sub Child array
@return mixed | [
"Returns",
"value",
"stored",
"in",
"given",
"key",
".",
"Can",
"acces",
"multidimenssional",
"array",
"values",
"with",
"a",
"DOT",
"(",
".",
")",
"i",
".",
"e",
".",
"paypal",
".",
"client_id",
"@since",
"1",
".",
"0"
] | train | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Config.php#L45-L62 |
AndreyKluev/yii2-shop-basket | behaviors/BasketProductBehavior.php | BasketProductBehavior.isInBasket | public function isInBasket($idComponent = 'basket')
{
return Yii::$app->get($idComponent)->basket->isProductInBasket($this->getHash());
} | php | public function isInBasket($idComponent = 'basket')
{
return Yii::$app->get($idComponent)->basket->isProductInBasket($this->getHash());
} | [
"public",
"function",
"isInBasket",
"(",
"$",
"idComponent",
"=",
"'basket'",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"get",
"(",
"$",
"idComponent",
")",
"->",
"basket",
"->",
"isProductInBasket",
"(",
"$",
"this",
"->",
"getHash",
"(",
")",
... | Проверяет добавлен ли товар в корзину '$idComponent'
@param $idComponent
@return mixed
@throws \yii\base\InvalidConfigException | [
"Проверяет",
"добавлен",
"ли",
"товар",
"в",
"корзину",
"$idComponent"
] | train | https://github.com/AndreyKluev/yii2-shop-basket/blob/3bc529fd576a18403096f911112d5337cb5b1069/behaviors/BasketProductBehavior.php#L51-L54 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Validator/ValidatorMethodName.php | ValidatorMethodName.getMapping | public function getMapping(CoverFishPHPUnitFile $phpUnitFile)
{
$method = $this->getResult()['method'];
$classFQN = $phpUnitFile->getCoversDefaultClass();
$class = $this->coverFishHelper->getClassNameFromClassFQN($classFQN);
$mappingOptions = array(
'coverToken' => $this... | php | public function getMapping(CoverFishPHPUnitFile $phpUnitFile)
{
$method = $this->getResult()['method'];
$classFQN = $phpUnitFile->getCoversDefaultClass();
$class = $this->coverFishHelper->getClassNameFromClassFQN($classFQN);
$mappingOptions = array(
'coverToken' => $this... | [
"public",
"function",
"getMapping",
"(",
"CoverFishPHPUnitFile",
"$",
"phpUnitFile",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"getResult",
"(",
")",
"[",
"'method'",
"]",
";",
"$",
"classFQN",
"=",
"$",
"phpUnitFile",
"->",
"getCoversDefaultClass",
"... | @param CoverFishPHPUnitFile $phpUnitFile
@return array | [
"@param",
"CoverFishPHPUnitFile",
"$phpUnitFile"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Validator/ValidatorMethodName.php#L54-L71 |
askupasoftware/amarkal | Extensions/WordPress/Options/Section.php | Section.is_current_section | public function is_current_section()
{
if( !isset( $this->active ) )
{
$this->active = filter_input(INPUT_GET, 'section') == $this->get_slug();
}
return $this->active;
} | php | public function is_current_section()
{
if( !isset( $this->active ) )
{
$this->active = filter_input(INPUT_GET, 'section') == $this->get_slug();
}
return $this->active;
} | [
"public",
"function",
"is_current_section",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"active",
")",
")",
"{",
"$",
"this",
"->",
"active",
"=",
"filter_input",
"(",
"INPUT_GET",
",",
"'section'",
")",
"==",
"$",
"this",
"->",
"... | Check if this is the current section.
@return boolean True if this is the currently active section. | [
"Check",
"if",
"this",
"is",
"the",
"current",
"section",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/Section.php#L95-L102 |
askupasoftware/amarkal | Extensions/WordPress/Options/Section.php | Section.get_fields | public function get_fields()
{
if( !isset( $this->fields ) )
{
if( !$this->has_sub_sections() )
{
$this->fields = $this->model['fields'];
}
else
{
$this->fields = array();
foreach( $this->mode... | php | public function get_fields()
{
if( !isset( $this->fields ) )
{
if( !$this->has_sub_sections() )
{
$this->fields = $this->model['fields'];
}
else
{
$this->fields = array();
foreach( $this->mode... | [
"public",
"function",
"get_fields",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has_sub_sections",
"(",
")",
")",
"{",
"$",
"this",
"->",
"fields",
"=",
"$",
"this",... | Get the array of fields for this section.
If this section has subsections, the returning array will consist of
all fields from all subsections.
@return array | [
"Get",
"the",
"array",
"of",
"fields",
"for",
"this",
"section",
".",
"If",
"this",
"section",
"has",
"subsections",
"the",
"returning",
"array",
"will",
"consist",
"of",
"all",
"fields",
"from",
"all",
"subsections",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/Section.php#L121-L143 |
iocaste/microservice-foundation | src/Http/Middleware/TranslatorMiddleware.php | TranslatorMiddleware.handle | public function handle($request, Closure $next)
{
$lang = app('request')->get('lang');
if (! $lang) {
$lang = app('request')->segment(1);
}
if (! \in_array($lang, config('microservice.enabled_languages'), true)) {
$lang = env('DEFAULT_LOCALE', 'ru');
... | php | public function handle($request, Closure $next)
{
$lang = app('request')->get('lang');
if (! $lang) {
$lang = app('request')->segment(1);
}
if (! \in_array($lang, config('microservice.enabled_languages'), true)) {
$lang = env('DEFAULT_LOCALE', 'ru');
... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"$",
"lang",
"=",
"app",
"(",
"'request'",
")",
"->",
"get",
"(",
"'lang'",
")",
";",
"if",
"(",
"!",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"app",
"(... | Run the request filter.
@param $request
@param Closure $next
@return \Illuminate\Http\JsonResponse|mixed | [
"Run",
"the",
"request",
"filter",
"."
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Middleware/TranslatorMiddleware.php#L17-L34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.