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
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_KeyValueMessage._getExtensionKpublicgs
function _getExtensionKpublicgs($aliases) { if ($aliases === null) { $aliases = new Auth_OpenID_NamespaceMap(); } $ax_args = array(); foreach ($this->data as $type_uri => $values) { $alias = $aliases->add($type_uri); $ax_args['type.' . $alias] =...
php
function _getExtensionKpublicgs($aliases) { if ($aliases === null) { $aliases = new Auth_OpenID_NamespaceMap(); } $ax_args = array(); foreach ($this->data as $type_uri => $values) { $alias = $aliases->add($type_uri); $ax_args['type.' . $alias] =...
[ "function", "_getExtensionKpublicgs", "(", "$", "aliases", ")", "{", "if", "(", "$", "aliases", "===", "null", ")", "{", "$", "aliases", "=", "new", "Auth_OpenID_NamespaceMap", "(", ")", ";", "}", "$", "ax_args", "=", "array", "(", ")", ";", "foreach", ...
Get the extension arguments for the key/value pairs contained in this message. @param Auth_OpenID_NamespaceMap $aliases An alias mapping. Set to None if you don't care about the aliases for this request. @access private @return array
[ "Get", "the", "extension", "arguments", "for", "the", "key", "/", "value", "pairs", "contained", "in", "this", "message", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L606-L627
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_KeyValueMessage.parseExtensionArgs
function parseExtensionArgs($ax_args) { $result = $this->_checkMode($ax_args); if (Auth_OpenID_AX::isError($result)) { return $result; } $aliases = new Auth_OpenID_NamespaceMap(); foreach ($ax_args as $key => $value) { if (strpos($key, 'type.') === 0...
php
function parseExtensionArgs($ax_args) { $result = $this->_checkMode($ax_args); if (Auth_OpenID_AX::isError($result)) { return $result; } $aliases = new Auth_OpenID_NamespaceMap(); foreach ($ax_args as $key => $value) { if (strpos($key, 'type.') === 0...
[ "function", "parseExtensionArgs", "(", "$", "ax_args", ")", "{", "$", "result", "=", "$", "this", "->", "_checkMode", "(", "$", "ax_args", ")", ";", "if", "(", "Auth_OpenID_AX", "::", "isError", "(", "$", "result", ")", ")", "{", "return", "$", "result...
Parse attribute exchange key/value arguments into this object. @param array $ax_args The attribute exchange fetch_response arguments, with namespacing removed. @return Auth_OpenID_AX_Error|bool
[ "Parse", "attribute", "exchange", "key", "/", "value", "arguments", "into", "this", "object", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L637-L723
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_KeyValueMessage.getSingle
function getSingle($type_uri, $default=null) { $values = Auth_OpenID::arrayGet($this->data, $type_uri); if (!$values) { return $default; } else if (count($values) == 1) { return $values[0]; } else { return new Auth_OpenID_AX_Error( sp...
php
function getSingle($type_uri, $default=null) { $values = Auth_OpenID::arrayGet($this->data, $type_uri); if (!$values) { return $default; } else if (count($values) == 1) { return $values[0]; } else { return new Auth_OpenID_AX_Error( sp...
[ "function", "getSingle", "(", "$", "type_uri", ",", "$", "default", "=", "null", ")", "{", "$", "values", "=", "Auth_OpenID", "::", "arrayGet", "(", "$", "this", "->", "data", ",", "$", "type_uri", ")", ";", "if", "(", "!", "$", "values", ")", "{",...
Get a single value for an attribute. If no value was sent for this attribute, use the supplied default. If there is more than one value for this attribute, this method will fail. @param string $type_uri The URI for the attribute @param mixed $default The value to return if the attribute was not sent in the fetch_respo...
[ "Get", "a", "single", "value", "for", "an", "attribute", ".", "If", "no", "value", "was", "sent", "for", "this", "attribute", "use", "the", "supplied", "default", ".", "If", "there", "is", "more", "than", "one", "value", "for", "this", "attribute", "this...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L736-L749
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_KeyValueMessage.get
function get($type_uri) { if (array_key_exists($type_uri, $this->data)) { return $this->data[$type_uri]; } else { return new Auth_OpenID_AX_Error( sprintf("Type URI %s not found in response", $type_uri) ); } }
php
function get($type_uri) { if (array_key_exists($type_uri, $this->data)) { return $this->data[$type_uri]; } else { return new Auth_OpenID_AX_Error( sprintf("Type URI %s not found in response", $type_uri) ); } }
[ "function", "get", "(", "$", "type_uri", ")", "{", "if", "(", "array_key_exists", "(", "$", "type_uri", ",", "$", "this", "->", "data", ")", ")", "{", "return", "$", "this", "->", "data", "[", "$", "type_uri", "]", ";", "}", "else", "{", "return", ...
Get the list of values for this attribute in the fetch_response. XXX: what to do if the values are not present? default parameter? this is funny because it's always supposed to return a list, so the default may break that, though it's provided by the user's code, so it might be okay. If no default is supplied, should ...
[ "Get", "the", "list", "of", "values", "for", "this", "attribute", "in", "the", "fetch_response", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L767-L777
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_FetchResponse.getExtensionArgs
function getExtensionArgs($request=null) { $aliases = new Auth_OpenID_NamespaceMap(); $zero_value_types = array(); if ($request !== null) { // Validate the data in the context of the request (the // same attributes should be present in each, and the // c...
php
function getExtensionArgs($request=null) { $aliases = new Auth_OpenID_NamespaceMap(); $zero_value_types = array(); if ($request !== null) { // Validate the data in the context of the request (the // same attributes should be present in each, and the // c...
[ "function", "getExtensionArgs", "(", "$", "request", "=", "null", ")", "{", "$", "aliases", "=", "new", "Auth_OpenID_NamespaceMap", "(", ")", ";", "$", "zero_value_types", "=", "array", "(", ")", ";", "if", "(", "$", "request", "!==", "null", ")", "{", ...
Serialize this object into arguments in the attribute exchange namespace @param Auth_OpenID_AX_FetchRequest|null $request @return Auth_OpenID_AX_Error|array|null $args The dictionary of unqualified attribute exchange arguments that represent this fetch_response, or Auth_OpenID_AX_Error on error.
[ "Serialize", "this", "object", "into", "arguments", "in", "the", "attribute", "exchange", "namespace" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L827-L911
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_FetchResponse.fromSuccessResponse
static function fromSuccessResponse($success_response, $signed=true) { $obj = new Auth_OpenID_AX_FetchResponse(); if ($signed) { $ax_args = $success_response->getSignedNS($obj->ns_uri); } else { $ax_args = $success_response->message->getArgs($obj->ns_uri); } ...
php
static function fromSuccessResponse($success_response, $signed=true) { $obj = new Auth_OpenID_AX_FetchResponse(); if ($signed) { $ax_args = $success_response->getSignedNS($obj->ns_uri); } else { $ax_args = $success_response->message->getArgs($obj->ns_uri); } ...
[ "static", "function", "fromSuccessResponse", "(", "$", "success_response", ",", "$", "signed", "=", "true", ")", "{", "$", "obj", "=", "new", "Auth_OpenID_AX_FetchResponse", "(", ")", ";", "if", "(", "$", "signed", ")", "{", "$", "ax_args", "=", "$", "su...
Construct a FetchResponse object from an OpenID library SuccessResponse object. @param Auth_OpenID_SuccessResponse $success_response A successful id_res response object @param bool $signed Whether non-signed args should be processsed. If True (the default), only signed arguments will be processsed. @return Auth_Open...
[ "Construct", "a", "FetchResponse", "object", "from", "an", "OpenID", "library", "SuccessResponse", "object", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L943-L962
openid/php-openid
Auth/OpenID/AX.php
Auth_OpenID_AX_StoreResponse.getExtensionArgs
function getExtensionArgs($request = null) { $ax_args = $this->_newArgs(); if ((!$this->succeeded()) && $this->error_message) { $ax_args['error'] = $this->error_message; } return $ax_args; }
php
function getExtensionArgs($request = null) { $ax_args = $this->_newArgs(); if ((!$this->succeeded()) && $this->error_message) { $ax_args['error'] = $this->error_message; } return $ax_args; }
[ "function", "getExtensionArgs", "(", "$", "request", "=", "null", ")", "{", "$", "ax_args", "=", "$", "this", "->", "_newArgs", "(", ")", ";", "if", "(", "(", "!", "$", "this", "->", "succeeded", "(", ")", ")", "&&", "$", "this", "->", "error_messa...
Get the string arguments that should be added to an OpenID message for this extension. @param Auth_OpenID_Request|null $request @return null
[ "Get", "the", "string", "arguments", "that", "should", "be", "added", "to", "an", "OpenID", "message", "for", "this", "extension", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/AX.php#L1044-L1052
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_PHPSession.get
function get($name, $default=null) { if (isset($_SESSION) && array_key_exists($name, $_SESSION)) { return $_SESSION[$name]; } else { return $default; } }
php
function get($name, $default=null) { if (isset($_SESSION) && array_key_exists($name, $_SESSION)) { return $_SESSION[$name]; } else { return $default; } }
[ "function", "get", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "_SESSION", ")", "&&", "array_key_exists", "(", "$", "name", ",", "$", "_SESSION", ")", ")", "{", "return", "$", "_SESSION", "[", "$", ...
Get a key's value from the session. @param string $name The name of the key to retrieve. @param string $default The optional value to return if the key is not found in the session. @return mixed $result The key's value in the session or $default if it isn't found.
[ "Get", "a", "key", "s", "value", "from", "the", "session", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L38-L45
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_SessionLoader.fromSession
function fromSession($data) { if (!$data) { return null; } $required = $this->requiredKeys(); foreach ($required as $k) { if (!array_key_exists($k, $data)) { return null; } } if (!$this->check($data)) { ...
php
function fromSession($data) { if (!$data) { return null; } $required = $this->requiredKeys(); foreach ($required as $k) { if (!array_key_exists($k, $data)) { return null; } } if (!$this->check($data)) { ...
[ "function", "fromSession", "(", "$", "data", ")", "{", "if", "(", "!", "$", "data", ")", "{", "return", "null", ";", "}", "$", "required", "=", "$", "this", "->", "requiredKeys", "(", ")", ";", "foreach", "(", "$", "required", "as", "$", "k", ")"...
Given a session data value (an array), this creates an object (returned by $this->newObject()) whose attributes and values are those in $data. Returns null if $data lacks keys found in $this->requiredKeys(). Returns null if $this->check($data) evaluates to false. Returns null if $this->newObject() evaluates to false...
[ "Given", "a", "session", "data", "value", "(", "an", "array", ")", "this", "creates", "an", "object", "(", "returned", "by", "$this", "-", ">", "newObject", "()", ")", "whose", "attributes", "and", "values", "are", "those", "in", "$data", ".", "Returns",...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L103-L133
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_SessionLoader.toSession
function toSession($obj) { $data = array(); foreach ($obj as $k => $v) { $data[$k] = $v; } $extra = $this->prepareForSave($obj); if ($extra && is_array($extra)) { foreach ($extra as $k => $v) { $data[$k] = $v; } } ...
php
function toSession($obj) { $data = array(); foreach ($obj as $k => $v) { $data[$k] = $v; } $extra = $this->prepareForSave($obj); if ($extra && is_array($extra)) { foreach ($extra as $k => $v) { $data[$k] = $v; } } ...
[ "function", "toSession", "(", "$", "obj", ")", "{", "$", "data", "=", "array", "(", ")", ";", "foreach", "(", "$", "obj", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "data", "[", "$", "k", "]", "=", "$", "v", ";", "}", "$", "extra", "=...
Returns an array of keys and values built from the attributes of $obj. If $this->prepareForSave($obj) returns an array, its keys and values are used to update the $data array of attributes from $obj. @access private @param object $obj @return array
[ "Returns", "an", "array", "of", "keys", "and", "values", "built", "from", "the", "attributes", "of", "$obj", ".", "If", "$this", "-", ">", "prepareForSave", "(", "$obj", ")", "returns", "an", "array", "its", "keys", "and", "values", "are", "used", "to", ...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L174-L190
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_Manager.nextService
function nextService() { if ($this->services) { $this->_current = array_shift($this->services); } else { $this->_current = null; } return $this->_current; }
php
function nextService() { if ($this->services) { $this->_current = array_shift($this->services); } else { $this->_current = null; } return $this->_current; }
[ "function", "nextService", "(", ")", "{", "if", "(", "$", "this", "->", "services", ")", "{", "$", "this", "->", "_current", "=", "array_shift", "(", "$", "this", "->", "services", ")", ";", "}", "else", "{", "$", "this", "->", "_current", "=", "nu...
Return the next service $this->current() will continue to return that service until the next call to this method.
[ "Return", "the", "next", "service" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L352-L362
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_Discovery.getNextService
function getNextService($discover_cb, $fetcher) { $manager = $this->getManager(); if (!$manager || (!$manager->services)) { $this->destroyManager(); list($yadis_url, $services) = call_user_func_array($discover_cb, ...
php
function getNextService($discover_cb, $fetcher) { $manager = $this->getManager(); if (!$manager || (!$manager->services)) { $this->destroyManager(); list($yadis_url, $services) = call_user_func_array($discover_cb, ...
[ "function", "getNextService", "(", "$", "discover_cb", ",", "$", "fetcher", ")", "{", "$", "manager", "=", "$", "this", "->", "getManager", "(", ")", ";", "if", "(", "!", "$", "manager", "||", "(", "!", "$", "manager", "->", "services", ")", ")", "...
Return the next authentication service for the pair of user_input and session. This function handles fallback. @param callback $discover_cb @param object $fetcher @return null|Auth_OpenID_ServiceEndpoint
[ "Return", "the", "next", "authentication", "service", "for", "the", "pair", "of", "user_input", "and", "session", ".", "This", "function", "handles", "fallback", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L447-L472
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_Discovery.cleanup
function cleanup($force=false) { $manager = $this->getManager($force); if ($manager) { $service = $manager->current(); $this->destroyManager($force); } else { $service = null; } return $service; }
php
function cleanup($force=false) { $manager = $this->getManager($force); if ($manager) { $service = $manager->current(); $this->destroyManager($force); } else { $service = null; } return $service; }
[ "function", "cleanup", "(", "$", "force", "=", "false", ")", "{", "$", "manager", "=", "$", "this", "->", "getManager", "(", "$", "force", ")", ";", "if", "(", "$", "manager", ")", "{", "$", "service", "=", "$", "manager", "->", "current", "(", "...
Clean up Yadis-related services in the session and return the most-recently-attempted service from the manager, if one exists. @param bool $force True if the manager should be deleted regardless of whether it's a manager for $this->url. @return null|Auth_OpenID_ServiceEndpoint
[ "Clean", "up", "Yadis", "-", "related", "services", "in", "the", "session", "and", "return", "the", "most", "-", "recently", "-", "attempted", "service", "from", "the", "manager", "if", "one", "exists", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L483-L494
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_Discovery.getManager
function getManager($force=false) { // Extract the YadisServiceManager for this object's URL and // suffix from the session. $manager_str = $this->session->get($this->getSessionKey()); /** @var Auth_Yadis_Manager $manager */ $manager = null; if ($manager_str !== nul...
php
function getManager($force=false) { // Extract the YadisServiceManager for this object's URL and // suffix from the session. $manager_str = $this->session->get($this->getSessionKey()); /** @var Auth_Yadis_Manager $manager */ $manager = null; if ($manager_str !== nul...
[ "function", "getManager", "(", "$", "force", "=", "false", ")", "{", "// Extract the YadisServiceManager for this object's URL and", "// suffix from the session.", "$", "manager_str", "=", "$", "this", "->", "session", "->", "get", "(", "$", "this", "->", "getSessionK...
@access private @param bool $force True if the manager should be returned regardless of whether it's a manager for $this->url. @return null|Auth_Yadis_Manager
[ "@access", "private" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L512-L530
openid/php-openid
Auth/Yadis/Manager.php
Auth_Yadis_Discovery.destroyManager
function destroyManager($force=false) { if ($this->getManager($force) !== null) { $key = $this->getSessionKey(); $this->session->del($key); } }
php
function destroyManager($force=false) { if ($this->getManager($force) !== null) { $key = $this->getSessionKey(); $this->session->del($key); } }
[ "function", "destroyManager", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "getManager", "(", "$", "force", ")", "!==", "null", ")", "{", "$", "key", "=", "$", "this", "->", "getSessionKey", "(", ")", ";", "$", "this", ...
@access private @param bool $force True if the manager should be deleted regardless of whether it's a manager for $this->url.
[ "@access", "private" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Manager.php#L562-L568
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegBase._getSRegNS
static function _getSRegNS($message) { $alias = null; $found_ns_uri = null; // See if there exists an alias for one of the two defined // simple registration types. foreach (array(Auth_OpenID_SREG_NS_URI_1_1, Auth_OpenID_SREG_NS_URI_1_0) as $sreg_ns_ur...
php
static function _getSRegNS($message) { $alias = null; $found_ns_uri = null; // See if there exists an alias for one of the two defined // simple registration types. foreach (array(Auth_OpenID_SREG_NS_URI_1_1, Auth_OpenID_SREG_NS_URI_1_0) as $sreg_ns_ur...
[ "static", "function", "_getSRegNS", "(", "$", "message", ")", "{", "$", "alias", "=", "null", ";", "$", "found_ns_uri", "=", "null", ";", "// See if there exists an alias for one of the two defined", "// simple registration types.", "foreach", "(", "array", "(", "Auth...
Extract the simple registration namespace URI from the given OpenID message. Handles OpenID 1 and 2, as well as both sreg namespace URIs found in the wild, as well as missing namespace definitions (for OpenID 1) $message: The OpenID message from which to parse simple registration fields. This may be a request or respo...
[ "Extract", "the", "simple", "registration", "namespace", "URI", "from", "the", "given", "OpenID", "message", ".", "Handles", "OpenID", "1", "and", "2", "as", "well", "as", "both", "sreg", "namespace", "URIs", "found", "in", "the", "wild", "as", "well", "as...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L131-L161
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.build
static function build($required=null, $optional=null, $policy_url=null, $sreg_ns_uri=Auth_OpenID_SREG_NS_URI, $cls='Auth_OpenID_SRegRequest') { /** @var Auth_OpenID_SRegRequest $obj */ $obj = new $cls(); $obj->required = array(); ...
php
static function build($required=null, $optional=null, $policy_url=null, $sreg_ns_uri=Auth_OpenID_SREG_NS_URI, $cls='Auth_OpenID_SRegRequest') { /** @var Auth_OpenID_SRegRequest $obj */ $obj = new $cls(); $obj->required = array(); ...
[ "static", "function", "build", "(", "$", "required", "=", "null", ",", "$", "optional", "=", "null", ",", "$", "policy_url", "=", "null", ",", "$", "sreg_ns_uri", "=", "Auth_OpenID_SREG_NS_URI", ",", "$", "cls", "=", "'Auth_OpenID_SRegRequest'", ")", "{", ...
Initialize an empty simple registration request. @param null $required @param null $optional @param null $policy_url @param string $sreg_ns_uri @param string $cls @return null
[ "Initialize", "an", "empty", "simple", "registration", "request", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L196-L222
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.fromOpenIDRequest
static function fromOpenIDRequest($request, $cls='Auth_OpenID_SRegRequest') { $obj = call_user_func_array(array($cls, 'build'), array(null, null, null, Auth_OpenID_SREG_NS_URI, $cls)); // Since we're going to mess with namespace URI mapping, don't // mutate the object that...
php
static function fromOpenIDRequest($request, $cls='Auth_OpenID_SRegRequest') { $obj = call_user_func_array(array($cls, 'build'), array(null, null, null, Auth_OpenID_SREG_NS_URI, $cls)); // Since we're going to mess with namespace URI mapping, don't // mutate the object that...
[ "static", "function", "fromOpenIDRequest", "(", "$", "request", ",", "$", "cls", "=", "'Auth_OpenID_SRegRequest'", ")", "{", "$", "obj", "=", "call_user_func_array", "(", "array", "(", "$", "cls", ",", "'build'", ")", ",", "array", "(", "null", ",", "null"...
Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments $request: The OpenID authentication request from which to extract an sreg request. $cls: name of class to use when creating sreg request object. Used for testing. Returns the newly created...
[ "Create", "a", "simple", "registration", "request", "that", "contains", "the", "fields", "that", "were", "requested", "in", "the", "OpenID", "request", "with", "the", "given", "arguments" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L241-L261
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.parseExtensionArgs
function parseExtensionArgs($args, $strict=false) { foreach (array('required', 'optional') as $list_name) { $required = ($list_name == 'required'); $items = Auth_OpenID::arrayGet($args, $list_name); if ($items) { foreach (explode(',', $items) as $field_nam...
php
function parseExtensionArgs($args, $strict=false) { foreach (array('required', 'optional') as $list_name) { $required = ($list_name == 'required'); $items = Auth_OpenID::arrayGet($args, $list_name); if ($items) { foreach (explode(',', $items) as $field_nam...
[ "function", "parseExtensionArgs", "(", "$", "args", ",", "$", "strict", "=", "false", ")", "{", "foreach", "(", "array", "(", "'required'", ",", "'optional'", ")", "as", "$", "list_name", ")", "{", "$", "required", "=", "(", "$", "list_name", "==", "'r...
Parse the unqualified simple registration request parameters and add them to this object. This method is essentially the inverse of getExtensionArgs. This method restores the serialized simple registration request fields. If you are extracting arguments from a standard OpenID checkid_* request, you probably want to u...
[ "Parse", "the", "unqualified", "simple", "registration", "request", "parameters", "and", "add", "them", "to", "this", "object", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L291-L310
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.contains
function contains($field_name) { return (in_array($field_name, $this->required) || in_array($field_name, $this->optional)); }
php
function contains($field_name) { return (in_array($field_name, $this->required) || in_array($field_name, $this->optional)); }
[ "function", "contains", "(", "$", "field_name", ")", "{", "return", "(", "in_array", "(", "$", "field_name", ",", "$", "this", "->", "required", ")", "||", "in_array", "(", "$", "field_name", ",", "$", "this", "->", "optional", ")", ")", ";", "}" ]
Was this field in the request? @param string $field_name @return bool
[ "Was", "this", "field", "in", "the", "request?" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L335-L339
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.requestField
function requestField($field_name, $required=false, $strict=false) { if (!Auth_OpenID_checkFieldName($field_name)) { return false; } if ($strict) { if ($this->contains($field_name)) { return false; } } els...
php
function requestField($field_name, $required=false, $strict=false) { if (!Auth_OpenID_checkFieldName($field_name)) { return false; } if ($strict) { if ($this->contains($field_name)) { return false; } } els...
[ "function", "requestField", "(", "$", "field_name", ",", "$", "required", "=", "false", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "!", "Auth_OpenID_checkFieldName", "(", "$", "field_name", ")", ")", "{", "return", "false", ";", "}", "if", ...
Request the specified field from the OpenID user $field_name: the unqualified simple registration field name required: whether the given field should be presented to the user as being a required to successfully complete the request strict: whether to raise an exception when a field is added to a request more than on...
[ "Request", "the", "specified", "field", "from", "the", "OpenID", "user" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L357-L390
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.requestFields
function requestFields($field_names, $required=false, $strict=false) { if (!is_array($field_names)) { return false; } foreach ($field_names as $field_name) { if (!$this->requestField($field_name, $required, $strict)) { return false; } ...
php
function requestFields($field_names, $required=false, $strict=false) { if (!is_array($field_names)) { return false; } foreach ($field_names as $field_name) { if (!$this->requestField($field_name, $required, $strict)) { return false; } ...
[ "function", "requestFields", "(", "$", "field_names", ",", "$", "required", "=", "false", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "!", "is_array", "(", "$", "field_names", ")", ")", "{", "return", "false", ";", "}", "foreach", "(", "$"...
Add the given list of fields to the request field_names: The simple registration data fields to request required: Whether these values should be presented to the user as required strict: whether to raise an exception when a field is added to a request more than once @param string $field_names @param bool $required ...
[ "Add", "the", "given", "list", "of", "fields", "to", "the", "request" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L408-L421
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegRequest.getExtensionArgs
function getExtensionArgs($request = null) { $args = array(); if ($this->required) { $args['required'] = implode(',', $this->required); } if ($this->optional) { $args['optional'] = implode(',', $this->optional); } if ($this->policy_url) { ...
php
function getExtensionArgs($request = null) { $args = array(); if ($this->required) { $args['required'] = implode(',', $this->required); } if ($this->optional) { $args['optional'] = implode(',', $this->optional); } if ($this->policy_url) { ...
[ "function", "getExtensionArgs", "(", "$", "request", "=", "null", ")", "{", "$", "args", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "required", ")", "{", "$", "args", "[", "'required'", "]", "=", "implode", "(", "','", ",", "$", "...
Get a dictionary of unqualified simple registration arguments representing this request. This method is essentially the inverse of C{L{parseExtensionArgs}}. This method serializes the simple registration request fields. @param Auth_OpenID_Request|null $request @return array|null
[ "Get", "a", "dictionary", "of", "unqualified", "simple", "registration", "arguments", "representing", "this", "request", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L434-L451
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegResponse.extractResponse
static function extractResponse($request, $data) { $obj = new Auth_OpenID_SRegResponse(); $obj->ns_uri = $request->ns_uri; foreach ($request->allRequestedFields() as $field) { $value = Auth_OpenID::arrayGet($data, $field); if ($value !== null) { $obj-...
php
static function extractResponse($request, $data) { $obj = new Auth_OpenID_SRegResponse(); $obj->ns_uri = $request->ns_uri; foreach ($request->allRequestedFields() as $field) { $value = Auth_OpenID::arrayGet($data, $field); if ($value !== null) { $obj-...
[ "static", "function", "extractResponse", "(", "$", "request", ",", "$", "data", ")", "{", "$", "obj", "=", "new", "Auth_OpenID_SRegResponse", "(", ")", ";", "$", "obj", "->", "ns_uri", "=", "$", "request", "->", "ns_uri", ";", "foreach", "(", "$", "req...
Take a C{L{SRegRequest}} and a dictionary of simple registration values and create a C{L{SRegResponse}} object containing that data. request: The simple registration request object data: The simple registration data for this response, as a dictionary from unqualified simple registration field name to string (unicode)...
[ "Take", "a", "C", "{", "L", "{", "SRegRequest", "}}", "and", "a", "dictionary", "of", "simple", "registration", "values", "and", "create", "a", "C", "{", "L", "{", "SRegResponse", "}}", "object", "containing", "that", "data", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L495-L508
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegResponse.fromSuccessResponse
static function fromSuccessResponse($success_response, $signed_only=true) { global $Auth_OpenID_sreg_data_fields; $obj = new Auth_OpenID_SRegResponse(); $obj->ns_uri = $obj->_getSRegNS($success_response->message); if ($signed_only) { $args = $success_response->getSigned...
php
static function fromSuccessResponse($success_response, $signed_only=true) { global $Auth_OpenID_sreg_data_fields; $obj = new Auth_OpenID_SRegResponse(); $obj->ns_uri = $obj->_getSRegNS($success_response->message); if ($signed_only) { $args = $success_response->getSigned...
[ "static", "function", "fromSuccessResponse", "(", "$", "success_response", ",", "$", "signed_only", "=", "true", ")", "{", "global", "$", "Auth_OpenID_sreg_data_fields", ";", "$", "obj", "=", "new", "Auth_OpenID_SRegResponse", "(", ")", ";", "$", "obj", "->", ...
Create a C{L{SRegResponse}} object from a successful OpenID library response (C{L{openid.consumer.consumer.SuccessResponse}}) response message success_response: A SuccessResponse from consumer.complete() signed_only: Whether to process only data that was signed in the id_res message from the server. Returns a simple...
[ "Create", "a", "C", "{", "L", "{", "SRegResponse", "}}", "object", "from", "a", "successful", "OpenID", "library", "response", "(", "C", "{", "L", "{", "openid", ".", "consumer", ".", "consumer", ".", "SuccessResponse", "}}", ")", "response", "message" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L528-L552
openid/php-openid
Auth/OpenID/SReg.php
Auth_OpenID_SRegResponse.get
function get($field_name, $default=null) { if (!Auth_OpenID_checkFieldName($field_name)) { return null; } return Auth_OpenID::arrayGet($this->data, $field_name, $default); }
php
function get($field_name, $default=null) { if (!Auth_OpenID_checkFieldName($field_name)) { return null; } return Auth_OpenID::arrayGet($this->data, $field_name, $default); }
[ "function", "get", "(", "$", "field_name", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "Auth_OpenID_checkFieldName", "(", "$", "field_name", ")", ")", "{", "return", "null", ";", "}", "return", "Auth_OpenID", "::", "arrayGet", "(", "$", ...
Read-only dictionary interface
[ "Read", "-", "only", "dictionary", "interface" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/SReg.php#L567-L574
openid/php-openid
Auth/Yadis/ParseHTML.php
Auth_Yadis_ParseHTML.tagPattern
function tagPattern($tag_names, $close, $self_close) { if (is_array($tag_names)) { $tag_names = '(?:'.implode('|',$tag_names).')'; } if ($close) { $close = '\/' . (($close == 1)? '' : '?'); } else { $close = ''; } if ($self_close) {...
php
function tagPattern($tag_names, $close, $self_close) { if (is_array($tag_names)) { $tag_names = '(?:'.implode('|',$tag_names).')'; } if ($close) { $close = '\/' . (($close == 1)? '' : '?'); } else { $close = ''; } if ($self_close) {...
[ "function", "tagPattern", "(", "$", "tag_names", ",", "$", "close", ",", "$", "self_close", ")", "{", "if", "(", "is_array", "(", "$", "tag_names", ")", ")", "{", "$", "tag_names", "=", "'(?:'", ".", "implode", "(", "'|'", ",", "$", "tag_names", ")",...
Create a regular expression that will match an opening or closing tag from a set of names. @access private @param mixed $tag_names Tag names to match @param mixed $close false/0 = no, true/1 = yes, other = maybe @param mixed $self_close false/0 = no, true/1 = yes, other = maybe @return string $regex A regular expressi...
[ "Create", "a", "regular", "expression", "that", "will", "match", "an", "opening", "or", "closing", "tag", "from", "a", "set", "of", "names", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/ParseHTML.php#L102-L120
openid/php-openid
Auth/Yadis/ParseHTML.php
Auth_Yadis_ParseHTML.getMetaTags
function getMetaTags($html_string) { $html_string = preg_replace($this->_removed_re, "", $html_string); $key_tags = array($this->tagPattern('html', false, false), $this->tagPattern('head', false, false...
php
function getMetaTags($html_string) { $html_string = preg_replace($this->_removed_re, "", $html_string); $key_tags = array($this->tagPattern('html', false, false), $this->tagPattern('head', false, false...
[ "function", "getMetaTags", "(", "$", "html_string", ")", "{", "$", "html_string", "=", "preg_replace", "(", "$", "this", "->", "_removed_re", ",", "\"\"", ",", "$", "html_string", ")", ";", "$", "key_tags", "=", "array", "(", "$", "this", "->", "tagPatte...
Given an HTML document string, this finds all the META tags in the document, provided they are found in the <HTML><HEAD>...</HEAD> section of the document. The <HTML> tag may be missing. @access private @param string $html_string An HTMl document string @return array $tag_list Array of tags; each tag is an array of a...
[ "Given", "an", "HTML", "document", "string", "this", "finds", "all", "the", "META", "tags", "in", "the", "document", "provided", "they", "are", "found", "in", "the", "<HTML", ">", "<HEAD", ">", "...", "<", "/", "HEAD", ">", "section", "of", "the", "doc...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/ParseHTML.php#L133-L204
openid/php-openid
Auth/Yadis/ParseHTML.php
Auth_Yadis_ParseHTML.getHTTPEquiv
function getHTTPEquiv($html_string) { $meta_tags = $this->getMetaTags($html_string); if ($meta_tags) { foreach ($meta_tags as $tag) { if (array_key_exists('http-equiv', $tag) && (in_array(strtolower($tag['http-equiv']), a...
php
function getHTTPEquiv($html_string) { $meta_tags = $this->getMetaTags($html_string); if ($meta_tags) { foreach ($meta_tags as $tag) { if (array_key_exists('http-equiv', $tag) && (in_array(strtolower($tag['http-equiv']), a...
[ "function", "getHTTPEquiv", "(", "$", "html_string", ")", "{", "$", "meta_tags", "=", "$", "this", "->", "getMetaTags", "(", "$", "html_string", ")", ";", "if", "(", "$", "meta_tags", ")", "{", "foreach", "(", "$", "meta_tags", "as", "$", "tag", ")", ...
Looks for a META tag with an "http-equiv" attribute whose value is one of ("x-xrds-location", "x-yadis-location"), ignoring case. If such a META tag is found, its "content" attribute value is returned. @param string $html_string An HTML document in string format @return mixed $content The "content" attribute value of...
[ "Looks", "for", "a", "META", "tag", "with", "an", "http", "-", "equiv", "attribute", "whose", "value", "is", "one", "of", "(", "x", "-", "xrds", "-", "location", "x", "-", "yadis", "-", "location", ")", "ignoring", "case", ".", "If", "such", "a", "...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/ParseHTML.php#L216-L232
openid/php-openid
Auth/OpenID/Extension.php
Auth_OpenID_Extension.toMessage
function toMessage($message, $request = null) { $implicit = $message->isOpenID1(); $added = $message->namespaces->addAlias($this->ns_uri, $this->ns_alias, $implicit); if ($added === null) { ...
php
function toMessage($message, $request = null) { $implicit = $message->isOpenID1(); $added = $message->namespaces->addAlias($this->ns_uri, $this->ns_alias, $implicit); if ($added === null) { ...
[ "function", "toMessage", "(", "$", "message", ",", "$", "request", "=", "null", ")", "{", "$", "implicit", "=", "$", "message", "->", "isOpenID1", "(", ")", ";", "$", "added", "=", "$", "message", "->", "namespaces", "->", "addAlias", "(", "$", "this...
Add the arguments from this extension to the provided message. Returns the message with the extension arguments added. @param Auth_OpenID_Message $message @param Auth_OpenID_Request $request @return null
[ "Add", "the", "arguments", "from", "this", "extension", "to", "the", "provided", "message", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Extension.php#L49-L71
openid/php-openid
Auth/OpenID/PredisStore.php
Auth_OpenID_PredisStore.storeAssociation
function storeAssociation($server_url, $association) { // create Redis keys for association itself // and list of associations for this server $associationKey = $this->associationKey($server_url, $association->handle); $serverKey = $this->associationServerKey($server_ur...
php
function storeAssociation($server_url, $association) { // create Redis keys for association itself // and list of associations for this server $associationKey = $this->associationKey($server_url, $association->handle); $serverKey = $this->associationServerKey($server_ur...
[ "function", "storeAssociation", "(", "$", "server_url", ",", "$", "association", ")", "{", "// create Redis keys for association itself ", "// and list of associations for this server", "$", "associationKey", "=", "$", "this", "->", "associationKey", "(", "$", "server_url",...
Store association until its expiration time in Redis server. Overwrites any existing association with same server_url and handle. Handles list of associations for every server.
[ "Store", "association", "until", "its", "expiration", "time", "in", "Redis", "server", ".", "Overwrites", "any", "existing", "association", "with", "same", "server_url", "and", "handle", ".", "Handles", "list", "of", "associations", "for", "every", "server", "."...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/PredisStore.php#L59-L90
openid/php-openid
Auth/OpenID/PredisStore.php
Auth_OpenID_PredisStore.getAssociation
function getAssociation($server_url, $handle = null) { // simple case: handle given if ($handle !== null) { return $this->getAssociationFromServer( $this->associationKey($server_url, $handle) ); } // no handle given, receiving the late...
php
function getAssociation($server_url, $handle = null) { // simple case: handle given if ($handle !== null) { return $this->getAssociationFromServer( $this->associationKey($server_url, $handle) ); } // no handle given, receiving the late...
[ "function", "getAssociation", "(", "$", "server_url", ",", "$", "handle", "=", "null", ")", "{", "// simple case: handle given", "if", "(", "$", "handle", "!==", "null", ")", "{", "return", "$", "this", "->", "getAssociationFromServer", "(", "$", "this", "->...
Read association from Redis. If no handle given and multiple associations found, returns latest issued
[ "Read", "association", "from", "Redis", ".", "If", "no", "handle", "given", "and", "multiple", "associations", "found", "returns", "latest", "issued" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/PredisStore.php#L96-L115
openid/php-openid
Auth/OpenID/PredisStore.php
Auth_OpenID_PredisStore.getAssociationFromServer
private function getAssociationFromServer($associationKey) { $association = $this->redis->get($associationKey); return $association ? unserialize($association) : null; }
php
private function getAssociationFromServer($associationKey) { $association = $this->redis->get($associationKey); return $association ? unserialize($association) : null; }
[ "private", "function", "getAssociationFromServer", "(", "$", "associationKey", ")", "{", "$", "association", "=", "$", "this", "->", "redis", "->", "get", "(", "$", "associationKey", ")", ";", "return", "$", "association", "?", "unserialize", "(", "$", "asso...
Function to actually receive and unserialize the association from the server.
[ "Function", "to", "actually", "receive", "and", "unserialize", "the", "association", "from", "the", "server", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/PredisStore.php#L121-L125
openid/php-openid
Auth/OpenID/PredisStore.php
Auth_OpenID_PredisStore.removeAssociation
function removeAssociation($server_url, $handle) { // create Redis keys $serverKey = $this->associationServerKey($server_url); $associationKey = $this->associationKey($server_url, $handle); // Removing the association from the server's association list $...
php
function removeAssociation($server_url, $handle) { // create Redis keys $serverKey = $this->associationServerKey($server_url); $associationKey = $this->associationKey($server_url, $handle); // Removing the association from the server's association list $...
[ "function", "removeAssociation", "(", "$", "server_url", ",", "$", "handle", ")", "{", "// create Redis keys", "$", "serverKey", "=", "$", "this", "->", "associationServerKey", "(", "$", "server_url", ")", ";", "$", "associationKey", "=", "$", "this", "->", ...
Immediately delete association from Redis.
[ "Immediately", "delete", "association", "from", "Redis", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/PredisStore.php#L130-L145
openid/php-openid
Auth/OpenID/PredisStore.php
Auth_OpenID_PredisStore.useNonce
function useNonce($server_url, $timestamp, $salt) { global $Auth_OpenID_SKEW; // save one request to memcache when nonce obviously expired if (abs($timestamp - time()) > $Auth_OpenID_SKEW) { return false; } // SETNX will set the value only of th...
php
function useNonce($server_url, $timestamp, $salt) { global $Auth_OpenID_SKEW; // save one request to memcache when nonce obviously expired if (abs($timestamp - time()) > $Auth_OpenID_SKEW) { return false; } // SETNX will set the value only of th...
[ "function", "useNonce", "(", "$", "server_url", ",", "$", "timestamp", ",", "$", "salt", ")", "{", "global", "$", "Auth_OpenID_SKEW", ";", "// save one request to memcache when nonce obviously expired ", "if", "(", "abs", "(", "$", "timestamp", "-", "time", "(", ...
Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.
[ "Create", "nonce", "for", "server", "and", "salt", "expiring", "after", "$Auth_OpenID_SKEW", "seconds", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/PredisStore.php#L151-L170
openid/php-openid
Auth/OpenID/PredisStore.php
Auth_OpenID_PredisStore.associationKey
function associationKey($server_url, $handle = null) { return $this->prefix . 'openid_association_' . sha1($server_url) . '_' . sha1($handle); }
php
function associationKey($server_url, $handle = null) { return $this->prefix . 'openid_association_' . sha1($server_url) . '_' . sha1($handle); }
[ "function", "associationKey", "(", "$", "server_url", ",", "$", "handle", "=", "null", ")", "{", "return", "$", "this", "->", "prefix", ".", "'openid_association_'", ".", "sha1", "(", "$", "server_url", ")", ".", "'_'", ".", "sha1", "(", "$", "handle", ...
Key is prefixed with $prefix and 'openid_association_' string
[ "Key", "is", "prefixed", "with", "$prefix", "and", "openid_association_", "string" ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/PredisStore.php#L185-L190
openid/php-openid
Auth/Yadis/XRDS.php
Auth_Yadis_Service.getTypes
function getTypes() { $t = array(); foreach ($this->getElements('xrd:Type') as $elem) { $c = $this->parser->content($elem); if ($c) { $t[] = $c; } } return $t; }
php
function getTypes() { $t = array(); foreach ($this->getElements('xrd:Type') as $elem) { $c = $this->parser->content($elem); if ($c) { $t[] = $c; } } return $t; }
[ "function", "getTypes", "(", ")", "{", "$", "t", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getElements", "(", "'xrd:Type'", ")", "as", "$", "elem", ")", "{", "$", "c", "=", "$", "this", "->", "parser", "->", "content", "(",...
Return the URIs in the "Type" elements, if any, of this Service element. @return array $type_uris An array of Type URI strings.
[ "Return", "the", "URIs", "in", "the", "Type", "elements", "if", "any", "of", "this", "Service", "element", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/XRDS.php#L98-L108
openid/php-openid
Auth/Yadis/XRDS.php
Auth_Yadis_Service.getURIs
function getURIs() { $uris = array(); $last = array(); foreach ($this->getElements('xrd:URI') as $elem) { $uri_string = $this->parser->content($elem); $attrs = $this->parser->attributes($elem); if ($attrs && array_key_exists('priority', $a...
php
function getURIs() { $uris = array(); $last = array(); foreach ($this->getElements('xrd:URI') as $elem) { $uri_string = $this->parser->content($elem); $attrs = $this->parser->attributes($elem); if ($attrs && array_key_exists('priority', $a...
[ "function", "getURIs", "(", ")", "{", "$", "uris", "=", "array", "(", ")", ";", "$", "last", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getElements", "(", "'xrd:URI'", ")", "as", "$", "elem", ")", "{", "$", "uri_string", "="...
Return the URIs in the "URI" elements, if any, of this Service element. The URIs are returned sorted in priority order. @return array $uris An array of URI strings.
[ "Return", "the", "URIs", "in", "the", "URI", "elements", "if", "any", "of", "this", "Service", "element", ".", "The", "URIs", "are", "returned", "sorted", "in", "priority", "order", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/XRDS.php#L129-L164
openid/php-openid
Auth/Yadis/XRDS.php
Auth_Yadis_Service.getPriority
function getPriority() { $attributes = $this->parser->attributes($this->element); if (array_key_exists('priority', $attributes)) { return intval($attributes['priority']); } return null; }
php
function getPriority() { $attributes = $this->parser->attributes($this->element); if (array_key_exists('priority', $attributes)) { return intval($attributes['priority']); } return null; }
[ "function", "getPriority", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "parser", "->", "attributes", "(", "$", "this", "->", "element", ")", ";", "if", "(", "array_key_exists", "(", "'priority'", ",", "$", "attributes", ")", ")", "{", "re...
Returns the "priority" attribute value of this <Service> element, if the attribute is present. Returns null if not. @return mixed $result Null or integer, depending on whether this Service element has a 'priority' attribute.
[ "Returns", "the", "priority", "attribute", "value", "of", "this", "<Service", ">", "element", "if", "the", "attribute", "is", "present", ".", "Returns", "null", "if", "not", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/XRDS.php#L173-L182
openid/php-openid
Auth/Yadis/XRDS.php
Auth_Yadis_XRDS.parseXRDS
static function parseXRDS($xml_string, $extra_ns_map = null) { $_null = null; if (!$xml_string) { return $_null; } $parser = Auth_Yadis_getXMLParser(); $ns_map = Auth_Yadis_getNSMap(); if ($extra_ns_map && is_array($extra_ns_map)) { $ns_map...
php
static function parseXRDS($xml_string, $extra_ns_map = null) { $_null = null; if (!$xml_string) { return $_null; } $parser = Auth_Yadis_getXMLParser(); $ns_map = Auth_Yadis_getNSMap(); if ($extra_ns_map && is_array($extra_ns_map)) { $ns_map...
[ "static", "function", "parseXRDS", "(", "$", "xml_string", ",", "$", "extra_ns_map", "=", "null", ")", "{", "$", "_null", "=", "null", ";", "if", "(", "!", "$", "xml_string", ")", "{", "return", "$", "_null", ";", "}", "$", "parser", "=", "Auth_Yadis...
Parse an XML string (XRDS document) and return either a Auth_Yadis_XRDS object or null, depending on whether the XRDS XML is valid. @param string $xml_string An XRDS XML string. @param array|null $extra_ns_map @return mixed $xrds An instance of Auth_Yadis_XRDS or null, depending on the validity of $xml_string
[ "Parse", "an", "XML", "string", "(", "XRDS", "document", ")", "and", "return", "either", "a", "Auth_Yadis_XRDS", "object", "or", "null", "depending", "on", "whether", "the", "XRDS", "XML", "is", "valid", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/XRDS.php#L288-L337
openid/php-openid
Auth/Yadis/XRDS.php
Auth_Yadis_XRDS._parse
function _parse() { $this->serviceList = array(); $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode); foreach ($services as $node) { $s = new Auth_Yadis_Service(); $s->element = $node; $s->parser = $this->parser; $priority =...
php
function _parse() { $this->serviceList = array(); $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode); foreach ($services as $node) { $s = new Auth_Yadis_Service(); $s->element = $node; $s->parser = $this->parser; $priority =...
[ "function", "_parse", "(", ")", "{", "$", "this", "->", "serviceList", "=", "array", "(", ")", ";", "$", "services", "=", "$", "this", "->", "parser", "->", "evalXPath", "(", "'xrd:Service'", ",", "$", "this", "->", "xrdNode", ")", ";", "foreach", "(...
Creates the service list using nodes from the XRDS XML document. @access private
[ "Creates", "the", "service", "list", "using", "nodes", "from", "the", "XRDS", "XML", "document", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/XRDS.php#L361-L380
openid/php-openid
Auth/Yadis/XRDS.php
Auth_Yadis_XRDS.services
function services($filters = null, $filter_mode = SERVICES_YADIS_MATCH_ANY) { $pri_keys = array_keys($this->serviceList); sort($pri_keys, SORT_NUMERIC); // If no filters are specified, return the entire service // list, ordered by priority. if (!$filte...
php
function services($filters = null, $filter_mode = SERVICES_YADIS_MATCH_ANY) { $pri_keys = array_keys($this->serviceList); sort($pri_keys, SORT_NUMERIC); // If no filters are specified, return the entire service // list, ordered by priority. if (!$filte...
[ "function", "services", "(", "$", "filters", "=", "null", ",", "$", "filter_mode", "=", "SERVICES_YADIS_MATCH_ANY", ")", "{", "$", "pri_keys", "=", "array_keys", "(", "$", "this", "->", "serviceList", ")", ";", "sort", "(", "$", "pri_keys", ",", "SORT_NUME...
Returns a list of service objects which correspond to <Service> elements in the XRDS XML document for this object. Optionally, an array of filter callbacks may be given to limit the list of returned service objects. Furthermore, the default mode is to return all service objects which match ANY of the specified filter...
[ "Returns", "a", "list", "of", "service", "objects", "which", "correspond", "to", "<Service", ">", "elements", "in", "the", "XRDS", "XML", "document", "for", "this", "object", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/XRDS.php#L406-L489
openid/php-openid
Auth/OpenID/Parse.php
Auth_OpenID_Parse.tagMatcher
function tagMatcher($tag_name, $close_tags = null) { $expr = $this->_tag_expr; if ($close_tags) { $options = implode("|", array_merge(array($tag_name), $close_tags)); $closer = sprintf("(?:%s)", $options); } else { $closer = $tag_name; } ...
php
function tagMatcher($tag_name, $close_tags = null) { $expr = $this->_tag_expr; if ($close_tags) { $options = implode("|", array_merge(array($tag_name), $close_tags)); $closer = sprintf("(?:%s)", $options); } else { $closer = $tag_name; } ...
[ "function", "tagMatcher", "(", "$", "tag_name", ",", "$", "close_tags", "=", "null", ")", "{", "$", "expr", "=", "$", "this", "->", "_tag_expr", ";", "if", "(", "$", "close_tags", ")", "{", "$", "options", "=", "implode", "(", "\"|\"", ",", "array_me...
Returns a regular expression that will match a given tag in an SGML string. @param string $tag_name @param array $close_tags @return string
[ "Returns", "a", "regular", "expression", "that", "will", "match", "a", "given", "tag", "in", "an", "SGML", "string", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Parse.php#L144-L157
openid/php-openid
Auth/OpenID/Parse.php
Auth_OpenID_Parse.parseLinkAttrs
function parseLinkAttrs($html) { $stripped = preg_replace($this->_removed_re, "", $html); $html_begin = $this->htmlBegin($stripped); $html_end = $this->htmlEnd($stripped); if ($html_begin === false) { ret...
php
function parseLinkAttrs($html) { $stripped = preg_replace($this->_removed_re, "", $html); $html_begin = $this->htmlBegin($stripped); $html_end = $this->htmlEnd($stripped); if ($html_begin === false) { ret...
[ "function", "parseLinkAttrs", "(", "$", "html", ")", "{", "$", "stripped", "=", "preg_replace", "(", "$", "this", "->", "_removed_re", ",", "\"\"", ",", "$", "html", ")", ";", "$", "html_begin", "=", "$", "this", "->", "htmlBegin", "(", "$", "stripped"...
Find all link tags in a string representing a HTML document and return a list of their attributes. @todo This is quite ineffective and may fail with the default pcre.backtrack_limit of 100000 in PHP 5.2, if $html is big. It should rather use stripos (in PHP5) or strpos()+strtoupper() in PHP4 to manage this. @param st...
[ "Find", "all", "link", "tags", "in", "a", "string", "representing", "a", "HTML", "document", "and", "return", "a", "list", "of", "their", "attributes", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Parse.php#L244-L300
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_Consumer.begin
function begin($user_url, $anonymous=false) { $openid_url = $user_url; $disco = $this->getDiscoveryObject($this->session, $openid_url, $this->session_key_prefix); // Set the 'stale' attribute of the manag...
php
function begin($user_url, $anonymous=false) { $openid_url = $user_url; $disco = $this->getDiscoveryObject($this->session, $openid_url, $this->session_key_prefix); // Set the 'stale' attribute of the manag...
[ "function", "begin", "(", "$", "user_url", ",", "$", "anonymous", "=", "false", ")", "{", "$", "openid_url", "=", "$", "user_url", ";", "$", "disco", "=", "$", "this", "->", "getDiscoveryObject", "(", "$", "this", "->", "session", ",", "$", "openid_url...
Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file. @param string $user_url Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure it is normalized. For example, a user_url of example.com will be normalized to http://exa...
[ "Start", "the", "OpenID", "authentication", "process", ".", "See", "steps", "1", "-", "2", "in", "the", "overview", "at", "the", "top", "of", "this", "file", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L308-L350
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_Consumer.beginWithoutDiscovery
function beginWithoutDiscovery($endpoint, $anonymous=false) { $loader = new Auth_OpenID_ServiceEndpointLoader(); $auth_req = $this->consumer->begin($endpoint); $this->session->set($this->_token_key, $loader->toSession($auth_req->endpoint)); if (!$auth_req->setAnonymous(...
php
function beginWithoutDiscovery($endpoint, $anonymous=false) { $loader = new Auth_OpenID_ServiceEndpointLoader(); $auth_req = $this->consumer->begin($endpoint); $this->session->set($this->_token_key, $loader->toSession($auth_req->endpoint)); if (!$auth_req->setAnonymous(...
[ "function", "beginWithoutDiscovery", "(", "$", "endpoint", ",", "$", "anonymous", "=", "false", ")", "{", "$", "loader", "=", "new", "Auth_OpenID_ServiceEndpointLoader", "(", ")", ";", "$", "auth_req", "=", "$", "this", "->", "consumer", "->", "begin", "(", ...
Start OpenID verification without doing OpenID server discovery. This method is used internally by Consumer.begin after discovery is performed, and exists to provide an interface for library users needing to perform their own discovery. @param Auth_OpenID_ServiceEndpoint $endpoint an OpenID service endpoint descriptor...
[ "Start", "OpenID", "verification", "without", "doing", "OpenID", "server", "discovery", ".", "This", "method", "is", "used", "internally", "by", "Consumer", ".", "begin", "after", "discovery", "is", "performed", "and", "exists", "to", "provide", "an", "interface...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L368-L380
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_Consumer.complete
function complete($current_url, $query=null) { if ($current_url && !is_string($current_url)) { // This is ugly, but we need to complain loudly when // someone uses the API incorrectly. trigger_error("current_url must be a string; see NEWS file " . ...
php
function complete($current_url, $query=null) { if ($current_url && !is_string($current_url)) { // This is ugly, but we need to complain loudly when // someone uses the API incorrectly. trigger_error("current_url must be a string; see NEWS file " . ...
[ "function", "complete", "(", "$", "current_url", ",", "$", "query", "=", "null", ")", "{", "if", "(", "$", "current_url", "&&", "!", "is_string", "(", "$", "current_url", ")", ")", "{", "// This is ugly, but we need to complain loudly when", "// someone uses the A...
Called to interpret the server's response to an OpenID request. It is called in step 4 of the flow described in the consumer overview. @param string $current_url The URL used to invoke the application. Extract the URL from your application's web request framework and specify it here to have it checked against the open...
[ "Called", "to", "interpret", "the", "server", "s", "response", "to", "an", "OpenID", "request", ".", "It", "is", "called", "in", "step", "4", "of", "the", "flow", "described", "in", "the", "consumer", "overview", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L405-L440
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_GenericConsumer.begin
function begin($service_endpoint) { $assoc = $this->_getAssociation($service_endpoint); $r = new Auth_OpenID_AuthRequest($service_endpoint, $assoc); $r->return_to_args[$this->openid1_nonce_query_arg_name] = Auth_OpenID_mkNonce(); if ($r->message->isOpenID1()) { ...
php
function begin($service_endpoint) { $assoc = $this->_getAssociation($service_endpoint); $r = new Auth_OpenID_AuthRequest($service_endpoint, $assoc); $r->return_to_args[$this->openid1_nonce_query_arg_name] = Auth_OpenID_mkNonce(); if ($r->message->isOpenID1()) { ...
[ "function", "begin", "(", "$", "service_endpoint", ")", "{", "$", "assoc", "=", "$", "this", "->", "_getAssociation", "(", "$", "service_endpoint", ")", ";", "$", "r", "=", "new", "Auth_OpenID_AuthRequest", "(", "$", "service_endpoint", ",", "$", "assoc", ...
Called to begin OpenID authentication using the specified {@link Auth_OpenID_ServiceEndpoint}. @access private @param Auth_OpenID_ServiceEndpoint $service_endpoint @return Auth_OpenID_AuthRequest
[ "Called", "to", "begin", "OpenID", "authentication", "using", "the", "specified", "{", "@link", "Auth_OpenID_ServiceEndpoint", "}", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L634-L647
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_GenericConsumer.complete
function complete($message, $endpoint, $return_to) { $mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode', '<no mode set>'); $mode_methods = array( 'cancel' => '_complete_cancel', 'error' => '_complete_er...
php
function complete($message, $endpoint, $return_to) { $mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode', '<no mode set>'); $mode_methods = array( 'cancel' => '_complete_cancel', 'error' => '_complete_er...
[ "function", "complete", "(", "$", "message", ",", "$", "endpoint", ",", "$", "return_to", ")", "{", "$", "mode", "=", "$", "message", "->", "getArg", "(", "Auth_OpenID_OPENID_NS", ",", "'mode'", ",", "'<no mode set>'", ")", ";", "$", "mode_methods", "=", ...
Given an {@link Auth_OpenID_Message}, {@link Auth_OpenID_ServiceEndpoint} and optional return_to URL, complete OpenID authentication. @access private @param Auth_OpenID_Message $message @param Auth_OpenID_ServiceEndpoint $endpoint @param string $return_to @return Auth_OpenID_SuccessResponse
[ "Given", "an", "{", "@link", "Auth_OpenID_Message", "}", "{", "@link", "Auth_OpenID_ServiceEndpoint", "}", "and", "optional", "return_to", "URL", "complete", "OpenID", "authentication", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L660-L677
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_GenericConsumer._httpResponseToMessage
static function _httpResponseToMessage($response) { // Should this function be named Message.fromHTTPResponse instead? $response_message = Auth_OpenID_Message::fromKVForm($response->body); if ($response->status == 400) { return Auth_OpenID_ServerErrorContainer::fromMessage( ...
php
static function _httpResponseToMessage($response) { // Should this function be named Message.fromHTTPResponse instead? $response_message = Auth_OpenID_Message::fromKVForm($response->body); if ($response->status == 400) { return Auth_OpenID_ServerErrorContainer::fromMessage( ...
[ "static", "function", "_httpResponseToMessage", "(", "$", "response", ")", "{", "// Should this function be named Message.fromHTTPResponse instead?", "$", "response_message", "=", "Auth_OpenID_Message", "::", "fromKVForm", "(", "$", "response", "->", "body", ")", ";", "if...
Adapt a POST response to a Message. @param Auth_Yadis_HTTPResponse $response Result of a POST to an OpenID endpoint. @access private @return Auth_OpenID_Message|Auth_OpenID_ServerErrorContainer|null
[ "Adapt", "a", "POST", "response", "to", "a", "Message", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L1470-L1483
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_GenericConsumer._extractSupportedAssociationType
function _extractSupportedAssociationType($server_error) { // Any error message whose code is not 'unsupported-type' // should be considered a total failure. if (($server_error->error_code != 'unsupported-type') || ($server_error->message->isOpenID1())) { return null;...
php
function _extractSupportedAssociationType($server_error) { // Any error message whose code is not 'unsupported-type' // should be considered a total failure. if (($server_error->error_code != 'unsupported-type') || ($server_error->message->isOpenID1())) { return null;...
[ "function", "_extractSupportedAssociationType", "(", "$", "server_error", ")", "{", "// Any error message whose code is not 'unsupported-type'", "// should be considered a total failure.", "if", "(", "(", "$", "server_error", "->", "error_code", "!=", "'unsupported-type'", ")", ...
Handle ServerErrors resulting from association requests. @param $server_error @return array|null $result If server replied with an C{unsupported-type} error, return a tuple of supported C{association_type}, C{session_type}. Otherwise logs the error and returns null. @access private
[ "Handle", "ServerErrors", "resulting", "from", "association", "requests", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L1538-L1567
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_GenericConsumer._getOpenID1SessionType
function _getOpenID1SessionType($assoc_response) { // If it's an OpenID 1 message, allow session_type to default // to None (which signifies "no-encryption") $session_type = $assoc_response->getArg(Auth_OpenID_OPENID1_NS, 'session_type'); ...
php
function _getOpenID1SessionType($assoc_response) { // If it's an OpenID 1 message, allow session_type to default // to None (which signifies "no-encryption") $session_type = $assoc_response->getArg(Auth_OpenID_OPENID1_NS, 'session_type'); ...
[ "function", "_getOpenID1SessionType", "(", "$", "assoc_response", ")", "{", "// If it's an OpenID 1 message, allow session_type to default", "// to None (which signifies \"no-encryption\")", "$", "session_type", "=", "$", "assoc_response", "->", "getArg", "(", "Auth_OpenID_OPENID1_...
Given an association response message, extract the OpenID 1.X session type. This function mostly takes care of the 'no-encryption' default behavior in OpenID 1. If the association type is plain-text, this function will return 'no-encryption' @access private @param Auth_OpenID_Message $assoc_response @return string T...
[ "Given", "an", "association", "response", "message", "extract", "the", "OpenID", "1", ".", "X", "session", "type", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L1793-L1817
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_AuthRequest.setAnonymous
function setAnonymous($is_anonymous) { if ($is_anonymous && $this->message->isOpenID1()) { return false; } else { $this->_anonymous = $is_anonymous; return true; } }
php
function setAnonymous($is_anonymous) { if ($is_anonymous && $this->message->isOpenID1()) { return false; } else { $this->_anonymous = $is_anonymous; return true; } }
[ "function", "setAnonymous", "(", "$", "is_anonymous", ")", "{", "if", "(", "$", "is_anonymous", "&&", "$", "this", "->", "message", "->", "isOpenID1", "(", ")", ")", "{", "return", "false", ";", "}", "else", "{", "$", "this", "->", "_anonymous", "=", ...
Set whether this request should be made anonymously. If a request is anonymous, the identifier will not be sent in the request. This is only useful if you are making another kind of request with an extension in this request. Anonymous requests are not allowed when the request is made with OpenID 1. @param bool $is_an...
[ "Set", "whether", "this", "request", "should", "be", "made", "anonymously", ".", "If", "a", "request", "is", "anonymous", "the", "identifier", "will", "not", "be", "sent", "in", "the", "request", ".", "This", "is", "only", "useful", "if", "you", "are", "...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L1897-L1905
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_AuthRequest.getMessage
function getMessage($realm, $return_to=null, $immediate=false) { if ($return_to) { $return_to = Auth_OpenID::appendArgs($return_to, $this->return_to_args); } else if ($immediate) { // raise ValueError( // '"retu...
php
function getMessage($realm, $return_to=null, $immediate=false) { if ($return_to) { $return_to = Auth_OpenID::appendArgs($return_to, $this->return_to_args); } else if ($immediate) { // raise ValueError( // '"retu...
[ "function", "getMessage", "(", "$", "realm", ",", "$", "return_to", "=", "null", ",", "$", "immediate", "=", "false", ")", "{", "if", "(", "$", "return_to", ")", "{", "$", "return_to", "=", "Auth_OpenID", "::", "appendArgs", "(", "$", "return_to", ",",...
Produce a {@link Auth_OpenID_Message} representing this request. @param string $realm The URL (or URL pattern) that identifies your web site to the user when she is authorizing it. @param string $return_to The URL that the OpenID provider will send the user back to after attempting to verify her identity. Not specif...
[ "Produce", "a", "{", "@link", "Auth_OpenID_Message", "}", "representing", "this", "request", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L1929-L2000
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_AuthRequest.formMarkup
function formMarkup($realm, $return_to=null, $immediate=false, $form_tag_attrs=null) { $message = $this->getMessage($realm, $return_to, $immediate); if (Auth_OpenID::isFailure($message)) { return $message; } return $message->toFormMarkup($this->e...
php
function formMarkup($realm, $return_to=null, $immediate=false, $form_tag_attrs=null) { $message = $this->getMessage($realm, $return_to, $immediate); if (Auth_OpenID::isFailure($message)) { return $message; } return $message->toFormMarkup($this->e...
[ "function", "formMarkup", "(", "$", "realm", ",", "$", "return_to", "=", "null", ",", "$", "immediate", "=", "false", ",", "$", "form_tag_attrs", "=", "null", ")", "{", "$", "message", "=", "$", "this", "->", "getMessage", "(", "$", "realm", ",", "$"...
Get html for a form to submit this request to the IDP. form_tag_attrs: An array of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that can be overridden. If a value is supplied for 'action' or 'method', it will be replaced. @param string $realm @param null|string $return_to @para...
[ "Get", "html", "for", "a", "form", "to", "submit", "this", "request", "to", "the", "IDP", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L2028-L2038
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_AuthRequest.htmlMarkup
function htmlMarkup($realm, $return_to=null, $immediate=false, $form_tag_attrs=null) { $form = $this->formMarkup($realm, $return_to, $immediate, $form_tag_attrs); if (Auth_OpenID::isFailure($form)) { return $form; } ...
php
function htmlMarkup($realm, $return_to=null, $immediate=false, $form_tag_attrs=null) { $form = $this->formMarkup($realm, $return_to, $immediate, $form_tag_attrs); if (Auth_OpenID::isFailure($form)) { return $form; } ...
[ "function", "htmlMarkup", "(", "$", "realm", ",", "$", "return_to", "=", "null", ",", "$", "immediate", "=", "false", ",", "$", "form_tag_attrs", "=", "null", ")", "{", "$", "form", "=", "$", "this", "->", "formMarkup", "(", "$", "realm", ",", "$", ...
Get a complete html document that will autosubmit the request to the IDP. Wraps formMarkup. See the documentation for that function. @param string $realm @param string $return_to @param bool $immediate @param array $form_tag_attrs @return Auth_OpenID_FailureResponse|Auth_OpenID_Message|string
[ "Get", "a", "complete", "html", "document", "that", "will", "autosubmit", "the", "request", "to", "the", "IDP", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L2052-L2062
openid/php-openid
Auth/OpenID/Consumer.php
Auth_OpenID_SuccessResponse.extensionResponse
function extensionResponse($namespace_uri, $require_signed) { if ($require_signed) { return $this->getSignedNS($namespace_uri); } else { return $this->message->getArgs($namespace_uri); } }
php
function extensionResponse($namespace_uri, $require_signed) { if ($require_signed) { return $this->getSignedNS($namespace_uri); } else { return $this->message->getArgs($namespace_uri); } }
[ "function", "extensionResponse", "(", "$", "namespace_uri", ",", "$", "require_signed", ")", "{", "if", "(", "$", "require_signed", ")", "{", "return", "$", "this", "->", "getSignedNS", "(", "$", "namespace_uri", ")", ";", "}", "else", "{", "return", "$", ...
Extract signed extension data from the server's response. @param $namespace_uri @param $require_signed @return array|Auth_OpenID_FailureResponse|null|string @internal param string $prefix The extension namespace from which to extract the extension data.
[ "Extract", "signed", "extension", "data", "from", "the", "server", "s", "response", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/OpenID/Consumer.php#L2172-L2179
openid/php-openid
Auth/Yadis/Yadis.php
Auth_Yadis_Yadis.getHTTPFetcher
static function getHTTPFetcher($timeout = 20) { if (Auth_Yadis_Yadis::curlPresent() && (!defined('Auth_Yadis_CURL_OVERRIDE'))) { $fetcher = new Auth_Yadis_ParanoidHTTPFetcher($timeout); } else { $fetcher = new Auth_Yadis_PlainHTTPFetcher($timeout); } ...
php
static function getHTTPFetcher($timeout = 20) { if (Auth_Yadis_Yadis::curlPresent() && (!defined('Auth_Yadis_CURL_OVERRIDE'))) { $fetcher = new Auth_Yadis_ParanoidHTTPFetcher($timeout); } else { $fetcher = new Auth_Yadis_PlainHTTPFetcher($timeout); } ...
[ "static", "function", "getHTTPFetcher", "(", "$", "timeout", "=", "20", ")", "{", "if", "(", "Auth_Yadis_Yadis", "::", "curlPresent", "(", ")", "&&", "(", "!", "defined", "(", "'Auth_Yadis_CURL_OVERRIDE'", ")", ")", ")", "{", "$", "fetcher", "=", "new", ...
Returns an HTTP fetcher object. If the CURL extension is present, an instance of {@link Auth_Yadis_ParanoidHTTPFetcher} is returned. If not, an instance of {@link Auth_Yadis_PlainHTTPFetcher} is returned. If Auth_Yadis_CURL_OVERRIDE is defined, this method will always return a {@link Auth_Yadis_PlainHTTPFetcher}. @...
[ "Returns", "an", "HTTP", "fetcher", "object", ".", "If", "the", "CURL", "extension", "is", "present", "an", "instance", "of", "{", "@link", "Auth_Yadis_ParanoidHTTPFetcher", "}", "is", "returned", ".", "If", "not", "an", "instance", "of", "{", "@link", "Auth...
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Yadis.php#L263-L272
openid/php-openid
Auth/Yadis/Yadis.php
Auth_Yadis_Yadis.discover
static function discover($uri, $fetcher, $extra_ns_map = null, $timeout = 20) { $result = new Auth_Yadis_DiscoveryResult($uri); $headers = array("Accept: " . Auth_Yadis_CONTENT_TYPE . ', text/html; q=0.3, application/xhtml+xml; q=0.5'); if ($f...
php
static function discover($uri, $fetcher, $extra_ns_map = null, $timeout = 20) { $result = new Auth_Yadis_DiscoveryResult($uri); $headers = array("Accept: " . Auth_Yadis_CONTENT_TYPE . ', text/html; q=0.3, application/xhtml+xml; q=0.5'); if ($f...
[ "static", "function", "discover", "(", "$", "uri", ",", "$", "fetcher", ",", "$", "extra_ns_map", "=", "null", ",", "$", "timeout", "=", "20", ")", "{", "$", "result", "=", "new", "Auth_Yadis_DiscoveryResult", "(", "$", "uri", ")", ";", "$", "headers",...
This should be called statically and will build a Yadis instance if the discovery process succeeds. This implements Yadis discovery as specified in the Yadis specification. @param string $uri The URI on which to perform Yadis discovery. @param Auth_Yadis_HTTPFetcher $fetcher An instance of a Auth_Yadis_HTTPFetcher s...
[ "This", "should", "be", "called", "statically", "and", "will", "build", "a", "Yadis", "instance", "if", "the", "discovery", "process", "succeeds", ".", "This", "implements", "Yadis", "discovery", "as", "specified", "in", "the", "Yadis", "specification", "." ]
train
https://github.com/openid/php-openid/blob/99d24177dbad21d13878ac653bbfb1ed18b66114/Auth/Yadis/Yadis.php#L332-L390
sngrl/php-firebase-cloud-messaging
src/Client.php
Client.processTopicSubscription
protected function processTopicSubscription($topic_id, $recipients_tokens, $url) { if (!is_array($recipients_tokens)) $recipients_tokens = [$recipients_tokens]; return $this->guzzleClient->post( $url, [ 'headers' => [ 'Authoriz...
php
protected function processTopicSubscription($topic_id, $recipients_tokens, $url) { if (!is_array($recipients_tokens)) $recipients_tokens = [$recipients_tokens]; return $this->guzzleClient->post( $url, [ 'headers' => [ 'Authoriz...
[ "protected", "function", "processTopicSubscription", "(", "$", "topic_id", ",", "$", "recipients_tokens", ",", "$", "url", ")", "{", "if", "(", "!", "is_array", "(", "$", "recipients_tokens", ")", ")", "$", "recipients_tokens", "=", "[", "$", "recipients_token...
@param integer $topic_id @param array|string $recipients_tokens @param string $url @return \Psr\Http\Message\ResponseInterface
[ "@param", "integer", "$topic_id", "@param", "array|string", "$recipients_tokens", "@param", "string", "$url" ]
train
https://github.com/sngrl/php-firebase-cloud-messaging/blob/e1a344c20c6d7dc4f89dcc5a56b17129d007d2b2/src/Client.php#L105-L123
sngrl/php-firebase-cloud-messaging
src/Message.php
Message.addRecipient
public function addRecipient(Recipient $recipient) { $this->recipients[] = $recipient; if (!isset($this->recipientType)) { $this->recipientType = get_class($recipient); } if ($this->recipientType !== get_class($recipient)) { throw new \InvalidArgumentExceptio...
php
public function addRecipient(Recipient $recipient) { $this->recipients[] = $recipient; if (!isset($this->recipientType)) { $this->recipientType = get_class($recipient); } if ($this->recipientType !== get_class($recipient)) { throw new \InvalidArgumentExceptio...
[ "public", "function", "addRecipient", "(", "Recipient", "$", "recipient", ")", "{", "$", "this", "->", "recipients", "[", "]", "=", "$", "recipient", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "recipientType", ")", ")", "{", "$", "this", "...
where should the message go @param Recipient $recipient @return \sngrl\PhpFirebaseCloudMessaging\Message
[ "where", "should", "the", "message", "go" ]
train
https://github.com/sngrl/php-firebase-cloud-messaging/blob/e1a344c20c6d7dc4f89dcc5a56b17129d007d2b2/src/Message.php#L40-L52
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.getSignature
public function getSignature(RequestInterface $request, array $params) { // Remove oauth_signature if present // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.") unset($params['oauth_signature']); // Add POST fields if the request uses POST fields and no files ...
php
public function getSignature(RequestInterface $request, array $params) { // Remove oauth_signature if present // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.") unset($params['oauth_signature']); // Add POST fields if the request uses POST fields and no files ...
[ "public", "function", "getSignature", "(", "RequestInterface", "$", "request", ",", "array", "$", "params", ")", "{", "// Remove oauth_signature if present", "// Ref: Spec: 9.1.1 (\"The oauth_signature parameter MUST be excluded.\")", "unset", "(", "$", "params", "[", "'oauth...
Calculate signature for request @param RequestInterface $request Request to generate a signature for @param array $params Oauth parameters. @return string @throws \RuntimeException
[ "Calculate", "signature", "for", "request" ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L134-L172
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.generateNonce
public function generateNonce(RequestInterface $request) { return sha1(uniqid('', true) . $request->getUri()->getHost() . $request->getUri()->getPath()); }
php
public function generateNonce(RequestInterface $request) { return sha1(uniqid('', true) . $request->getUri()->getHost() . $request->getUri()->getPath()); }
[ "public", "function", "generateNonce", "(", "RequestInterface", "$", "request", ")", "{", "return", "sha1", "(", "uniqid", "(", "''", ",", "true", ")", ".", "$", "request", "->", "getUri", "(", ")", "->", "getHost", "(", ")", ".", "$", "request", "->",...
Returns a Nonce Based on the unique id and URL. This will allow for multiple requests in parallel with the same exact timestamp to use separate nonce's. @param RequestInterface $request Request to generate a nonce for @return string
[ "Returns", "a", "Nonce", "Based", "on", "the", "unique", "id", "and", "URL", "." ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L184-L187
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.createBaseString
protected function createBaseString(RequestInterface $request, array $params) { // Remove query params from URL. Ref: Spec: 9.1.2. $url = $request->getUri()->withQuery(''); $query = http_build_query($params, '', '&', PHP_QUERY_RFC3986); return strtoupper($request->getMethod()) ...
php
protected function createBaseString(RequestInterface $request, array $params) { // Remove query params from URL. Ref: Spec: 9.1.2. $url = $request->getUri()->withQuery(''); $query = http_build_query($params, '', '&', PHP_QUERY_RFC3986); return strtoupper($request->getMethod()) ...
[ "protected", "function", "createBaseString", "(", "RequestInterface", "$", "request", ",", "array", "$", "params", ")", "{", "// Remove query params from URL. Ref: Spec: 9.1.2.", "$", "url", "=", "$", "request", "->", "getUri", "(", ")", "->", "withQuery", "(", "'...
Creates the Signature Base String. The Signature Base String is a consistent reproducible concatenation of the request elements into a single string. The string is used as an input in hashing or signing algorithms. @param RequestInterface $request Request being signed @param array $params Associative arra...
[ "Creates", "the", "Signature", "Base", "String", "." ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L202-L211
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.prepareParameters
private function prepareParameters($data) { // Parameters are sorted by name, using lexicographical byte value // ordering. Ref: Spec: 9.1.1 (1). uksort($data, 'strcmp'); foreach ($data as $key => $value) { if ($value === null) { unset($data[$key]); ...
php
private function prepareParameters($data) { // Parameters are sorted by name, using lexicographical byte value // ordering. Ref: Spec: 9.1.1 (1). uksort($data, 'strcmp'); foreach ($data as $key => $value) { if ($value === null) { unset($data[$key]); ...
[ "private", "function", "prepareParameters", "(", "$", "data", ")", "{", "// Parameters are sorted by name, using lexicographical byte value", "// ordering. Ref: Spec: 9.1.1 (1).", "uksort", "(", "$", "data", ",", "'strcmp'", ")", ";", "foreach", "(", "$", "data", "as", ...
Convert booleans to strings, removed unset parameters, and sorts the array @param array $data Data array @return array
[ "Convert", "booleans", "to", "strings", "removed", "unset", "parameters", "and", "sorts", "the", "array" ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L220-L233
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.signUsingHmacSha1
private function signUsingHmacSha1($baseString) { $key = rawurlencode($this->config['consumer_secret']) . '&' . rawurlencode($this->config['token_secret']); return hash_hmac('sha1', $baseString, $key, true); }
php
private function signUsingHmacSha1($baseString) { $key = rawurlencode($this->config['consumer_secret']) . '&' . rawurlencode($this->config['token_secret']); return hash_hmac('sha1', $baseString, $key, true); }
[ "private", "function", "signUsingHmacSha1", "(", "$", "baseString", ")", "{", "$", "key", "=", "rawurlencode", "(", "$", "this", "->", "config", "[", "'consumer_secret'", "]", ")", ".", "'&'", ".", "rawurlencode", "(", "$", "this", "->", "config", "[", "...
@param string $baseString @return string
[ "@param", "string", "$baseString" ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L240-L246
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.signUsingRsaSha1
private function signUsingRsaSha1($baseString) { if (!function_exists('openssl_pkey_get_private')) { throw new \RuntimeException('RSA-SHA1 signature method ' . 'requires the OpenSSL extension.'); } $privateKey = openssl_pkey_get_private( file_get_cont...
php
private function signUsingRsaSha1($baseString) { if (!function_exists('openssl_pkey_get_private')) { throw new \RuntimeException('RSA-SHA1 signature method ' . 'requires the OpenSSL extension.'); } $privateKey = openssl_pkey_get_private( file_get_cont...
[ "private", "function", "signUsingRsaSha1", "(", "$", "baseString", ")", "{", "if", "(", "!", "function_exists", "(", "'openssl_pkey_get_private'", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'RSA-SHA1 signature method '", ".", "'requires the OpenSSL...
@param string $baseString @return string
[ "@param", "string", "$baseString" ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L253-L270
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.buildAuthorizationHeader
private function buildAuthorizationHeader(array $params) { foreach ($params as $key => $value) { $params[$key] = $key . '="' . rawurlencode($value) . '"'; } if (isset($this->config['realm'])) { array_unshift( $params, 'realm="' . rawur...
php
private function buildAuthorizationHeader(array $params) { foreach ($params as $key => $value) { $params[$key] = $key . '="' . rawurlencode($value) . '"'; } if (isset($this->config['realm'])) { array_unshift( $params, 'realm="' . rawur...
[ "private", "function", "buildAuthorizationHeader", "(", "array", "$", "params", ")", "{", "foreach", "(", "$", "params", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "params", "[", "$", "key", "]", "=", "$", "key", ".", "'=\"'", ".", "rawurle...
Builds the Authorization header for a request @param array $params Associative array of authorization parameters. @return array
[ "Builds", "the", "Authorization", "header", "for", "a", "request" ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L289-L303
guzzle/oauth-subscriber
src/Oauth1.php
Oauth1.getOauthParams
private function getOauthParams($nonce, array $config) { $params = [ 'oauth_consumer_key' => $config['consumer_key'], 'oauth_nonce' => $nonce, 'oauth_signature_method' => $config['signature_method'], 'oauth_timestamp' => time(), ]...
php
private function getOauthParams($nonce, array $config) { $params = [ 'oauth_consumer_key' => $config['consumer_key'], 'oauth_nonce' => $nonce, 'oauth_signature_method' => $config['signature_method'], 'oauth_timestamp' => time(), ]...
[ "private", "function", "getOauthParams", "(", "$", "nonce", ",", "array", "$", "config", ")", "{", "$", "params", "=", "[", "'oauth_consumer_key'", "=>", "$", "config", "[", "'consumer_key'", "]", ",", "'oauth_nonce'", "=>", "$", "nonce", ",", "'oauth_signat...
Get the oauth parameters as named by the oauth spec @param string $nonce Unique nonce @param array $config Configuration options of the plugin. @return array
[ "Get", "the", "oauth", "parameters", "as", "named", "by", "the", "oauth", "spec" ]
train
https://github.com/guzzle/oauth-subscriber/blob/8b2f3f924d46ac187b0d8df1ed3e96c5ccfd3d85/src/Oauth1.php#L313-L339
supervisorphp/supervisor
src/Exception/Fault.php
Fault.create
public static function create($faultString, $faultCode) { if (!isset(self::$exceptionMap[$faultCode])) { return new self($faultString, $faultCode); } return new self::$exceptionMap[$faultCode]($faultString, $faultCode); }
php
public static function create($faultString, $faultCode) { if (!isset(self::$exceptionMap[$faultCode])) { return new self($faultString, $faultCode); } return new self::$exceptionMap[$faultCode]($faultString, $faultCode); }
[ "public", "static", "function", "create", "(", "$", "faultString", ",", "$", "faultCode", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "exceptionMap", "[", "$", "faultCode", "]", ")", ")", "{", "return", "new", "self", "(", "$", "faultS...
Creates a new Fault. If there is a mach for the fault code in the exception map then the matched exception will be returned @param string $faultString @param int $faultCode @return self
[ "Creates", "a", "new", "Fault", "." ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/src/Exception/Fault.php#L71-L78
supervisorphp/supervisor
RoboFile.php
RoboFile.faults
public function faults() { $faultReflection = new \ReflectionClass('Supervisor\Exception\Fault'); $faults = array_flip($faultReflection->getConstants()); $this->taskCleanDir([__DIR__.'/src/Exception/Fault'])->run(); foreach ($faults as $code => $name) { $exName = $this-...
php
public function faults() { $faultReflection = new \ReflectionClass('Supervisor\Exception\Fault'); $faults = array_flip($faultReflection->getConstants()); $this->taskCleanDir([__DIR__.'/src/Exception/Fault'])->run(); foreach ($faults as $code => $name) { $exName = $this-...
[ "public", "function", "faults", "(", ")", "{", "$", "faultReflection", "=", "new", "\\", "ReflectionClass", "(", "'Supervisor\\Exception\\Fault'", ")", ";", "$", "faults", "=", "array_flip", "(", "$", "faultReflection", "->", "getConstants", "(", ")", ")", ";"...
Generates fault exception classes
[ "Generates", "fault", "exception", "classes" ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/RoboFile.php#L15-L32
supervisorphp/supervisor
RoboFile.php
RoboFile.createExceptionName
protected function createExceptionName($faultString) { $parts = explode('_', $faultString); $parts = array_map(function($el) { return ucfirst(strtolower($el)); }, $parts); return implode('', $parts); }
php
protected function createExceptionName($faultString) { $parts = explode('_', $faultString); $parts = array_map(function($el) { return ucfirst(strtolower($el)); }, $parts); return implode('', $parts); }
[ "protected", "function", "createExceptionName", "(", "$", "faultString", ")", "{", "$", "parts", "=", "explode", "(", "'_'", ",", "$", "faultString", ")", ";", "$", "parts", "=", "array_map", "(", "function", "(", "$", "el", ")", "{", "return", "ucfirst"...
Returns a CamelCased exception name from UNDER_SCORED fault string @param string $faultString @return string
[ "Returns", "a", "CamelCased", "exception", "name", "from", "UNDER_SCORED", "fault", "string" ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/RoboFile.php#L41-L48
supervisorphp/supervisor
src/Process.php
Process.offsetGet
public function offsetGet($offset) { return isset($this->payload[$offset]) ? $this->payload[$offset] : null; }
php
public function offsetGet($offset) { return isset($this->payload[$offset]) ? $this->payload[$offset] : null; }
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "return", "isset", "(", "$", "this", "->", "payload", "[", "$", "offset", "]", ")", "?", "$", "this", "->", "payload", "[", "$", "offset", "]", ":", "null", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/src/Process.php#L94-L97
supervisorphp/supervisor
src/Connector/XmlRpc.php
XmlRpc.call
public function call($namespace, $method, array $arguments = []) { try { return $this->client->call($namespace.'.'.$method, $arguments); } catch (ResponseException $e) { throw Fault::create($e->getFaultString(), $e->getFaultCode()); } }
php
public function call($namespace, $method, array $arguments = []) { try { return $this->client->call($namespace.'.'.$method, $arguments); } catch (ResponseException $e) { throw Fault::create($e->getFaultString(), $e->getFaultCode()); } }
[ "public", "function", "call", "(", "$", "namespace", ",", "$", "method", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "try", "{", "return", "$", "this", "->", "client", "->", "call", "(", "$", "namespace", ".", "'.'", ".", "$", "method"...
{@inheritdoc}
[ "{" ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/src/Connector/XmlRpc.php#L33-L40
supervisorphp/supervisor
src/Supervisor.php
Supervisor.getAllProcesses
public function getAllProcesses() { $processes = $this->getAllProcessInfo(); foreach ($processes as $key => $processInfo) { $processes[$key] = new Process($processInfo); } return $processes; }
php
public function getAllProcesses() { $processes = $this->getAllProcessInfo(); foreach ($processes as $key => $processInfo) { $processes[$key] = new Process($processInfo); } return $processes; }
[ "public", "function", "getAllProcesses", "(", ")", "{", "$", "processes", "=", "$", "this", "->", "getAllProcessInfo", "(", ")", ";", "foreach", "(", "$", "processes", "as", "$", "key", "=>", "$", "processInfo", ")", "{", "$", "processes", "[", "$", "k...
Returns all processes as Process objects. @return array Array of Process objects
[ "Returns", "all", "processes", "as", "Process", "objects", "." ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/src/Supervisor.php#L133-L142
supervisorphp/supervisor
src/Connector/Zend.php
Zend.call
public function call($namespace, $method, array $arguments = []) { try { return $this->client->call($namespace.'.'.$method, $arguments); } catch (FaultException $e) { throw Fault::create($e->getMessage(), $e->getCode()); } }
php
public function call($namespace, $method, array $arguments = []) { try { return $this->client->call($namespace.'.'.$method, $arguments); } catch (FaultException $e) { throw Fault::create($e->getMessage(), $e->getCode()); } }
[ "public", "function", "call", "(", "$", "namespace", ",", "$", "method", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "try", "{", "return", "$", "this", "->", "client", "->", "call", "(", "$", "namespace", ".", "'.'", ".", "$", "method"...
{@inheritdoc}
[ "{" ]
train
https://github.com/supervisorphp/supervisor/blob/f1f42c3e86411ae929e6af88f61a59e2f95efc2b/src/Connector/Zend.php#L37-L44
rollerworks/PasswordStrengthValidator
src/Blacklist/PdoProvider.php
PdoProvider.add
public function add($password) { if (!is_scalar($password)) { throw new \InvalidArgumentException('Only scalar values are accepted.'); } if ('' === $password) { return -1; } $db = $this->initDb(); $args = [ ':password' => $passwor...
php
public function add($password) { if (!is_scalar($password)) { throw new \InvalidArgumentException('Only scalar values are accepted.'); } if ('' === $password) { return -1; } $db = $this->initDb(); $args = [ ':password' => $passwor...
[ "public", "function", "add", "(", "$", "password", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "password", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Only scalar values are accepted.'", ")", ";", "}", "if", "(", "''", "===...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/PdoProvider.php#L43-L75
rollerworks/PasswordStrengthValidator
src/Blacklist/PdoProvider.php
PdoProvider.delete
public function delete($password) { if (!is_scalar($password)) { throw new \InvalidArgumentException('Only scalar values are accepted.'); } $db = $this->initDb(); $args = [ ':password' => $password, ]; try { $this->exec($db, 'DELE...
php
public function delete($password) { if (!is_scalar($password)) { throw new \InvalidArgumentException('Only scalar values are accepted.'); } $db = $this->initDb(); $args = [ ':password' => $password, ]; try { $this->exec($db, 'DELE...
[ "public", "function", "delete", "(", "$", "password", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "password", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Only scalar values are accepted.'", ")", ";", "}", "$", "db", "=", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/PdoProvider.php#L80-L103
rollerworks/PasswordStrengthValidator
src/Blacklist/PdoProvider.php
PdoProvider.purge
public function purge() { $db = $this->initDb(); $this->exec($db, 'DELETE FROM rollerworks_passdbl'); $this->close($db); }
php
public function purge() { $db = $this->initDb(); $this->exec($db, 'DELETE FROM rollerworks_passdbl'); $this->close($db); }
[ "public", "function", "purge", "(", ")", "{", "$", "db", "=", "$", "this", "->", "initDb", "(", ")", ";", "$", "this", "->", "exec", "(", "$", "db", ",", "'DELETE FROM rollerworks_passdbl'", ")", ";", "$", "this", "->", "close", "(", "$", "db", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/PdoProvider.php#L118-L123
rollerworks/PasswordStrengthValidator
src/Blacklist/PdoProvider.php
PdoProvider.isBlacklisted
public function isBlacklisted($password) { if (!is_scalar($password)) { throw new \InvalidArgumentException('Only scalar values are accepted.'); } $db = $this->initDb(); $tokenExists = $this->fetch($db, 'SELECT 1 FROM rollerworks_passdbl WHERE passwd = :password LIMIT 1'...
php
public function isBlacklisted($password) { if (!is_scalar($password)) { throw new \InvalidArgumentException('Only scalar values are accepted.'); } $db = $this->initDb(); $tokenExists = $this->fetch($db, 'SELECT 1 FROM rollerworks_passdbl WHERE passwd = :password LIMIT 1'...
[ "public", "function", "isBlacklisted", "(", "$", "password", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "password", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Only scalar values are accepted.'", ")", ";", "}", "$", "db", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/PdoProvider.php#L128-L138
rollerworks/PasswordStrengthValidator
src/Blacklist/PdoProvider.php
PdoProvider.fetch
protected function fetch($db, $query, array $args = []) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); } $stmt->execute(); return $stmt->fetchAll(\...
php
protected function fetch($db, $query, array $args = []) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); } $stmt->execute(); return $stmt->fetchAll(\...
[ "protected", "function", "fetch", "(", "$", "db", ",", "$", "query", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "stmt", "=", "$", "this", "->", "prepareStatement", "(", "$", "db", ",", "$", "query", ")", ";", "foreach", "(", "$", ...
@param object $db @param string $query @param array $args @return mixed
[ "@param", "object", "$db", "@param", "string", "$query", "@param", "array", "$args" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/PdoProvider.php#L154-L164
rollerworks/PasswordStrengthValidator
src/Blacklist/PdoProvider.php
PdoProvider.exec
protected function exec($db, $query, array $args = []) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); } $success = $stmt->execute(); if (!$success)...
php
protected function exec($db, $query, array $args = []) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); } $success = $stmt->execute(); if (!$success)...
[ "protected", "function", "exec", "(", "$", "db", ",", "$", "query", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "stmt", "=", "$", "this", "->", "prepareStatement", "(", "$", "db", ",", "$", "query", ")", ";", "foreach", "(", "$", "...
@param object $db @param string $query @param array $args @throws \RuntimeException
[ "@param", "object", "$db", "@param", "string", "$query", "@param", "array", "$args" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/PdoProvider.php#L173-L185
rollerworks/PasswordStrengthValidator
src/P0wnedPassword/Request/Client.php
Client.check
public function check($password) { $hashedPassword = strtoupper(sha1($password)); $checkHash = substr($hashedPassword, 0, 5); try { $response = $this->client->sendRequest(new Request('GET', 'https://api.pwnedpasswords.com/range/'.$checkHash)); if ($response->getStatu...
php
public function check($password) { $hashedPassword = strtoupper(sha1($password)); $checkHash = substr($hashedPassword, 0, 5); try { $response = $this->client->sendRequest(new Request('GET', 'https://api.pwnedpasswords.com/range/'.$checkHash)); if ($response->getStatu...
[ "public", "function", "check", "(", "$", "password", ")", "{", "$", "hashedPassword", "=", "strtoupper", "(", "sha1", "(", "$", "password", ")", ")", ";", "$", "checkHash", "=", "substr", "(", "$", "hashedPassword", ",", "0", ",", "5", ")", ";", "try...
@param $password @return Result @throws \Http\Client\Exception
[ "@param", "$password" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/P0wnedPassword/Request/Client.php#L41-L68
rollerworks/PasswordStrengthValidator
src/Blacklist/ChainProvider.php
ChainProvider.addProvider
public function addProvider(BlacklistProviderInterface $provider) { if ($provider === $this) { throw new \RuntimeException('Unable to add ChainProvider to itself.'); } $this->providers[] = $provider; return $this; }
php
public function addProvider(BlacklistProviderInterface $provider) { if ($provider === $this) { throw new \RuntimeException('Unable to add ChainProvider to itself.'); } $this->providers[] = $provider; return $this; }
[ "public", "function", "addProvider", "(", "BlacklistProviderInterface", "$", "provider", ")", "{", "if", "(", "$", "provider", "===", "$", "this", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Unable to add ChainProvider to itself.'", ")", ";", "}", ...
Adds a new blacklist provider. @param BlacklistProviderInterface $provider @throws \RuntimeException @return self
[ "Adds", "a", "new", "blacklist", "provider", "." ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/ChainProvider.php#L47-L56
rollerworks/PasswordStrengthValidator
src/Blacklist/ChainProvider.php
ChainProvider.isBlacklisted
public function isBlacklisted($password) { foreach ($this->providers as $provider) { if (true === $provider->isBlacklisted($password)) { return true; } } return false; }
php
public function isBlacklisted($password) { foreach ($this->providers as $provider) { if (true === $provider->isBlacklisted($password)) { return true; } } return false; }
[ "public", "function", "isBlacklisted", "(", "$", "password", ")", "{", "foreach", "(", "$", "this", "->", "providers", "as", "$", "provider", ")", "{", "if", "(", "true", "===", "$", "provider", "->", "isBlacklisted", "(", "$", "password", ")", ")", "{...
Runs trough all the providers until one returns true. {@inheritdoc}
[ "Runs", "trough", "all", "the", "providers", "until", "one", "returns", "true", "." ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/ChainProvider.php#L73-L82
rollerworks/PasswordStrengthValidator
src/Validator/Constraints/P0wnedPasswordValidator.php
P0wnedPasswordValidator.validate
public function validate($password, Constraint $constraint) { if (null === $password) { return; } if (!is_scalar($password) && !(is_object($password) && method_exists($password, '__toString'))) { throw new UnexpectedTypeException($password, 'string'); } ...
php
public function validate($password, Constraint $constraint) { if (null === $password) { return; } if (!is_scalar($password) && !(is_object($password) && method_exists($password, '__toString'))) { throw new UnexpectedTypeException($password, 'string'); } ...
[ "public", "function", "validate", "(", "$", "password", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "null", "===", "$", "password", ")", "{", "return", ";", "}", "if", "(", "!", "is_scalar", "(", "$", "password", ")", "&&", "!", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Validator/Constraints/P0wnedPasswordValidator.php#L37-L56
rollerworks/PasswordStrengthValidator
src/Command/BlacklistPurgeCommand.php
BlacklistPurgeCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); if (!$input->getOption('no-ask')) { $io->warning('This will remove all the passwords from your blacklist.'); if (!$io->confirm('Are you sure you want to pur...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); if (!$input->getOption('no-ask')) { $io->warning('This will remove all the passwords from your blacklist.'); if (!$io->confirm('Are you sure you want to pur...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "if", "(", "!", "$", "input", "->", "getOp...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Command/BlacklistPurgeCommand.php#L36-L51
rollerworks/PasswordStrengthValidator
src/Blacklist/SqliteProvider.php
SqliteProvider.all
public function all() { $db = $this->initDb(); if ($db instanceof \SQLite3) { return $this->fetch($db, 'SELECT passwd FROM rollerworks_passdbl'); } return $this->exec($db, 'SELECT passwd FROM rollerworks_passdbl'); }
php
public function all() { $db = $this->initDb(); if ($db instanceof \SQLite3) { return $this->fetch($db, 'SELECT passwd FROM rollerworks_passdbl'); } return $this->exec($db, 'SELECT passwd FROM rollerworks_passdbl'); }
[ "public", "function", "all", "(", ")", "{", "$", "db", "=", "$", "this", "->", "initDb", "(", ")", ";", "if", "(", "$", "db", "instanceof", "\\", "SQLite3", ")", "{", "return", "$", "this", "->", "fetch", "(", "$", "db", ",", "'SELECT passwd FROM r...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/SqliteProvider.php#L25-L34
rollerworks/PasswordStrengthValidator
src/Blacklist/SqliteProvider.php
SqliteProvider.initDb
protected function initDb() { if (null === $this->db || $this->db instanceof \SQLite3) { if (0 !== strpos($this->dsn, 'sqlite')) { throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Sqlite with an invalid dsn "%s". The expected format is "...
php
protected function initDb() { if (null === $this->db || $this->db instanceof \SQLite3) { if (0 !== strpos($this->dsn, 'sqlite')) { throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Sqlite with an invalid dsn "%s". The expected format is "...
[ "protected", "function", "initDb", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "db", "||", "$", "this", "->", "db", "instanceof", "\\", "SQLite3", ")", "{", "if", "(", "0", "!==", "strpos", "(", "$", "this", "->", "dsn", ",", "'sq...
{@inheritdoc} @throws \RuntimeException When neither of SQLite3 or PDO_SQLite extension is enabled
[ "{", "@inheritdoc", "}" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/SqliteProvider.php#L52-L75
rollerworks/PasswordStrengthValidator
src/Blacklist/SqliteProvider.php
SqliteProvider.exec
protected function exec($db, $query, array $args = []) { if ($db instanceof \SQLite3) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); } ...
php
protected function exec($db, $query, array $args = []) { if ($db instanceof \SQLite3) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); } ...
[ "protected", "function", "exec", "(", "$", "db", ",", "$", "query", ",", "array", "$", "args", "=", "[", "]", ")", "{", "if", "(", "$", "db", "instanceof", "\\", "SQLite3", ")", "{", "$", "stmt", "=", "$", "this", "->", "prepareStatement", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/SqliteProvider.php#L80-L96
rollerworks/PasswordStrengthValidator
src/Blacklist/SqliteProvider.php
SqliteProvider.fetch
protected function fetch($db, $query, array $args = []) { $return = []; if ($db instanceof \SQLite3) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT...
php
protected function fetch($db, $query, array $args = []) { $return = []; if ($db instanceof \SQLite3) { $stmt = $this->prepareStatement($db, $query); foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT...
[ "protected", "function", "fetch", "(", "$", "db", ",", "$", "query", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "return", "=", "[", "]", ";", "if", "(", "$", "db", "instanceof", "\\", "SQLite3", ")", "{", "$", "stmt", "=", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks/PasswordStrengthValidator/blob/428a7bf3e74fcb50fb7225a3f4b451ae2e61d864/src/Blacklist/SqliteProvider.php#L101-L121
yiisoft/yii2-mongodb
src/console/controllers/MigrateController.php
MigrateController.createMigration
protected function createMigration($class) { // since Yii 2.0.12 includeMigrationFile() exists, which replaced the code below // remove this construct when composer requirement raises above 2.0.12 if (method_exists($this, 'includeMigrationFile')) { $this->includeMigrationFile($cl...
php
protected function createMigration($class) { // since Yii 2.0.12 includeMigrationFile() exists, which replaced the code below // remove this construct when composer requirement raises above 2.0.12 if (method_exists($this, 'includeMigrationFile')) { $this->includeMigrationFile($cl...
[ "protected", "function", "createMigration", "(", "$", "class", ")", "{", "// since Yii 2.0.12 includeMigrationFile() exists, which replaced the code below", "// remove this construct when composer requirement raises above 2.0.12", "if", "(", "method_exists", "(", "$", "this", ",", ...
Creates a new migration instance. @param string $class the migration class name @return \yii\mongodb\Migration the migration instance
[ "Creates", "a", "new", "migration", "instance", "." ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/console/controllers/MigrateController.php#L130-L145
yiisoft/yii2-mongodb
src/console/controllers/MigrateController.php
MigrateController.ensureBaseMigrationHistory
protected function ensureBaseMigrationHistory() { if (!$this->baseMigrationEnsured) { $query = new Query; $row = $query->select(['version']) ->from($this->migrationCollection) ->andWhere(['version' => self::BASE_MIGRATION]) ->limit(1) ...
php
protected function ensureBaseMigrationHistory() { if (!$this->baseMigrationEnsured) { $query = new Query; $row = $query->select(['version']) ->from($this->migrationCollection) ->andWhere(['version' => self::BASE_MIGRATION]) ->limit(1) ...
[ "protected", "function", "ensureBaseMigrationHistory", "(", ")", "{", "if", "(", "!", "$", "this", "->", "baseMigrationEnsured", ")", "{", "$", "query", "=", "new", "Query", ";", "$", "row", "=", "$", "query", "->", "select", "(", "[", "'version'", "]", ...
Ensures migration history contains at least base migration entry.
[ "Ensures", "migration", "history", "contains", "at", "least", "base", "migration", "entry", "." ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/console/controllers/MigrateController.php#L206-L220
yiisoft/yii2-mongodb
src/console/controllers/MigrateController.php
MigrateController.addMigrationHistory
protected function addMigrationHistory($version) { $this->db->getCollection($this->migrationCollection)->insert([ 'version' => $version, 'apply_time' => time(), ]); }
php
protected function addMigrationHistory($version) { $this->db->getCollection($this->migrationCollection)->insert([ 'version' => $version, 'apply_time' => time(), ]); }
[ "protected", "function", "addMigrationHistory", "(", "$", "version", ")", "{", "$", "this", "->", "db", "->", "getCollection", "(", "$", "this", "->", "migrationCollection", ")", "->", "insert", "(", "[", "'version'", "=>", "$", "version", ",", "'apply_time'...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/console/controllers/MigrateController.php#L225-L231
yiisoft/yii2-mongodb
src/console/controllers/MigrateController.php
MigrateController.truncateDatabase
protected function truncateDatabase() { $collections = $this->db->getDatabase()->createCommand()->listCollections(); foreach ($collections as $collection) { if (in_array($collection['name'], ['system.roles', 'system.users', 'system.indexes'])) { // prevent deleting datab...
php
protected function truncateDatabase() { $collections = $this->db->getDatabase()->createCommand()->listCollections(); foreach ($collections as $collection) { if (in_array($collection['name'], ['system.roles', 'system.users', 'system.indexes'])) { // prevent deleting datab...
[ "protected", "function", "truncateDatabase", "(", ")", "{", "$", "collections", "=", "$", "this", "->", "db", "->", "getDatabase", "(", ")", "->", "createCommand", "(", ")", "->", "listCollections", "(", ")", ";", "foreach", "(", "$", "collections", "as", ...
{@inheritdoc} @since 2.1.5
[ "{" ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/console/controllers/MigrateController.php#L247-L270
yiisoft/yii2-mongodb
src/Collection.php
Collection.dropIndexes
public function dropIndexes($indexes) { $result = $this->database->createCommand()->dropIndexes($this->name, $indexes); return $result['nIndexesWas']; }
php
public function dropIndexes($indexes) { $result = $this->database->createCommand()->dropIndexes($this->name, $indexes); return $result['nIndexesWas']; }
[ "public", "function", "dropIndexes", "(", "$", "indexes", ")", "{", "$", "result", "=", "$", "this", "->", "database", "->", "createCommand", "(", ")", "->", "dropIndexes", "(", "$", "this", "->", "name", ",", "$", "indexes", ")", ";", "return", "$", ...
Drops collection indexes by name. @param string $indexes wildcard for name of the indexes to be dropped. You can use `*` to drop all indexes. @return int count of dropped indexes.
[ "Drops", "collection", "indexes", "by", "name", "." ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/Collection.php#L124-L128
yiisoft/yii2-mongodb
src/Collection.php
Collection.createIndex
public function createIndex($columns, $options = []) { $index = array_merge(['key' => $columns], $options); return $this->database->createCommand()->createIndexes($this->name, [$index]); }
php
public function createIndex($columns, $options = []) { $index = array_merge(['key' => $columns], $options); return $this->database->createCommand()->createIndexes($this->name, [$index]); }
[ "public", "function", "createIndex", "(", "$", "columns", ",", "$", "options", "=", "[", "]", ")", "{", "$", "index", "=", "array_merge", "(", "[", "'key'", "=>", "$", "columns", "]", ",", "$", "options", ")", ";", "return", "$", "this", "->", "dat...
Creates an index on the collection and the specified fields. @param array|string $columns column name or list of column names. If array is given, each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort. You can specify field using native numeric key with ...
[ "Creates", "an", "index", "on", "the", "collection", "and", "the", "specified", "fields", ".", "@param", "array|string", "$columns", "column", "name", "or", "list", "of", "column", "names", ".", "If", "array", "is", "given", "each", "element", "in", "the", ...
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/Collection.php#L150-L154
yiisoft/yii2-mongodb
src/Collection.php
Collection.dropIndex
public function dropIndex($columns) { $existingIndexes = $this->listIndexes(); $indexKey = $this->database->connection->getQueryBuilder()->buildSortFields($columns); foreach ($existingIndexes as $index) { if ($index['key'] == $indexKey) { $this->database->createC...
php
public function dropIndex($columns) { $existingIndexes = $this->listIndexes(); $indexKey = $this->database->connection->getQueryBuilder()->buildSortFields($columns); foreach ($existingIndexes as $index) { if ($index['key'] == $indexKey) { $this->database->createC...
[ "public", "function", "dropIndex", "(", "$", "columns", ")", "{", "$", "existingIndexes", "=", "$", "this", "->", "listIndexes", "(", ")", ";", "$", "indexKey", "=", "$", "this", "->", "database", "->", "connection", "->", "getQueryBuilder", "(", ")", "-...
Drop indexes for specified column(s). @param string|array $columns column name or list of column names. If array is given, each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort. Use value 'text' to specify text index. You can specify field using native ...
[ "Drop", "indexes", "for", "specified", "column", "(", "s", ")", ".", "@param", "string|array", "$columns", "column", "name", "or", "list", "of", "column", "names", ".", "If", "array", "is", "given", "each", "element", "in", "the", "array", "has", "as", "...
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/Collection.php#L177-L199
yiisoft/yii2-mongodb
src/Collection.php
Collection.find
public function find($condition = [], $fields = [], $options = []) { if (!empty($fields)) { $options['projection'] = $fields; } return $this->database->createCommand()->find($this->name, $condition, $options); }
php
public function find($condition = [], $fields = [], $options = []) { if (!empty($fields)) { $options['projection'] = $fields; } return $this->database->createCommand()->find($this->name, $condition, $options); }
[ "public", "function", "find", "(", "$", "condition", "=", "[", "]", ",", "$", "fields", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "fields", ")", ")", "{", "$", "options", "[", "'projection'"...
Returns a cursor for the search results. In order to perform "find" queries use [[Query]] class. @param array $condition query condition @param array $fields fields to be selected @param array $options query options (available since 2.1). @return \MongoDB\Driver\Cursor cursor for the search results @see Query
[ "Returns", "a", "cursor", "for", "the", "search", "results", ".", "In", "order", "to", "perform", "find", "queries", "use", "[[", "Query", "]]", "class", "." ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/Collection.php#L221-L227
yiisoft/yii2-mongodb
src/Collection.php
Collection.findOne
public function findOne($condition = [], $fields = [], $options = []) { $options['limit'] = 1; $cursor = $this->find($condition, $fields, $options); $rows = $cursor->toArray(); return empty($rows) ? null : current($rows); }
php
public function findOne($condition = [], $fields = [], $options = []) { $options['limit'] = 1; $cursor = $this->find($condition, $fields, $options); $rows = $cursor->toArray(); return empty($rows) ? null : current($rows); }
[ "public", "function", "findOne", "(", "$", "condition", "=", "[", "]", ",", "$", "fields", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'limit'", "]", "=", "1", ";", "$", "cursor", "=", "$", "this", "->", ...
Returns a single document. @param array $condition query condition @param array $fields fields to be selected @param array $options query options (available since 2.1). @return array|null the single document. Null is returned if the query results in nothing.
[ "Returns", "a", "single", "document", "." ]
train
https://github.com/yiisoft/yii2-mongodb/blob/7f8d9862ac6c133d63afda171860ca9b61563d27/src/Collection.php#L236-L242