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 |
|---|---|---|---|---|---|---|---|---|---|---|
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.getAllowedDirectivesForForm | public static function getAllowedDirectivesForForm($allowed, $schema = null) {
if (!$schema) {
$schema = HTMLPurifier_ConfigSchema::instance();
}
if ($allowed !== true) {
if (is_string($allowed)) $allowed = array($allowed);
$allowed_ns = array();
... | php | public static function getAllowedDirectivesForForm($allowed, $schema = null) {
if (!$schema) {
$schema = HTMLPurifier_ConfigSchema::instance();
}
if ($allowed !== true) {
if (is_string($allowed)) $allowed = array($allowed);
$allowed_ns = array();
... | [
"public",
"static",
"function",
"getAllowedDirectivesForForm",
"(",
"$",
"allowed",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"schema",
")",
"{",
"$",
"schema",
"=",
"HTMLPurifier_ConfigSchema",
"::",
"instance",
"(",
")",
";",
"}",
... | Returns a list of array(namespace, directive) for all directives
that are allowed in a web-form context as per an allowed
namespaces/directives list.
@param $allowed List of allowed namespaces/directives | [
"Returns",
"a",
"list",
"of",
"array",
"(",
"namespace",
"directive",
")",
"for",
"all",
"directives",
"that",
"are",
"allowed",
"in",
"a",
"web",
"-",
"form",
"context",
"as",
"per",
"an",
"allowed",
"namespaces",
"/",
"directives",
"list",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L424-L459 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.prepareArrayFromForm | public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) {
if ($index !== false) $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
$mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quot... | php | public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) {
if ($index !== false) $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
$mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quot... | [
"public",
"static",
"function",
"prepareArrayFromForm",
"(",
"$",
"array",
",",
"$",
"index",
"=",
"false",
",",
"$",
"allowed",
"=",
"true",
",",
"$",
"mq_fix",
"=",
"true",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"index",
"!==",
... | Prepares an array from a form into something usable for the more
strict parts of HTMLPurifier_Config | [
"Prepares",
"an",
"array",
"from",
"a",
"form",
"into",
"something",
"usable",
"for",
"the",
"more",
"strict",
"parts",
"of",
"HTMLPurifier_Config"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L489-L507 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php | HTMLPurifier_Config.triggerError | protected function triggerError($msg, $no) {
// determine previous stack frame
$backtrace = debug_backtrace();
if ($this->chatty && isset($backtrace[1])) {
$frame = $backtrace[1];
$extra = " on line {$frame['line']} in file {$frame['file']}";
} else {
... | php | protected function triggerError($msg, $no) {
// determine previous stack frame
$backtrace = debug_backtrace();
if ($this->chatty && isset($backtrace[1])) {
$frame = $backtrace[1];
$extra = " on line {$frame['line']} in file {$frame['file']}";
} else {
... | [
"protected",
"function",
"triggerError",
"(",
"$",
"msg",
",",
"$",
"no",
")",
"{",
"// determine previous stack frame",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"chatty",
"&&",
"isset",
"(",
"$",
"backtrace",
... | Produces a nicely formatted error message by supplying the
stack frame information from two levels up and OUTSIDE of
HTMLPurifier_Config. | [
"Produces",
"a",
"nicely",
"formatted",
"error",
"message",
"by",
"supplying",
"the",
"stack",
"frame",
"information",
"from",
"two",
"levels",
"up",
"and",
"OUTSIDE",
"of",
"HTMLPurifier_Config",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Config.php#L555-L565 |
transfer-framework/transfer | src/Transfer/Adapter/CallbackAdapter.php | CallbackAdapter.receive | public function receive(Request $request)
{
if (is_callable($this->receiveCallback)) {
return call_user_func_array($this->receiveCallback, array($request));
}
} | php | public function receive(Request $request)
{
if (is_callable($this->receiveCallback)) {
return call_user_func_array($this->receiveCallback, array($request));
}
} | [
"public",
"function",
"receive",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"receiveCallback",
")",
")",
"{",
"return",
"call_user_func_array",
"(",
"$",
"this",
"->",
"receiveCallback",
",",
"array",
"(",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Adapter/CallbackAdapter.php#L42-L47 |
transfer-framework/transfer | src/Transfer/Adapter/CallbackAdapter.php | CallbackAdapter.send | public function send(Request $request)
{
if (is_callable($this->sendCallback)) {
return call_user_func_array($this->sendCallback, array($request));
}
} | php | public function send(Request $request)
{
if (is_callable($this->sendCallback)) {
return call_user_func_array($this->sendCallback, array($request));
}
} | [
"public",
"function",
"send",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"sendCallback",
")",
")",
"{",
"return",
"call_user_func_array",
"(",
"$",
"this",
"->",
"sendCallback",
",",
"array",
"(",
"$",
"re... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Adapter/CallbackAdapter.php#L52-L57 |
terdia/legato-framework | src/Mail/Mail.php | Mail.send | public static function send($params)
{
$params = array_merge([
'subject' => '',
'view' => '',
'body' => '',
'bodyHtml' => '',
'to' => [],
'bcc' => [],
'cc' => [],
'replyTo' => [],
... | php | public static function send($params)
{
$params = array_merge([
'subject' => '',
'view' => '',
'body' => '',
'bodyHtml' => '',
'to' => [],
'bcc' => [],
'cc' => [],
'replyTo' => [],
... | [
"public",
"static",
"function",
"send",
"(",
"$",
"params",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"[",
"'subject'",
"=>",
"''",
",",
"'view'",
"=>",
"''",
",",
"'body'",
"=>",
"''",
",",
"'bodyHtml'",
"=>",
"''",
",",
"'to'",
"=>",
"[",
... | Send message using chosen driver.
@param $params
@return int|mixed | [
"Send",
"message",
"using",
"chosen",
"driver",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Mail/Mail.php#L52-L81 |
ssnepenthe/soter | src/class-slack-notifier.php | Slack_Notifier.notify | public function notify( Vulnerabilities $vulnerabilities ) {
$vuln_count = $vulnerabilities->count();
$text = sprintf(
'%s %s detected on %s. <%s|Please update your site.>',
$vuln_count,
1 === $vuln_count ? 'vulnerability' : 'vulnerabilities',
get_bloginfo( 'name' ),
admin_url( 'update-core.php' )
... | php | public function notify( Vulnerabilities $vulnerabilities ) {
$vuln_count = $vulnerabilities->count();
$text = sprintf(
'%s %s detected on %s. <%s|Please update your site.>',
$vuln_count,
1 === $vuln_count ? 'vulnerability' : 'vulnerabilities',
get_bloginfo( 'name' ),
admin_url( 'update-core.php' )
... | [
"public",
"function",
"notify",
"(",
"Vulnerabilities",
"$",
"vulnerabilities",
")",
"{",
"$",
"vuln_count",
"=",
"$",
"vulnerabilities",
"->",
"count",
"(",
")",
";",
"$",
"text",
"=",
"sprintf",
"(",
"'%s %s detected on %s. <%s|Please update your site.>'",
",",
... | Prepare and send a notification.
@param Vulnerabilities $vulnerabilities List of vulnerabilities.
@return void | [
"Prepare",
"and",
"send",
"a",
"notification",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-slack-notifier.php#L57-L83 |
ssnepenthe/soter | src/class-slack-notifier.php | Slack_Notifier.build_attachment_fields | protected function build_attachment_fields( Vulnerabilities $vulnerabilities ) {
$fields = [];
foreach ( $vulnerabilities as $vulnerability ) {
$fixed_in = $vulnerability->fixed_in
? 'Fixed in v' . $vulnerability->fixed_in
: 'Not fixed yet';
$wpvdb_url = "https://wpvulndb.com/vulnerabilities/{$vulner... | php | protected function build_attachment_fields( Vulnerabilities $vulnerabilities ) {
$fields = [];
foreach ( $vulnerabilities as $vulnerability ) {
$fixed_in = $vulnerability->fixed_in
? 'Fixed in v' . $vulnerability->fixed_in
: 'Not fixed yet';
$wpvdb_url = "https://wpvulndb.com/vulnerabilities/{$vulner... | [
"protected",
"function",
"build_attachment_fields",
"(",
"Vulnerabilities",
"$",
"vulnerabilities",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"vulnerabilities",
"as",
"$",
"vulnerability",
")",
"{",
"$",
"fixed_in",
"=",
"$",
"vulnerabi... | Generates the fields array for the message attachment.
@param Vulnerabilities $vulnerabilities List of vulnerabilities.
@return array | [
"Generates",
"the",
"fields",
"array",
"for",
"the",
"message",
"attachment",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-slack-notifier.php#L92-L108 |
inpsyde/wp-db-tools | src/Db/WpDbAdapter.php | WpDbAdapter.execute | public function execute( $statement ) {
$result = $this->wpdb->query( $statement );
if ( FALSE === $result ) {
throw new WpDbExecuteException( $this->wpdb->last_error );
}
return (int) $result;
} | php | public function execute( $statement ) {
$result = $this->wpdb->query( $statement );
if ( FALSE === $result ) {
throw new WpDbExecuteException( $this->wpdb->last_error );
}
return (int) $result;
} | [
"public",
"function",
"execute",
"(",
"$",
"statement",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"wpdb",
"->",
"query",
"(",
"$",
"statement",
")",
";",
"if",
"(",
"FALSE",
"===",
"$",
"result",
")",
"{",
"throw",
"new",
"WpDbExecuteException",... | @param string $statement
@throws WpDbExecuteException
@return int | [
"@param",
"string",
"$statement"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Db/WpDbAdapter.php#L58-L66 |
inpsyde/wp-db-tools | src/Db/WpDbAdapter.php | WpDbAdapter.query | public function query( $query, $options = 0 ) {
$result = $this->wpdb->get_results( (string) $query );
$this->last_affected_rows = (int) $this->wpdb->rows_affected;
$this->last_insert_id = (int) $this->wpdb->insert_id;
$this->last_statement = NULL;
if ( ! is_array( $result ) )
$r... | php | public function query( $query, $options = 0 ) {
$result = $this->wpdb->get_results( (string) $query );
$this->last_affected_rows = (int) $this->wpdb->rows_affected;
$this->last_insert_id = (int) $this->wpdb->insert_id;
$this->last_statement = NULL;
if ( ! is_array( $result ) )
$r... | [
"public",
"function",
"query",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"wpdb",
"->",
"get_results",
"(",
"(",
"string",
")",
"$",
"query",
")",
";",
"$",
"this",
"->",
"last_affected_rows",
... | Executes a plain SQL query and return the results
@param $query
@param int $options
@return \WpDbTools\Type\Result | [
"Executes",
"a",
"plain",
"SQL",
"query",
"and",
"return",
"the",
"results"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Db/WpDbAdapter.php#L76-L86 |
inpsyde/wp-db-tools | src/Db/WpDbAdapter.php | WpDbAdapter.query_statement | public function query_statement( Statement $statement, array $data, $options = 0 ) {
$query = call_user_func_array(
[ $this->wpdb, 'prepare' ],
array_merge( [ (string) $statement] , $data )
);
$result = $this->query( $query );
$this->last_statement = $statement;
return $result;
} | php | public function query_statement( Statement $statement, array $data, $options = 0 ) {
$query = call_user_func_array(
[ $this->wpdb, 'prepare' ],
array_merge( [ (string) $statement] , $data )
);
$result = $this->query( $query );
$this->last_statement = $statement;
return $result;
} | [
"public",
"function",
"query_statement",
"(",
"Statement",
"$",
"statement",
",",
"array",
"$",
"data",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"query",
"=",
"call_user_func_array",
"(",
"[",
"$",
"this",
"->",
"wpdb",
",",
"'prepare'",
"]",
",",
... | Executes a Statement and return a Result
@param Statement $statement
@param array $data
@param int $options (Optional)
@return Result | [
"Executes",
"a",
"Statement",
"and",
"return",
"a",
"Result"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Db/WpDbAdapter.php#L97-L107 |
inpsyde/wp-db-tools | src/Db/WpDbAdapter.php | WpDbAdapter.execute_statement | public function execute_statement( Statement $statement, array $data, $options = 0 ) {
$this->query_statement( $statement, $data, $options );
return $this->last_affected_rows();
} | php | public function execute_statement( Statement $statement, array $data, $options = 0 ) {
$this->query_statement( $statement, $data, $options );
return $this->last_affected_rows();
} | [
"public",
"function",
"execute_statement",
"(",
"Statement",
"$",
"statement",
",",
"array",
"$",
"data",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"query_statement",
"(",
"$",
"statement",
",",
"$",
"data",
",",
"$",
"options",
")",
... | Executes a Statement and return the number of affected rows
@param Statement $statement
@param array $data
@param int $options (Optional)
@return int | [
"Executes",
"a",
"Statement",
"and",
"return",
"the",
"number",
"of",
"affected",
"rows"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Db/WpDbAdapter.php#L118-L123 |
inpsyde/wp-db-tools | src/Db/WpDbAdapter.php | WpDbAdapter.last_insert_id | public function last_insert_id( Statement $statement = NULL ) {
if ( $statement && ! $this->last_statement === $statement )
return FALSE;
return $this->last_insert_id;
} | php | public function last_insert_id( Statement $statement = NULL ) {
if ( $statement && ! $this->last_statement === $statement )
return FALSE;
return $this->last_insert_id;
} | [
"public",
"function",
"last_insert_id",
"(",
"Statement",
"$",
"statement",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"statement",
"&&",
"!",
"$",
"this",
"->",
"last_statement",
"===",
"$",
"statement",
")",
"return",
"FALSE",
";",
"return",
"$",
"this",
"... | Returns the inserted ID of the last executed statement. If a statement
is provided it should be verified that it is the same as the last executed one.
@param Statement $statement (Optional)
@return int|false | [
"Returns",
"the",
"inserted",
"ID",
"of",
"the",
"last",
"executed",
"statement",
".",
"If",
"a",
"statement",
"is",
"provided",
"it",
"should",
"be",
"verified",
"that",
"it",
"is",
"the",
"same",
"as",
"the",
"last",
"executed",
"one",
"."
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Db/WpDbAdapter.php#L133-L139 |
inpsyde/wp-db-tools | src/Db/WpDbAdapter.php | WpDbAdapter.last_affected_rows | public function last_affected_rows( Statement $statement = NULL ) {
if ( $statement && ! $this->last_statement === $statement )
return FALSE;
return $this->last_affected_rows;
} | php | public function last_affected_rows( Statement $statement = NULL ) {
if ( $statement && ! $this->last_statement === $statement )
return FALSE;
return $this->last_affected_rows;
} | [
"public",
"function",
"last_affected_rows",
"(",
"Statement",
"$",
"statement",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"statement",
"&&",
"!",
"$",
"this",
"->",
"last_statement",
"===",
"$",
"statement",
")",
"return",
"FALSE",
";",
"return",
"$",
"this",... | Returns the number of affected rows of the last executed statement.
If a statement is provided it should be verified that it is the same
as the last executed one.
@param Statement $statement (Optional)
@return mixed | [
"Returns",
"the",
"number",
"of",
"affected",
"rows",
"of",
"the",
"last",
"executed",
"statement",
".",
"If",
"a",
"statement",
"is",
"provided",
"it",
"should",
"be",
"verified",
"that",
"it",
"is",
"the",
"same",
"as",
"the",
"last",
"executed",
"one",
... | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Db/WpDbAdapter.php#L150-L156 |
KejawenLab/PetrukUsername | Generator/ShortUsernameGenerator.php | ShortUsernameGenerator.generate | public function generate(string $fullName, int $limit = 8): array
{
$original = str_replace(' ', '', $fullName);
if ($limit < strlen($original)) {
return array();
}
$fullName = strtoupper(substr(str_repeat($original, $limit), 0, $limit));
return $this->shift($fu... | php | public function generate(string $fullName, int $limit = 8): array
{
$original = str_replace(' ', '', $fullName);
if ($limit < strlen($original)) {
return array();
}
$fullName = strtoupper(substr(str_repeat($original, $limit), 0, $limit));
return $this->shift($fu... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"fullName",
",",
"int",
"$",
"limit",
"=",
"8",
")",
":",
"array",
"{",
"$",
"original",
"=",
"str_replace",
"(",
"' '",
",",
"''",
",",
"$",
"fullName",
")",
";",
"if",
"(",
"$",
"limit",
"<",
... | @param string $fullName
@param int $limit
@return array | [
"@param",
"string",
"$fullName",
"@param",
"int",
"$limit"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/Generator/ShortUsernameGenerator.php#L16-L26 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.paramExists | public function paramExists($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
if (strlen($name) == 1) {
return isset($this->shortNames[$name]);
} else {
return isset($this->longNames[$name]);
} //if
} | php | public function paramExists($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
if (strlen($name) == 1) {
return isset($this->shortNames[$name]);
} else {
return isset($this->longNames[$name]);
} //if
} | [
"public",
"function",
"paramExists",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"if",
"(",
"strlen",
"(",
"$",
"name",
")",
"==",
"1",
")... | checks if parameter is allowed
@author Patrick Forget <patforg at webtrendi.com>
@param string $name either short or long name of the parameter to check
@return boolean true if definition exisits, false otherwise | [
"checks",
"if",
"parameter",
"is",
"allowed"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L85-L96 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.allowsValue | public function allowsValue($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
$longName = (strlen($name) == 1 ? ( isset($this->shortNames[$name]) ? $this->shortNames[$name] : '') : $name);
if (isset($this->longNames[$longName])) {
return $th... | php | public function allowsValue($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
$longName = (strlen($name) == 1 ? ( isset($this->shortNames[$name]) ? $this->shortNames[$name] : '') : $name);
if (isset($this->longNames[$longName])) {
return $th... | [
"public",
"function",
"allowsValue",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"$",
"longName",
"=",
"(",
"strlen",
"(",
"$",
"name",
")",... | checks if parameter allows a value if so what type
@author Patrick Forget <patforg at webtrendi.com>
@param string $name either short or long name of the parameter to check
@return boolean|string false doesn't allow value, The value "string" or "integer" depending which type it allows | [
"checks",
"if",
"parameter",
"allows",
"a",
"value",
"if",
"so",
"what",
"type"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L108-L121 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.getValueType | public function getValueType($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
$longName = (strlen($name) == 1 ? ( isset($this->shortNames[$name]) ? $this->shortNames[$name] : '') : $name);
if (isset($this->longNames[$longName]['parameterType'])
... | php | public function getValueType($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
$longName = (strlen($name) == 1 ? ( isset($this->shortNames[$name]) ? $this->shortNames[$name] : '') : $name);
if (isset($this->longNames[$longName]['parameterType'])
... | [
"public",
"function",
"getValueType",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"$",
"longName",
"=",
"(",
"strlen",
"(",
"$",
"name",
")"... | returns the type of value allowed
@author Patrick Forget <patforg at webtrendi.com> | [
"returns",
"the",
"type",
"of",
"value",
"allowed"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L128-L142 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.getShortName | public function getShortName($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
if (isset($this->longNames[$name])) {
return $this->longNames[$name]['shortName'];
} else {
return null;
} //if
} | php | public function getShortName($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
if (isset($this->longNames[$name])) {
return $this->longNames[$name]['shortName'];
} else {
return null;
} //if
} | [
"public",
"function",
"getShortName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"longNames",
"... | retreive short name of a parameter using its long name
@author Patrick Forget <patforg at webtrendi.com>
@param string $name long name of the parameter to check
@return string character of the short name or null if it doesn't exist | [
"retreive",
"short",
"name",
"of",
"a",
"parameter",
"using",
"its",
"long",
"name"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L178-L189 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.getLongName | public function getLongName($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
if (isset($this->shortNames[$name])) {
return $this->shortNames[$name];
} else {
return null;
} //if
} | php | public function getLongName($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
if (isset($this->shortNames[$name])) {
return $this->shortNames[$name];
} else {
return null;
} //if
} | [
"public",
"function",
"getLongName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"shortNames",
"... | retreive long name of a parameter using its short name
@author Patrick Forget <patforg at webtrendi.com>
@param string $name short name of the parameter to check
@return string long name or null if it doesn't exist | [
"retreive",
"long",
"name",
"of",
"a",
"parameter",
"using",
"its",
"short",
"name"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L200-L211 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.getDescription | public function getDescription($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
$longName = (strlen($name) == 1 ? ( isset($this->shortNames[$name]) ? $this->shortNames[$name] : '') : $name);
if (isset($this->longNames[$longName])) {
return ... | php | public function getDescription($name)
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
$longName = (strlen($name) == 1 ? ( isset($this->shortNames[$name]) ? $this->shortNames[$name] : '') : $name);
if (isset($this->longNames[$longName])) {
return ... | [
"public",
"function",
"getDescription",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"$",
"longName",
"=",
"(",
"strlen",
"(",
"$",
"name",
"... | retreive description of a paramter
@author Patrick Forget <patforg at webtrendi.com>
@param string $name either short or long name of the parameter to check
@return string description or null if it doesn't exist | [
"retreive",
"description",
"of",
"a",
"paramter"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L222-L235 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.getUsage | public function getUsage()
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
/* build list of argument names and calculate
the first column width so we can pad to
align definitions */
$firstCol = array();
$longestDef = 0;
... | php | public function getUsage()
{
if (!$this->isParsed) {
$this->parseDefinitions();
} //if
/* build list of argument names and calculate
the first column width so we can pad to
align definitions */
$firstCol = array();
$longestDef = 0;
... | [
"public",
"function",
"getUsage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isParsed",
")",
"{",
"$",
"this",
"->",
"parseDefinitions",
"(",
")",
";",
"}",
"//if",
"/* build list of argument names and calculate\n the first column width so we can pad... | builds a usage definition based on definition of params
@author Patrick Forget <patforg at webtrendi.com> | [
"builds",
"a",
"usage",
"definition",
"based",
"on",
"definition",
"of",
"params"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L242-L293 |
webtrendi/clapp | src/Clapp/CommandLineArgumentDefinition.php | CommandLineArgumentDefinition.parseDefinitions | protected function parseDefinitions()
{
foreach ($this->definitions as $nameDef => $description) {
$nameParts = explode("|", $nameDef);
if (sizeof($nameParts) !== 2) {
throw new \UnexpectedValueException("Unexpected argument name definition expecting \"longName|char\... | php | protected function parseDefinitions()
{
foreach ($this->definitions as $nameDef => $description) {
$nameParts = explode("|", $nameDef);
if (sizeof($nameParts) !== 2) {
throw new \UnexpectedValueException("Unexpected argument name definition expecting \"longName|char\... | [
"protected",
"function",
"parseDefinitions",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"definitions",
"as",
"$",
"nameDef",
"=>",
"$",
"description",
")",
"{",
"$",
"nameParts",
"=",
"explode",
"(",
"\"|\"",
",",
"$",
"nameDef",
")",
";",
"if",
... | parses the definitions
@author Patrick Forget <patforg at webtrendi.com> | [
"parses",
"the",
"definitions"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandLineArgumentDefinition.php#L301-L388 |
BenConstable/lock | src/BenConstable/Lock/Lock.php | Lock.acquire | public function acquire()
{
if (!$this->locked) {
$this->fp = @fopen($this->filePath, 'a');
if (!$this->fp || !flock($this->fp, LOCK_EX | LOCK_NB)) {
throw new LockException("Could not get lock on {$this->filePath}");
} else {
$this->locke... | php | public function acquire()
{
if (!$this->locked) {
$this->fp = @fopen($this->filePath, 'a');
if (!$this->fp || !flock($this->fp, LOCK_EX | LOCK_NB)) {
throw new LockException("Could not get lock on {$this->filePath}");
} else {
$this->locke... | [
"public",
"function",
"acquire",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"locked",
")",
"{",
"$",
"this",
"->",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"this",
"->",
"filePath",
",",
"'a'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"f... | Acquire a lock on the resource.
@return \BenConstable\Lock\Lock This, for chaining
@throws \BenConstable\Lock\Exception\LockException If lock could not be acquired | [
"Acquire",
"a",
"lock",
"on",
"the",
"resource",
"."
] | train | https://github.com/BenConstable/lock/blob/40b86cf8c2c4f90374d79c0b0d76999e99ed32c6/src/BenConstable/Lock/Lock.php#L64-L77 |
BenConstable/lock | src/BenConstable/Lock/Lock.php | Lock.release | public function release()
{
if ($this->locked) {
flock($this->fp, LOCK_UN);
fclose($this->fp);
$this->fp = null;
$this->locked = false;
}
return $this;
} | php | public function release()
{
if ($this->locked) {
flock($this->fp, LOCK_UN);
fclose($this->fp);
$this->fp = null;
$this->locked = false;
}
return $this;
} | [
"public",
"function",
"release",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"flock",
"(",
"$",
"this",
"->",
"fp",
",",
"LOCK_UN",
")",
";",
"fclose",
"(",
"$",
"this",
"->",
"fp",
")",
";",
"$",
"this",
"->",
"fp",
"=",
... | Release the lock on the resource, if we have one.
@return \BenConstable\Lock\Lock This, for chaining | [
"Release",
"the",
"lock",
"on",
"the",
"resource",
"if",
"we",
"have",
"one",
"."
] | train | https://github.com/BenConstable/lock/blob/40b86cf8c2c4f90374d79c0b0d76999e99ed32c6/src/BenConstable/Lock/Lock.php#L84-L95 |
csun-metalab/laravel-directory-authentication | src/Authentication/Providers/UserProviderLDAP.php | UserProviderLDAP.retrieveByCredentials | public function retrieveByCredentials(array $credentials, $checkDatabaseModel=true) {
$u = $credentials['username'];
$p = $credentials['password'];
$m = $this->modelName;
// attempt to auth with the credentials provided first
try
{
// attempt regular authentication
if($this->... | php | public function retrieveByCredentials(array $credentials, $checkDatabaseModel=true) {
$u = $credentials['username'];
$p = $credentials['password'];
$m = $this->modelName;
// attempt to auth with the credentials provided first
try
{
// attempt regular authentication
if($this->... | [
"public",
"function",
"retrieveByCredentials",
"(",
"array",
"$",
"credentials",
",",
"$",
"checkDatabaseModel",
"=",
"true",
")",
"{",
"$",
"u",
"=",
"$",
"credentials",
"[",
"'username'",
"]",
";",
"$",
"p",
"=",
"$",
"credentials",
"[",
"'password'",
"]... | Retrieves the user with the specified credentials from LDAP. Returns null
if the user could not be found. If the optional $checkDatabaseModel flag has
been set to false, it will instead return true if the authentication was successful.
@param array $credentials The credentials to use
@param boolean $checkDatabaseModel... | [
"Retrieves",
"the",
"user",
"with",
"the",
"specified",
"credentials",
"from",
"LDAP",
".",
"Returns",
"null",
"if",
"the",
"user",
"could",
"not",
"be",
"found",
".",
"If",
"the",
"optional",
"$checkDatabaseModel",
"flag",
"has",
"been",
"set",
"to",
"false... | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Providers/UserProviderLDAP.php#L95-L164 |
econic/CsvReader | Classes/Econic/CsvReader/Reader.php | Reader.addKeys | public function addKeys($keys) {
foreach ((array)$keys as $position => $key) {
$this->keys[$position] = $key;
}
return $this;
} | php | public function addKeys($keys) {
foreach ((array)$keys as $position => $key) {
$this->keys[$position] = $key;
}
return $this;
} | [
"public",
"function",
"addKeys",
"(",
"$",
"keys",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"keys",
"as",
"$",
"position",
"=>",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"keys",
"[",
"$",
"position",
"]",
"=",
"$",
"key",
";",
"}",
"re... | Sets the keys for the properties
Existing keys will be overridden only when necessary
@param array $keys two dimensional array with the keys | [
"Sets",
"the",
"keys",
"for",
"the",
"properties",
"Existing",
"keys",
"will",
"be",
"overridden",
"only",
"when",
"necessary"
] | train | https://github.com/econic/CsvReader/blob/d650c278ab0602ffe1f5847580e0cf0f1c8167ae/Classes/Econic/CsvReader/Reader.php#L254-L259 |
econic/CsvReader | Classes/Econic/CsvReader/Reader.php | Reader.setKey | public function setKey($location, $key) {
$this->keys[(integer)$location] = (string)$key;
return $this;
} | php | public function setKey($location, $key) {
$this->keys[(integer)$location] = (string)$key;
return $this;
} | [
"public",
"function",
"setKey",
"(",
"$",
"location",
",",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"keys",
"[",
"(",
"integer",
")",
"$",
"location",
"]",
"=",
"(",
"string",
")",
"$",
"key",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the key for a property
@param integer $location which key should be replaced
@param string $key what the new associative key should be named like | [
"Sets",
"the",
"key",
"for",
"a",
"property"
] | train | https://github.com/econic/CsvReader/blob/d650c278ab0602ffe1f5847580e0cf0f1c8167ae/Classes/Econic/CsvReader/Reader.php#L267-L270 |
econic/CsvReader | Classes/Econic/CsvReader/Reader.php | Reader.resetModifiers | public function resetModifiers($key = false) {
if ($key) {
unset($this->modifiers[$key]);
} else {
$this->modifiers = array();
}
return $this;
} | php | public function resetModifiers($key = false) {
if ($key) {
unset($this->modifiers[$key]);
} else {
$this->modifiers = array();
}
return $this;
} | [
"public",
"function",
"resetModifiers",
"(",
"$",
"key",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"key",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"modifiers",
"[",
"$",
"key",
"]",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"modifiers",
"=",... | resets the modifiers | [
"resets",
"the",
"modifiers"
] | train | https://github.com/econic/CsvReader/blob/d650c278ab0602ffe1f5847580e0cf0f1c8167ae/Classes/Econic/CsvReader/Reader.php#L304-L311 |
econic/CsvReader | Classes/Econic/CsvReader/Reader.php | Reader.parse | public function parse() {
$lines = str_getcsv($this->source, $this->newline, $this->enclosure, $this->escape);
// add keys from headline if available
if ($this->getSourceHasHeadline()) {
$keys = explode($this->delimiter, $lines[0]);
$this->addKeys($keys);
unset($lines[0]);
}
foreach ($lines as $li... | php | public function parse() {
$lines = str_getcsv($this->source, $this->newline, $this->enclosure, $this->escape);
// add keys from headline if available
if ($this->getSourceHasHeadline()) {
$keys = explode($this->delimiter, $lines[0]);
$this->addKeys($keys);
unset($lines[0]);
}
foreach ($lines as $li... | [
"public",
"function",
"parse",
"(",
")",
"{",
"$",
"lines",
"=",
"str_getcsv",
"(",
"$",
"this",
"->",
"source",
",",
"$",
"this",
"->",
"newline",
",",
"$",
"this",
"->",
"enclosure",
",",
"$",
"this",
"->",
"escape",
")",
";",
"// add keys from headl... | main function, parses the source and returns the result array
@return array result | [
"main",
"function",
"parses",
"the",
"source",
"and",
"returns",
"the",
"result",
"array"
] | train | https://github.com/econic/CsvReader/blob/d650c278ab0602ffe1f5847580e0cf0f1c8167ae/Classes/Econic/CsvReader/Reader.php#L318-L364 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/PropertyList.php | HTMLPurifier_PropertyList.squash | public function squash($force = false) {
if ($this->cache !== null && !$force) return $this->cache;
if ($this->parent) {
return $this->cache = array_merge($this->parent->squash($force), $this->data);
} else {
return $this->cache = $this->data;
}
} | php | public function squash($force = false) {
if ($this->cache !== null && !$force) return $this->cache;
if ($this->parent) {
return $this->cache = array_merge($this->parent->squash($force), $this->data);
} else {
return $this->cache = $this->data;
}
} | [
"public",
"function",
"squash",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cache",
"!==",
"null",
"&&",
"!",
"$",
"force",
")",
"return",
"$",
"this",
"->",
"cache",
";",
"if",
"(",
"$",
"this",
"->",
"parent",
")",... | Squashes this property list and all of its property lists into a single
array, and returns the array. This value is cached by default.
@param $force If true, ignores the cache and regenerates the array. | [
"Squashes",
"this",
"property",
"list",
"and",
"all",
"of",
"its",
"property",
"lists",
"into",
"a",
"single",
"array",
"and",
"returns",
"the",
"array",
".",
"This",
"value",
"is",
"cached",
"by",
"default",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/PropertyList.php#L62-L69 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/TableInheritance.php | TableInheritance.storeValues | public function storeValues(&$models)
{
if (count($models) === 0) {
return true;
}
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait|\DevGroup\TagDependencyHelper\TagDependencyTrait $firstModel */
$firstModel = reset($models);
$db = $f... | php | public function storeValues(&$models)
{
if (count($models) === 0) {
return true;
}
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait|\DevGroup\TagDependencyHelper\TagDependencyTrait $firstModel */
$firstModel = reset($models);
$db = $f... | [
"public",
"function",
"storeValues",
"(",
"&",
"$",
"models",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"models",
")",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait|\\DevGroup\\TagD... | @param ActiveRecord[]|\DevGroup\DataStructure\traits\PropertiesTrait[]|\DevGroup\DataStructure\behaviors\HasProperties[] $models
@return boolean | [
"@param",
"ActiveRecord",
"[]",
"|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"[]",
"|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"behaviors",
"\\",
"HasProperties",
"[]",
"$models"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/TableInheritance.php#L103-L164 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/TableInheritance.php | TableInheritance.modelIdsQueryAtOnce | public static function modelIdsQueryAtOnce($modelClass, $values)
{
$q = (new Query())
->select('model_id')
->from($modelClass::tableInheritanceTable());
foreach ($values as $key => $vals) {
$q->andWhere(['or', $key, $vals]);
};
$q->groupBy('m... | php | public static function modelIdsQueryAtOnce($modelClass, $values)
{
$q = (new Query())
->select('model_id')
->from($modelClass::tableInheritanceTable());
foreach ($values as $key => $vals) {
$q->andWhere(['or', $key, $vals]);
};
$q->groupBy('m... | [
"public",
"static",
"function",
"modelIdsQueryAtOnce",
"(",
"$",
"modelClass",
",",
"$",
"values",
")",
"{",
"$",
"q",
"=",
"(",
"new",
"Query",
"(",
")",
")",
"->",
"select",
"(",
"'model_id'",
")",
"->",
"from",
"(",
"$",
"modelClass",
"::",
"tableIn... | @param PropertiesTrait|TagDependencyTrait $modelClass
@param array $values
@todo Add SMART cache here(hash values somehow)
@return Query | [
"@param",
"PropertiesTrait|TagDependencyTrait",
"$modelClass",
"@param",
"array",
"$values",
"@todo",
"Add",
"SMART",
"cache",
"here",
"(",
"hash",
"values",
"somehow",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/TableInheritance.php#L458-L470 |
activecollab/user | src/IdentifiedVisitor.php | IdentifiedVisitor.jsonSerialize | public function jsonSerialize()
{
return [
'id' => $this->getId(),
'class' => get_class($this),
'first_name' => $this->getFirstName(),
'last_name' => $this->getLastName(),
'full_name' => $this->getFullName(),
'email' => $this->getEmail(... | php | public function jsonSerialize()
{
return [
'id' => $this->getId(),
'class' => get_class($this),
'first_name' => $this->getFirstName(),
'last_name' => $this->getLastName(),
'full_name' => $this->getFullName(),
'email' => $this->getEmail(... | [
"public",
"function",
"jsonSerialize",
"(",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'class'",
"=>",
"get_class",
"(",
"$",
"this",
")",
",",
"'first_name'",
"=>",
"$",
"this",
"->",
"getFirstName",
"(",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/user/blob/f54b858eb9016fbca32090e624eccb0354e93d8f/src/IdentifiedVisitor.php#L53-L63 |
activecollab/user | src/IdentifiedVisitor.php | IdentifiedVisitor.is | public function is($object)
{
if ($object instanceof UserInterface) {
return empty($object->getId()) && $this->getEmail() === $object->getEmail();
}
return false;
} | php | public function is($object)
{
if ($object instanceof UserInterface) {
return empty($object->getId()) && $this->getEmail() === $object->getEmail();
}
return false;
} | [
"public",
"function",
"is",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"UserInterface",
")",
"{",
"return",
"empty",
"(",
"$",
"object",
"->",
"getId",
"(",
")",
")",
"&&",
"$",
"this",
"->",
"getEmail",
"(",
")",
"===",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/user/blob/f54b858eb9016fbca32090e624eccb0354e93d8f/src/IdentifiedVisitor.php#L92-L99 |
yosmanyga/validation | src/Yosmanyga/Validation/Validator/GroupObjectValidator.php | GroupObjectValidator.validate | public function validate($value, $groups = [])
{
$groups = $this->fixGroups($groups);
$errors = [];
foreach ($groups as $group) {
if (!isset($this->validators[$group])) {
throw new \InvalidArgumentException(sprintf('Group "%s" not found', $group));
}
... | php | public function validate($value, $groups = [])
{
$groups = $this->fixGroups($groups);
$errors = [];
foreach ($groups as $group) {
if (!isset($this->validators[$group])) {
throw new \InvalidArgumentException(sprintf('Group "%s" not found', $group));
}
... | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"$",
"groups",
"=",
"[",
"]",
")",
"{",
"$",
"groups",
"=",
"$",
"this",
"->",
"fixGroups",
"(",
"$",
"groups",
")",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"groups",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/GroupObjectValidator.php#L23-L41 |
ixocreate/type-package | src/Entity/SchemaType.php | SchemaType.getSchema | private function getSchema(): ?SchemaInterface
{
if ($this->schema !== null) {
return $this->schema;
}
if (!empty($this->options['schema']) && $this->options['schema'] instanceof SchemaInterface) {
$this->schema = $this->options['schema'];
return $this->s... | php | private function getSchema(): ?SchemaInterface
{
if ($this->schema !== null) {
return $this->schema;
}
if (!empty($this->options['schema']) && $this->options['schema'] instanceof SchemaInterface) {
$this->schema = $this->options['schema'];
return $this->s... | [
"private",
"function",
"getSchema",
"(",
")",
":",
"?",
"SchemaInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"schema",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"schema",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"opti... | Doesn't work when the object is unserialized!
@throws \Exception
@return SchemaInterface|null | [
"Doesn",
"t",
"work",
"when",
"the",
"object",
"is",
"unserialized!"
] | train | https://github.com/ixocreate/type-package/blob/20399dc055a2bea0da26311aef8c68bf2eaf5c1e/src/Entity/SchemaType.php#L178-L219 |
ignasbernotas/console | src/Process/Signals.php | Signals.handleExit | public function handleExit(\Closure $callback)
{
// You cannot assign a signal handler for SIGKILL
$this->append(SIGHUP, $callback);
$this->append(SIGINT, $callback);
$this->append(SIGQUIT, $callback);
$this->append(SIGTERM, $callback);
} | php | public function handleExit(\Closure $callback)
{
// You cannot assign a signal handler for SIGKILL
$this->append(SIGHUP, $callback);
$this->append(SIGINT, $callback);
$this->append(SIGQUIT, $callback);
$this->append(SIGTERM, $callback);
} | [
"public",
"function",
"handleExit",
"(",
"\\",
"Closure",
"$",
"callback",
")",
"{",
"// You cannot assign a signal handler for SIGKILL",
"$",
"this",
"->",
"append",
"(",
"SIGHUP",
",",
"$",
"callback",
")",
";",
"$",
"this",
"->",
"append",
"(",
"SIGINT",
",... | Handle application exit signals
@param \Closure $callback callback to run after the signal is received
@return void | [
"Handle",
"application",
"exit",
"signals"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/Process/Signals.php#L23-L31 |
ignasbernotas/console | src/Process/Signals.php | Signals.append | public function append($signal, Closure $callback)
{
if (empty($this->listeners)) {
declare(ticks = 1);
}
$this->listeners[$signal] = $callback;
pcntl_signal($signal, [$this, "executeListener"]);
return $this;
} | php | public function append($signal, Closure $callback)
{
if (empty($this->listeners)) {
declare(ticks = 1);
}
$this->listeners[$signal] = $callback;
pcntl_signal($signal, [$this, "executeListener"]);
return $this;
} | [
"public",
"function",
"append",
"(",
"$",
"signal",
",",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"listeners",
")",
")",
"{",
"declare",
"(",
"ticks",
"=",
"1",
")",
";",
"}",
"$",
"this",
"->",
"listeners",... | Add signal listener
@param int $signal signal id
@param \Closure $callback function to run when the signal is
received
@return $this | [
"Add",
"signal",
"listener"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/Process/Signals.php#L42-L53 |
ignasbernotas/console | src/Process/Signals.php | Signals.executeListener | public function executeListener($signal, $exit = true)
{
$return = null;
if (isset($this->listeners[$signal])) {
$return = call_user_func_array($this->listeners[$signal], [$signal]);
}
if (true === $exit) {
// exit the application
posix_kill(posi... | php | public function executeListener($signal, $exit = true)
{
$return = null;
if (isset($this->listeners[$signal])) {
$return = call_user_func_array($this->listeners[$signal], [$signal]);
}
if (true === $exit) {
// exit the application
posix_kill(posi... | [
"public",
"function",
"executeListener",
"(",
"$",
"signal",
",",
"$",
"exit",
"=",
"true",
")",
"{",
"$",
"return",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"signal",
"]",
")",
")",
"{",
"$",
"return",
... | Method which is executed when a signal is received
@param int $signal signal Id
@param bool $exit
@return mixed | [
"Method",
"which",
"is",
"executed",
"when",
"a",
"signal",
"is",
"received"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/Process/Signals.php#L63-L77 |
chippyash/Strong-Type | src/Chippyash/Type/TypeFactory.php | TypeFactory.create | public static function create($type, $value, $extra = null)
{
switch (strtolower($type)) {
case 'int':
case 'integer':
return self::createInt($value);
case 'float':
case 'double':
return self::createFloat($value);
ca... | php | public static function create($type, $value, $extra = null)
{
switch (strtolower($type)) {
case 'int':
case 'integer':
return self::createInt($value);
case 'float':
case 'double':
return self::createFloat($value);
ca... | [
"public",
"static",
"function",
"create",
"(",
"$",
"type",
",",
"$",
"value",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"type",
")",
")",
"{",
"case",
"'int'",
":",
"case",
"'integer'",
":",
"return",
"self",
... | Generic type factory
@param string $type
@param mixed $value
@param mixed $extra required for some types
@return \Chippyash\Type\AbstractType
@throws InvalidTypeException | [
"Generic",
"type",
"factory"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/TypeFactory.php#L39-L66 |
chippyash/Strong-Type | src/Chippyash/Type/TypeFactory.php | TypeFactory.createInt | public static function createInt($value)
{
if ($value instanceof NumericTypeInterface) {
return $value->asIntType();
}
if (!is_numeric($value)) {
throw new \InvalidArgumentException("'{$value}' is no valid numeric for IntType");
}
if (self::getRequired... | php | public static function createInt($value)
{
if ($value instanceof NumericTypeInterface) {
return $value->asIntType();
}
if (!is_numeric($value)) {
throw new \InvalidArgumentException("'{$value}' is no valid numeric for IntType");
}
if (self::getRequired... | [
"public",
"static",
"function",
"createInt",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"NumericTypeInterface",
")",
"{",
"return",
"$",
"value",
"->",
"asIntType",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"v... | Create an IntType
@param mixed $value
@return \Chippyash\Type\Number\IntType
@throws \InvalidArgumentException | [
"Create",
"an",
"IntType"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/TypeFactory.php#L76-L89 |
chippyash/Strong-Type | src/Chippyash/Type/TypeFactory.php | TypeFactory.createFloat | public static function createFloat($value)
{
if ($value instanceof NumericTypeInterface) {
return $value->asFloatType();
}
if (!is_numeric($value)) {
throw new \InvalidArgumentException("'{$value}' is no valid numeric for FloatType");
}
if (se... | php | public static function createFloat($value)
{
if ($value instanceof NumericTypeInterface) {
return $value->asFloatType();
}
if (!is_numeric($value)) {
throw new \InvalidArgumentException("'{$value}' is no valid numeric for FloatType");
}
if (se... | [
"public",
"static",
"function",
"createFloat",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"NumericTypeInterface",
")",
"{",
"return",
"$",
"value",
"->",
"asFloatType",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
... | Create a FloatType
@param mixed $value
@return \Chippyash\Type\Number\FloatType|\Chippyash\Type\Number\Rational\GMPRationalType
@throws \InvalidArgumentException | [
"Create",
"a",
"FloatType"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/TypeFactory.php#L99-L113 |
chippyash/Strong-Type | src/Chippyash/Type/TypeFactory.php | TypeFactory.createSuperIntType | protected static function createSuperIntType($value, $typeClassName)
{
if ($value instanceof NumericTypeInterface) {
$value = $value->asIntType()->get();
}
if (!is_numeric($value)) {
throw new \InvalidArgumentException("'{$value}' is no valid numeric for {$ty... | php | protected static function createSuperIntType($value, $typeClassName)
{
if ($value instanceof NumericTypeInterface) {
$value = $value->asIntType()->get();
}
if (!is_numeric($value)) {
throw new \InvalidArgumentException("'{$value}' is no valid numeric for {$ty... | [
"protected",
"static",
"function",
"createSuperIntType",
"(",
"$",
"value",
",",
"$",
"typeClassName",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"NumericTypeInterface",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"->",
"asIntType",
"(",
")",
"->",
"g... | Create a super int type (whole, natural)
@param mixed $value
@param string $typeClassName
@return GMPIntType | [
"Create",
"a",
"super",
"int",
"type",
"(",
"whole",
"natural",
")"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/TypeFactory.php#L216-L234 |
ionutmilica/laravel-settings | src/SettingsServiceProvider.php | SettingsServiceProvider.register | public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/config.php', 'settings'
);
$this->app->singleton('IonutMilica\LaravelSettings\DriverContract', function ($app) {
return (new DriversManager($app))->driver();
});
$this->app->sin... | php | public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/config.php', 'settings'
);
$this->app->singleton('IonutMilica\LaravelSettings\DriverContract', function ($app) {
return (new DriversManager($app))->driver();
});
$this->app->sin... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../config/config.php'",
",",
"'settings'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'IonutMilica\\LaravelSettings\\DriverContract'",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/SettingsServiceProvider.php#L15-L33 |
cpliakas/search-framework | src/Search/Framework/IndexFieldIterator.php | IndexFieldIterator.valid | function valid()
{
list($this->_fieldId, $this->_field) = each($this->_fields);
return $this->_fieldId !== null;
} | php | function valid()
{
list($this->_fieldId, $this->_field) = each($this->_fields);
return $this->_fieldId !== null;
} | [
"function",
"valid",
"(",
")",
"{",
"list",
"(",
"$",
"this",
"->",
"_fieldId",
",",
"$",
"this",
"->",
"_field",
")",
"=",
"each",
"(",
"$",
"this",
"->",
"_fields",
")",
";",
"return",
"$",
"this",
"->",
"_fieldId",
"!==",
"null",
";",
"}"
] | Implements \Iterator::valid(). | [
"Implements",
"\\",
"Iterator",
"::",
"valid",
"()",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/IndexFieldIterator.php#L97-L101 |
Sam-Burns/pimple3-containerinterop | src/SamBurns/Pimple3ContainerInterop/ServiceContainer.php | ServiceContainer.get | public function get($serviceId)
{
if (!$this->has($serviceId)) {
throw NotFoundException::constructWithServiceId($serviceId);
}
try {
return $this->pimpleContainer[$serviceId];
} catch (\Exception $exception) {
throw new ContainerException('Pimple ... | php | public function get($serviceId)
{
if (!$this->has($serviceId)) {
throw NotFoundException::constructWithServiceId($serviceId);
}
try {
return $this->pimpleContainer[$serviceId];
} catch (\Exception $exception) {
throw new ContainerException('Pimple ... | [
"public",
"function",
"get",
"(",
"$",
"serviceId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"serviceId",
")",
")",
"{",
"throw",
"NotFoundException",
"::",
"constructWithServiceId",
"(",
"$",
"serviceId",
")",
";",
"}",
"try",
"{"... | @throws NotFoundExceptionInterface
@throws ContainerExceptionInterface
@param string $serviceId
@return mixed | [
"@throws",
"NotFoundExceptionInterface",
"@throws",
"ContainerExceptionInterface"
] | train | https://github.com/Sam-Burns/pimple3-containerinterop/blob/8314e9452b68eede1b2c6f23c8b7e18336b0d46e/src/SamBurns/Pimple3ContainerInterop/ServiceContainer.php#L51-L61 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createContactFromStdClass | public static function createContactFromStdClass(\stdClass $stdContact): Contact
{
if (empty($stdContact->FirstName)) {
throw new \InvalidArgumentException("stdClass argument must contain FirstName attribute");
}
if (empty($stdContact->Phone)) {
throw new \InvalidArgu... | php | public static function createContactFromStdClass(\stdClass $stdContact): Contact
{
if (empty($stdContact->FirstName)) {
throw new \InvalidArgumentException("stdClass argument must contain FirstName attribute");
}
if (empty($stdContact->Phone)) {
throw new \InvalidArgu... | [
"public",
"static",
"function",
"createContactFromStdClass",
"(",
"\\",
"stdClass",
"$",
"stdContact",
")",
":",
"Contact",
"{",
"if",
"(",
"empty",
"(",
"$",
"stdContact",
"->",
"FirstName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"("... | Creates a Contact using the stdClass given.
@param \stdClass $stdContact An stdClass object matching the format of the IP1 SMS API.
@return Contact
@throws \InvalidArgumentException Thrown when required parameters in the argument is missing. | [
"Creates",
"a",
"Contact",
"using",
"the",
"stdClass",
"given",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L37-L56 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createContactFromAttributes | public static function createContactFromAttributes(
string $firstName,
string $phoneNumber,
?string $lastName = null,
?string $title = null,
?string $organization = null,
?string $email = null,
?string $notes = null
) : Contact {
return new Contact(
... | php | public static function createContactFromAttributes(
string $firstName,
string $phoneNumber,
?string $lastName = null,
?string $title = null,
?string $organization = null,
?string $email = null,
?string $notes = null
) : Contact {
return new Contact(
... | [
"public",
"static",
"function",
"createContactFromAttributes",
"(",
"string",
"$",
"firstName",
",",
"string",
"$",
"phoneNumber",
",",
"?",
"string",
"$",
"lastName",
"=",
"null",
",",
"?",
"string",
"$",
"title",
"=",
"null",
",",
"?",
"string",
"$",
"or... | Creates a Contact using the parameters given.
@param string $firstName The first name of the contact in question.
@param string $phoneNumber Contact phone number: with country code and without spaces and dashes.
@param string|null $lastName Contact last name.
@param string|null $title Contact t... | [
"Creates",
"a",
"Contact",
"using",
"the",
"parameters",
"given",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L68-L86 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createProcessedContactFromStdClassArray | public static function createProcessedContactFromStdClassArray(array $contactArray): ClassValidationArray
{
$contacts = new ClassValidationArray();
foreach ($contactArray as $c) {
$contacts[] = self::createProcessedContactFromStdClass($c);
}
return $contacts;
} | php | public static function createProcessedContactFromStdClassArray(array $contactArray): ClassValidationArray
{
$contacts = new ClassValidationArray();
foreach ($contactArray as $c) {
$contacts[] = self::createProcessedContactFromStdClass($c);
}
return $contacts;
} | [
"public",
"static",
"function",
"createProcessedContactFromStdClassArray",
"(",
"array",
"$",
"contactArray",
")",
":",
"ClassValidationArray",
"{",
"$",
"contacts",
"=",
"new",
"ClassValidationArray",
"(",
")",
";",
"foreach",
"(",
"$",
"contactArray",
"as",
"$",
... | Take an array filled with contact stdClasses and returns a ClassValidationArray filled with ProcessedContact.
@param array $contactArray An array filled with stdClass contacts.
@return ClassValidationArray Filled with ProcessedContact. | [
"Take",
"an",
"array",
"filled",
"with",
"contact",
"stdClasses",
"and",
"returns",
"a",
"ClassValidationArray",
"filled",
"with",
"ProcessedContact",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L102-L109 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createProcessedContactFromStdClass | public static function createProcessedContactFromStdClass(\stdClass $stdContact): ProcessedContact
{
if (empty($stdContact->FirstName)) {
throw new \InvalidArgumentException("stdClass argument must contain FirstName attribute");
}
if (empty($stdContact->Phone)) {
thro... | php | public static function createProcessedContactFromStdClass(\stdClass $stdContact): ProcessedContact
{
if (empty($stdContact->FirstName)) {
throw new \InvalidArgumentException("stdClass argument must contain FirstName attribute");
}
if (empty($stdContact->Phone)) {
thro... | [
"public",
"static",
"function",
"createProcessedContactFromStdClass",
"(",
"\\",
"stdClass",
"$",
"stdContact",
")",
":",
"ProcessedContact",
"{",
"if",
"(",
"empty",
"(",
"$",
"stdContact",
"->",
"FirstName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumen... | Creates a ProcessedContact using the stdClass given.
@param \stdClass $stdContact An stdClass object matching the format of the IP1 SMS API.
@return ProcessedContact
@throws \InvalidArgumentException Thrown when required parameters in the argument is missing. | [
"Creates",
"a",
"ProcessedContact",
"using",
"the",
"stdClass",
"given",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L116-L138 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createProcessedGroupFromStdClass | public static function createProcessedGroupFromStdClass(\stdClass $stdGroup): ProcessedGroup
{
return new ProcessedGroup(
$stdGroup->Name,
$stdGroup->Color,
$stdGroup->ID,
$stdGroup->OwnerID,
new \DateTime($stdGroup->Created),
new \Date... | php | public static function createProcessedGroupFromStdClass(\stdClass $stdGroup): ProcessedGroup
{
return new ProcessedGroup(
$stdGroup->Name,
$stdGroup->Color,
$stdGroup->ID,
$stdGroup->OwnerID,
new \DateTime($stdGroup->Created),
new \Date... | [
"public",
"static",
"function",
"createProcessedGroupFromStdClass",
"(",
"\\",
"stdClass",
"$",
"stdGroup",
")",
":",
"ProcessedGroup",
"{",
"return",
"new",
"ProcessedGroup",
"(",
"$",
"stdGroup",
"->",
"Name",
",",
"$",
"stdGroup",
"->",
"Color",
",",
"$",
"... | Takes a stdClass group and returns a ProcessedGroup.
@param \stdClass $stdGroup A single stdClass group.
@return ProcessedGroup | [
"Takes",
"a",
"stdClass",
"group",
"and",
"returns",
"a",
"ProcessedGroup",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L153-L163 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createProcessedOutGoingSMSFromStdClass | public static function createProcessedOutGoingSMSFromStdClass(\stdClass $stdClassSMS): ProcessedOutGoingSMS
{
return new ProcessedOutGoingSMS(
$stdClassSMS->From,
$stdClassSMS->Message,
$stdClassSMS->To,
$stdClassSMS->ID,
new \DateTime($stdClassSM... | php | public static function createProcessedOutGoingSMSFromStdClass(\stdClass $stdClassSMS): ProcessedOutGoingSMS
{
return new ProcessedOutGoingSMS(
$stdClassSMS->From,
$stdClassSMS->Message,
$stdClassSMS->To,
$stdClassSMS->ID,
new \DateTime($stdClassSM... | [
"public",
"static",
"function",
"createProcessedOutGoingSMSFromStdClass",
"(",
"\\",
"stdClass",
"$",
"stdClassSMS",
")",
":",
"ProcessedOutGoingSMS",
"{",
"return",
"new",
"ProcessedOutGoingSMS",
"(",
"$",
"stdClassSMS",
"->",
"From",
",",
"$",
"stdClassSMS",
"->",
... | Creates a ProcessedOutGoingSMS from an stdClass object.
@param \stdClass $stdClassSMS An stdClass.
@return ProcessedOutGoingSMS | [
"Creates",
"a",
"ProcessedOutGoingSMS",
"from",
"an",
"stdClass",
"object",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L223-L236 |
iP1SMS/ip1-php-sdk | src/Recipient/RecipientFactory.php | RecipientFactory.createProcessedOutGoingSMSFromStdClassArray | public static function createProcessedOutGoingSMSFromStdClassArray(array $stdClassArray): ClassValidationArray
{
$array = new ClassValidationArray(ProcessedOutGoingSMS::class);
foreach ($stdClassArray as $stdClass) {
$array[]= self::createProcessedOutGoingSMSFromStdClass($stdClass);
... | php | public static function createProcessedOutGoingSMSFromStdClassArray(array $stdClassArray): ClassValidationArray
{
$array = new ClassValidationArray(ProcessedOutGoingSMS::class);
foreach ($stdClassArray as $stdClass) {
$array[]= self::createProcessedOutGoingSMSFromStdClass($stdClass);
... | [
"public",
"static",
"function",
"createProcessedOutGoingSMSFromStdClassArray",
"(",
"array",
"$",
"stdClassArray",
")",
":",
"ClassValidationArray",
"{",
"$",
"array",
"=",
"new",
"ClassValidationArray",
"(",
"ProcessedOutGoingSMS",
"::",
"class",
")",
";",
"foreach",
... | Creates a ClassValidationArray filled with ProcessedOutGoingSMS given an array of stdClass.
@param array $stdClassArray An array of stdClass OutGoingSMS.
@return ClassValidationArray Filled with ProcessedOutGoingSMS. | [
"Creates",
"a",
"ClassValidationArray",
"filled",
"with",
"ProcessedOutGoingSMS",
"given",
"an",
"array",
"of",
"stdClass",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/RecipientFactory.php#L242-L249 |
delatbabel/site-config | src/Repository/ConfigLoaderRepository.php | ConfigLoaderRepository.fetchConfig | public function fetchConfig()
{
if (Cache::has($this->getCacheKey())) {
return Cache::get($this->getCacheKey());
}
return null;
} | php | public function fetchConfig()
{
if (Cache::has($this->getCacheKey())) {
return Cache::get($this->getCacheKey());
}
return null;
} | [
"public",
"function",
"fetchConfig",
"(",
")",
"{",
"if",
"(",
"Cache",
"::",
"has",
"(",
"$",
"this",
"->",
"getCacheKey",
"(",
")",
")",
")",
"{",
"return",
"Cache",
"::",
"get",
"(",
"$",
"this",
"->",
"getCacheKey",
"(",
")",
")",
";",
"}",
"... | Fetch the stored config from the cache.
@return mixed | [
"Fetch",
"the",
"stored",
"config",
"from",
"the",
"cache",
"."
] | train | https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Repository/ConfigLoaderRepository.php#L78-L85 |
delatbabel/site-config | src/Repository/ConfigLoaderRepository.php | ConfigLoaderRepository.loadEnvironment | public function loadEnvironment()
{
// Fetch the current application environment.
$this->environment = app()->environment();
$this->website_id = null;
// Fetch the current web site data and check to see if it has an
// alternative environment.
$website_data = Websit... | php | public function loadEnvironment()
{
// Fetch the current application environment.
$this->environment = app()->environment();
$this->website_id = null;
// Fetch the current web site data and check to see if it has an
// alternative environment.
$website_data = Websit... | [
"public",
"function",
"loadEnvironment",
"(",
")",
"{",
"// Fetch the current application environment.",
"$",
"this",
"->",
"environment",
"=",
"app",
"(",
")",
"->",
"environment",
"(",
")",
";",
"$",
"this",
"->",
"website_id",
"=",
"null",
";",
"// Fetch the ... | Loads the internal website_id and environment
@return ConfigLoaderRepository | [
"Loads",
"the",
"internal",
"website_id",
"and",
"environment"
] | train | https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Repository/ConfigLoaderRepository.php#L115-L135 |
delatbabel/site-config | src/Repository/ConfigLoaderRepository.php | ConfigLoaderRepository.loadConfiguration | public function loadConfiguration()
{
/** @var ConfigLoaderRepository $repository */
$repository = $this->loadEnvironment();
$cache = $repository->fetchConfig();
if (! empty($cache)) {
return $cache;
}
$config = [];
// Fetch all groups, and fetc... | php | public function loadConfiguration()
{
/** @var ConfigLoaderRepository $repository */
$repository = $this->loadEnvironment();
$cache = $repository->fetchConfig();
if (! empty($cache)) {
return $cache;
}
$config = [];
// Fetch all groups, and fetc... | [
"public",
"function",
"loadConfiguration",
"(",
")",
"{",
"/** @var ConfigLoaderRepository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"loadEnvironment",
"(",
")",
";",
"$",
"cache",
"=",
"$",
"repository",
"->",
"fetchConfig",
"(",
")",
";",
"if... | Load the database backed configuration.
This function does the work of loading the entire site configuration
from the database and returns it as a group => [key=>value] set. The
configuration is retrieved from cache if it already exists there, and
stored into the cache after it is loaded.
@return array | [
"Load",
"the",
"database",
"backed",
"configuration",
"."
] | train | https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Repository/ConfigLoaderRepository.php#L147-L172 |
delatbabel/site-config | src/Repository/ConfigLoaderRepository.php | ConfigLoaderRepository.setRunningConfiguration | public function setRunningConfiguration(RepositoryContract $config)
{
// Load the configuration into the current running config.
foreach ($this->loadConfiguration() as $group => $groupConfig) {
$config->set($group, $groupConfig);
}
} | php | public function setRunningConfiguration(RepositoryContract $config)
{
// Load the configuration into the current running config.
foreach ($this->loadConfiguration() as $group => $groupConfig) {
$config->set($group, $groupConfig);
}
} | [
"public",
"function",
"setRunningConfiguration",
"(",
"RepositoryContract",
"$",
"config",
")",
"{",
"// Load the configuration into the current running config.",
"foreach",
"(",
"$",
"this",
"->",
"loadConfiguration",
"(",
")",
"as",
"$",
"group",
"=>",
"$",
"groupConf... | Load the database backed configuration and save it
Load the database backed configuration and save it
into the current running config
@param RepositoryContract $config
@return void | [
"Load",
"the",
"database",
"backed",
"configuration",
"and",
"save",
"it"
] | train | https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Repository/ConfigLoaderRepository.php#L183-L189 |
guillaumemonet/Rad | src/Rad/Utils/Filter.php | Filter.matchFilter | public static function matchFilter(array &$datas, array $get) {
if (sizeof($get) > 0) {
$datas = array_filter($datas, function($obj) use($get) {
return array_intersect_assoc((array) $obj, $get) == $get;
});
}
} | php | public static function matchFilter(array &$datas, array $get) {
if (sizeof($get) > 0) {
$datas = array_filter($datas, function($obj) use($get) {
return array_intersect_assoc((array) $obj, $get) == $get;
});
}
} | [
"public",
"static",
"function",
"matchFilter",
"(",
"array",
"&",
"$",
"datas",
",",
"array",
"$",
"get",
")",
"{",
"if",
"(",
"sizeof",
"(",
"$",
"get",
")",
">",
"0",
")",
"{",
"$",
"datas",
"=",
"array_filter",
"(",
"$",
"datas",
",",
"function"... | Return mathing objects with get filter
@param array $datas
@param array $get | [
"Return",
"mathing",
"objects",
"with",
"get",
"filter"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Utils/Filter.php#L45-L51 |
o2system/parser | src/Template/Adapters/Blade.php | Blade.initialize | public function initialize(array $config = [])
{
$config = array_merge($this->config, $config);
if (empty($this->engine)) {
if ($this->isSupported()) {
$this->engine = new \O2System\Parser\Template\Engines\Blade($config);
} else {
thro... | php | public function initialize(array $config = [])
{
$config = array_merge($this->config, $config);
if (empty($this->engine)) {
if ($this->isSupported()) {
$this->engine = new \O2System\Parser\Template\Engines\Blade($config);
} else {
thro... | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"config",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"engine",
")",
... | Blade::initialize
@param array $config
@return static
@throws \O2System\Spl\Exceptions\RuntimeException | [
"Blade",
"::",
"initialize"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Adapters/Blade.php#L38-L51 |
o2system/parser | src/Template/Adapters/Blade.php | Blade.isValidEngine | protected function isValidEngine($engine)
{
if ($engine instanceof \O2System\Parser\Template\Engines\Blade) {
return true;
}
return false;
} | php | protected function isValidEngine($engine)
{
if ($engine instanceof \O2System\Parser\Template\Engines\Blade) {
return true;
}
return false;
} | [
"protected",
"function",
"isValidEngine",
"(",
"$",
"engine",
")",
"{",
"if",
"(",
"$",
"engine",
"instanceof",
"\\",
"O2System",
"\\",
"Parser",
"\\",
"Template",
"\\",
"Engines",
"\\",
"Blade",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
"... | Blade::isValidEngine
Checks if is a valid Object Engine.
@param object $engine Engine Object Resource.
@return bool | [
"Blade",
"::",
"isValidEngine"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Adapters/Blade.php#L96-L103 |
venta/framework | src/Framework/Kernel/Bootstrap/ErrorHandling.php | ErrorHandling.registerErrorRenderer | private function registerErrorRenderer()
{
if ($this->kernel()->isCli()) {
$this->container()->bind(ErrorRendererContract::class, ConsoleErrorRenderer::class);
} else {
$this->container()->bind(ErrorRendererContract::class, HttpErrorRenderer::class);
}
} | php | private function registerErrorRenderer()
{
if ($this->kernel()->isCli()) {
$this->container()->bind(ErrorRendererContract::class, ConsoleErrorRenderer::class);
} else {
$this->container()->bind(ErrorRendererContract::class, HttpErrorRenderer::class);
}
} | [
"private",
"function",
"registerErrorRenderer",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"kernel",
"(",
")",
"->",
"isCli",
"(",
")",
")",
"{",
"$",
"this",
"->",
"container",
"(",
")",
"->",
"bind",
"(",
"ErrorRendererContract",
"::",
"class",
","... | Registers the default error renderer. | [
"Registers",
"the",
"default",
"error",
"renderer",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Framework/Kernel/Bootstrap/ErrorHandling.php#L42-L49 |
venta/framework | src/Framework/Kernel/Bootstrap/ErrorHandling.php | ErrorHandling.registerErrorReporters | private function registerErrorReporters()
{
$this->container()->factory(
ErrorReporterAggregateContract::class,
function () {
$reporters = new ErrorReporterAggregate($this->container());
$reporters->push(LogErrorReporter::class);
retur... | php | private function registerErrorReporters()
{
$this->container()->factory(
ErrorReporterAggregateContract::class,
function () {
$reporters = new ErrorReporterAggregate($this->container());
$reporters->push(LogErrorReporter::class);
retur... | [
"private",
"function",
"registerErrorReporters",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"(",
")",
"->",
"factory",
"(",
"ErrorReporterAggregateContract",
"::",
"class",
",",
"function",
"(",
")",
"{",
"$",
"reporters",
"=",
"new",
"ErrorReporterAggregate... | Registers default error reporters. | [
"Registers",
"default",
"error",
"reporters",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Framework/Kernel/Bootstrap/ErrorHandling.php#L54-L66 |
transfer-framework/transfer | src/Transfer/Processor/NonSequentialProcessor.php | NonSequentialProcessor.handleProcedure | protected function handleProcedure(Procedure $procedure)
{
$response = $this->handleSources($procedure->getSources());
while ($object = $this->nextObject($response)) {
$storage = $this->prepareLocalStorage($object);
$this->handleWorkers($procedure->getWorkers(), $storage);
... | php | protected function handleProcedure(Procedure $procedure)
{
$response = $this->handleSources($procedure->getSources());
while ($object = $this->nextObject($response)) {
$storage = $this->prepareLocalStorage($object);
$this->handleWorkers($procedure->getWorkers(), $storage);
... | [
"protected",
"function",
"handleProcedure",
"(",
"Procedure",
"$",
"procedure",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"handleSources",
"(",
"$",
"procedure",
"->",
"getSources",
"(",
")",
")",
";",
"while",
"(",
"$",
"object",
"=",
"$",
"thi... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/NonSequentialProcessor.php#L31-L44 |
bariew/yii2-rbac-cms-module | controllers/AuthAssignmentController.php | AuthAssignmentController.actionChange | public function actionChange($id, $user_id, $add)
{
$authItem = AuthItem::findOne($id);
if ($add) {
Yii::$app->authManager->assign($authItem, $user_id);
} else {
$rootCount = AuthAssignment::find()->where(['item_name' => $id])->count();
if ($id == 'root' &... | php | public function actionChange($id, $user_id, $add)
{
$authItem = AuthItem::findOne($id);
if ($add) {
Yii::$app->authManager->assign($authItem, $user_id);
} else {
$rootCount = AuthAssignment::find()->where(['item_name' => $id])->count();
if ($id == 'root' &... | [
"public",
"function",
"actionChange",
"(",
"$",
"id",
",",
"$",
"user_id",
",",
"$",
"add",
")",
"{",
"$",
"authItem",
"=",
"AuthItem",
"::",
"findOne",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"add",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"... | Attaches or detaches user role/permission.
@param string $id permission/role name.
@param integer $user_id user id.
@param integer $add 1/0 whether to add or to remove user permission.
@throws \yii\web\HttpException only_root_remove_denied | [
"Attaches",
"or",
"detaches",
"user",
"role",
"/",
"permission",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/controllers/AuthAssignmentController.php#L49-L61 |
venta/framework | src/Http/src/Cookie.php | Cookie.freezeExpiration | private function freezeExpiration(DateTimeInterface $expires): DateTimeImmutable
{
if (!$expires instanceof DateTimeImmutable) {
$expires = new DateTimeImmutable($expires->format(DateTime::ISO8601), $expires->getTimezone());
}
return $expires;
} | php | private function freezeExpiration(DateTimeInterface $expires): DateTimeImmutable
{
if (!$expires instanceof DateTimeImmutable) {
$expires = new DateTimeImmutable($expires->format(DateTime::ISO8601), $expires->getTimezone());
}
return $expires;
} | [
"private",
"function",
"freezeExpiration",
"(",
"DateTimeInterface",
"$",
"expires",
")",
":",
"DateTimeImmutable",
"{",
"if",
"(",
"!",
"$",
"expires",
"instanceof",
"DateTimeImmutable",
")",
"{",
"$",
"expires",
"=",
"new",
"DateTimeImmutable",
"(",
"$",
"expi... | Creates immutable date time instance from the provided one.
@param DateTimeInterface $expires
@return DateTimeImmutable | [
"Creates",
"immutable",
"date",
"time",
"instance",
"from",
"the",
"provided",
"one",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Http/src/Cookie.php#L263-L270 |
terdia/legato-framework | src/Validation/Rule.php | Rule.unique | public function unique($column, $value, $policy)
{
if ($this->shouldNotBeEmpty($value)) {
return !DB::table($policy)->where($column, '=', $value)->exists();
}
return true;
} | php | public function unique($column, $value, $policy)
{
if ($this->shouldNotBeEmpty($value)) {
return !DB::table($policy)->where($column, '=', $value)->exists();
}
return true;
} | [
"public",
"function",
"unique",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"policy",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldNotBeEmpty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"!",
"DB",
"::",
"table",
"(",
"$",
"policy",
")",
... | @param $column, field name
@param $value, value passed into the form
@param $policy, the rule that e set e.g min = 5
@return bool, true | false | [
"@param",
"$column",
"field",
"name",
"@param",
"$value",
"value",
"passed",
"into",
"the",
"form",
"@param",
"$policy",
"the",
"rule",
"that",
"e",
"set",
"e",
".",
"g",
"min",
"=",
"5"
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Validation/Rule.php#L26-L33 |
Im0rtality/Underscore | src/Mutator/ShuffleMutator.php | ShuffleMutator.shuffleAssoc | private function shuffleAssoc(array $values)
{
$keys = array_keys($values);
shuffle($keys);
$output = [];
foreach ($keys as $key) {
$output[$key] = $values[$key];
}
return $output;
} | php | private function shuffleAssoc(array $values)
{
$keys = array_keys($values);
shuffle($keys);
$output = [];
foreach ($keys as $key) {
$output[$key] = $values[$key];
}
return $output;
} | [
"private",
"function",
"shuffleAssoc",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"values",
")",
";",
"shuffle",
"(",
"$",
"keys",
")",
";",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",... | Shuffle an array while preserving keys.
@param array $values
@return array | [
"Shuffle",
"an",
"array",
"while",
"preserving",
"keys",
"."
] | train | https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Mutator/ShuffleMutator.php#L30-L41 |
dekalee/cdn77 | src/Cdn77/Query/PurgeFileQuery.php | PurgeFileQuery.execute | public function execute($resource = null, array $files = array())
{
$this->populateCDNResources();
$urls = [];
foreach ($files as $file) {
$urls[] = '/' . urlencode($file);
}
$cdnResources = array_filter($this->cdnResources, function($value, $key) use ($resource... | php | public function execute($resource = null, array $files = array())
{
$this->populateCDNResources();
$urls = [];
foreach ($files as $file) {
$urls[] = '/' . urlencode($file);
}
$cdnResources = array_filter($this->cdnResources, function($value, $key) use ($resource... | [
"public",
"function",
"execute",
"(",
"$",
"resource",
"=",
"null",
",",
"array",
"$",
"files",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"populateCDNResources",
"(",
")",
";",
"$",
"urls",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"files... | @param null $resource
@param array $files
@return mixed|null | [
"@param",
"null",
"$resource",
"@param",
"array",
"$files"
] | train | https://github.com/dekalee/cdn77/blob/71d1771e047cf2fbd273018f6f35d44b87c53b24/src/Cdn77/Query/PurgeFileQuery.php#L21-L46 |
joomla-projects/jorobo | src/Tasks/Deploy/Zip.php | Zip.run | public function run()
{
$this->say('Zipping ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);
// Instantiate the zip archive
$this->zip->open($this->target, \ZipArchive::CREATE);
// Process the files to zip
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($thi... | php | public function run()
{
$this->say('Zipping ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);
// Instantiate the zip archive
$this->zip->open($this->target, \ZipArchive::CREATE);
// Process the files to zip
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($thi... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"'Zipping '",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"extension",
".",
"\" \"",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"version",
")",
";",
"//... | Build the package
@return bool
@since 1.0 | [
"Build",
"the",
"package"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Zip.php#L47-L87 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.filter | public function filter($userAgent, $deviceID)
{
if ($this->canHandle($userAgent)) {
$this->updateUserAgentsWithDeviceIDMap($userAgent, $deviceID);
return true;
}
return false;
} | php | public function filter($userAgent, $deviceID)
{
if ($this->canHandle($userAgent)) {
$this->updateUserAgentsWithDeviceIDMap($userAgent, $deviceID);
return true;
}
return false;
} | [
"public",
"function",
"filter",
"(",
"$",
"userAgent",
",",
"$",
"deviceID",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canHandle",
"(",
"$",
"userAgent",
")",
")",
"{",
"$",
"this",
"->",
"updateUserAgentsWithDeviceIDMap",
"(",
"$",
"userAgent",
",",
"$",... | Classifies the given $userAgent and specified $deviceID
@param string $userAgent
@param string $deviceID
@return bool | [
"Classifies",
"the",
"given",
"$userAgent",
"and",
"specified",
"$deviceID"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L146-L155 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.updateUserAgentsWithDeviceIDMap | final public function updateUserAgentsWithDeviceIDMap($userAgent, $deviceID)
{
if (isset($this->userAgentsWithDeviceID[$this->normalizeUserAgent($userAgent)])) {
$this->logger->debug($this->userAgentsWithDeviceID[$this->normalizeUserAgent($userAgent)] . "\t"); //old_id
$this->logger-... | php | final public function updateUserAgentsWithDeviceIDMap($userAgent, $deviceID)
{
if (isset($this->userAgentsWithDeviceID[$this->normalizeUserAgent($userAgent)])) {
$this->logger->debug($this->userAgentsWithDeviceID[$this->normalizeUserAgent($userAgent)] . "\t"); //old_id
$this->logger-... | [
"final",
"public",
"function",
"updateUserAgentsWithDeviceIDMap",
"(",
"$",
"userAgent",
",",
"$",
"deviceID",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
"[",
"$",
"this",
"->",
"normalizeUserAgent",
"(",
"$",
"userAgent",
... | Updates the map containing the classified user agents. These are stored in the associative
array userAgentsWithDeviceID like user_agent => deviceID.
Before adding the user agent to the map it normalizes by using the normalizeUserAgent
function.
@see normalizeUserAgent()
@see userAgentsWithDeviceID
@param string $use... | [
"Updates",
"the",
"map",
"containing",
"the",
"classified",
"user",
"agents",
".",
"These",
"are",
"stored",
"in",
"the",
"associative",
"array",
"userAgentsWithDeviceID",
"like",
"user_agent",
"=",
">",
"deviceID",
".",
"Before",
"adding",
"the",
"user",
"agent... | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L169-L179 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.persistData | public function persistData()
{
// we sort the array first, useful for doing ris match
if (!empty($this->userAgentsWithDeviceID)) {
ksort($this->userAgentsWithDeviceID);
$this->persistenceProvider->save($this->getPrefix(), $this->userAgentsWithDeviceID);
$this->p... | php | public function persistData()
{
// we sort the array first, useful for doing ris match
if (!empty($this->userAgentsWithDeviceID)) {
ksort($this->userAgentsWithDeviceID);
$this->persistenceProvider->save($this->getPrefix(), $this->userAgentsWithDeviceID);
$this->p... | [
"public",
"function",
"persistData",
"(",
")",
"{",
"// we sort the array first, useful for doing ris match",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
")",
"{",
"ksort",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
... | Saves the classified user agents in the persistence provider | [
"Saves",
"the",
"classified",
"user",
"agents",
"in",
"the",
"persistence",
"provider"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L204-L214 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.getUserAgentsWithDeviceId | public function getUserAgentsWithDeviceId()
{
if (empty($this->userAgentsWithDeviceID)) {
$this->userAgentsWithDeviceID = $this->persistenceProvider->load($this->getPrefix());
}
if (!is_array($this->userAgentsWithDeviceID)) {
$this->userAgentsWithDeviceID = array();
... | php | public function getUserAgentsWithDeviceId()
{
if (empty($this->userAgentsWithDeviceID)) {
$this->userAgentsWithDeviceID = $this->persistenceProvider->load($this->getPrefix());
}
if (!is_array($this->userAgentsWithDeviceID)) {
$this->userAgentsWithDeviceID = array();
... | [
"public",
"function",
"getUserAgentsWithDeviceId",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
")",
"{",
"$",
"this",
"->",
"userAgentsWithDeviceID",
"=",
"$",
"this",
"->",
"persistenceProvider",
"->",
"load",
"("... | Returns a list of User Agents with their Device IDs
@return array User agents and device IDs | [
"Returns",
"a",
"list",
"of",
"User",
"Agents",
"with",
"their",
"Device",
"IDs"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L221-L232 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.getUserAgentsForBucket | public function getUserAgentsForBucket()
{
if (empty($this->userAgents)) {
$this->userAgents = $this->persistenceProvider->load($this->getPrefix(self::PREFIX_UA_BUCKET));
}
return $this->userAgents;
} | php | public function getUserAgentsForBucket()
{
if (empty($this->userAgents)) {
$this->userAgents = $this->persistenceProvider->load($this->getPrefix(self::PREFIX_UA_BUCKET));
}
return $this->userAgents;
} | [
"public",
"function",
"getUserAgentsForBucket",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"userAgents",
")",
")",
"{",
"$",
"this",
"->",
"userAgents",
"=",
"$",
"this",
"->",
"persistenceProvider",
"->",
"load",
"(",
"$",
"this",
"->",
... | Returns a list of User Agents associated with the bucket
@return array User agents | [
"Returns",
"a",
"list",
"of",
"User",
"Agents",
"associated",
"with",
"the",
"bucket"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L238-L245 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.applyMatch | final public function applyMatch(GenericRequest $request)
{
$className = get_class($this);
$request->getMatchInfo()->matcher = $className;
$startTime = microtime(true);
$request->getMatchInfo()->cleanedUserAgent... | php | final public function applyMatch(GenericRequest $request)
{
$className = get_class($this);
$request->getMatchInfo()->matcher = $className;
$startTime = microtime(true);
$request->getMatchInfo()->cleanedUserAgent... | [
"final",
"public",
"function",
"applyMatch",
"(",
"GenericRequest",
"$",
"request",
")",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"request",
"->",
"getMatchInfo",
"(",
")",
"->",
"matcher",
"=",
"$",
"className",
";",
"$"... | Template method to apply matching system to user agent
@param \Wurfl\Request\GenericRequest $request
@return string Device ID | [
"Template",
"method",
"to",
"apply",
"matching",
"system",
"to",
"user",
"agent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L257-L329 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.isBlankOrGeneric | private function isBlankOrGeneric($deviceID)
{
return ($deviceID === WurflConstants::NO_MATCH || strcmp($deviceID, 'generic') === 0 || strlen(
trim($deviceID)
) === 0);
} | php | private function isBlankOrGeneric($deviceID)
{
return ($deviceID === WurflConstants::NO_MATCH || strcmp($deviceID, 'generic') === 0 || strlen(
trim($deviceID)
) === 0);
} | [
"private",
"function",
"isBlankOrGeneric",
"(",
"$",
"deviceID",
")",
"{",
"return",
"(",
"$",
"deviceID",
"===",
"WurflConstants",
"::",
"NO_MATCH",
"||",
"strcmp",
"(",
"$",
"deviceID",
",",
"'generic'",
")",
"===",
"0",
"||",
"strlen",
"(",
"trim",
"(",... | Given $deviceID is blank or generic, indicating no match
@param string $deviceID
@return bool | [
"Given",
"$deviceID",
"is",
"blank",
"or",
"generic",
"indicating",
"no",
"match"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L338-L343 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.applyExactMatch | public function applyExactMatch($userAgent)
{
if (array_key_exists($userAgent, $this->userAgentsWithDeviceID)) {
return $this->userAgentsWithDeviceID[$userAgent];
}
return WurflConstants::NO_MATCH;
} | php | public function applyExactMatch($userAgent)
{
if (array_key_exists($userAgent, $this->userAgentsWithDeviceID)) {
return $this->userAgentsWithDeviceID[$userAgent];
}
return WurflConstants::NO_MATCH;
} | [
"public",
"function",
"applyExactMatch",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"userAgent",
",",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
")",
"{",
"return",
"$",
"this",
"->",
"userAgentsWithDeviceID",
"[",
"$",
... | Attempt to find a exact match for the given $userAgent
@param string $userAgent
@return string Matching WURFL deviceID | [
"Attempt",
"to",
"find",
"a",
"exact",
"match",
"for",
"the",
"given",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L352-L359 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
$match = $this->lookForMatchingUserAgent($userAgent);
if (!empty($match)) {
return $this->userAgentsWithDeviceID[$match];
}
return WurflConstants::NO_MATCH;
} | php | public function applyConclusiveMatch($userAgent)
{
$match = $this->lookForMatchingUserAgent($userAgent);
if (!empty($match)) {
return $this->userAgentsWithDeviceID[$match];
}
return WurflConstants::NO_MATCH;
} | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"match",
"=",
"$",
"this",
"->",
"lookForMatchingUserAgent",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"match",
")",
")",
"{",
"return",
"$",
... | Attempt to find a conclusive match for the given $userAgent
@param string $userAgent
@return string Matching WURFL deviceID | [
"Attempt",
"to",
"find",
"a",
"conclusive",
"match",
"for",
"the",
"given",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L368-L377 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.lookForMatchingUserAgent | public function lookForMatchingUserAgent($userAgent)
{
$tolerance = Utils::firstSlash($userAgent);
return Utils::risMatch($this->userAgents, $userAgent, $tolerance);
} | php | public function lookForMatchingUserAgent($userAgent)
{
$tolerance = Utils::firstSlash($userAgent);
return Utils::risMatch($this->userAgents, $userAgent, $tolerance);
} | [
"public",
"function",
"lookForMatchingUserAgent",
"(",
"$",
"userAgent",
")",
"{",
"$",
"tolerance",
"=",
"Utils",
"::",
"firstSlash",
"(",
"$",
"userAgent",
")",
";",
"return",
"Utils",
"::",
"risMatch",
"(",
"$",
"this",
"->",
"userAgents",
",",
"$",
"us... | Find a matching WURFL device from the given $userAgent. Override this method to give an alternative way to do
the matching
@param string $userAgent
@return string | [
"Find",
"a",
"matching",
"WURFL",
"device",
"from",
"the",
"given",
"$userAgent",
".",
"Override",
"this",
"method",
"to",
"give",
"an",
"alternative",
"way",
"to",
"do",
"the",
"matching"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L387-L392 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.getDeviceIDFromRIS | public function getDeviceIDFromRIS($userAgent, $tolerance)
{
if ($tolerance === null) {
return WurflConstants::NO_MATCH;
}
$match = Utils::risMatch($this->userAgents, $userAgent, $tolerance);
if (!empty($match)) {
return $this->userAgentsWithDeviceID[$match]... | php | public function getDeviceIDFromRIS($userAgent, $tolerance)
{
if ($tolerance === null) {
return WurflConstants::NO_MATCH;
}
$match = Utils::risMatch($this->userAgents, $userAgent, $tolerance);
if (!empty($match)) {
return $this->userAgentsWithDeviceID[$match]... | [
"public",
"function",
"getDeviceIDFromRIS",
"(",
"$",
"userAgent",
",",
"$",
"tolerance",
")",
"{",
"if",
"(",
"$",
"tolerance",
"===",
"null",
")",
"{",
"return",
"WurflConstants",
"::",
"NO_MATCH",
";",
"}",
"$",
"match",
"=",
"Utils",
"::",
"risMatch",
... | @param string $userAgent
@param int $tolerance
@return null|string | [
"@param",
"string",
"$userAgent",
"@param",
"int",
"$tolerance"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L400-L413 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.applyRecoveryCatchAllMatch | public function applyRecoveryCatchAllMatch($userAgent)
{
if (Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
return WurflConstants::GENERIC_WEB_BROWSER;
}
if (Utils::checkIfContains($userAgent, 'CoreMedia')) {
return 'apple_iphone_coremedia_ver1';
}
... | php | public function applyRecoveryCatchAllMatch($userAgent)
{
if (Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
return WurflConstants::GENERIC_WEB_BROWSER;
}
if (Utils::checkIfContains($userAgent, 'CoreMedia')) {
return 'apple_iphone_coremedia_ver1';
}
... | [
"public",
"function",
"applyRecoveryCatchAllMatch",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"Utils",
"::",
"isDesktopBrowserHeavyDutyAnalysis",
"(",
"$",
"userAgent",
")",
")",
"{",
"return",
"WurflConstants",
"::",
"GENERIC_WEB_BROWSER",
";",
"}",
"if",
"(",
... | Applies Catch-All match
@param string $userAgent
@return string WURFL deviceID | [
"Applies",
"Catch",
"-",
"All",
"match"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L434-L534 |
mimmi20/Wurfl | src/Handlers/AbstractHandler.php | AbstractHandler.isDeviceExist | protected function isDeviceExist($deviceId)
{
$ids = array_values($this->userAgentsWithDeviceID);
if (in_array($deviceId, $ids)) {
return true;
}
return false;
} | php | protected function isDeviceExist($deviceId)
{
$ids = array_values($this->userAgentsWithDeviceID);
if (in_array($deviceId, $ids)) {
return true;
}
return false;
} | [
"protected",
"function",
"isDeviceExist",
"(",
"$",
"deviceId",
")",
"{",
"$",
"ids",
"=",
"array_values",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"deviceId",
",",
"$",
"ids",
")",
")",
"{",
"return",
... | Returns true if given $deviceId exists
@param string $deviceId
@return bool | [
"Returns",
"true",
"if",
"given",
"$deviceId",
"exists"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AbstractHandler.php#L567-L576 |
mimmi20/Wurfl | src/VirtualCapability/Tool/DeviceFactory.php | DeviceFactory.build | public static function build(GenericRequest $request, CustomDevice $customDevice)
{
$device = new Device($request);
self::assignProperties($device, $customDevice);
self::normalizeOS($device);
self::normalizeBrowser($device);
return $device;
} | php | public static function build(GenericRequest $request, CustomDevice $customDevice)
{
$device = new Device($request);
self::assignProperties($device, $customDevice);
self::normalizeOS($device);
self::normalizeBrowser($device);
return $device;
} | [
"public",
"static",
"function",
"build",
"(",
"GenericRequest",
"$",
"request",
",",
"CustomDevice",
"$",
"customDevice",
")",
"{",
"$",
"device",
"=",
"new",
"Device",
"(",
"$",
"request",
")",
";",
"self",
"::",
"assignProperties",
"(",
"$",
"device",
",... | Gets a device from the UA
@param \Wurfl\Request\GenericRequest $request
@param \Wurfl\CustomDevice $customDevice
@return \Wurfl\VirtualCapability\Tool\Device | [
"Gets",
"a",
"device",
"from",
"the",
"UA"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/Tool/DeviceFactory.php#L65-L74 |
mimmi20/Wurfl | src/VirtualCapability/Tool/DeviceFactory.php | DeviceFactory.assignProperties | private static function assignProperties(Device $device, CustomDevice $customDevice)
{
//Is UA Windows Mobile?
if ($device->getOs()->setContains($device->getDeviceUa(), 'Windows CE', 'Windows Mobile')) {
$device->getBrowser()->set('IE Mobile');
return;
}
//I... | php | private static function assignProperties(Device $device, CustomDevice $customDevice)
{
//Is UA Windows Mobile?
if ($device->getOs()->setContains($device->getDeviceUa(), 'Windows CE', 'Windows Mobile')) {
$device->getBrowser()->set('IE Mobile');
return;
}
//I... | [
"private",
"static",
"function",
"assignProperties",
"(",
"Device",
"$",
"device",
",",
"CustomDevice",
"$",
"customDevice",
")",
"{",
"//Is UA Windows Mobile?",
"if",
"(",
"$",
"device",
"->",
"getOs",
"(",
")",
"->",
"setContains",
"(",
"$",
"device",
"->",
... | Gets a device from the UA
@param \Wurfl\VirtualCapability\Tool\Device $device
@param \Wurfl\CustomDevice $customDevice | [
"Gets",
"a",
"device",
"from",
"the",
"UA"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/Tool/DeviceFactory.php#L82-L825 |
mimmi20/Wurfl | src/VirtualCapability/Tool/DeviceFactory.php | DeviceFactory.normalizeOS | private static function normalizeOS(Device $device)
{
if (strpos($device->getDeviceUa(), 'Windows') !== false) {
if (preg_match('/Windows NT ([0-9]+?\.[0-9])/', $device->getOs()->name, $matches)) {
$device->getOs()->name = 'Windows';
$device->getOs()->version =... | php | private static function normalizeOS(Device $device)
{
if (strpos($device->getDeviceUa(), 'Windows') !== false) {
if (preg_match('/Windows NT ([0-9]+?\.[0-9])/', $device->getOs()->name, $matches)) {
$device->getOs()->name = 'Windows';
$device->getOs()->version =... | [
"private",
"static",
"function",
"normalizeOS",
"(",
"Device",
"$",
"device",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"device",
"->",
"getDeviceUa",
"(",
")",
",",
"'Windows'",
")",
"!==",
"false",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/Windows NT (... | normalize the OS Information
@param \Wurfl\VirtualCapability\Tool\Device $device | [
"normalize",
"the",
"OS",
"Information"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/Tool/DeviceFactory.php#L832-L902 |
mimmi20/Wurfl | src/VirtualCapability/Tool/DeviceFactory.php | DeviceFactory.normalizeBrowser | private static function normalizeBrowser(Device $device)
{
if ($device->getBrowser()->name === 'IE' && preg_match('#Trident/([\d\.]+)#', $device->getDeviceUa(), $matches)) {
if (array_key_exists($matches[1], self::$trident_map)) {
$compatibilityViewCheck = self::$trident_map[$mat... | php | private static function normalizeBrowser(Device $device)
{
if ($device->getBrowser()->name === 'IE' && preg_match('#Trident/([\d\.]+)#', $device->getDeviceUa(), $matches)) {
if (array_key_exists($matches[1], self::$trident_map)) {
$compatibilityViewCheck = self::$trident_map[$mat... | [
"private",
"static",
"function",
"normalizeBrowser",
"(",
"Device",
"$",
"device",
")",
"{",
"if",
"(",
"$",
"device",
"->",
"getBrowser",
"(",
")",
"->",
"name",
"===",
"'IE'",
"&&",
"preg_match",
"(",
"'#Trident/([\\d\\.]+)#'",
",",
"$",
"device",
"->",
... | normalize the Browser Information
@param \Wurfl\VirtualCapability\Tool\Device $device | [
"normalize",
"the",
"Browser",
"Information"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/Tool/DeviceFactory.php#L909-L922 |
ikwattro/guzzle-stereo | src/Player.php | Player.replayFromTape | public static function replayFromTape($tapeFileLocation)
{
$reader = new Reader();
$formatter = new ResponseFormatter();
$content = $reader->getTapeContent($tapeFileLocation);
return new self($formatter->rebuildFromTape($content));
} | php | public static function replayFromTape($tapeFileLocation)
{
$reader = new Reader();
$formatter = new ResponseFormatter();
$content = $reader->getTapeContent($tapeFileLocation);
return new self($formatter->rebuildFromTape($content));
} | [
"public",
"static",
"function",
"replayFromTape",
"(",
"$",
"tapeFileLocation",
")",
"{",
"$",
"reader",
"=",
"new",
"Reader",
"(",
")",
";",
"$",
"formatter",
"=",
"new",
"ResponseFormatter",
"(",
")",
";",
"$",
"content",
"=",
"$",
"reader",
"->",
"get... | @param $tapeFileLocation
@return \Ikwattro\GuzzleStereo\Player | [
"@param",
"$tapeFileLocation"
] | train | https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/Player.php#L32-L39 |
astronati/php-fantasy-football-quotations-parser | src/Map/Row/Normalizer/Field/NormalizedFieldsContainer.php | NormalizedFieldsContainer.add | public function add(string $type, RowFieldNormalizerInterface $normalizer)
{
$this->normalizers[$type] = $normalizer;
return $this;
} | php | public function add(string $type, RowFieldNormalizerInterface $normalizer)
{
$this->normalizers[$type] = $normalizer;
return $this;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"type",
",",
"RowFieldNormalizerInterface",
"$",
"normalizer",
")",
"{",
"$",
"this",
"->",
"normalizers",
"[",
"$",
"type",
"]",
"=",
"$",
"normalizer",
";",
"return",
"$",
"this",
";",
"}"
] | Add a new normalized field
@param string $type The name of the field
@param RowFieldNormalizerInterface $normalizer
@return $this | [
"Add",
"a",
"new",
"normalized",
"field"
] | train | https://github.com/astronati/php-fantasy-football-quotations-parser/blob/1214f313c325ac7e9fc4d5218b85b3d7234f7bf3/src/Map/Row/Normalizer/Field/NormalizedFieldsContainer.php#L18-L22 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModuleManager.php | HTMLPurifier_HTMLModuleManager.addModule | public function addModule($module) {
$this->registerModule($module);
if (is_object($module)) $module = $module->name;
$this->userModules[] = $module;
} | php | public function addModule($module) {
$this->registerModule($module);
if (is_object($module)) $module = $module->name;
$this->userModules[] = $module;
} | [
"public",
"function",
"addModule",
"(",
"$",
"module",
")",
"{",
"$",
"this",
"->",
"registerModule",
"(",
"$",
"module",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"module",
")",
")",
"$",
"module",
"=",
"$",
"module",
"->",
"name",
";",
"$",
"th... | Adds a module to the current doctype by first registering it,
and then tacking it on to the active doctype | [
"Adds",
"a",
"module",
"to",
"the",
"current",
"doctype",
"by",
"first",
"registering",
"it",
"and",
"then",
"tacking",
"it",
"on",
"to",
"the",
"active",
"doctype"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModuleManager.php#L181-L185 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModuleManager.php | HTMLPurifier_HTMLModuleManager.getElements | public function getElements() {
$elements = array();
foreach ($this->modules as $module) {
if (!$this->trusted && !$module->safe) continue;
foreach ($module->info as $name => $v) {
if (isset($elements[$name])) continue;
$elements[$name] = $this->g... | php | public function getElements() {
$elements = array();
foreach ($this->modules as $module) {
if (!$this->trusted && !$module->safe) continue;
foreach ($module->info as $name => $v) {
if (isset($elements[$name])) continue;
$elements[$name] = $this->g... | [
"public",
"function",
"getElements",
"(",
")",
"{",
"$",
"elements",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"modules",
"as",
"$",
"module",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"trusted",
"&&",
"!",
"$",
"module",
... | Retrieves merged element definitions.
@return Array of HTMLPurifier_ElementDef | [
"Retrieves",
"merged",
"element",
"definitions",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModuleManager.php#L299-L318 |
wpup/digster | src/extensions/class-i18n-extensions.php | I18n_Extensions.trans | public function trans( $message ) {
$theme = wp_get_theme();
$domain = $theme->get( 'TextDomain' );
return __( $message, $domain );
} | php | public function trans( $message ) {
$theme = wp_get_theme();
$domain = $theme->get( 'TextDomain' );
return __( $message, $domain );
} | [
"public",
"function",
"trans",
"(",
"$",
"message",
")",
"{",
"$",
"theme",
"=",
"wp_get_theme",
"(",
")",
";",
"$",
"domain",
"=",
"$",
"theme",
"->",
"get",
"(",
"'TextDomain'",
")",
";",
"return",
"__",
"(",
"$",
"message",
",",
"$",
"domain",
"... | Translate message.
@param string $message
@return string | [
"Translate",
"message",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/extensions/class-i18n-extensions.php#L46-L50 |
mybb/standards | MyBB2/Sniffs/Properties/OnlyPrivateAndProtectedPropertiesSniff.php | MyBB2_Sniffs_Properties_OnlyPrivateAndProtectedPropertiesSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// That's not a class variable so ignore it
if ($tokens[$stackPtr]['level'] != 1) {
return;
}
$visibility = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$scopeModifiers, $stackPtr);
// Not ... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// That's not a class variable so ignore it
if ($tokens[$stackPtr]['level'] != 1) {
return;
}
$visibility = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$scopeModifiers, $stackPtr);
// Not ... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"// That's not a class variable so ignore it",
"if",
"(",
"$",
"tokens",
"[",
... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The current file being processed.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/mybb/standards/blob/78beaef4c8940f251bc62fdb7998566fe3a20be0/MyBB2/Sniffs/Properties/OnlyPrivateAndProtectedPropertiesSniff.php#L35-L64 |
cbednarski/pharcc | src/cbednarski/Pharcc/Config.php | Config.loadFile | public static function loadFile($path)
{
if (!realpath($path)) {
throw new \RuntimeException('Unable to load configuration file from ' . $path);
}
$data = Yaml::parse($path);
return new static(pathinfo($path, PATHINFO_DIRNAME), $data);
} | php | public static function loadFile($path)
{
if (!realpath($path)) {
throw new \RuntimeException('Unable to load configuration file from ' . $path);
}
$data = Yaml::parse($path);
return new static(pathinfo($path, PATHINFO_DIRNAME), $data);
} | [
"public",
"static",
"function",
"loadFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"realpath",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Unable to load configuration file from '",
".",
"$",
"path",
")",
";",
"}"... | Load configuration data from the specified file
@param string $path Read this config file
@return self
@throws \RuntimeException | [
"Load",
"configuration",
"data",
"from",
"the",
"specified",
"file"
] | train | https://github.com/cbednarski/pharcc/blob/562f9d3d13d2856de6a7ca846a83fe70897baaea/src/cbednarski/Pharcc/Config.php#L22-L31 |
liuguangw/mvc | src/http/UrlHelper.php | UrlHelper.createUrl | public function createUrl(string $action, ?DataMap $params = null, bool $isFullUrl = false, array $fullUrlInfo = []): string
{
list ($moduleName, $controllerName, $actionName) = Application::$app->getFullAction($action);
$resourcePath = $this->routeHandler->createUrl($moduleName, $controllerName, $a... | php | public function createUrl(string $action, ?DataMap $params = null, bool $isFullUrl = false, array $fullUrlInfo = []): string
{
list ($moduleName, $controllerName, $actionName) = Application::$app->getFullAction($action);
$resourcePath = $this->routeHandler->createUrl($moduleName, $controllerName, $a... | [
"public",
"function",
"createUrl",
"(",
"string",
"$",
"action",
",",
"?",
"DataMap",
"$",
"params",
"=",
"null",
",",
"bool",
"$",
"isFullUrl",
"=",
"false",
",",
"array",
"$",
"fullUrlInfo",
"=",
"[",
"]",
")",
":",
"string",
"{",
"list",
"(",
"$",... | url生成
@param string $action
缺省操作
@param DataMap $params
路由参数
@param bool $isFullUrl
是否返回完整url
@param array $fullUrlInfo
完整url特别指定信息
@return string | [
"url生成"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/http/UrlHelper.php#L38-L43 |
liuguangw/mvc | src/http/UrlHelper.php | UrlHelper.getPublicUrl | public function getPublicUrl(string $resourcePath = '/', bool $isFullUrl = false, array $fullUrlInfo = [])
{
$url = $this->context . $resourcePath;
if ($isFullUrl) {
$this->formatUrlData($fullUrlInfo);
$prefix = $fullUrlInfo['scheme'] . '://' . $fullUrlInfo['host'];
... | php | public function getPublicUrl(string $resourcePath = '/', bool $isFullUrl = false, array $fullUrlInfo = [])
{
$url = $this->context . $resourcePath;
if ($isFullUrl) {
$this->formatUrlData($fullUrlInfo);
$prefix = $fullUrlInfo['scheme'] . '://' . $fullUrlInfo['host'];
... | [
"public",
"function",
"getPublicUrl",
"(",
"string",
"$",
"resourcePath",
"=",
"'/'",
",",
"bool",
"$",
"isFullUrl",
"=",
"false",
",",
"array",
"$",
"fullUrlInfo",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"context",
".",
"$",
"re... | 获取公共URL
@param string $resourcePath
资源路径
@param bool $isFullUrl
是否返回完整路径
@param array $fullUrlInfo
完整路径附加信息 | [
"获取公共URL"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/http/UrlHelper.php#L55-L69 |
liuguangw/mvc | src/http/UrlHelper.php | UrlHelper.formatUrlData | private function formatUrlData(array &$fullUrlInfo): void
{
if (! isset($fullUrlInfo['scheme'])) {
if (! isset($_SERVER['HTTPS'])) {
$fullUrlInfo['scheme'] = 'http';
} elseif ($_SERVER['HTTPS'] == 'off') {
$fullUrlInfo['scheme'] = 'http';
}... | php | private function formatUrlData(array &$fullUrlInfo): void
{
if (! isset($fullUrlInfo['scheme'])) {
if (! isset($_SERVER['HTTPS'])) {
$fullUrlInfo['scheme'] = 'http';
} elseif ($_SERVER['HTTPS'] == 'off') {
$fullUrlInfo['scheme'] = 'http';
}... | [
"private",
"function",
"formatUrlData",
"(",
"array",
"&",
"$",
"fullUrlInfo",
")",
":",
"void",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"fullUrlInfo",
"[",
"'scheme'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",... | 格式化URL各部分
@param array $fullUrlInfo
@return void | [
"格式化URL各部分"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/http/UrlHelper.php#L77-L100 |
incraigulous/contentful-sdk | src/PayloadBuilders/Entry.php | Entry.objectifyFields | protected function objectifyFields($fields) {
$new = array();
foreach($fields as $name => $field) {
if (is_object($field)) {
$new[] = $field;
} else {
$new[] = new EntryField($name, $field);
}
}
return $new;
} | php | protected function objectifyFields($fields) {
$new = array();
foreach($fields as $name => $field) {
if (is_object($field)) {
$new[] = $field;
} else {
$new[] = new EntryField($name, $field);
}
}
return $new;
} | [
"protected",
"function",
"objectifyFields",
"(",
"$",
"fields",
")",
"{",
"$",
"new",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"name",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"field",
")",
")",
... | Convert the field to an object to get the language formatting.
@param $fields
@return array | [
"Convert",
"the",
"field",
"to",
"an",
"object",
"to",
"get",
"the",
"language",
"formatting",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/Entry.php#L18-L28 |
webtrendi/clapp | src/Clapp/CommandArgumentFilter.php | CommandArgumentFilter.getParam | public function getParam($name)
{
if (!$this->parsed) {
$this->parseParams();
} //if
$longName = strlen($name) === 1 ? $this->definitions->getLongName($name) : $name;
if (isset($this->params[$longName])) {
return $this->params[$longName];
} else {
... | php | public function getParam($name)
{
if (!$this->parsed) {
$this->parseParams();
} //if
$longName = strlen($name) === 1 ? $this->definitions->getLongName($name) : $name;
if (isset($this->params[$longName])) {
return $this->params[$longName];
} else {
... | [
"public",
"function",
"getParam",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"parsed",
")",
"{",
"$",
"this",
"->",
"parseParams",
"(",
")",
";",
"}",
"//if",
"$",
"longName",
"=",
"strlen",
"(",
"$",
"name",
")",
"===",
"1",
... | returns parameter matching provided name
@author Patrick Forget <patforg at webtrendi.com>
@param string name of the paramter to retreive
@return mixed if param the param appears only once the method will
return 1 if the parameter doesn't take a value. The specified value
for that param will returned if it does take... | [
"returns",
"parameter",
"matching",
"provided",
"name"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandArgumentFilter.php#L88-L105 |
webtrendi/clapp | src/Clapp/CommandArgumentFilter.php | CommandArgumentFilter.parseParams | protected function parseParams()
{
$argumentStack = $this->arguments;
$expectingValue = false;
$currentLongName = null;
$currentValue = null;
$trailingValues = "";
$endOfDashedArguments = false;
$addParam = false;
$argumentsLeft = sizeof($argumentSta... | php | protected function parseParams()
{
$argumentStack = $this->arguments;
$expectingValue = false;
$currentLongName = null;
$currentValue = null;
$trailingValues = "";
$endOfDashedArguments = false;
$addParam = false;
$argumentsLeft = sizeof($argumentSta... | [
"protected",
"function",
"parseParams",
"(",
")",
"{",
"$",
"argumentStack",
"=",
"$",
"this",
"->",
"arguments",
";",
"$",
"expectingValue",
"=",
"false",
";",
"$",
"currentLongName",
"=",
"null",
";",
"$",
"currentValue",
"=",
"null",
";",
"$",
"trailing... | extracts params from arguments
@author Patrick Forget <patforg at webtrendi.com> | [
"extracts",
"params",
"from",
"arguments"
] | train | https://github.com/webtrendi/clapp/blob/2747f7abaefd70c107ef553e01f3d812cfa8241c/src/Clapp/CommandArgumentFilter.php#L140-L342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.