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 |
|---|---|---|---|---|---|---|---|---|---|---|
yuncms/framework | src/notifications/ChannelManager.php | ChannelManager.has | public function has($id, $checkInstance = false)
{
return $checkInstance ? isset($this->_channels[$id]) : isset($this->_definitions[$id]);
} | php | public function has($id, $checkInstance = false)
{
return $checkInstance ? isset($this->_channels[$id]) : isset($this->_definitions[$id]);
} | [
"public",
"function",
"has",
"(",
"$",
"id",
",",
"$",
"checkInstance",
"=",
"false",
")",
"{",
"return",
"$",
"checkInstance",
"?",
"isset",
"(",
"$",
"this",
"->",
"_channels",
"[",
"$",
"id",
"]",
")",
":",
"isset",
"(",
"$",
"this",
"->",
"_def... | Returns a value indicating whether the locator has the specified channel definition or has instantiated the channel.
This method may return different results depending on the value of `$checkInstance`.
- If `$checkInstance` is false (default), the method will return a value indicating whether the locator has the speci... | [
"Returns",
"a",
"value",
"indicating",
"whether",
"the",
"locator",
"has",
"the",
"specified",
"channel",
"definition",
"or",
"has",
"instantiated",
"the",
"channel",
".",
"This",
"method",
"may",
"return",
"different",
"results",
"depending",
"on",
"the",
"valu... | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/notifications/ChannelManager.php#L106-L109 |
yuncms/framework | src/notifications/ChannelManager.php | ChannelManager.setChannels | public function setChannels($channels)
{
foreach ($channels as $id => $channel) {
$this->set($id, $channel);
}
} | php | public function setChannels($channels)
{
foreach ($channels as $id => $channel) {
$this->set($id, $channel);
}
} | [
"public",
"function",
"setChannels",
"(",
"$",
"channels",
")",
"{",
"foreach",
"(",
"$",
"channels",
"as",
"$",
"id",
"=>",
"$",
"channel",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"id",
",",
"$",
"channel",
")",
";",
"}",
"}"
] | Registers a set of channel definitions in this locator.
This is the bulk version of [[set()]]. The parameter should be an array
whose keys are channel IDs and values the corresponding channel definitions.
For more details on how to specify channel IDs and definitions, please refer to [[set()]].
If a channel definiti... | [
"Registers",
"a",
"set",
"of",
"channel",
"definitions",
"in",
"this",
"locator",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/notifications/ChannelManager.php#L250-L255 |
yuncms/framework | src/notifications/ChannelManager.php | ChannelManager.send | public function send($notifiables, $notifications)
{
if (!is_array($notifiables)) {
$notifiables = [$notifiables];
}
if (!is_array($notifications)) {
$notifications = [$notifications];
}
foreach ($notifiables as $notifiable) {
$channels = a... | php | public function send($notifiables, $notifications)
{
if (!is_array($notifiables)) {
$notifiables = [$notifiables];
}
if (!is_array($notifications)) {
$notifications = [$notifications];
}
foreach ($notifiables as $notifiable) {
$channels = a... | [
"public",
"function",
"send",
"(",
"$",
"notifiables",
",",
"$",
"notifications",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"notifiables",
")",
")",
"{",
"$",
"notifiables",
"=",
"[",
"$",
"notifiables",
"]",
";",
"}",
"if",
"(",
"!",
"is_array... | 通过可用渠道将给定的通知发送给给定的可通知实体。您可以传递数组以便将多个通知发送给多个收件人。
@param NotifiableInterface|NotifiableInterface[] $notifiables 可以收到给定通知的收件人。
@param Notification|Notification[] $notifications 应该交付的通知。
@return void
@throws InvalidConfigException | [
"通过可用渠道将给定的通知发送给给定的可通知实体。您可以传递数组以便将多个通知发送给多个收件人。"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/notifications/ChannelManager.php#L265-L286 |
Chill-project/Main | Search/SearchProvider.php | SearchProvider.getByOrder | public function getByOrder()
{
//sort the array
uasort($this->searchServices, function(SearchInterface $a, SearchInterface $b) {
if ($a->getOrder() == $b->getOrder()) {
return 0;
}
return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
});
... | php | public function getByOrder()
{
//sort the array
uasort($this->searchServices, function(SearchInterface $a, SearchInterface $b) {
if ($a->getOrder() == $b->getOrder()) {
return 0;
}
return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
});
... | [
"public",
"function",
"getByOrder",
"(",
")",
"{",
"//sort the array",
"uasort",
"(",
"$",
"this",
"->",
"searchServices",
",",
"function",
"(",
"SearchInterface",
"$",
"a",
",",
"SearchInterface",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getOrder",... | /*
return search services in an array, ordered by
the order key (defined in service definition)
the conflicts in keys (twice the same order) are resolved
within the compiler : the function will preserve all services
defined (if two services have the same order, the will increment
the order of the second one.
@return S... | [
"/",
"*",
"return",
"search",
"services",
"in",
"an",
"array",
"ordered",
"by",
"the",
"order",
"key",
"(",
"defined",
"in",
"service",
"definition",
")",
"the",
"conflicts",
"in",
"keys",
"(",
"twice",
"the",
"same",
"order",
")",
"are",
"resolved",
"wi... | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/SearchProvider.php#L33-L44 |
Chill-project/Main | Search/SearchProvider.php | SearchProvider.parse | public function parse($pattern)
{
//reset must be extracted
$this->mustBeExtracted = array();
//filter to lower and remove accentued
$filteredPattern = mb_strtolower($this->remove_accents($pattern));
$terms = $this->extractTerms($filteredPattern);
$terms['_domain'] =... | php | public function parse($pattern)
{
//reset must be extracted
$this->mustBeExtracted = array();
//filter to lower and remove accentued
$filteredPattern = mb_strtolower($this->remove_accents($pattern));
$terms = $this->extractTerms($filteredPattern);
$terms['_domain'] =... | [
"public",
"function",
"parse",
"(",
"$",
"pattern",
")",
"{",
"//reset must be extracted",
"$",
"this",
"->",
"mustBeExtracted",
"=",
"array",
"(",
")",
";",
"//filter to lower and remove accentued",
"$",
"filteredPattern",
"=",
"mb_strtolower",
"(",
"$",
"this",
... | parse the search string to extract domain and terms
@param string $pattern
@return string[] an array where the keys are _domain, _default (residual terms) or term | [
"parse",
"the",
"search",
"string",
"to",
"extract",
"domain",
"and",
"terms"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/SearchProvider.php#L52-L64 |
Chill-project/Main | Search/SearchProvider.php | SearchProvider.getSearchResults | public function getSearchResults($pattern, $start = 0, $limit = 50)
{
$terms = $this->parse($pattern);
$results = array();
//sort searchServices by order
$sortedSearchServices = array();
foreach($this->searchServices as $service) {
$sortedSearchServices[$... | php | public function getSearchResults($pattern, $start = 0, $limit = 50)
{
$terms = $this->parse($pattern);
$results = array();
//sort searchServices by order
$sortedSearchServices = array();
foreach($this->searchServices as $service) {
$sortedSearchServices[$... | [
"public",
"function",
"getSearchResults",
"(",
"$",
"pattern",
",",
"$",
"start",
"=",
"0",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"terms",
"=",
"$",
"this",
"->",
"parse",
"(",
"$",
"pattern",
")",
";",
"$",
"results",
"=",
"array",
"(",
"... | search through services which supports domain and give
results as html string
@param string $pattern
@param number $start
@param number $limit
@return array of html results
@throws UnknowSearchDomainException if the domain is unknow | [
"search",
"through",
"services",
"which",
"supports",
"domain",
"and",
"give",
"results",
"as",
"html",
"string"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/SearchProvider.php#L129-L162 |
Chill-project/Main | Search/SearchProvider.php | SearchProvider.getByName | public function getByName($name)
{
if (isset($this->searchServices[$name])) {
return $this->searchServices[$name];
} else {
throw new UnknowSearchNameException($name);
}
} | php | public function getByName($name)
{
if (isset($this->searchServices[$name])) {
return $this->searchServices[$name];
} else {
throw new UnknowSearchNameException($name);
}
} | [
"public",
"function",
"getByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"searchServices",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"searchServices",
"[",
"$",
"name",
"]",
";",
"}",
"else... | return search services with a specific name, defined in service
definition.
@return SearchInterface
@throws UnknowSearchNameException if not exists | [
"return",
"search",
"services",
"with",
"a",
"specific",
"name",
"defined",
"in",
"service",
"definition",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/SearchProvider.php#L184-L191 |
Chill-project/Main | Search/SearchProvider.php | SearchProvider.remove_accents | private function remove_accents($string)
{
if (!preg_match('/[\x80-\xff]/', $string))
return $string;
//if ($this->seems_utf8($string)) { // remove from wordpress: we use only UTF-8
if (true) {
$chars = array(
// Decompositions for Latin-1 Supplement
... | php | private function remove_accents($string)
{
if (!preg_match('/[\x80-\xff]/', $string))
return $string;
//if ($this->seems_utf8($string)) { // remove from wordpress: we use only UTF-8
if (true) {
$chars = array(
// Decompositions for Latin-1 Supplement
... | [
"private",
"function",
"remove_accents",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/[\\x80-\\xff]/'",
",",
"$",
"string",
")",
")",
"return",
"$",
"string",
";",
"//if ($this->seems_utf8($string)) { // remove from wordpress: we use only UTF-8",
... | Converts all accent characters to ASCII characters.
If there are no accent characters, then the string given is just returned.
Imported from wordpress : https://core.trac.wordpress.org/browser/tags/4.1/src/wp-includes/formatting.php?order=name
@param string $string Text that might have accent characters
@return stri... | [
"Converts",
"all",
"accent",
"characters",
"to",
"ASCII",
"characters",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/SearchProvider.php#L209-L438 |
studiowbe/html | src/Attributes.php | Attributes.addClass | public function addClass($classname)
{
$classArr = $this->getClassArray();
$classArr[] = $classname;
return $this->setClassArray($classArr);
} | php | public function addClass($classname)
{
$classArr = $this->getClassArray();
$classArr[] = $classname;
return $this->setClassArray($classArr);
} | [
"public",
"function",
"addClass",
"(",
"$",
"classname",
")",
"{",
"$",
"classArr",
"=",
"$",
"this",
"->",
"getClassArray",
"(",
")",
";",
"$",
"classArr",
"[",
"]",
"=",
"$",
"classname",
";",
"return",
"$",
"this",
"->",
"setClassArray",
"(",
"$",
... | Add a class
@param string $classname
@return \Studiow\HTML\Attributes | [
"Add",
"a",
"class"
] | train | https://github.com/studiowbe/html/blob/860a6d4ff85bc25df5b9e0293d7ff916db8e01af/src/Attributes.php#L43-L48 |
studiowbe/html | src/Attributes.php | Attributes.removeClass | public function removeClass($classname)
{
$classArr = array_diff($this->getClassArray(), [$classname]);
return $this->setClassArray($classArr);
} | php | public function removeClass($classname)
{
$classArr = array_diff($this->getClassArray(), [$classname]);
return $this->setClassArray($classArr);
} | [
"public",
"function",
"removeClass",
"(",
"$",
"classname",
")",
"{",
"$",
"classArr",
"=",
"array_diff",
"(",
"$",
"this",
"->",
"getClassArray",
"(",
")",
",",
"[",
"$",
"classname",
"]",
")",
";",
"return",
"$",
"this",
"->",
"setClassArray",
"(",
"... | Remove a class
@param string $classname
@return \Studiow\HTML\Attributes | [
"Remove",
"a",
"class"
] | train | https://github.com/studiowbe/html/blob/860a6d4ff85bc25df5b9e0293d7ff916db8e01af/src/Attributes.php#L55-L59 |
lode/fem | src/session.php | session.create | public static function create($type=null) {
$type = self::check_type($type);
self::destroy($type);
self::start($type);
} | php | public static function create($type=null) {
$type = self::check_type($type);
self::destroy($type);
self::start($type);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"check_type",
"(",
"$",
"type",
")",
";",
"self",
"::",
"destroy",
"(",
"$",
"type",
")",
";",
"self",
"::",
"start",
"(",
"$",
"ty... | create a new session, destroying any current session
use this when you want to *start* tracking a user
@param string $type one of the ::TYPE_* consts
optional, defaults to ::TYPE_CONTINUOUS
@return void | [
"create",
"a",
"new",
"session",
"destroying",
"any",
"current",
"session",
"use",
"this",
"when",
"you",
"want",
"to",
"*",
"start",
"*",
"tracking",
"a",
"user"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L80-L85 |
lode/fem | src/session.php | session.keep | public static function keep($type=null) {
$type = self::check_type($type);
if (self::cookie_exists($type)) {
self::start($type);
}
} | php | public static function keep($type=null) {
$type = self::check_type($type);
if (self::cookie_exists($type)) {
self::start($type);
}
} | [
"public",
"static",
"function",
"keep",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"check_type",
"(",
"$",
"type",
")",
";",
"if",
"(",
"self",
"::",
"cookie_exists",
"(",
"$",
"type",
")",
")",
"{",
"self",
"::",
"s... | keep a current session active
use this when you want to start using a session in the current request
@note this does *not* create a new session if one doesn't already exist
@see ::start() if you always want to create a new one anyway
@param string $type one of the ::TYPE_* consts
optional, defaults to ::TYPE_CONTIN... | [
"keep",
"a",
"current",
"session",
"active",
"use",
"this",
"when",
"you",
"want",
"to",
"start",
"using",
"a",
"session",
"in",
"the",
"current",
"request"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L98-L104 |
lode/fem | src/session.php | session.is_active | public static function is_active() {
if (session_status() != PHP_SESSION_ACTIVE) {
return false;
}
if (empty($_SESSION['_session_type']) || empty($_SESSION['_session_last_active'])) {
return false;
}
return true;
} | php | public static function is_active() {
if (session_status() != PHP_SESSION_ACTIVE) {
return false;
}
if (empty($_SESSION['_session_type']) || empty($_SESSION['_session_last_active'])) {
return false;
}
return true;
} | [
"public",
"static",
"function",
"is_active",
"(",
")",
"{",
"if",
"(",
"session_status",
"(",
")",
"!=",
"PHP_SESSION_ACTIVE",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"_SESSION",
"[",
"'_session_type'",
"]",
")",
"||",
"empty... | wrapper for session_status() which returns a boolean
@return boolean | [
"wrapper",
"for",
"session_status",
"()",
"which",
"returns",
"a",
"boolean"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L111-L120 |
lode/fem | src/session.php | session.start | public static function start($type=null) {
if (self::is_active()) {
return;
}
$type = self::check_type($type);
$cookie = self::get_cookie_settings($type);
session_set_cookie_params($cookie['duration'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['http_only']);
session_name($cookie['name']... | php | public static function start($type=null) {
if (self::is_active()) {
return;
}
$type = self::check_type($type);
$cookie = self::get_cookie_settings($type);
session_set_cookie_params($cookie['duration'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['http_only']);
session_name($cookie['name']... | [
"public",
"static",
"function",
"start",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"type",
"=",
"self",
"::",
"check_type",
"(",
"$",
"type",
")",
";",
"$",
"cookie... | wrapper for the native session_start() with added security measures:
- sets the cookie arguments
- prevents session fixation
- validates sessions
- regenerates ids on an interval
@param string $type one of the ::TYPE_* consts
optional, defaults to ::TYPE_CONTINUOUS
@return void | [
"wrapper",
"for",
"the",
"native",
"session_start",
"()",
"with",
"added",
"security",
"measures",
":",
"-",
"sets",
"the",
"cookie",
"arguments",
"-",
"prevents",
"session",
"fixation",
"-",
"validates",
"sessions",
"-",
"regenerates",
"ids",
"on",
"an",
"int... | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L133-L171 |
lode/fem | src/session.php | session.regenerate_id | public static function regenerate_id($interval_based=false) {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
$fresh_enough = ($_SESSION['_session_last_active'] > (time() - self::INTERVAL_REFRESH));
if ($fresh_enough && $interval_... | php | public static function regenerate_id($interval_based=false) {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
$fresh_enough = ($_SESSION['_session_last_active'] > (time() - self::INTERVAL_REFRESH));
if ($fresh_enough && $interval_... | [
"public",
"static",
"function",
"regenerate_id",
"(",
"$",
"interval_based",
"=",
"false",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
"==",
"false",
")",
"{",
"$",
"exception",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'exception'",
")",
... | wrapper for the native session_regenerate_id()
when $interval_based is set to true ..
.. regeneration only happens at certain intervals of a sessions lifetime ..
.. to keep a small attack window
the old session is marked to expire instead of deleted at once ..
.. this to allow running ajax requests to continue to use... | [
"wrapper",
"for",
"the",
"native",
"session_regenerate_id",
"()"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L203-L225 |
lode/fem | src/session.php | session.set_user_id | public static function set_user_id($user_id) {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
$_SESSION['_session_user_id'] = $user_id;
} | php | public static function set_user_id($user_id) {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
$_SESSION['_session_user_id'] = $user_id;
} | [
"public",
"static",
"function",
"set_user_id",
"(",
"$",
"user_id",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
"==",
"false",
")",
"{",
"$",
"exception",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'exception'",
")",
";",
"throw",
"new",
... | connects a user to the current session
once a user is connected, ::is_valid() will validate it
@param int $user_id | [
"connects",
"a",
"user",
"to",
"the",
"current",
"session",
"once",
"a",
"user",
"is",
"connected",
"::",
"is_valid",
"()",
"will",
"validate",
"it"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L249-L256 |
lode/fem | src/session.php | session.is_loggedin | public static function is_loggedin() {
if (self::is_active() == false) {
return false;
}
if (self::get_user_id() == false) {
return false;
}
return true;
} | php | public static function is_loggedin() {
if (self::is_active() == false) {
return false;
}
if (self::get_user_id() == false) {
return false;
}
return true;
} | [
"public",
"static",
"function",
"is_loggedin",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
"==",
"false",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"self",
"::",
"get_user_id",
"(",
")",
"==",
"false",
")",
"{",
"return",
... | checks whether the current user is logged in
i.e. whether the session has a user attached via ::set_user_id()
@return boolean | [
"checks",
"whether",
"the",
"current",
"user",
"is",
"logged",
"in",
"i",
".",
"e",
".",
"whether",
"the",
"session",
"has",
"a",
"user",
"attached",
"via",
"::",
"set_user_id",
"()"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L264-L273 |
lode/fem | src/session.php | session.force_loggedin | public static function force_loggedin() {
if (self::is_loggedin() == false) {
$request = bootstrap::get_library('request');
$request::redirect(self::$login_url);
}
return true;
} | php | public static function force_loggedin() {
if (self::is_loggedin() == false) {
$request = bootstrap::get_library('request');
$request::redirect(self::$login_url);
}
return true;
} | [
"public",
"static",
"function",
"force_loggedin",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"is_loggedin",
"(",
")",
"==",
"false",
")",
"{",
"$",
"request",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'request'",
")",
";",
"$",
"request",
"::",
"redirect... | redirects the user to the login page when it is not logged in
@see ::is_loggedin() for the check
@see ::$login_url for the redirection
@return boolean|void returns true when loggedin, redirects otherwise | [
"redirects",
"the",
"user",
"to",
"the",
"login",
"page",
"when",
"it",
"is",
"not",
"logged",
"in",
"@see",
"::",
"is_loggedin",
"()",
"for",
"the",
"check",
"@see",
"::",
"$login_url",
"for",
"the",
"redirection"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L282-L289 |
lode/fem | src/session.php | session.is_valid | private static function is_valid() {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
if (self::validate() == false) {
return false;
}
if (self::challenge() == false) {
return false;
}
if (is_callable(self::$validation_cal... | php | private static function is_valid() {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
if (self::validate() == false) {
return false;
}
if (self::challenge() == false) {
return false;
}
if (is_callable(self::$validation_cal... | [
"private",
"static",
"function",
"is_valid",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
"==",
"false",
")",
"{",
"$",
"exception",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'exception'",
")",
";",
"throw",
"new",
"$",
"exception",
... | wrapper for all kinds of validation methods
@see ::validate(), ::challenge() and user::validate_session()
@return boolean | [
"wrapper",
"for",
"all",
"kinds",
"of",
"validation",
"methods",
"@see",
"::",
"validate",
"()",
"::",
"challenge",
"()",
"and",
"user",
"::",
"validate_session",
"()"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L297-L317 |
lode/fem | src/session.php | session.validate | private static function validate() {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
if (empty($_SESSION['_session_type']) || empty($_SESSION['_session_last_active'])) {
return false;
}
// throw away expired (replaced) sessio... | php | private static function validate() {
if (self::is_active() == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('inactive session');
}
if (empty($_SESSION['_session_type']) || empty($_SESSION['_session_last_active'])) {
return false;
}
// throw away expired (replaced) sessio... | [
"private",
"static",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
"==",
"false",
")",
"{",
"$",
"exception",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'exception'",
")",
";",
"throw",
"new",
"$",
"exception",
... | checks whether the session is still valid to continue on
this mainly checks the duration, and delayed deletions
@return boolean | [
"checks",
"whether",
"the",
"session",
"is",
"still",
"valid",
"to",
"continue",
"on",
"this",
"mainly",
"checks",
"the",
"duration",
"and",
"delayed",
"deletions"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L325-L348 |
lode/fem | src/session.php | session.challenge | private static function challenge() {
$exception = bootstrap::get_library('exception');
if (self::is_active() == false) {
throw new $exception('inactive session');
}
if (empty($_SESSION['_session_fingerprint'])) {
throw new $exception('cannot challenge a fresh session');
}
$request = bootstrap::get_libr... | php | private static function challenge() {
$exception = bootstrap::get_library('exception');
if (self::is_active() == false) {
throw new $exception('inactive session');
}
if (empty($_SESSION['_session_fingerprint'])) {
throw new $exception('cannot challenge a fresh session');
}
$request = bootstrap::get_libr... | [
"private",
"static",
"function",
"challenge",
"(",
")",
"{",
"$",
"exception",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'exception'",
")",
";",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"$",
"exception",... | challenge the session's fingerprint
this is a balanced check for similar user-agent / ip-address data
a like a spam filter, the challenge only fails when the score is too high
@return boolean false meaning the session should not be trusted | [
"challenge",
"the",
"session",
"s",
"fingerprint",
"this",
"is",
"a",
"balanced",
"check",
"for",
"similar",
"user",
"-",
"agent",
"/",
"ip",
"-",
"address",
"data",
"a",
"like",
"a",
"spam",
"filter",
"the",
"challenge",
"only",
"fails",
"when",
"the",
... | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L357-L378 |
lode/fem | src/session.php | session.calculate_fingerprint_score | private static function calculate_fingerprint_score($old_fingerprint, $new_fingerprint) {
$score = 0;
foreach ($new_fingerprint as $key => $new_value) {
if (isset($old_fingerprint[$key]) == false) {
// tampered data
$score = 100;
break;
}
$old_value = $old_fingerprint[$key];
if (empty($old_value) ... | php | private static function calculate_fingerprint_score($old_fingerprint, $new_fingerprint) {
$score = 0;
foreach ($new_fingerprint as $key => $new_value) {
if (isset($old_fingerprint[$key]) == false) {
// tampered data
$score = 100;
break;
}
$old_value = $old_fingerprint[$key];
if (empty($old_value) ... | [
"private",
"static",
"function",
"calculate_fingerprint_score",
"(",
"$",
"old_fingerprint",
",",
"$",
"new_fingerprint",
")",
"{",
"$",
"score",
"=",
"0",
";",
"foreach",
"(",
"$",
"new_fingerprint",
"as",
"$",
"key",
"=>",
"$",
"new_value",
")",
"{",
"if",... | calculates a weighed difference between old and new challenge data
challenge data is produced by \alsvanzelf\fem\request::get_fingerprint()
a score somewhere between 1 and 3 should be the threshold for turning bad
when a score of 100 is returned, it should be treated as definitely bad
@param array $previous_data fro... | [
"calculates",
"a",
"weighed",
"difference",
"between",
"old",
"and",
"new",
"challenge",
"data",
"challenge",
"data",
"is",
"produced",
"by",
"\\",
"alsvanzelf",
"\\",
"fem",
"\\",
"request",
"::",
"get_fingerprint",
"()"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L391-L418 |
lode/fem | src/session.php | session.check_type | private static function check_type($type=null) {
if (is_null($type)) {
return self::TYPE_CONTINUOUS;
}
if (isset(self::$type_durations[$type]) == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('unknown session type');
}
return $type;
} | php | private static function check_type($type=null) {
if (is_null($type)) {
return self::TYPE_CONTINUOUS;
}
if (isset(self::$type_durations[$type]) == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('unknown session type');
}
return $type;
} | [
"private",
"static",
"function",
"check_type",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"type",
")",
")",
"{",
"return",
"self",
"::",
"TYPE_CONTINUOUS",
";",
"}",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"type_dura... | returns the same type as the input, except when:
- null, it returns the default ::TYPE_CONTINUOUS
- not one of the allowed types, it throws an exception
@param string $type one of the ::TYPE_* consts
@return string|exception | [
"returns",
"the",
"same",
"type",
"as",
"the",
"input",
"except",
"when",
":",
"-",
"null",
"it",
"returns",
"the",
"default",
"::",
"TYPE_CONTINUOUS",
"-",
"not",
"one",
"of",
"the",
"allowed",
"types",
"it",
"throws",
"an",
"exception"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L428-L439 |
lode/fem | src/session.php | session.get_cookie_name | private static function get_cookie_name($type=null) {
if (is_null($type)) {
$type = $_SESSION['_session_type'];
}
return self::COOKIE_NAME_PREFIX.'-'.$type;
} | php | private static function get_cookie_name($type=null) {
if (is_null($type)) {
$type = $_SESSION['_session_type'];
}
return self::COOKIE_NAME_PREFIX.'-'.$type;
} | [
"private",
"static",
"function",
"get_cookie_name",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"type",
")",
")",
"{",
"$",
"type",
"=",
"$",
"_SESSION",
"[",
"'_session_type'",
"]",
";",
"}",
"return",
"self",
"::",
"COO... | generates a key for the session cookie
@param string $type one of the ::TYPE_* consts
defaults to the type of the current session
@return string a concatenation of the base (see ::COOKIE_NAME_PREFIX) and the type
i.e. prefix + '-temporary' | [
"generates",
"a",
"key",
"for",
"the",
"session",
"cookie"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L449-L455 |
lode/fem | src/session.php | session.get_cookie_settings | private static function get_cookie_settings($type) {
$name = self::get_cookie_name($type);
$duration = self::$type_durations[$type];
$domain = $_SERVER['SERVER_NAME'];
$path = '/';
$secure = !empty($_SERVER['HTTPS']) ? true : false;
$http_only = true;
return [
'name' => $name,
'durati... | php | private static function get_cookie_settings($type) {
$name = self::get_cookie_name($type);
$duration = self::$type_durations[$type];
$domain = $_SERVER['SERVER_NAME'];
$path = '/';
$secure = !empty($_SERVER['HTTPS']) ? true : false;
$http_only = true;
return [
'name' => $name,
'durati... | [
"private",
"static",
"function",
"get_cookie_settings",
"(",
"$",
"type",
")",
"{",
"$",
"name",
"=",
"self",
"::",
"get_cookie_name",
"(",
"$",
"type",
")",
";",
"$",
"duration",
"=",
"self",
"::",
"$",
"type_durations",
"[",
"$",
"type",
"]",
";",
"$... | returns all keys needed for session cookie management
@param string $type one of the ::TYPE_* consts
@return array keys 'name', 'duration', 'domain', 'path', 'secure', 'http_only' | [
"returns",
"all",
"keys",
"needed",
"for",
"session",
"cookie",
"management"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L463-L479 |
lode/fem | src/session.php | session.destroy_cookie | private static function destroy_cookie($type=null) {
if (is_null($type)) {
foreach (self::$type_durations as $type => $null) {
self::destroy_cookie($type);
}
return;
}
if (self::cookie_exists($type) == false) {
return;
}
self::update_cookie_expiration($type, $expire_now=true);
$cookie_name = self... | php | private static function destroy_cookie($type=null) {
if (is_null($type)) {
foreach (self::$type_durations as $type => $null) {
self::destroy_cookie($type);
}
return;
}
if (self::cookie_exists($type) == false) {
return;
}
self::update_cookie_expiration($type, $expire_now=true);
$cookie_name = self... | [
"private",
"static",
"function",
"destroy_cookie",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"type",
")",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"type_durations",
"as",
"$",
"type",
"=>",
"$",
"null",
")",
"{",
... | throws away the session cookie
@param string $type one of the ::TYPE_* consts
if null, defaults to removing cookies for all possible types
@return void | [
"throws",
"away",
"the",
"session",
"cookie"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L500-L516 |
lode/fem | src/session.php | session.update_cookie_expiration | private static function update_cookie_expiration($type, $expire_now=false) {
$params = self::get_cookie_settings($type);
$value = session_id();
$expire = (time() + $params['duration']);
if ($expire_now) {
$value = null;
$expire = (time() - 604800); // one week ago
}
setcookie($params['name'], $value, $e... | php | private static function update_cookie_expiration($type, $expire_now=false) {
$params = self::get_cookie_settings($type);
$value = session_id();
$expire = (time() + $params['duration']);
if ($expire_now) {
$value = null;
$expire = (time() - 604800); // one week ago
}
setcookie($params['name'], $value, $e... | [
"private",
"static",
"function",
"update_cookie_expiration",
"(",
"$",
"type",
",",
"$",
"expire_now",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"get_cookie_settings",
"(",
"$",
"type",
")",
";",
"$",
"value",
"=",
"session_id",
"(",
")",
... | updates the cookies expiration with the type's duration
useful to keep the cookie active after each user activity
set $expire_now to true to remove the cookie
@param string $type one of the ::TYPE_* consts
@param boolean $expire_now default false
@return void | [
"updates",
"the",
"cookies",
"expiration",
"with",
"the",
"type",
"s",
"duration",
"useful",
"to",
"keep",
"the",
"cookie",
"active",
"after",
"each",
"user",
"activity"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/session.php#L528-L539 |
webforge-labs/psc-cms | lib/Psc/UI/HTMLTag.php | HTMLTag.getAttributes | public function getAttributes() {
$attributes = parent::getAttributes();
/* wir fügen den namespace hinzu wenn es nötig ist */
if (isset($attributes['class']) && ($namespace = $this->getOption('css.namespace')) != '') {
$attributes['class'] = array_map(array('\Psc\UI\UI','getClass'), $attributes['clas... | php | public function getAttributes() {
$attributes = parent::getAttributes();
/* wir fügen den namespace hinzu wenn es nötig ist */
if (isset($attributes['class']) && ($namespace = $this->getOption('css.namespace')) != '') {
$attributes['class'] = array_map(array('\Psc\UI\UI','getClass'), $attributes['clas... | [
"public",
"function",
"getAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"parent",
"::",
"getAttributes",
"(",
")",
";",
"/* wir fügen den namespace hinzu wenn es nötig ist */",
"if",
"(",
"isset",
"(",
"$",
"attributes",
"[",
"'class'",
"]",
")",
"&&",
"("... | Gibt die Attribute des Tags zurück
Fügt jeder Klasse des Tags einen namespace hinzu, sofern die klasse mit \Psc anfängt | [
"Gibt",
"die",
"Attribute",
"des",
"Tags",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/HTMLTag.php#L19-L26 |
sebastiaanluca/laravel-unbreakable-migrations | src/Migration.php | Migration.connect | protected function connect() : void
{
if (! $this->isLaravel()) {
throw new Exception('This migrator must be ran from inside a Laravel application.');
}
$this->manager = app('db');
$this->database = $this->manager->connection();
$this->schema = $this->database->g... | php | protected function connect() : void
{
if (! $this->isLaravel()) {
throw new Exception('This migrator must be ran from inside a Laravel application.');
}
$this->manager = app('db');
$this->database = $this->manager->connection();
$this->schema = $this->database->g... | [
"protected",
"function",
"connect",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isLaravel",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'This migrator must be ran from inside a Laravel application.'",
")",
";",
"}",
"$",
"this",
... | Check the database connection and use of the Laravel framework.
@return void
@throws \Exception | [
"Check",
"the",
"database",
"connection",
"and",
"use",
"of",
"the",
"Laravel",
"framework",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/Migration.php#L93-L102 |
sebastiaanluca/laravel-unbreakable-migrations | src/Migration.php | Migration.handleException | protected function handleException($exception) : void
{
$previous = $exception->getPrevious();
if ($exception instanceof QueryException) {
throw new $exception($exception->getMessage(), $exception->getBindings(), $previous);
}
throw new $exception($exception->getMessage... | php | protected function handleException($exception) : void
{
$previous = $exception->getPrevious();
if ($exception instanceof QueryException) {
throw new $exception($exception->getMessage(), $exception->getBindings(), $previous);
}
throw new $exception($exception->getMessage... | [
"protected",
"function",
"handleException",
"(",
"$",
"exception",
")",
":",
"void",
"{",
"$",
"previous",
"=",
"$",
"exception",
"->",
"getPrevious",
"(",
")",
";",
"if",
"(",
"$",
"exception",
"instanceof",
"QueryException",
")",
"{",
"throw",
"new",
"$"... | Handle an exception.
@param \Exception $exception
@return void | [
"Handle",
"an",
"exception",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/Migration.php#L111-L120 |
sebastiaanluca/laravel-unbreakable-migrations | src/Migration.php | Migration.dropColumn | protected function dropColumn(string $tableName, string $column) : void
{
// Check for its existence before dropping
if (! $this->schema->hasColumn($tableName, $column)) {
return;
}
$this->schema->table($tableName, function (Blueprint $table) use ($column) {
... | php | protected function dropColumn(string $tableName, string $column) : void
{
// Check for its existence before dropping
if (! $this->schema->hasColumn($tableName, $column)) {
return;
}
$this->schema->table($tableName, function (Blueprint $table) use ($column) {
... | [
"protected",
"function",
"dropColumn",
"(",
"string",
"$",
"tableName",
",",
"string",
"$",
"column",
")",
":",
"void",
"{",
"// Check for its existence before dropping",
"if",
"(",
"!",
"$",
"this",
"->",
"schema",
"->",
"hasColumn",
"(",
"$",
"tableName",
",... | Safely drop a column from a table.
@param string $tableName
@param string $column
@return void | [
"Safely",
"drop",
"a",
"column",
"from",
"a",
"table",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/Migration.php#L130-L140 |
sebastiaanluca/laravel-unbreakable-migrations | src/Migration.php | Migration.drop | protected function drop($tables, bool $ignoreKeyConstraints = false) : void
{
if ($ignoreKeyConstraints) {
$this->database->statement('SET FOREIGN_KEY_CHECKS=0;');
}
if (! is_array($tables)) {
$tables = [$tables];
}
foreach ($tables as $table) {
... | php | protected function drop($tables, bool $ignoreKeyConstraints = false) : void
{
if ($ignoreKeyConstraints) {
$this->database->statement('SET FOREIGN_KEY_CHECKS=0;');
}
if (! is_array($tables)) {
$tables = [$tables];
}
foreach ($tables as $table) {
... | [
"protected",
"function",
"drop",
"(",
"$",
"tables",
",",
"bool",
"$",
"ignoreKeyConstraints",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"$",
"ignoreKeyConstraints",
")",
"{",
"$",
"this",
"->",
"database",
"->",
"statement",
"(",
"'SET FOREIGN_KEY_CHE... | Safely drop a table.
@param array|string $tables
@param bool $ignoreKeyConstraints
@return void | [
"Safely",
"drop",
"a",
"table",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/Migration.php#L150-L169 |
sebastiaanluca/laravel-unbreakable-migrations | src/Migration.php | Migration.dropAllTables | protected function dropAllTables(bool $ignoreKeyConstraints = false) : void
{
$this->drop($this->tables, $ignoreKeyConstraints);
} | php | protected function dropAllTables(bool $ignoreKeyConstraints = false) : void
{
$this->drop($this->tables, $ignoreKeyConstraints);
} | [
"protected",
"function",
"dropAllTables",
"(",
"bool",
"$",
"ignoreKeyConstraints",
"=",
"false",
")",
":",
"void",
"{",
"$",
"this",
"->",
"drop",
"(",
"$",
"this",
"->",
"tables",
",",
"$",
"ignoreKeyConstraints",
")",
";",
"}"
] | Safely drop all tables.
@param bool $ignoreKeyConstraints
@return void | [
"Safely",
"drop",
"all",
"tables",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/Migration.php#L178-L181 |
ClanCats/Core | src/classes/CCServer.php | CCServer._init | public static function _init()
{
// create new instance from default input
CCServer::$_instance = CCIn::create( $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER );
// unset default http holder to safe mem
//unset( $_GET, $_POST, $_COOKIE, $_SERVER, $_FILES );
} | php | public static function _init()
{
// create new instance from default input
CCServer::$_instance = CCIn::create( $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER );
// unset default http holder to safe mem
//unset( $_GET, $_POST, $_COOKIE, $_SERVER, $_FILES );
} | [
"public",
"static",
"function",
"_init",
"(",
")",
"{",
"// create new instance from default input",
"CCServer",
"::",
"$",
"_instance",
"=",
"CCIn",
"::",
"create",
"(",
"$",
"_GET",
",",
"$",
"_POST",
",",
"$",
"_COOKIE",
",",
"$",
"_FILES",
",",
"$",
"_... | The initial call of the CCServer get all Superglobals
and assigns them to itself as an holder.
@return void | [
"The",
"initial",
"call",
"of",
"the",
"CCServer",
"get",
"all",
"Superglobals",
"and",
"assigns",
"them",
"to",
"itself",
"as",
"an",
"holder",
"."
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCServer.php#L21-L28 |
phug-php/formatter | src/Phug/Formatter/AbstractFormat.php | AbstractFormat.setFormatter | public function setFormatter(Formatter $formatter)
{
$this->formatter = $formatter;
$format = $this;
return $this
->setOptionsRecursive($formatter->getOptions())
->registerHelper(
'dependencies_storage',
$formatter->getOption('dependen... | php | public function setFormatter(Formatter $formatter)
{
$this->formatter = $formatter;
$format = $this;
return $this
->setOptionsRecursive($formatter->getOptions())
->registerHelper(
'dependencies_storage',
$formatter->getOption('dependen... | [
"public",
"function",
"setFormatter",
"(",
"Formatter",
"$",
"formatter",
")",
"{",
"$",
"this",
"->",
"formatter",
"=",
"$",
"formatter",
";",
"$",
"format",
"=",
"$",
"this",
";",
"return",
"$",
"this",
"->",
"setOptionsRecursive",
"(",
"$",
"formatter",... | @param Formatter $formatter
@return $this | [
"@param",
"Formatter",
"$formatter"
] | train | https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/AbstractFormat.php#L152-L193 |
phug-php/formatter | src/Phug/Formatter/AbstractFormat.php | AbstractFormat.format | public function format($element, $noDebug = false)
{
if (is_string($element)) {
return $element;
}
$debug = $this->getOption('debug') && !$noDebug;
foreach ($this->getOption('element_handlers') as $className => $handler) {
if (is_a($element, $className)) {
... | php | public function format($element, $noDebug = false)
{
if (is_string($element)) {
return $element;
}
$debug = $this->getOption('debug') && !$noDebug;
foreach ($this->getOption('element_handlers') as $className => $handler) {
if (is_a($element, $className)) {
... | [
"public",
"function",
"format",
"(",
"$",
"element",
",",
"$",
"noDebug",
"=",
"false",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"element",
")",
")",
"{",
"return",
"$",
"element",
";",
"}",
"$",
"debug",
"=",
"$",
"this",
"->",
"getOption",
"("... | @param string|ElementInterface $element
@param bool $noDebug
@param $element
@return string | [
"@param",
"string|ElementInterface",
"$element",
"@param",
"bool",
"$noDebug",
"@param",
"$element"
] | train | https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/AbstractFormat.php#L232-L252 |
phug-php/formatter | src/Phug/Formatter/AbstractFormat.php | AbstractFormat.formatCode | public function formatCode($code, $checked, $noTransformation = false)
{
if (!$noTransformation) {
$code = $this->pattern(
'transform_code',
$this->pattern(
'transform_expression',
$this->pattern('transform_raw_code', $code)... | php | public function formatCode($code, $checked, $noTransformation = false)
{
if (!$noTransformation) {
$code = $this->pattern(
'transform_code',
$this->pattern(
'transform_expression',
$this->pattern('transform_raw_code', $code)... | [
"public",
"function",
"formatCode",
"(",
"$",
"code",
",",
"$",
"checked",
",",
"$",
"noTransformation",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"noTransformation",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"pattern",
"(",
"'transform_code'",
... | Format a code with transform_expression and tokens handlers.
@param string $code
@param bool $checked
@param bool $noTransformation
@return string | [
"Format",
"a",
"code",
"with",
"transform_expression",
"and",
"tokens",
"handlers",
"."
] | train | https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/AbstractFormat.php#L412-L428 |
phug-php/formatter | src/Phug/Formatter/AbstractFormat.php | AbstractFormat.formatKeywordElement | protected function formatKeywordElement(KeywordElement $element)
{
$name = $element->getName();
$keyword = $this->getOption(['keywords', $name]);
$result = call_user_func($keyword, $element->getValue(), $element, $name);
if (is_string($result)) {
$result = ['begin' => $r... | php | protected function formatKeywordElement(KeywordElement $element)
{
$name = $element->getName();
$keyword = $this->getOption(['keywords', $name]);
$result = call_user_func($keyword, $element->getValue(), $element, $name);
if (is_string($result)) {
$result = ['begin' => $r... | [
"protected",
"function",
"formatKeywordElement",
"(",
"KeywordElement",
"$",
"element",
")",
"{",
"$",
"name",
"=",
"$",
"element",
"->",
"getName",
"(",
")",
";",
"$",
"keyword",
"=",
"$",
"this",
"->",
"getOption",
"(",
"[",
"'keywords'",
",",
"$",
"na... | @param KeywordElement $element
@return string | [
"@param",
"KeywordElement",
"$element"
] | train | https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/AbstractFormat.php#L508-L540 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent.install | public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
$this->_installAutoloader($package);
$this->_copyAssets($package);
} | php | public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
$this->_installAutoloader($package);
$this->_copyAssets($package);
} | [
"public",
"function",
"install",
"(",
"InstalledRepositoryInterface",
"$",
"repo",
",",
"PackageInterface",
"$",
"package",
")",
"{",
"parent",
"::",
"install",
"(",
"$",
"repo",
",",
"$",
"package",
")",
";",
"$",
"this",
"->",
"_installAutoloader",
"(",
"$... | Installs specific package.
@param InstalledRepositoryInterface $repo repository in which to check
@param PackageInterface $package package instance
@throws InvalidArgumentException | [
"Installs",
"specific",
"package",
"."
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L33-L39 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent.update | public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
$this->_removeAutoloader($target);
parent::update($repo, $initial, $target);
$this->_installAutoloader($target);
$this->_copyAssets($target);
} | php | public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
$this->_removeAutoloader($target);
parent::update($repo, $initial, $target);
$this->_installAutoloader($target);
$this->_copyAssets($target);
} | [
"public",
"function",
"update",
"(",
"InstalledRepositoryInterface",
"$",
"repo",
",",
"PackageInterface",
"$",
"initial",
",",
"PackageInterface",
"$",
"target",
")",
"{",
"$",
"this",
"->",
"_removeAutoloader",
"(",
"$",
"target",
")",
";",
"parent",
"::",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L44-L52 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent._installAutoloader | protected function _installAutoloader(PackageInterface $package)
{
$path = $this->_getAutoloaderPath($package);
$manifest = $this->_getKoowaManifest($package);
if(!file_exists($path))
{
$platform = $this->_isPlatform();
$classname = $platform ?... | php | protected function _installAutoloader(PackageInterface $package)
{
$path = $this->_getAutoloaderPath($package);
$manifest = $this->_getKoowaManifest($package);
if(!file_exists($path))
{
$platform = $this->_isPlatform();
$classname = $platform ?... | [
"protected",
"function",
"_installAutoloader",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_getAutoloaderPath",
"(",
"$",
"package",
")",
";",
"$",
"manifest",
"=",
"$",
"this",
"->",
"_getKoowaManifest",
"(",
"$"... | Installs the default autoloader if no autoloader is supplied.
@param PackageInterface $package | [
"Installs",
"the",
"default",
"autoloader",
"if",
"no",
"autoloader",
"is",
"supplied",
"."
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L58-L92 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent._removeAutoloader | protected function _removeAutoloader(PackageInterface $package)
{
$path = $this->_getAutoloaderPath($package);
if(file_exists($path))
{
$contents = file_get_contents($path);
if (strpos($contents, 'This file has been generated automatically by Composer.') !== false) ... | php | protected function _removeAutoloader(PackageInterface $package)
{
$path = $this->_getAutoloaderPath($package);
if(file_exists($path))
{
$contents = file_get_contents($path);
if (strpos($contents, 'This file has been generated automatically by Composer.') !== false) ... | [
"protected",
"function",
"_removeAutoloader",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_getAutoloaderPath",
"(",
"$",
"package",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"co... | Removes the autoloader for the given package if it was generated automatically.
@param PackageInterface $package | [
"Removes",
"the",
"autoloader",
"for",
"the",
"given",
"package",
"if",
"it",
"was",
"generated",
"automatically",
"."
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L99-L111 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent._getKoowaManifest | protected function _getKoowaManifest(PackageInterface $package)
{
$path = $this->getInstallPath($package);
$directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::KEY_AS_PATHNAME);
$iterator = new \RecursiveIteratorIterator($directory);
$regex = new... | php | protected function _getKoowaManifest(PackageInterface $package)
{
$path = $this->getInstallPath($package);
$directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::KEY_AS_PATHNAME);
$iterator = new \RecursiveIteratorIterator($directory);
$regex = new... | [
"protected",
"function",
"_getKoowaManifest",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getInstallPath",
"(",
"$",
"package",
")",
";",
"$",
"directory",
"=",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
... | Attempts to locate and initialize the koowa-component.xml manifest
@param PackageInterface $package
@return bool|\SimpleXMLElement Instance of SimpleXMLElement or false on failure
@throws `InvalidArgumentException` on failure to load the XML manifest | [
"Attempts",
"to",
"locate",
"and",
"initialize",
"the",
"koowa",
"-",
"component",
".",
"xml",
"manifest"
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L120-L143 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent._copyAssets | protected function _copyAssets(PackageInterface $package)
{
$path = rtrim($this->getInstallPath($package), '/');
$asset_path = $path.'/resources/assets';
$vendor_dir = dirname(dirname($path));
// Check for libraries/joomla. vendor directory sits in libraries/ folder in Joomla ... | php | protected function _copyAssets(PackageInterface $package)
{
$path = rtrim($this->getInstallPath($package), '/');
$asset_path = $path.'/resources/assets';
$vendor_dir = dirname(dirname($path));
// Check for libraries/joomla. vendor directory sits in libraries/ folder in Joomla ... | [
"protected",
"function",
"_copyAssets",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"getInstallPath",
"(",
"$",
"package",
")",
",",
"'/'",
")",
";",
"$",
"asset_path",
"=",
"$",
"path",
".",
"'... | Copy assets into the media folder if the installation is running in a Joomla context
@param PackageInterface $package | [
"Copy",
"assets",
"into",
"the",
"media",
"folder",
"if",
"the",
"installation",
"is",
"running",
"in",
"a",
"Joomla",
"context"
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L184-L202 |
nooku/nooku-installer | src/Nooku/Composer/Installer/NookuComponent.php | NookuComponent._copyDirectory | protected function _copyDirectory($source, $target)
{
$result = false;
if (!is_dir($target)) {
$result = mkdir($target, 0755, true);
}
else
{
// Clear directory
$iter = new \RecursiveDirectoryIterator($target);
foreach (new \Re... | php | protected function _copyDirectory($source, $target)
{
$result = false;
if (!is_dir($target)) {
$result = mkdir($target, 0755, true);
}
else
{
// Clear directory
$iter = new \RecursiveDirectoryIterator($target);
foreach (new \Re... | [
"protected",
"function",
"_copyDirectory",
"(",
"$",
"source",
",",
"$",
"target",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"target",
")",
")",
"{",
"$",
"result",
"=",
"mkdir",
"(",
"$",
"target",
",",
"0755"... | Copy source folder into target. Clears the target folder first.
@param $source
@param $target
@return bool | [
"Copy",
"source",
"folder",
"into",
"target",
".",
"Clears",
"the",
"target",
"folder",
"first",
"."
] | train | https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/NookuComponent.php#L211-L257 |
VincentChalnot/SidusEAVFilterBundle | Filter/EAVFilterHelper.php | EAVFilterHelper.getEAVAttributeQueryBuilder | public function getEAVAttributeQueryBuilder(
EAVQueryBuilderInterface $eavQueryBuilder,
FamilyInterface $family,
$attributePath,
$enforceFamilyCondition = true
): AttributeQueryBuilderInterface {
$attributeQueryBuilder = null;
$attribute = null;
/**
*... | php | public function getEAVAttributeQueryBuilder(
EAVQueryBuilderInterface $eavQueryBuilder,
FamilyInterface $family,
$attributePath,
$enforceFamilyCondition = true
): AttributeQueryBuilderInterface {
$attributeQueryBuilder = null;
$attribute = null;
/**
*... | [
"public",
"function",
"getEAVAttributeQueryBuilder",
"(",
"EAVQueryBuilderInterface",
"$",
"eavQueryBuilder",
",",
"FamilyInterface",
"$",
"family",
",",
"$",
"attributePath",
",",
"$",
"enforceFamilyCondition",
"=",
"true",
")",
":",
"AttributeQueryBuilderInterface",
"{"... | @param EAVQueryBuilderInterface $eavQueryBuilder
@param FamilyInterface $family
@param string $attributePath
@param bool $enforceFamilyCondition
@throws \UnexpectedValueException
@return AttributeQueryBuilderInterface | [
"@param",
"EAVQueryBuilderInterface",
"$eavQueryBuilder",
"@param",
"FamilyInterface",
"$family",
"@param",
"string",
"$attributePath",
"@param",
"bool",
"$enforceFamilyCondition"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/EAVFilterHelper.php#L39-L67 |
VincentChalnot/SidusEAVFilterBundle | Filter/EAVFilterHelper.php | EAVFilterHelper.getEAVAttributes | public function getEAVAttributes(FamilyInterface $family, array $attributePaths): array
{
$attributes = [];
foreach ($attributePaths as $attributePath) {
$attribute = null;
/** @var AttributeInterface $attribute */
foreach (explode('.', $attributePath) as $attribu... | php | public function getEAVAttributes(FamilyInterface $family, array $attributePaths): array
{
$attributes = [];
foreach ($attributePaths as $attributePath) {
$attribute = null;
/** @var AttributeInterface $attribute */
foreach (explode('.', $attributePath) as $attribu... | [
"public",
"function",
"getEAVAttributes",
"(",
"FamilyInterface",
"$",
"family",
",",
"array",
"$",
"attributePaths",
")",
":",
"array",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"attributePaths",
"as",
"$",
"attributePath",
")",
"{",
... | @param FamilyInterface $family
@param array $attributePaths
@throws \UnexpectedValueException
@throws MissingAttributeException
@throws MissingFamilyException
@return AttributeInterface[] | [
"@param",
"FamilyInterface",
"$family",
"@param",
"array",
"$attributePaths"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/EAVFilterHelper.php#L79-L106 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/File/Count.php | Zend_Validate_File_Count.setMin | public function setMin($min)
{
if (is_array($min) and isset($min['min'])) {
$min = $min['min'];
}
if (!is_string($min) and !is_numeric($min)) {
require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator pr... | php | public function setMin($min)
{
if (is_array($min) and isset($min['min'])) {
$min = $min['min'];
}
if (!is_string($min) and !is_numeric($min)) {
require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception ('Invalid options to validator pr... | [
"public",
"function",
"setMin",
"(",
"$",
"min",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"min",
")",
"and",
"isset",
"(",
"$",
"min",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"min",
"=",
"$",
"min",
"[",
"'min'",
"]",
";",
"}",
"if",
"(",
... | Sets the minimum file count
@param integer|array $min The minimum file count
@return Zend_Validate_File_Count Provides a fluent interface
@throws Zend_Validate_Exception When min is greater than max | [
"Sets",
"the",
"minimum",
"file",
"count"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/File/Count.php#L150-L170 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/File/Count.php | Zend_Validate_File_Count.isValid | public function isValid($value, $file = null)
{
$this->addFile($value);
$this->_count = count($this->_files);
if (($this->_max !== null) && ($this->_count > $this->_max)) {
return $this->_throw($file, self::TOO_MUCH);
}
if (($this->_min !== null) && ($this->_coun... | php | public function isValid($value, $file = null)
{
$this->addFile($value);
$this->_count = count($this->_files);
if (($this->_max !== null) && ($this->_count > $this->_max)) {
return $this->_throw($file, self::TOO_MUCH);
}
if (($this->_min !== null) && ($this->_coun... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
",",
"$",
"file",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addFile",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"_count",
"=",
"count",
"(",
"$",
"this",
"->",
"_files",
")",
";",
"if",
... | Defined by Zend_Validate_Interface
Returns true if and only if the file count of all checked files is at least min and
not bigger than max (when max is not null). Attention: When checking with set min you
must give all files with the first call, otherwise you will get an false.
@param string|array $value Filenames t... | [
"Defined",
"by",
"Zend_Validate_Interface"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/File/Count.php#L244-L257 |
ClanCats/Core | src/bundles/Database/Model/Relation.php | Model_Relation.collection_query | protected function collection_query( &$collection )
{
$local_keys = array();
foreach( $collection as $item )
{
$local_keys[] = $item->raw( $this->local_key );
}
// set the correct collection where
$this->query->wheres = array();
$this->query->where( $this->foreign_key, 'in', $local_keys );
$t... | php | protected function collection_query( &$collection )
{
$local_keys = array();
foreach( $collection as $item )
{
$local_keys[] = $item->raw( $this->local_key );
}
// set the correct collection where
$this->query->wheres = array();
$this->query->where( $this->foreign_key, 'in', $local_keys );
$t... | [
"protected",
"function",
"collection_query",
"(",
"&",
"$",
"collection",
")",
"{",
"$",
"local_keys",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"item",
")",
"{",
"$",
"local_keys",
"[",
"]",
"=",
"$",
"item",
"->",
"... | Prepare the query with collection select
@param array $collection
@return void | [
"Prepare",
"the",
"query",
"with",
"collection",
"select"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model/Relation.php#L142-L157 |
ClanCats/Core | src/bundles/Database/Model/Relation.php | Model_Relation.collection_assign | public function collection_assign( $relation, &$collection, $callback = null )
{
// make the query
$this->collection_query( $collection );
call_user_func_array( $callback, array( &$this->query ) );
// get the reults
$results = $this->query->run();
foreach( $collection as $item )
{
if ( $this... | php | public function collection_assign( $relation, &$collection, $callback = null )
{
// make the query
$this->collection_query( $collection );
call_user_func_array( $callback, array( &$this->query ) );
// get the reults
$results = $this->query->run();
foreach( $collection as $item )
{
if ( $this... | [
"public",
"function",
"collection_assign",
"(",
"$",
"relation",
",",
"&",
"$",
"collection",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"// make the query",
"$",
"this",
"->",
"collection_query",
"(",
"$",
"collection",
")",
";",
"call_user_func_array",
"("... | Prepare the query with collection select
@param string $relation
@param array $collection
@param callback $callback
@return void | [
"Prepare",
"the",
"query",
"with",
"collection",
"select"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model/Relation.php#L167-L188 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section/Table.php | PHPWord_Section_Table.addCell | public function addCell($width, $style = null) {
$cell = new PHPWord_Section_Table_Cell($this->_insideOf, $this->_pCount, $width, $style);
$i = count($this->_rows) - 1;
$this->_rows[$i][] = $cell;
return $cell;
} | php | public function addCell($width, $style = null) {
$cell = new PHPWord_Section_Table_Cell($this->_insideOf, $this->_pCount, $width, $style);
$i = count($this->_rows) - 1;
$this->_rows[$i][] = $cell;
return $cell;
} | [
"public",
"function",
"addCell",
"(",
"$",
"width",
",",
"$",
"style",
"=",
"null",
")",
"{",
"$",
"cell",
"=",
"new",
"PHPWord_Section_Table_Cell",
"(",
"$",
"this",
"->",
"_insideOf",
",",
"$",
"this",
"->",
"_pCount",
",",
"$",
"width",
",",
"$",
... | Add a cell
@param int $width
@param mixed $style
@return PHPWord_Section_Table_Cell | [
"Add",
"a",
"cell"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section/Table.php#L118-L123 |
gevans/phaker | lib/Phaker/Generator/Internet.php | Internet.safe_email | public function safe_email($name = NULL)
{
$tlds = array('org', 'com', 'net');
return implode('@', array($this->user_name($name), 'example.'.$tlds[array_rand($tlds)]));
} | php | public function safe_email($name = NULL)
{
$tlds = array('org', 'com', 'net');
return implode('@', array($this->user_name($name), 'example.'.$tlds[array_rand($tlds)]));
} | [
"public",
"function",
"safe_email",
"(",
"$",
"name",
"=",
"NULL",
")",
"{",
"$",
"tlds",
"=",
"array",
"(",
"'org'",
",",
"'com'",
",",
"'net'",
")",
";",
"return",
"implode",
"(",
"'@'",
",",
"array",
"(",
"$",
"this",
"->",
"user_name",
"(",
"$"... | Generate a safe email address ending with example.tld, with a TLD of
org, com, or net only.
@param string $name User name
@return string | [
"Generate",
"a",
"safe",
"email",
"address",
"ending",
"with",
"example",
".",
"tld",
"with",
"a",
"TLD",
"of",
"org",
"com",
"or",
"net",
"only",
"."
] | train | https://github.com/gevans/phaker/blob/b99f4a20a09188c219649127655e980d1e983274/lib/Phaker/Generator/Internet.php#L45-L49 |
gevans/phaker | lib/Phaker/Generator/Internet.php | Internet.user_name | public function user_name($name = NULL)
{
$delim = array('.', '_');
if ($name)
{
$names = preg_split('/[^\w]+/', $name, NULL, PREG_SPLIT_NO_EMPTY);
shuffle($names);
return implode($delim[array_rand($delim)], $names);
}
if (mt_rand(0, 1))
{
$name = preg_replace('/\W/', '', \Phaker::name()->fir... | php | public function user_name($name = NULL)
{
$delim = array('.', '_');
if ($name)
{
$names = preg_split('/[^\w]+/', $name, NULL, PREG_SPLIT_NO_EMPTY);
shuffle($names);
return implode($delim[array_rand($delim)], $names);
}
if (mt_rand(0, 1))
{
$name = preg_replace('/\W/', '', \Phaker::name()->fir... | [
"public",
"function",
"user_name",
"(",
"$",
"name",
"=",
"NULL",
")",
"{",
"$",
"delim",
"=",
"array",
"(",
"'.'",
",",
"'_'",
")",
";",
"if",
"(",
"$",
"name",
")",
"{",
"$",
"names",
"=",
"preg_split",
"(",
"'/[^\\w]+/'",
",",
"$",
"name",
","... | Generate a lowercase user name from a full or partial name.
echo $internet->user_name('Dr. Seuss'); // => "dr.seuss"
@param string $name User name
@return string | [
"Generate",
"a",
"lowercase",
"user",
"name",
"from",
"a",
"full",
"or",
"partial",
"name",
"."
] | train | https://github.com/gevans/phaker/blob/b99f4a20a09188c219649127655e980d1e983274/lib/Phaker/Generator/Internet.php#L59-L81 |
gevans/phaker | lib/Phaker/Generator/Internet.php | Internet.fix_umlauts | public static function fix_umlauts($string)
{
return str_ireplace(array('ä', 'ö', 'ü', 'ß'), array('ae', 'oe', 'ue', 'ss'), $string);
} | php | public static function fix_umlauts($string)
{
return str_ireplace(array('ä', 'ö', 'ü', 'ß'), array('ae', 'oe', 'ue', 'ss'), $string);
} | [
"public",
"static",
"function",
"fix_umlauts",
"(",
"$",
"string",
")",
"{",
"return",
"str_ireplace",
"(",
"array",
"(",
"'ä',",
" ",
"ö', ",
"'",
"', '",
"ß",
"), a",
"r",
"r",
"y('ae",
"'",
", 'o",
"e",
", 'u",
"e",
", 's",
"s",
"), $",
"s",
"t",
... | Convert umlauts and other characters for safe use in URLs,
email addresses, user names, etc.
@return string | [
"Convert",
"umlauts",
"and",
"other",
"characters",
"for",
"safe",
"use",
"in",
"URLs",
"email",
"addresses",
"user",
"names",
"etc",
"."
] | train | https://github.com/gevans/phaker/blob/b99f4a20a09188c219649127655e980d1e983274/lib/Phaker/Generator/Internet.php#L154-L157 |
ClanCats/Core | src/classes/CCLog.php | CCLog.write | public static function write()
{
if ( empty( static::$_data ) )
{
return;
}
$buffer = date("H:i:s")." - ".CCServer::method().' '.CCServer::server('REQUEST_URI')."\n";
$buffer .= implode( "\n", static::$_data );
CCFile::append( CCStorage::path( 'logs/'.date( 'Y-m' ).'/'.date( 'd' ).'.log' ), $buff... | php | public static function write()
{
if ( empty( static::$_data ) )
{
return;
}
$buffer = date("H:i:s")." - ".CCServer::method().' '.CCServer::server('REQUEST_URI')."\n";
$buffer .= implode( "\n", static::$_data );
CCFile::append( CCStorage::path( 'logs/'.date( 'Y-m' ).'/'.date( 'd' ).'.log' ), $buff... | [
"public",
"static",
"function",
"write",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"static",
"::",
"$",
"_data",
")",
")",
"{",
"return",
";",
"}",
"$",
"buffer",
"=",
"date",
"(",
"\"H:i:s\"",
")",
".",
"\" - \"",
".",
"CCServer",
"::",
"method",
"(... | write the log down to disk
@return void | [
"write",
"the",
"log",
"down",
"to",
"disk"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCLog.php#L81-L95 |
TheBigBrainsCompany/TbbcRestUtilBundle | DependencyInjection/TbbcRestUtilExtension.php | TbbcRestUtilExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../... | php | public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"processor",
"=",
"new",
"Processor",
"(",
")",
";",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=... | {@inheritDoc} | [
"{"
] | train | https://github.com/TheBigBrainsCompany/TbbcRestUtilBundle/blob/48c0598a94a4f6b3883d349d8f134138e8bc6d7c/DependencyInjection/TbbcRestUtilExtension.php#L30-L50 |
ClanCats/Core | src/bundles/UI/Table.php | Table.row | public function row( $data = array(), $attr = array() ) {
$this->data[] = $this->_repair_row( $data, $attr ); return $this;
} | php | public function row( $data = array(), $attr = array() ) {
$this->data[] = $this->_repair_row( $data, $attr ); return $this;
} | [
"public",
"function",
"row",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"]",
"=",
"$",
"this",
"->",
"_repair_row",
"(",
"$",
"data",
",",
"$",
"attr",
")",
";... | add a new row | [
"add",
"a",
"new",
"row"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Table.php#L52-L54 |
ClanCats/Core | src/bundles/UI/Table.php | Table.header | public function header( $data = array(), $attr = array() ) {
$this->header = $this->_repair_row( $data, $attr ); return $this;
} | php | public function header( $data = array(), $attr = array() ) {
$this->header = $this->_repair_row( $data, $attr ); return $this;
} | [
"public",
"function",
"header",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"header",
"=",
"$",
"this",
"->",
"_repair_row",
"(",
"$",
"data",
",",
"$",
"attr",
")",
";",
"ret... | set the header | [
"set",
"the",
"header"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Table.php#L59-L61 |
ClanCats/Core | src/bundles/UI/Table.php | Table._repair_row | private function _repair_row( $data = array(), $attr = array() ) {
$row = array();
foreach( $data as $key => $value ) {
if ( !$value instanceof HTML || ( $value->name != 'td' && $value->name != 'th' ) ) {
$value = static::cell( (string) $value );
}
if ( is_string( $key ) ) {
$row[$key] = $value;
... | php | private function _repair_row( $data = array(), $attr = array() ) {
$row = array();
foreach( $data as $key => $value ) {
if ( !$value instanceof HTML || ( $value->name != 'td' && $value->name != 'th' ) ) {
$value = static::cell( (string) $value );
}
if ( is_string( $key ) ) {
$row[$key] = $value;
... | [
"private",
"function",
"_repair_row",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"row",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",... | repair a row for rendering | [
"repair",
"a",
"row",
"for",
"rendering"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Table.php#L66-L79 |
ClanCats/Core | src/bundles/UI/Table.php | Table.render | public function render() {
$buffer = '';
if ( !empty( $this->header ) ) {
$buffer .= '<tr'.HTML::attr( $this->header[1] ).'>';
foreach( $this->header[0] as $head ) {
$head->name = 'th';
$buffer .= $head->render();
}
$buffer .= '</tr>';
foreach( $this->data as $row ) {
$buffer .... | php | public function render() {
$buffer = '';
if ( !empty( $this->header ) ) {
$buffer .= '<tr'.HTML::attr( $this->header[1] ).'>';
foreach( $this->header[0] as $head ) {
$head->name = 'th';
$buffer .= $head->render();
}
$buffer .= '</tr>';
foreach( $this->data as $row ) {
$buffer .... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"buffer",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"header",
")",
")",
"{",
"$",
"buffer",
".=",
"'<tr'",
".",
"HTML",
"::",
"attr",
"(",
"$",
"this",
"->",
"header",
"... | generate the output | [
"generate",
"the",
"output"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Table.php#L91-L124 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setCategories | public function setCategories(array $categories)
{
$nb = count($categories);
if (0 === $nb) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set... | php | public function setCategories(array $categories)
{
$nb = count($categories);
if (0 === $nb) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set... | [
"public",
"function",
"setCategories",
"(",
"array",
"$",
"categories",
")",
"{",
"$",
"nb",
"=",
"count",
"(",
"$",
"categories",
")",
";",
"if",
"(",
"0",
"===",
"$",
"nb",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"req... | Sets the categories column and in iTunes Music Store Browse
$categories must conform to the following format:
<code>
array(array('main' => 'main category',
'sub' => 'sub category' // optionnal
),
// up to 3 rows
)
</code>
@param array $categories
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Excep... | [
"Sets",
"the",
"categories",
"column",
"and",
"in",
"iTunes",
"Music",
"Store",
"Browse",
"$categories",
"must",
"conform",
"to",
"the",
"following",
"format",
":",
"<code",
">",
"array",
"(",
"array",
"(",
"main",
"=",
">",
"main",
"category",
"sub",
"=",... | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L62-L90 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setOwner | public function setOwner($name = '', $email = '')
{
if (!empty($email)) {
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
... | php | public function setOwner($name = '', $email = '')
{
if (!empty($email)) {
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
... | [
"public",
"function",
"setOwner",
"(",
"$",
"name",
"=",
"''",
",",
"$",
"email",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"email",
")",
")",
"{",
"/**\n \t * @see Zend_Validate_EmailAddress\n \t */",
"require_once",
"'Zend/Validate/... | Sets the owner of the postcast
@param string $name default to the feed's author value
@param string $email default to the feed's email value
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Exception | [
"Sets",
"the",
"owner",
"of",
"the",
"postcast"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L112-L130 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setBlock | public function setBlock($block)
{
$block = strtolower($block);
if (!in_array($block, array('yes', 'no'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("... | php | public function setBlock($block)
{
$block = strtolower($block);
if (!in_array($block, array('yes', 'no'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("... | [
"public",
"function",
"setBlock",
"(",
"$",
"block",
")",
"{",
"$",
"block",
"=",
"strtolower",
"(",
"$",
"block",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"block",
",",
"array",
"(",
"'yes'",
",",
"'no'",
")",
")",
")",
"{",
"/**\n ... | Prevent a feed from appearing
@param string $block can be 'yes' or 'no'
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Exception | [
"Prevent",
"a",
"feed",
"from",
"appearing"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L178-L190 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setExplicit | public function setExplicit($explicit)
{
$explicit = strtolower($explicit);
if (!in_array($explicit, array('yes', 'no', 'clean'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_... | php | public function setExplicit($explicit)
{
$explicit = strtolower($explicit);
if (!in_array($explicit, array('yes', 'no', 'clean'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_... | [
"public",
"function",
"setExplicit",
"(",
"$",
"explicit",
")",
"{",
"$",
"explicit",
"=",
"strtolower",
"(",
"$",
"explicit",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"explicit",
",",
"array",
"(",
"'yes'",
",",
"'no'",
",",
"'clean'",
")",
"... | Configuration of the parental advisory graphic
@param string $explicit can be 'yes', 'no' or 'clean'
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Exception | [
"Configuration",
"of",
"the",
"parental",
"advisory",
"graphic"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L199-L211 |
webforge-labs/psc-cms | lib/Psc/PHPUnit/InvokedAtMethodIndexMatcher.php | InvokedAtMethodIndexMatcher.verify | public function verify()
{
if ($this->currentIndex < $this->sequenceIndex) {
throw new PHPUnit_Framework_ExpectationFailedException(
sprintf(
"The expected invocation at method '%s' index %d was never reached.",
$this->method,
$this-... | php | public function verify()
{
if ($this->currentIndex < $this->sequenceIndex) {
throw new PHPUnit_Framework_ExpectationFailedException(
sprintf(
"The expected invocation at method '%s' index %d was never reached.",
$this->method,
$this-... | [
"public",
"function",
"verify",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentIndex",
"<",
"$",
"this",
"->",
"sequenceIndex",
")",
"{",
"throw",
"new",
"PHPUnit_Framework_ExpectationFailedException",
"(",
"sprintf",
"(",
"\"The expected invocation at method ... | Verifies that the current expectation is valid. If everything is OK the
code should just return, if not it must throw an exception.
@throws PHPUnit_Framework_ExpectationFailedException | [
"Verifies",
"that",
"the",
"current",
"expectation",
"is",
"valid",
".",
"If",
"everything",
"is",
"OK",
"the",
"code",
"should",
"just",
"return",
"if",
"not",
"it",
"must",
"throw",
"an",
"exception",
"."
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHPUnit/InvokedAtMethodIndexMatcher.php#L132-L144 |
AydinHassan/cli-md-renderer | src/Renderer/HeaderRenderer.php | HeaderRenderer.render | public function render(AbstractBlock $block, CliRenderer $renderer)
{
if (!($block instanceof Heading)) {
throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
}
$level = $block->getLevel();
$text = $renderer->renderInlines(... | php | public function render(AbstractBlock $block, CliRenderer $renderer)
{
if (!($block instanceof Heading)) {
throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
}
$level = $block->getLevel();
$text = $renderer->renderInlines(... | [
"public",
"function",
"render",
"(",
"AbstractBlock",
"$",
"block",
",",
"CliRenderer",
"$",
"renderer",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"block",
"instanceof",
"Heading",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
... | @param AbstractBlock $block
@param CliRenderer $renderer
@return string | [
"@param",
"AbstractBlock",
"$block",
"@param",
"CliRenderer",
"$renderer"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/Renderer/HeaderRenderer.php#L23-L37 |
alanpich/slender | src/Core/ModuleLoader/ModuleLoader.php | ModuleLoader.addConfig | public function addConfig(array $conf = array())
{
$appConfig =& $this->config;
// Iterate through new top-level keys
foreach ($conf as $key => $value) {
// If doesnt exist yet, create it
if (!isset($appConfig[$key])) {
$appConfig[$key] = $value;
... | php | public function addConfig(array $conf = array())
{
$appConfig =& $this->config;
// Iterate through new top-level keys
foreach ($conf as $key => $value) {
// If doesnt exist yet, create it
if (!isset($appConfig[$key])) {
$appConfig[$key] = $value;
... | [
"public",
"function",
"addConfig",
"(",
"array",
"$",
"conf",
"=",
"array",
"(",
")",
")",
"{",
"$",
"appConfig",
"=",
"&",
"$",
"this",
"->",
"config",
";",
"// Iterate through new top-level keys",
"foreach",
"(",
"$",
"conf",
"as",
"$",
"key",
"=>",
"$... | Recursively merge array of settings into app
config. This is needed because \Slim\ConfigurationHander doesn't
seem to like recursing...
@param array $conf | [
"Recursively",
"merge",
"array",
"of",
"settings",
"into",
"app",
"config",
".",
"This",
"is",
"needed",
"because",
"\\",
"Slim",
"\\",
"ConfigurationHander",
"doesn",
"t",
"seem",
"to",
"like",
"recursing",
"..."
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/ModuleLoader/ModuleLoader.php#L143-L168 |
alanpich/slender | src/Core/ModuleLoader/ModuleLoader.php | ModuleLoader.setupAutoloaders | protected function setupAutoloaders($modulePath, array $mConf)
{
if (isset($mConf['autoload']['psr-4'])) {
foreach ($mConf['autoload']['psr-4'] as $ns => $path) {
$path = $modulePath . DIRECTORY_SEPARATOR . preg_replace("/^\\.\\//", "", $path);
$this->classLoader-... | php | protected function setupAutoloaders($modulePath, array $mConf)
{
if (isset($mConf['autoload']['psr-4'])) {
foreach ($mConf['autoload']['psr-4'] as $ns => $path) {
$path = $modulePath . DIRECTORY_SEPARATOR . preg_replace("/^\\.\\//", "", $path);
$this->classLoader-... | [
"protected",
"function",
"setupAutoloaders",
"(",
"$",
"modulePath",
",",
"array",
"$",
"mConf",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"mConf",
"[",
"'autoload'",
"]",
"[",
"'psr-4'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"mConf",
"[",
"'autoload'... | Copy autoloader settings to global collection ready for registering | [
"Copy",
"autoloader",
"settings",
"to",
"global",
"collection",
"ready",
"for",
"registering"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/ModuleLoader/ModuleLoader.php#L175-L183 |
maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/PlayerInfo.php | PlayerInfo.CleanUp | static function CleanUp()
{
$limit = new \DateTime('-30 minutes');
foreach(self::$instances as $login => $player)
if($player->awaySince && $player->awaySince < $limit) unset(self::$instances[$login]);
} | php | static function CleanUp()
{
$limit = new \DateTime('-30 minutes');
foreach(self::$instances as $login => $player)
if($player->awaySince && $player->awaySince < $limit) unset(self::$instances[$login]);
} | [
"static",
"function",
"CleanUp",
"(",
")",
"{",
"$",
"limit",
"=",
"new",
"\\",
"DateTime",
"(",
"'-30 minutes'",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"instances",
"as",
"$",
"login",
"=>",
"$",
"player",
")",
"if",
"(",
"$",
"player",
"->",
... | Destroy players disconnected for more than 1 hour | [
"Destroy",
"players",
"disconnected",
"for",
"more",
"than",
"1",
"hour"
] | train | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/PlayerInfo.php#L88-L93 |
limen/php-jobs | src/Contracts/BaseJob.php | BaseJob.failed | protected function failed()
{
$retryCount = $this->model->getTriedCount() + 1;
if ($retryCount >= $this->getMaxRetryCount()) {
$this->model->setStatus(JobsConst::JOB_STATUS_FAILED);
} else {
$this->model->setStatus(JobsConst::JOB_STATUS_WAITING_RETRY);
$t... | php | protected function failed()
{
$retryCount = $this->model->getTriedCount() + 1;
if ($retryCount >= $this->getMaxRetryCount()) {
$this->model->setStatus(JobsConst::JOB_STATUS_FAILED);
} else {
$this->model->setStatus(JobsConst::JOB_STATUS_WAITING_RETRY);
$t... | [
"protected",
"function",
"failed",
"(",
")",
"{",
"$",
"retryCount",
"=",
"$",
"this",
"->",
"model",
"->",
"getTriedCount",
"(",
")",
"+",
"1",
";",
"if",
"(",
"$",
"retryCount",
">=",
"$",
"this",
"->",
"getMaxRetryCount",
"(",
")",
")",
"{",
"$",
... | After failed we need to update tried count
and check whether the tried count have reached to max retry count | [
"After",
"failed",
"we",
"need",
"to",
"update",
"tried",
"count",
"and",
"check",
"whether",
"the",
"tried",
"count",
"have",
"reached",
"to",
"max",
"retry",
"count"
] | train | https://github.com/limen/php-jobs/blob/525f4082b49a7a3e69acb4cea3a622244f1616b9/src/Contracts/BaseJob.php#L236-L249 |
CakeCMS/Core | src/Cms.php | Cms.mergeConfig | public static function mergeConfig($key, $config)
{
$values = Hash::merge((array) Configure::read($key), $config);
Configure::write($key, $values);
return $values;
} | php | public static function mergeConfig($key, $config)
{
$values = Hash::merge((array) Configure::read($key), $config);
Configure::write($key, $values);
return $values;
} | [
"public",
"static",
"function",
"mergeConfig",
"(",
"$",
"key",
",",
"$",
"config",
")",
"{",
"$",
"values",
"=",
"Hash",
"::",
"merge",
"(",
"(",
"array",
")",
"Configure",
"::",
"read",
"(",
"$",
"key",
")",
",",
"$",
"config",
")",
";",
"Configu... | Merge configure values by key.
@param string $key
@param array|string $config
@return array|mixed | [
"Merge",
"configure",
"values",
"by",
"key",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Cms.php#L56-L62 |
CakeCMS/Core | src/Cms.php | Cms._initPaths | protected function _initPaths()
{
$path = Path::getInstance();
$path->setRoot(ROOT);
// Setup all webroot paths
$path->set('webroot', Configure::read('App.wwwRoot'));
foreach ((array) Plugin::loaded() as $name) {
$plgPath = Plugin::path($name) . '/' . Configure:... | php | protected function _initPaths()
{
$path = Path::getInstance();
$path->setRoot(ROOT);
// Setup all webroot paths
$path->set('webroot', Configure::read('App.wwwRoot'));
foreach ((array) Plugin::loaded() as $name) {
$plgPath = Plugin::path($name) . '/' . Configure:... | [
"protected",
"function",
"_initPaths",
"(",
")",
"{",
"$",
"path",
"=",
"Path",
"::",
"getInstance",
"(",
")",
";",
"$",
"path",
"->",
"setRoot",
"(",
"ROOT",
")",
";",
"// Setup all webroot paths",
"$",
"path",
"->",
"set",
"(",
"'webroot'",
",",
"Conf... | Init base paths.
@return Path
@throws \JBZoo\Path\Exception | [
"Init",
"base",
"paths",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Cms.php#L86-L105 |
yuncms/framework | src/i18n/I18N.php | I18N.initTranslations | public function initTranslations()
{
$manifestFile = Yii::getAlias('@vendor/yuncms/translates.php');
if (is_file($manifestFile)) {
$manifest = require($manifestFile);
$this->translations = ArrayHelper::merge($manifest, $this->translations);
}
} | php | public function initTranslations()
{
$manifestFile = Yii::getAlias('@vendor/yuncms/translates.php');
if (is_file($manifestFile)) {
$manifest = require($manifestFile);
$this->translations = ArrayHelper::merge($manifest, $this->translations);
}
} | [
"public",
"function",
"initTranslations",
"(",
")",
"{",
"$",
"manifestFile",
"=",
"Yii",
"::",
"getAlias",
"(",
"'@vendor/yuncms/translates.php'",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"manifestFile",
")",
")",
"{",
"$",
"manifest",
"=",
"require",
"(",... | 处理默认翻译清单 | [
"处理默认翻译清单"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/i18n/I18N.php#L45-L52 |
vi-kon/laravel-auth | src/ViKon/Auth/Middleware/HasAccessMiddleware.php | HasAccessMiddleware.handle | public function handle(Request $request, Closure $next)
{
$action = $this->container->make('router')->current()->getAction();
if (array_key_exists('group', $action)) {
$action['groups'] = $action['group'];
}
if (array_key_exists('role', $action)) {
$action['r... | php | public function handle(Request $request, Closure $next)
{
$action = $this->container->make('router')->current()->getAction();
if (array_key_exists('group', $action)) {
$action['groups'] = $action['group'];
}
if (array_key_exists('role', $action)) {
$action['r... | [
"public",
"function",
"handle",
"(",
"Request",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'router'",
")",
"->",
"current",
"(",
")",
"->",
"getAction",
"(",
")",
";"... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return \Illuminate\Http\RedirectResponse|mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Middleware/HasAccessMiddleware.php#L45-L111 |
anime-db/app-bundle | src/Command/TaskSchedulerCommand.php | TaskSchedulerCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
// exit if disabled
if (!$this->getContainer()->getParameter('task_scheduler.enabled')) {
return true;
}
// path to php executable
$finder = new PhpExecutableFinder();
$console =... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
// exit if disabled
if (!$this->getContainer()->getParameter('task_scheduler.enabled')) {
return true;
}
// path to php executable
$finder = new PhpExecutableFinder();
$console =... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"// exit if disabled",
"if",
"(",
"!",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"getParameter",
"(",
"'task_scheduler.enabled'",
"... | @param InputInterface $input
@param OutputInterface $output
@return bool | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Command/TaskSchedulerCommand.php#L33-L82 |
anime-db/app-bundle | src/Entity/Task.php | Task.executed | public function executed()
{
$this->setLastRun(new \DateTime());
if (!$this->getModify()) {
$this->setStatus(self::STATUS_DISABLED);
}
if ($this->getStatus() == self::STATUS_ENABLED) {
// find near time task launch
$next_run = $this->getNextRun();
... | php | public function executed()
{
$this->setLastRun(new \DateTime());
if (!$this->getModify()) {
$this->setStatus(self::STATUS_DISABLED);
}
if ($this->getStatus() == self::STATUS_ENABLED) {
// find near time task launch
$next_run = $this->getNextRun();
... | [
"public",
"function",
"executed",
"(",
")",
"{",
"$",
"this",
"->",
"setLastRun",
"(",
"new",
"\\",
"DateTime",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"getModify",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setStatus",
"(",
"self",
"... | Update task after execution. | [
"Update",
"task",
"after",
"execution",
"."
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Entity/Task.php#L243-L262 |
alanpich/slender | src/Core/ModuleResolver/NamespaceResolver.php | NamespaceResolver.getPath | public function getPath($module)
{
// treat $module as a namespace
$class = $module."\\SlenderModule";
// Try to find class for path
if (class_exists($class) ) {
$reflector = new \ReflectionClass($class);
$interfaces = $reflector->getInterfaceNames();
... | php | public function getPath($module)
{
// treat $module as a namespace
$class = $module."\\SlenderModule";
// Try to find class for path
if (class_exists($class) ) {
$reflector = new \ReflectionClass($class);
$interfaces = $reflector->getInterfaceNames();
... | [
"public",
"function",
"getPath",
"(",
"$",
"module",
")",
"{",
"// treat $module as a namespace",
"$",
"class",
"=",
"$",
"module",
".",
"\"\\\\SlenderModule\"",
";",
"// Try to find class for path",
"if",
"(",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"... | Return the path to Module $module, or false
if not found
@param string $module Module name or Namespace
@return string|false | [
"Return",
"the",
"path",
"to",
"Module",
"$module",
"or",
"false",
"if",
"not",
"found"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/ModuleResolver/NamespaceResolver.php#L45-L64 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.getLastLogin | public function getLastLogin($format = null)
{
if ($this->last_login === null) {
return null;
}
if ($this->last_login === '0000-00-00 00:00:00') {
// while technically this is not a default value of null,
// this seems to be closest in meaning.
... | php | public function getLastLogin($format = null)
{
if ($this->last_login === null) {
return null;
}
if ($this->last_login === '0000-00-00 00:00:00') {
// while technically this is not a default value of null,
// this seems to be closest in meaning.
... | [
"public",
"function",
"getLastLogin",
"(",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"last_login",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"last_login",
"===",
"'0000-00-00 00:00:00'",
... | Get the [optionally formatted] temporal [last_login] column value.
@param string $format The date/time format string (either date()-style or strftime()-style).
If format is null, then the raw DateTime object will be returned.
@return mixed Formatted date/time value as string or DateTime object (if format is null), nu... | [
"Get",
"the",
"[",
"optionally",
"formatted",
"]",
"temporal",
"[",
"last_login",
"]",
"column",
"value",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L312-L341 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setUsername | public function setUsername($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->username !== $v) {
$this->username = $v;
$this->modifiedColumns[] = UserPeer::USERNAME;
}
return $this;
} | php | public function setUsername($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->username !== $v) {
$this->username = $v;
$this->modifiedColumns[] = UserPeer::USERNAME;
}
return $this;
} | [
"public",
"function",
"setUsername",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"username",
"!==",
"$",
"v",
")",
"{",
"$",
"th... | Set the value of [username] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"username",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L392-L405 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setPassword | public function setPassword($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->password !== $v) {
$this->password = $v;
$this->modifiedColumns[] = UserPeer::PASSWORD;
}
return $this;
} | php | public function setPassword($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->password !== $v) {
$this->password = $v;
$this->modifiedColumns[] = UserPeer::PASSWORD;
}
return $this;
} | [
"public",
"function",
"setPassword",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"password",
"!==",
"$",
"v",
")",
"{",
"$",
"th... | Set the value of [password] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"password",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L413-L426 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setSalt | public function setSalt($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->salt !== $v) {
$this->salt = $v;
$this->modifiedColumns[] = UserPeer::SALT;
}
return $this;
} | php | public function setSalt($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->salt !== $v) {
$this->salt = $v;
$this->modifiedColumns[] = UserPeer::SALT;
}
return $this;
} | [
"public",
"function",
"setSalt",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"salt",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"... | Set the value of [salt] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"salt",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L434-L447 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setFirstname | public function setFirstname($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->firstname !== $v) {
$this->firstname = $v;
$this->modifiedColumns[] = UserPeer::FIRSTNAME;
}
return $this;
} | php | public function setFirstname($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->firstname !== $v) {
$this->firstname = $v;
$this->modifiedColumns[] = UserPeer::FIRSTNAME;
}
return $this;
} | [
"public",
"function",
"setFirstname",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"firstname",
"!==",
"$",
"v",
")",
"{",
"$",
"... | Set the value of [firstname] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"firstname",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L455-L468 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setLastname | public function setLastname($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->lastname !== $v) {
$this->lastname = $v;
$this->modifiedColumns[] = UserPeer::LASTNAME;
}
return $this;
} | php | public function setLastname($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->lastname !== $v) {
$this->lastname = $v;
$this->modifiedColumns[] = UserPeer::LASTNAME;
}
return $this;
} | [
"public",
"function",
"setLastname",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"lastname",
"!==",
"$",
"v",
")",
"{",
"$",
"th... | Set the value of [lastname] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"lastname",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L476-L489 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setEmail | public function setEmail($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->email !== $v) {
$this->email = $v;
$this->modifiedColumns[] = UserPeer::EMAIL;
}
return $this;
} | php | public function setEmail($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->email !== $v) {
$this->email = $v;
$this->modifiedColumns[] = UserPeer::EMAIL;
}
return $this;
} | [
"public",
"function",
"setEmail",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"email",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
... | Set the value of [email] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"email",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L497-L510 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setPhone | public function setPhone($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->phone !== $v) {
$this->phone = $v;
$this->modifiedColumns[] = UserPeer::PHONE;
}
return $this;
} | php | public function setPhone($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->phone !== $v) {
$this->phone = $v;
$this->modifiedColumns[] = UserPeer::PHONE;
}
return $this;
} | [
"public",
"function",
"setPhone",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"phone",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
... | Set the value of [phone] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"phone",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L518-L531 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setMemo | public function setMemo($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->memo !== $v) {
$this->memo = $v;
$this->modifiedColumns[] = UserPeer::MEMO;
}
return $this;
} | php | public function setMemo($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->memo !== $v) {
$this->memo = $v;
$this->modifiedColumns[] = UserPeer::MEMO;
}
return $this;
} | [
"public",
"function",
"setMemo",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"memo",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"... | Set the value of [memo] column.
@param string $v new value
@return User The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"memo",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L539-L552 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setLastLogin | public function setLastLogin($v)
{
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->last_login !== null || $dt !== null) {
$currentDateAsString = ($this->last_login !== null && $tmpDt = new DateTime($this->last_login)) ? $tmpDt->format('Y-m-d H:i:s') : null;
... | php | public function setLastLogin($v)
{
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->last_login !== null || $dt !== null) {
$currentDateAsString = ($this->last_login !== null && $tmpDt = new DateTime($this->last_login)) ? $tmpDt->format('Y-m-d H:i:s') : null;
... | [
"public",
"function",
"setLastLogin",
"(",
"$",
"v",
")",
"{",
"$",
"dt",
"=",
"PropelDateTime",
"::",
"newInstance",
"(",
"$",
"v",
",",
"null",
",",
"'DateTime'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"last_login",
"!==",
"null",
"||",
"$",
"dt",... | Sets the value of [last_login] column to a normalized version of the date/time value specified.
@param mixed $v string, integer (timestamp), or DateTime value.
Empty strings are treated as null.
@return User The current object (for fluent API support) | [
"Sets",
"the",
"value",
"of",
"[",
"last_login",
"]",
"column",
"to",
"a",
"normalized",
"version",
"of",
"the",
"date",
"/",
"time",
"value",
"specified",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L590-L604 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.hasOnlyDefaultValues | public function hasOnlyDefaultValues()
{
if ($this->notification_change !== true) {
return false;
}
if ($this->notification_error !== true) {
return false;
}
// otherwise, everything was equal, so return true
return tr... | php | public function hasOnlyDefaultValues()
{
if ($this->notification_change !== true) {
return false;
}
if ($this->notification_error !== true) {
return false;
}
// otherwise, everything was equal, so return true
return tr... | [
"public",
"function",
"hasOnlyDefaultValues",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"notification_change",
"!==",
"true",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"notification_error",
"!==",
"true",
")",
"{",
"return",
... | Indicates whether the columns in this object are only set to default values.
This method can be used in conjunction with isModified() to indicate whether an object is both
modified _and_ has some values set which are non-default.
@return boolean Whether the columns in this object are only been set with default values... | [
"Indicates",
"whether",
"the",
"columns",
"in",
"this",
"object",
"are",
"only",
"set",
"to",
"default",
"values",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L672-L684 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.hydrate | public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->username = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->password = ($row[$startc... | php | public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->username = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->password = ($row[$startc... | [
"public",
"function",
"hydrate",
"(",
"$",
"row",
",",
"$",
"startcol",
"=",
"0",
",",
"$",
"rehydrate",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"id",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"0",
"]",
"!==",
"null",
")",... | Hydrates (populates) the object variables with values from the database resultset.
An offset (0-based "start column") is specified so that objects can be hydrated
with a subset of the columns in the resultset rows. This is needed, for example,
for results of JOIN queries where the resultset row includes columns from ... | [
"Hydrates",
"(",
"populates",
")",
"the",
"object",
"variables",
"with",
"values",
"from",
"the",
"database",
"resultset",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L700-L731 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.doSave | protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if (... | php | protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if (... | [
"protected",
"function",
"doSave",
"(",
"PropelPDO",
"$",
"con",
")",
"{",
"$",
"affectedRows",
"=",
"0",
";",
"// initialize var to track total num of affected rows",
"if",
"(",
"!",
"$",
"this",
"->",
"alreadyInSave",
")",
"{",
"$",
"this",
"->",
"alreadyInSav... | Performs the work of inserting or updating the row in the database.
If the object is new, it inserts it; otherwise an update is performed.
All related objects are also updated in this method.
@param PropelPDO $con
@return int The number of rows affected by this insert/update and any referring fk objects' ... | [
"Performs",
"the",
"work",
"of",
"inserting",
"or",
"updating",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L899-L955 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.doInsert | protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = UserPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserPeer::ID . ')');
}
... | php | protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = UserPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserPeer::ID . ')');
}
... | [
"protected",
"function",
"doInsert",
"(",
"PropelPDO",
"$",
"con",
")",
"{",
"$",
"modifiedColumns",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"UserPeer",
"::",
"ID",
";",
"if",
"("... | Insert the row in the database.
@param PropelPDO $con
@throws PropelException
@see doSave() | [
"Insert",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L965-L1081 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.getByPosition | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getUsername();
break;
case 2:
return $this->getPassword();
bre... | php | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getUsername();
break;
case 2:
return $this->getPassword();
bre... | [
"public",
"function",
"getByPosition",
"(",
"$",
"pos",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"return",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"break",
";",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getUsername"... | Retrieves a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@return mixed Value of field at $pos | [
"Retrieves",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1212-L1258 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.toArray | public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['User'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['User'][... | php | public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['User'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['User'][... | [
"public",
"function",
"toArray",
"(",
"$",
"keyType",
"=",
"BasePeer",
"::",
"TYPE_PHPNAME",
",",
"$",
"includeLazyLoadColumns",
"=",
"true",
",",
"$",
"alreadyDumpedObjects",
"=",
"array",
"(",
")",
",",
"$",
"includeForeignObjects",
"=",
"false",
")",
"{",
... | Exports the object as an array.
You can specify the key type of the array by passing one of the class
type constants.
@param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
Defau... | [
"Exports",
"the",
"object",
"as",
"an",
"array",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1275-L1312 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.setByPosition | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setUsername($value);
break;
case 2:
$this->setPassword($value);
... | php | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setUsername($value);
break;
case 2:
$this->setPassword($value);
... | [
"public",
"function",
"setByPosition",
"(",
"$",
"pos",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"$",
"this",
"->",
"setId",
"(",
"$",
"value",
")",
";",
"break",
";",
"case",
"1",
":",
"$",
"this",
"-... | Sets a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@param mixed $value field value
@return void | [
"Sets",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1340-L1383 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.fromArray | public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = UserPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setUsername($arr[$keys[1]]);
if (array_key_exists($keys[2]... | php | public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = UserPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setUsername($arr[$keys[1]]);
if (array_key_exists($keys[2]... | [
"public",
"function",
"fromArray",
"(",
"$",
"arr",
",",
"$",
"keyType",
"=",
"BasePeer",
"::",
"TYPE_PHPNAME",
")",
"{",
"$",
"keys",
"=",
"UserPeer",
"::",
"getFieldNames",
"(",
"$",
"keyType",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"keys",... | Populates the object using an array.
This is particularly useful when populating an object from one of the
request arrays (e.g. $_POST). This method goes through the column
names, checking to see whether a matching key exists in populated
array. If so the setByName() method is called for that column.
You can specify... | [
"Populates",
"the",
"object",
"using",
"an",
"array",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1402-L1419 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.buildCriteria | public function buildCriteria()
{
$criteria = new Criteria(UserPeer::DATABASE_NAME);
if ($this->isColumnModified(UserPeer::ID)) $criteria->add(UserPeer::ID, $this->id);
if ($this->isColumnModified(UserPeer::USERNAME)) $criteria->add(UserPeer::USERNAME, $this->username);
if ($this->i... | php | public function buildCriteria()
{
$criteria = new Criteria(UserPeer::DATABASE_NAME);
if ($this->isColumnModified(UserPeer::ID)) $criteria->add(UserPeer::ID, $this->id);
if ($this->isColumnModified(UserPeer::USERNAME)) $criteria->add(UserPeer::USERNAME, $this->username);
if ($this->i... | [
"public",
"function",
"buildCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"UserPeer",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"UserPeer",
"::",
"ID",
")",
")",
"$",
"criteria",
"->... | Build a Criteria object containing the values of all modified columns in this object.
@return Criteria The Criteria object containing all modified values. | [
"Build",
"a",
"Criteria",
"object",
"containing",
"the",
"values",
"of",
"all",
"modified",
"columns",
"in",
"this",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1426-L1445 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.copyInto | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setUsername($this->getUsername());
$copyObj->setPassword($this->getPassword());
$copyObj->setSalt($this->getSalt());
$copyObj->setFirstname($this->getFirstname());
$copyObj->setLastname($this->... | php | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setUsername($this->getUsername());
$copyObj->setPassword($this->getPassword());
$copyObj->setSalt($this->getSalt());
$copyObj->setFirstname($this->getFirstname());
$copyObj->setLastname($this->... | [
"public",
"function",
"copyInto",
"(",
"$",
"copyObj",
",",
"$",
"deepCopy",
"=",
"false",
",",
"$",
"makeNew",
"=",
"true",
")",
"{",
"$",
"copyObj",
"->",
"setUsername",
"(",
"$",
"this",
"->",
"getUsername",
"(",
")",
")",
";",
"$",
"copyObj",
"->... | Sets contents of passed object to values from current object.
If desired, this method can also make copies of all associated (fkey referrers)
objects.
@param object $copyObj An object of User (or compatible) type.
@param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
@param b... | [
"Sets",
"contents",
"of",
"passed",
"object",
"to",
"values",
"from",
"current",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1504-L1546 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.getUserCustomerRelations | public function getUserCustomerRelations($criteria = null, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserCus... | php | public function getUserCustomerRelations($criteria = null, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserCus... | [
"public",
"function",
"getUserCustomerRelations",
"(",
"$",
"criteria",
"=",
"null",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUserCustomerRelationsPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
... | Gets an array of UserCustomerRelation objects which contain a foreign key that references this object.
If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $cr... | [
"Gets",
"an",
"array",
"of",
"UserCustomerRelation",
"objects",
"which",
"contain",
"a",
"foreign",
"key",
"that",
"references",
"this",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1669-L1712 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.countUserCustomerRelations | public function countUserCustomerRelations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() &... | php | public function countUserCustomerRelations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() &... | [
"public",
"function",
"countUserCustomerRelations",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"$",
"distinct",
"=",
"false",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUserCustomerRelationsPartia... | Returns the number of related UserCustomerRelation objects.
@param Criteria $criteria
@param boolean $distinct
@param PropelPDO $con
@return int Count of related UserCustomerRelation objects.
@throws PropelException | [
"Returns",
"the",
"number",
"of",
"related",
"UserCustomerRelation",
"objects",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1755-L1777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.