repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
tw88/sso | src/Broker.php | Broker.login | public function login($username = null, $password = null)
{
if (!isset($username) && isset($_POST['username'])) {
$username = $_POST['username'];
}
if (!isset($password) && isset($_POST['password'])) {
$password = $_POST['password'];
}
$result = $this... | php | public function login($username = null, $password = null)
{
if (!isset($username) && isset($_POST['username'])) {
$username = $_POST['username'];
}
if (!isset($password) && isset($_POST['password'])) {
$password = $_POST['password'];
}
$result = $this... | [
"public",
"function",
"login",
"(",
"$",
"username",
"=",
"null",
",",
"$",
"password",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"username",
")",
"&&",
"isset",
"(",
"$",
"_POST",
"[",
"'username'",
"]",
")",
")",
"{",
"$",
"user... | Log the client in at the SSO server.
Only brokers marked trused can collect and send the user's credentials. Other brokers should omit $username and
$password.
@param string $username
@param string $password
@return array user info
@throws Exception if login fails eg due to incorrect credentials | [
"Log",
"the",
"client",
"in",
"at",
"the",
"SSO",
"server",
"."
] | 746323f3087af5a06769f7c207ab4ed5124a14bb | https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Broker.php#L283-L296 | train |
squareproton/Bond | src/Bond/Pg/QueryExceptionFactory.php | QueryExceptionFactory.get | public function get()
{
$class = null;
// decide the most accurate exception we've got for this state and throw that
if( $this->state ) {
for( $i = 5; $i > 0; $i-- ) {
$exceptionQueue[] = sprintf(
"State%s",
substr( $this->state, ... | php | public function get()
{
$class = null;
// decide the most accurate exception we've got for this state and throw that
if( $this->state ) {
for( $i = 5; $i > 0; $i-- ) {
$exceptionQueue[] = sprintf(
"State%s",
substr( $this->state, ... | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"class",
"=",
"null",
";",
"// decide the most accurate exception we've got for this state and throw that",
"if",
"(",
"$",
"this",
"->",
"state",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"5",
";",
"$",
"i",
">",
... | Get the actual exception
@return Bond\Pg\Exception\QueryException | [
"Get",
"the",
"actual",
"exception"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/QueryExceptionFactory.php#L328-L368 | train |
native5/native5-sdk-client-php | src/Native5/Control/ProtectedController.php | ProtectedController.execute | public function execute($request)
{
$logger = $GLOBALS['logger'];
try {
parent::execute($request);
} catch(AuthenticationException $ex) {
$logger->error('Unauthorized attempt to access resource, being redirected to home page', array($ex->getMessage()));
$... | php | public function execute($request)
{
$logger = $GLOBALS['logger'];
try {
parent::execute($request);
} catch(AuthenticationException $ex) {
$logger->error('Unauthorized attempt to access resource, being redirected to home page', array($ex->getMessage()));
$... | [
"public",
"function",
"execute",
"(",
"$",
"request",
")",
"{",
"$",
"logger",
"=",
"$",
"GLOBALS",
"[",
"'logger'",
"]",
";",
"try",
"{",
"parent",
"::",
"execute",
"(",
"$",
"request",
")",
";",
"}",
"catch",
"(",
"AuthenticationException",
"$",
"ex"... | Checks for secure routing,
currently security is handled at a base route level,
@param mixed $request Execute request.
@access public
@return void | [
"Checks",
"for",
"secure",
"routing",
"currently",
"security",
"is",
"handled",
"at",
"a",
"base",
"route",
"level"
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Control/ProtectedController.php#L72-L83 | train |
native5/native5-sdk-client-php | src/Native5/Control/ProtectedController.php | ProtectedController._handleUnauthenticatedAccess | protected function _handleUnauthenticatedAccess()
{
header("HTTP/1.0 401 Unauthorized");
$renderer = new TwigRenderer();
$output = $renderer->render('unauth.tmpl', array());
$result = array("code"=>"401","message" => $output);
echo parent::encodeData($result);
exit;
... | php | protected function _handleUnauthenticatedAccess()
{
header("HTTP/1.0 401 Unauthorized");
$renderer = new TwigRenderer();
$output = $renderer->render('unauth.tmpl', array());
$result = array("code"=>"401","message" => $output);
echo parent::encodeData($result);
exit;
... | [
"protected",
"function",
"_handleUnauthenticatedAccess",
"(",
")",
"{",
"header",
"(",
"\"HTTP/1.0 401 Unauthorized\"",
")",
";",
"$",
"renderer",
"=",
"new",
"TwigRenderer",
"(",
")",
";",
"$",
"output",
"=",
"$",
"renderer",
"->",
"render",
"(",
"'unauth.tmpl'... | Handle Unauthenticated access.
@access protected
@return void | [
"Handle",
"Unauthenticated",
"access",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Control/ProtectedController.php#L106-L115 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Extend/Redirect.php | Redirect.domain | public function domain($domain = null) {
if(null !== $domain) {
if(false === is_string($domain)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
}
//Check if identifier exists
if(false === Rout... | php | public function domain($domain = null) {
if(null !== $domain) {
if(false === is_string($domain)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
}
//Check if identifier exists
if(false === Rout... | [
"public",
"function",
"domain",
"(",
"$",
"domain",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"domain",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"domain",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
... | Set the domain
@param string $domain
@return sFire\Routing\Redirect | [
"Set",
"the",
"domain"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Extend/Redirect.php#L77-L94 | train |
dann95/ts3-php | TeamSpeak3/Adapter/Update.php | Update.syn | public function syn()
{
if (!isset($this->options["host"]) || empty($this->options["host"])) {
$this->options["host"] = $this->default_host;
}
if (!isset($this->options["port"]) || empty($this->options["port"])) {
$this->options["port"] = $this->default_port;
... | php | public function syn()
{
if (!isset($this->options["host"]) || empty($this->options["host"])) {
$this->options["host"] = $this->default_host;
}
if (!isset($this->options["port"]) || empty($this->options["port"])) {
$this->options["port"] = $this->default_port;
... | [
"public",
"function",
"syn",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"\"host\"",
"]",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"options",
"[",
"\"host\"",
"]",
")",
")",
"{",
"$",
"this",
"->",
"options"... | Connects the AbstractTransport object and performs initial actions on the remote
server.
@throws Ts3Exception
@return void | [
"Connects",
"the",
"AbstractTransport",
"object",
"and",
"performs",
"initial",
"actions",
"on",
"the",
"remote",
"server",
"."
] | d4693d78b54be0177a2b5fab316c0ff9d036238d | https://github.com/dann95/ts3-php/blob/d4693d78b54be0177a2b5fab316c0ff9d036238d/TeamSpeak3/Adapter/Update.php#L78-L107 | train |
t3v/t3v_datamapper | Classes/Command/PageLanguageOverlayCommandController.php | PageLanguageOverlayCommandController.listCommand | public function listCommand(int $sysLanguageUid, int $pid = 1, int $recursion = 99, string $exclude = '') {
$this->beforeCommand();
$table = new ConsoleTable();
$table->setHeaders(['UID', 'Title', 'Page ID', 'Status']);
foreach ($this->getPageUids($pid, $recursion, $exclude) as $pageUid) {
$lang... | php | public function listCommand(int $sysLanguageUid, int $pid = 1, int $recursion = 99, string $exclude = '') {
$this->beforeCommand();
$table = new ConsoleTable();
$table->setHeaders(['UID', 'Title', 'Page ID', 'Status']);
foreach ($this->getPageUids($pid, $recursion, $exclude) as $pageUid) {
$lang... | [
"public",
"function",
"listCommand",
"(",
"int",
"$",
"sysLanguageUid",
",",
"int",
"$",
"pid",
"=",
"1",
",",
"int",
"$",
"recursion",
"=",
"99",
",",
"string",
"$",
"exclude",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"beforeCommand",
"(",
")",
";",
... | Lists page language overlays.
@param int $sysLanguageUid The system language UID of the page language overlays to list
@param int $pid The optional PID of the page to search from, defaults to `1`
@param int $recursion The optional recursion, defaults to `99`
@param string $exclude The optional UIDs of pages to exclude... | [
"Lists",
"page",
"language",
"overlays",
"."
] | bab2de90f467936fbe4270cd133cb4109d1108eb | https://github.com/t3v/t3v_datamapper/blob/bab2de90f467936fbe4270cd133cb4109d1108eb/Classes/Command/PageLanguageOverlayCommandController.php#L46-L65 | train |
t3v/t3v_datamapper | Classes/Command/PageLanguageOverlayCommandController.php | PageLanguageOverlayCommandController.initializeCommand | public function initializeCommand(int $sysLanguageUid, int $pid = 1, int $recursion = 99, string $exclude = '', bool $verbose = false) {
$this->beforeCommand();
foreach ($this->getPageUids($pid, $recursion, $exclude) as $pageUid) {
$languageOverlay = LanguageOverlay::where([['pid', '=', $pageUid], ['sys_... | php | public function initializeCommand(int $sysLanguageUid, int $pid = 1, int $recursion = 99, string $exclude = '', bool $verbose = false) {
$this->beforeCommand();
foreach ($this->getPageUids($pid, $recursion, $exclude) as $pageUid) {
$languageOverlay = LanguageOverlay::where([['pid', '=', $pageUid], ['sys_... | [
"public",
"function",
"initializeCommand",
"(",
"int",
"$",
"sysLanguageUid",
",",
"int",
"$",
"pid",
"=",
"1",
",",
"int",
"$",
"recursion",
"=",
"99",
",",
"string",
"$",
"exclude",
"=",
"''",
",",
"bool",
"$",
"verbose",
"=",
"false",
")",
"{",
"$... | Initializes page language overlays.
@param int $sysLanguageUid The system language UID of the page language overlays to initialize
@param int $pid The optional PID of the page to search from, defaults to `1`
@param int $recursion The optional recursion, defaults to `99`
@param string $exclude The optional UIDs of page... | [
"Initializes",
"page",
"language",
"overlays",
"."
] | bab2de90f467936fbe4270cd133cb4109d1108eb | https://github.com/t3v/t3v_datamapper/blob/bab2de90f467936fbe4270cd133cb4109d1108eb/Classes/Command/PageLanguageOverlayCommandController.php#L76-L110 | train |
t3v/t3v_datamapper | Classes/Command/PageLanguageOverlayCommandController.php | PageLanguageOverlayCommandController.hideCommand | public function hideCommand(int $sysLanguageUid, int $pid = 1, int $recursion = 99, string $exclude = '', bool $verbose = false) {
$this->beforeCommand();
foreach ($this->getPageUids($pid, $recursion, $exclude) as $pageUid) {
$languageOverlay = LanguageOverlay::where([['pid', '=', $pageUid], ['sys_langua... | php | public function hideCommand(int $sysLanguageUid, int $pid = 1, int $recursion = 99, string $exclude = '', bool $verbose = false) {
$this->beforeCommand();
foreach ($this->getPageUids($pid, $recursion, $exclude) as $pageUid) {
$languageOverlay = LanguageOverlay::where([['pid', '=', $pageUid], ['sys_langua... | [
"public",
"function",
"hideCommand",
"(",
"int",
"$",
"sysLanguageUid",
",",
"int",
"$",
"pid",
"=",
"1",
",",
"int",
"$",
"recursion",
"=",
"99",
",",
"string",
"$",
"exclude",
"=",
"''",
",",
"bool",
"$",
"verbose",
"=",
"false",
")",
"{",
"$",
"... | Hides page language overlays.
@param int $sysLanguageUid The system language UID of the page language overlays to hide
@param int $pid The optional PID of the page to search from, defaults to `1`
@param int $recursion The optional recursion, defaults to `99`
@param string $exclude The optional UIDs of pages to exclude... | [
"Hides",
"page",
"language",
"overlays",
"."
] | bab2de90f467936fbe4270cd133cb4109d1108eb | https://github.com/t3v/t3v_datamapper/blob/bab2de90f467936fbe4270cd133cb4109d1108eb/Classes/Command/PageLanguageOverlayCommandController.php#L121-L142 | train |
t3v/t3v_datamapper | Classes/Command/PageLanguageOverlayCommandController.php | PageLanguageOverlayCommandController.getPageUids | protected function getPageUids(int $pid = 1, int $recursion = 99, string $exclude = '') {
$exclude = $exclude === '-' ? '' : $exclude;
$exclude = GeneralUtility::intExplode(',', $exclude, true);
$pagesTreeList = $this->queryGenerator->getTreeList($pid, $recursion, 0, 1);
$pageUids = Gen... | php | protected function getPageUids(int $pid = 1, int $recursion = 99, string $exclude = '') {
$exclude = $exclude === '-' ? '' : $exclude;
$exclude = GeneralUtility::intExplode(',', $exclude, true);
$pagesTreeList = $this->queryGenerator->getTreeList($pid, $recursion, 0, 1);
$pageUids = Gen... | [
"protected",
"function",
"getPageUids",
"(",
"int",
"$",
"pid",
"=",
"1",
",",
"int",
"$",
"recursion",
"=",
"99",
",",
"string",
"$",
"exclude",
"=",
"''",
")",
"{",
"$",
"exclude",
"=",
"$",
"exclude",
"===",
"'-'",
"?",
"''",
":",
"$",
"exclude"... | Gets page UIDs.
@param int $pid The optional PID of the page to search from, defaults to `1`
@param int $recursion The optional recursion, defaults to `99`
@param string $exclude The optional UIDs of pages to exclude from as string, seperated by `,`, empty by default | [
"Gets",
"page",
"UIDs",
"."
] | bab2de90f467936fbe4270cd133cb4109d1108eb | https://github.com/t3v/t3v_datamapper/blob/bab2de90f467936fbe4270cd133cb4109d1108eb/Classes/Command/PageLanguageOverlayCommandController.php#L190-L198 | train |
JurJean/SpraySerializerBundle | src/DependencyInjection/CompilerPass/TaggedSerializerCompilerPass.php | TaggedSerializerCompilerPass.process | public function process(ContainerBuilder $container)
{
$registryDefinition = $container->getDefinition('spray_serializer.serializer_registry');
$tagged = $container->findTaggedServiceIds('spray_serializer');
foreach ($tagged as $id => $tags) {
foreach ($tags as $attr) {
... | php | public function process(ContainerBuilder $container)
{
$registryDefinition = $container->getDefinition('spray_serializer.serializer_registry');
$tagged = $container->findTaggedServiceIds('spray_serializer');
foreach ($tagged as $id => $tags) {
foreach ($tags as $attr) {
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"registryDefinition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"'spray_serializer.serializer_registry'",
")",
";",
"$",
"tagged",
"=",
"$",
"container",
"->",
"fin... | Find services tagged with "spray_serializer" and attach them to the
serializer registry.
@param ContainerBuilder $container
@return void | [
"Find",
"services",
"tagged",
"with",
"spray_serializer",
"and",
"attach",
"them",
"to",
"the",
"serializer",
"registry",
"."
] | 2b822f81bd7a49f120dbe6d75672908727fc40f9 | https://github.com/JurJean/SpraySerializerBundle/blob/2b822f81bd7a49f120dbe6d75672908727fc40f9/src/DependencyInjection/CompilerPass/TaggedSerializerCompilerPass.php#L18-L30 | train |
Vectrex/vxPHP | src/Security/Csrf/CsrfTokenManager.php | CsrfTokenManager.getToken | public function getToken($tokenId) {
if($this->storage->hasToken($tokenId)) {
return $this->storage->getToken($tokenId);
}
$token = new CsrfToken(
$tokenId,
$this->generateValue((int) $this->tokenLength)
);
$this->storage->setToken($tokenId, $token);
return $token;
} | php | public function getToken($tokenId) {
if($this->storage->hasToken($tokenId)) {
return $this->storage->getToken($tokenId);
}
$token = new CsrfToken(
$tokenId,
$this->generateValue((int) $this->tokenLength)
);
$this->storage->setToken($tokenId, $token);
return $token;
} | [
"public",
"function",
"getToken",
"(",
"$",
"tokenId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"storage",
"->",
"hasToken",
"(",
"$",
"tokenId",
")",
")",
"{",
"return",
"$",
"this",
"->",
"storage",
"->",
"getToken",
"(",
"$",
"tokenId",
")",
";",
... | returns a CSRF token for the given token id
if previously no token existed for the given id, a new token is
generated, stored and returned; otherwise the existing token is returned
@param string $tokenId
@return CsrfToken | [
"returns",
"a",
"CSRF",
"token",
"for",
"the",
"given",
"token",
"id"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Security/Csrf/CsrfTokenManager.php#L69-L83 | train |
Vectrex/vxPHP | src/Security/Csrf/CsrfTokenManager.php | CsrfTokenManager.refreshToken | public function refreshToken($tokenId) {
$this->storage->removeToken($tokenId);
$token = new CsrfToken(
$tokenId,
$this->generateValue((int) $this->tokenLength)
);
$this->storage->setToken($tokenId, $token);
return $token;
} | php | public function refreshToken($tokenId) {
$this->storage->removeToken($tokenId);
$token = new CsrfToken(
$tokenId,
$this->generateValue((int) $this->tokenLength)
);
$this->storage->setToken($tokenId, $token);
return $token;
} | [
"public",
"function",
"refreshToken",
"(",
"$",
"tokenId",
")",
"{",
"$",
"this",
"->",
"storage",
"->",
"removeToken",
"(",
"$",
"tokenId",
")",
";",
"$",
"token",
"=",
"new",
"CsrfToken",
"(",
"$",
"tokenId",
",",
"$",
"this",
"->",
"generateValue",
... | generates a new token for the given id
a new token will be generated, independent
of whether a token value previously existed or not
useful to enforce once-only tokens
@param string $tokenId
@return CsrfToken | [
"generates",
"a",
"new",
"token",
"for",
"the",
"given",
"id",
"a",
"new",
"token",
"will",
"be",
"generated",
"independent",
"of",
"whether",
"a",
"token",
"value",
"previously",
"existed",
"or",
"not",
"useful",
"to",
"enforce",
"once",
"-",
"only",
"tok... | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Security/Csrf/CsrfTokenManager.php#L94-L107 | train |
Vectrex/vxPHP | src/Security/Csrf/CsrfTokenManager.php | CsrfTokenManager.isTokenValid | public function isTokenValid(CsrfToken $token) {
$tokenId = $token->getId();
if (!$this->storage->hasToken($tokenId)) {
return FALSE;
}
return hash_equals($this->storage->getToken($tokenId)->getValue(), $token->getValue());
} | php | public function isTokenValid(CsrfToken $token) {
$tokenId = $token->getId();
if (!$this->storage->hasToken($tokenId)) {
return FALSE;
}
return hash_equals($this->storage->getToken($tokenId)->getValue(), $token->getValue());
} | [
"public",
"function",
"isTokenValid",
"(",
"CsrfToken",
"$",
"token",
")",
"{",
"$",
"tokenId",
"=",
"$",
"token",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"storage",
"->",
"hasToken",
"(",
"$",
"tokenId",
")",
")",
"{",
"re... | check whether the given CSRF token is valid
returns TRUE if the token is valid, FALSE otherwise
@param CsrfToken $token
@return bool | [
"check",
"whether",
"the",
"given",
"CSRF",
"token",
"is",
"valid",
"returns",
"TRUE",
"if",
"the",
"token",
"is",
"valid",
"FALSE",
"otherwise"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Security/Csrf/CsrfTokenManager.php#L130-L140 | train |
kkthek/diqa-util | src/Util/RequestUtils.php | RequestUtils.getSessionCookieForExportUser | public static function getSessionCookieForExportUser($user, $pass) {
global $wgServerHTTP, $wgScriptPath, $wgODBTechnicalUser;
$user = urlencode ( $user );
$pass = urlencode ( $pass );
// first: request a token
$apiPath = "/api.php?action=login&format=json&lgname=$user&lgpasswo... | php | public static function getSessionCookieForExportUser($user, $pass) {
global $wgServerHTTP, $wgScriptPath, $wgODBTechnicalUser;
$user = urlencode ( $user );
$pass = urlencode ( $pass );
// first: request a token
$apiPath = "/api.php?action=login&format=json&lgname=$user&lgpasswo... | [
"public",
"static",
"function",
"getSessionCookieForExportUser",
"(",
"$",
"user",
",",
"$",
"pass",
")",
"{",
"global",
"$",
"wgServerHTTP",
",",
"$",
"wgScriptPath",
",",
"$",
"wgODBTechnicalUser",
";",
"$",
"user",
"=",
"urlencode",
"(",
"$",
"user",
")",... | Requests a session cookie for a user.
@param string $user
@param string $pass
@throws \Exception
@return [ 'cookieprefix' => ... , 'sessionId' => ... ] | [
"Requests",
"a",
"session",
"cookie",
"for",
"a",
"user",
"."
] | df35d16403b5dbf0f7570daded6cfa26814ae7e0 | https://github.com/kkthek/diqa-util/blob/df35d16403b5dbf0f7570daded6cfa26814ae7e0/src/Util/RequestUtils.php#L25-L65 | train |
geoffadams/bedrest-events | library/BedRest/Events/EventManager.php | EventManager.addClassListeners | public function addClassListeners($instance)
{
if (!$this->driver) {
throw Exception::noDriver();
}
foreach ($this->driver->getListenersForClass($instance) as $listener) {
$this->addListener($listener['event'], array($instance, $listener['method']));
... | php | public function addClassListeners($instance)
{
if (!$this->driver) {
throw Exception::noDriver();
}
foreach ($this->driver->getListenersForClass($instance) as $listener) {
$this->addListener($listener['event'], array($instance, $listener['method']));
... | [
"public",
"function",
"addClassListeners",
"(",
"$",
"instance",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"driver",
")",
"{",
"throw",
"Exception",
"::",
"noDriver",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"driver",
"->",
"getListene... | Automatically maps event listeners associated with a class using the driver provided to this instance and
registers them.
@param object $instance
@throws \BedRest\Events\MappingException | [
"Automatically",
"maps",
"event",
"listeners",
"associated",
"with",
"a",
"class",
"using",
"the",
"driver",
"provided",
"to",
"this",
"instance",
"and",
"registers",
"them",
"."
] | 470f7b5358b80e3c69e8337670e8d347d4e3dbff | https://github.com/geoffadams/bedrest-events/blob/470f7b5358b80e3c69e8337670e8d347d4e3dbff/library/BedRest/Events/EventManager.php#L62-L71 | train |
geoffadams/bedrest-events | library/BedRest/Events/EventManager.php | EventManager.addListeners | public function addListeners($event, $listeners)
{
foreach ($listeners as $listener) {
$this->addListener($event, $listener);
}
} | php | public function addListeners($event, $listeners)
{
foreach ($listeners as $listener) {
$this->addListener($event, $listener);
}
} | [
"public",
"function",
"addListeners",
"(",
"$",
"event",
",",
"$",
"listeners",
")",
"{",
"foreach",
"(",
"$",
"listeners",
"as",
"$",
"listener",
")",
"{",
"$",
"this",
"->",
"addListener",
"(",
"$",
"event",
",",
"$",
"listener",
")",
";",
"}",
"}"... | Adds a set of listeners.
@param string $event
@param callable $listeners | [
"Adds",
"a",
"set",
"of",
"listeners",
"."
] | 470f7b5358b80e3c69e8337670e8d347d4e3dbff | https://github.com/geoffadams/bedrest-events/blob/470f7b5358b80e3c69e8337670e8d347d4e3dbff/library/BedRest/Events/EventManager.php#L94-L99 | train |
geoffadams/bedrest-events | library/BedRest/Events/EventManager.php | EventManager.getListeners | public function getListeners($event)
{
if (!isset($this->listeners[$event]) || !is_array($this->listeners[$event])) {
return array();
}
return $this->listeners[$event];
} | php | public function getListeners($event)
{
if (!isset($this->listeners[$event]) || !is_array($this->listeners[$event])) {
return array();
}
return $this->listeners[$event];
} | [
"public",
"function",
"getListeners",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"event",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"event",
"]",
")",
... | Retrieves all listeners for an event.
@param string $event
@return array | [
"Retrieves",
"all",
"listeners",
"for",
"an",
"event",
"."
] | 470f7b5358b80e3c69e8337670e8d347d4e3dbff | https://github.com/geoffadams/bedrest-events/blob/470f7b5358b80e3c69e8337670e8d347d4e3dbff/library/BedRest/Events/EventManager.php#L107-L114 | train |
geoffadams/bedrest-events | library/BedRest/Events/EventManager.php | EventManager.dispatch | public function dispatch($event, Event $eventObject)
{
if (!isset($this->listeners[$event])) {
return;
}
foreach ($this->listeners[$event] as $listener) {
call_user_func_array($listener, array($eventObject));
if ($eventObject->propaga... | php | public function dispatch($event, Event $eventObject)
{
if (!isset($this->listeners[$event])) {
return;
}
foreach ($this->listeners[$event] as $listener) {
call_user_func_array($listener, array($eventObject));
if ($eventObject->propaga... | [
"public",
"function",
"dispatch",
"(",
"$",
"event",
",",
"Event",
"$",
"eventObject",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"event",
"]",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
... | Dispatches an event to all listeners.
@param string $event
@param \BedRest\Events\Event $eventObject | [
"Dispatches",
"an",
"event",
"to",
"all",
"listeners",
"."
] | 470f7b5358b80e3c69e8337670e8d347d4e3dbff | https://github.com/geoffadams/bedrest-events/blob/470f7b5358b80e3c69e8337670e8d347d4e3dbff/library/BedRest/Events/EventManager.php#L122-L135 | train |
agentmedia/phine-core | src/Core/Logic/Module/TemplateModule.php | TemplateModule.BuiltInTemplateFile | protected final function BuiltInTemplateFile()
{
$class = new \ReflectionClass($this);
$classFile = Str::Replace('\\', '/', $class->getFileName());
$templatePath = Str::Replace('/Modules/', '/Templates/', $classFile);
return Path::AddExtension($templatePath, 'phtml', true);
} | php | protected final function BuiltInTemplateFile()
{
$class = new \ReflectionClass($this);
$classFile = Str::Replace('\\', '/', $class->getFileName());
$templatePath = Str::Replace('/Modules/', '/Templates/', $classFile);
return Path::AddExtension($templatePath, 'phtml', true);
} | [
"protected",
"final",
"function",
"BuiltInTemplateFile",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"$",
"classFile",
"=",
"Str",
"::",
"Replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"class",
"->",
"g... | Returns the template file that comes with the bundle module
@return string | [
"Returns",
"the",
"template",
"file",
"that",
"comes",
"with",
"the",
"bundle",
"module"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/TemplateModule.php#L30-L36 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.up | public function up ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0],
$this->_currentPosition[1] - $count,
);
return $this;
} | php | public function up ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0],
$this->_currentPosition[1] - $count,
);
return $this;
} | [
"public",
"function",
"up",
"(",
"$",
"count",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"_currentPosition",
"=",
"array",
"(",
"$",
"this",
"->",
"_currentPosition",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"_currentPosition",
"[",
"1",
"]",
"-",
"$",
... | Move up current position
@param int $count Move count
@return CursorObject Self instance | [
"Move",
"up",
"current",
"position"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L56-L62 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.down | public function down ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0],
$this->_currentPosition[1] + $count,
);
return $this;
} | php | public function down ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0],
$this->_currentPosition[1] + $count,
);
return $this;
} | [
"public",
"function",
"down",
"(",
"$",
"count",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"_currentPosition",
"=",
"array",
"(",
"$",
"this",
"->",
"_currentPosition",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"_currentPosition",
"[",
"1",
"]",
"+",
"$",
... | Move down current position
@param int $count Move count
@return CursorObject Self instance | [
"Move",
"down",
"current",
"position"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L70-L76 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.left | public function left ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0] - $count,
$this->_currentPosition[1],
);
return $this;
} | php | public function left ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0] - $count,
$this->_currentPosition[1],
);
return $this;
} | [
"public",
"function",
"left",
"(",
"$",
"count",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"_currentPosition",
"=",
"array",
"(",
"$",
"this",
"->",
"_currentPosition",
"[",
"0",
"]",
"-",
"$",
"count",
",",
"$",
"this",
"->",
"_currentPosition",
"[",
"... | Move left current position
@param int $count Move count
@return CursorObject Self instance | [
"Move",
"left",
"current",
"position"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L84-L90 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.right | public function right ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0] + $count,
$this->_currentPosition[1],
);
return $this;
} | php | public function right ( $count = 0 ) {
$this->_currentPosition = array(
$this->_currentPosition[0] + $count,
$this->_currentPosition[1],
);
return $this;
} | [
"public",
"function",
"right",
"(",
"$",
"count",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"_currentPosition",
"=",
"array",
"(",
"$",
"this",
"->",
"_currentPosition",
"[",
"0",
"]",
"+",
"$",
"count",
",",
"$",
"this",
"->",
"_currentPosition",
"[",
... | Move right current position
@param int $count Move count
@return CursorObject Self instance | [
"Move",
"right",
"current",
"position"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L98-L104 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.move | public function move ( $dx, $dy ) {
if ( $dx < 0 ) {
$this->left(abs($dx));
} else {
$this->right(abs($dx));
}
if ( $dy < 0 ) {
$this->up(abs($dy));
} else {
$this->down(abs($dy));
}
return $this;
} | php | public function move ( $dx, $dy ) {
if ( $dx < 0 ) {
$this->left(abs($dx));
} else {
$this->right(abs($dx));
}
if ( $dy < 0 ) {
$this->up(abs($dy));
} else {
$this->down(abs($dy));
}
return $this;
} | [
"public",
"function",
"move",
"(",
"$",
"dx",
",",
"$",
"dy",
")",
"{",
"if",
"(",
"$",
"dx",
"<",
"0",
")",
"{",
"$",
"this",
"->",
"left",
"(",
"abs",
"(",
"$",
"dx",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"right",
"(",
"ab... | Move current position
@param int $dx Horizontal displacement
@param int $dy Vertical displacement
@return CursorObject Self instance | [
"Move",
"current",
"position"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L113-L125 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.setAncor | public function setAncor ( $position = null ) {
if ( is_null($position) === true ) {
$position = $this->_currentPosition;
}
$this->_ancorPosition = $position;
return $this;
} | php | public function setAncor ( $position = null ) {
if ( is_null($position) === true ) {
$position = $this->_currentPosition;
}
$this->_ancorPosition = $position;
return $this;
} | [
"public",
"function",
"setAncor",
"(",
"$",
"position",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"position",
")",
"===",
"true",
")",
"{",
"$",
"position",
"=",
"$",
"this",
"->",
"_currentPosition",
";",
"}",
"$",
"this",
"->",
"_ancor... | Set ancor position
@param array $position (x, y)
@return CursorObject Self instance | [
"Set",
"ancor",
"position"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L154-L160 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.getEscapeSequencesByPath | public function getEscapeSequencesByPath ( $dx = null, $dy = null ) {
if ( is_null($dx) === true ) {
$dx = $this->_currentPosition[0] - $this->_ancorPosition[0];
}
if ( is_null($dy) === true ) {
$dy = $this->_currentPosition[1] - $this->_ancorPosition[1];
}
... | php | public function getEscapeSequencesByPath ( $dx = null, $dy = null ) {
if ( is_null($dx) === true ) {
$dx = $this->_currentPosition[0] - $this->_ancorPosition[0];
}
if ( is_null($dy) === true ) {
$dy = $this->_currentPosition[1] - $this->_ancorPosition[1];
}
... | [
"public",
"function",
"getEscapeSequencesByPath",
"(",
"$",
"dx",
"=",
"null",
",",
"$",
"dy",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"dx",
")",
"===",
"true",
")",
"{",
"$",
"dx",
"=",
"$",
"this",
"->",
"_currentPosition",
"[",
"0... | Get escape sequences by path
@param int $dx Horizontal displacement
@param int $dy Vertical displacement
@return string Escape sequences | [
"Get",
"escape",
"sequences",
"by",
"path"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L169-L177 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/CursorObject.php | CursorObject.getMovingEscapeSequences | public static function getMovingEscapeSequences ( $dx, $dy ) {
$escapeSequences = '';
if ( $dy < 0 ) {
$escapeSequences .= self::getUpEscapeSequence(abs($dy));
} else if ( $dy > 0 ) {
$escapeSequences .= self::getDownEscapeSequence(abs($dy));
}
if ( $dx < ... | php | public static function getMovingEscapeSequences ( $dx, $dy ) {
$escapeSequences = '';
if ( $dy < 0 ) {
$escapeSequences .= self::getUpEscapeSequence(abs($dy));
} else if ( $dy > 0 ) {
$escapeSequences .= self::getDownEscapeSequence(abs($dy));
}
if ( $dx < ... | [
"public",
"static",
"function",
"getMovingEscapeSequences",
"(",
"$",
"dx",
",",
"$",
"dy",
")",
"{",
"$",
"escapeSequences",
"=",
"''",
";",
"if",
"(",
"$",
"dy",
"<",
"0",
")",
"{",
"$",
"escapeSequences",
".=",
"self",
"::",
"getUpEscapeSequence",
"("... | Get moving escape sequences
@param int $dx
@param int $dy
@return string Moving escape sequences | [
"Get",
"moving",
"escape",
"sequences"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/CursorObject.php#L186-L199 | train |
PenoaksDev/Milky-Framework | src/Milky/Queue/Console/RetryCommand.php | RetryCommand.retryJob | protected function retryJob($id)
{
$failed = $this->laravel['queue.failer']->find($id);
if (! is_null($failed)) {
$failed = (object) $failed;
$failed->payload = $this->resetAttempts($failed->payload);
$this->laravel['queue']->connection($failed->connection)
->pushRaw($failed->payload, $failed->... | php | protected function retryJob($id)
{
$failed = $this->laravel['queue.failer']->find($id);
if (! is_null($failed)) {
$failed = (object) $failed;
$failed->payload = $this->resetAttempts($failed->payload);
$this->laravel['queue']->connection($failed->connection)
->pushRaw($failed->payload, $failed->... | [
"protected",
"function",
"retryJob",
"(",
"$",
"id",
")",
"{",
"$",
"failed",
"=",
"$",
"this",
"->",
"laravel",
"[",
"'queue.failer'",
"]",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"failed",
")",
")",
"{",
"$"... | Retry the queue job with the given ID.
@param string $id
@return void | [
"Retry",
"the",
"queue",
"job",
"with",
"the",
"given",
"ID",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Queue/Console/RetryCommand.php#L47-L65 | train |
PenoaksDev/Milky-Framework | src/Milky/Queue/Console/RetryCommand.php | RetryCommand.resetAttempts | protected function resetAttempts($payload)
{
$payload = json_decode($payload, true);
if (isset($payload['attempts'])) {
$payload['attempts'] = 1;
}
return json_encode($payload);
} | php | protected function resetAttempts($payload)
{
$payload = json_decode($payload, true);
if (isset($payload['attempts'])) {
$payload['attempts'] = 1;
}
return json_encode($payload);
} | [
"protected",
"function",
"resetAttempts",
"(",
"$",
"payload",
")",
"{",
"$",
"payload",
"=",
"json_decode",
"(",
"$",
"payload",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"payload",
"[",
"'attempts'",
"]",
")",
")",
"{",
"$",
"payload",
"... | Reset the payload attempts.
@param string $payload
@return string | [
"Reset",
"the",
"payload",
"attempts",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Queue/Console/RetryCommand.php#L73-L82 | train |
hiqdev/minii-validators | src/Validator.php | Validator.validate | public function validate($value, &$error = null)
{
$result = $this->validateValue($value);
if (empty($result)) {
return true;
}
list($message, $params) = $result;
$params['attribute'] = Yii::t('yii', 'the input value');
$params['value'] = is_array($value)... | php | public function validate($value, &$error = null)
{
$result = $this->validateValue($value);
if (empty($result)) {
return true;
}
list($message, $params) = $result;
$params['attribute'] = Yii::t('yii', 'the input value');
$params['value'] = is_array($value)... | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"&",
"$",
"error",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"validateValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"result",
")",
")",
"{",
"retur... | Validates a given value.
You may use this method to validate a value out of the context of a data model.
@param mixed $value the data value to be validated.
@param string $error the error message to be returned, if the validation fails.
@return boolean whether the data is valid. | [
"Validates",
"a",
"given",
"value",
".",
"You",
"may",
"use",
"this",
"method",
"to",
"validate",
"a",
"value",
"out",
"of",
"the",
"context",
"of",
"a",
"data",
"model",
"."
] | 3e32ccf5d0dadc070bc5a9bd6ebe98f778a1f741 | https://github.com/hiqdev/minii-validators/blob/3e32ccf5d0dadc070bc5a9bd6ebe98f778a1f741/src/Validator.php#L270-L283 | train |
hiqdev/minii-validators | src/Validator.php | Validator.addError | public function addError($model, $attribute, $message, $params = [])
{
$value = $model->$attribute;
$params['attribute'] = $model->getAttributeLabel($attribute);
$params['value'] = is_array($value) ? 'array()' : $value;
$model->addError($attribute, Yii::$app->getI18n()->format($messa... | php | public function addError($model, $attribute, $message, $params = [])
{
$value = $model->$attribute;
$params['attribute'] = $model->getAttributeLabel($attribute);
$params['value'] = is_array($value) ? 'array()' : $value;
$model->addError($attribute, Yii::$app->getI18n()->format($messa... | [
"public",
"function",
"addError",
"(",
"$",
"model",
",",
"$",
"attribute",
",",
"$",
"message",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"value",
"=",
"$",
"model",
"->",
"$",
"attribute",
";",
"$",
"params",
"[",
"'attribute'",
"]",
"=",... | Adds an error about the specified attribute to the model object.
This is a helper method that performs message selection and internationalization.
@param \yii\base\Model $model the data model being validated
@param string $attribute the attribute being validated
@param string $message the error message
@param array $pa... | [
"Adds",
"an",
"error",
"about",
"the",
"specified",
"attribute",
"to",
"the",
"model",
"object",
".",
"This",
"is",
"a",
"helper",
"method",
"that",
"performs",
"message",
"selection",
"and",
"internationalization",
"."
] | 3e32ccf5d0dadc070bc5a9bd6ebe98f778a1f741 | https://github.com/hiqdev/minii-validators/blob/3e32ccf5d0dadc070bc5a9bd6ebe98f778a1f741/src/Validator.php#L357-L363 | train |
WesamMikhail/Utils | src/Explorer.php | Explorer.getAllFiles | public static function getAllFiles($dir, $subdir = false) {
$path = '';
$stack[] = $dir;
while ($stack) {
$thisdir = array_pop($stack);
if ($dircont = scandir($thisdir)) {
$i = 0;
while (isset($dircont[$i])) {
if ($dirco... | php | public static function getAllFiles($dir, $subdir = false) {
$path = '';
$stack[] = $dir;
while ($stack) {
$thisdir = array_pop($stack);
if ($dircont = scandir($thisdir)) {
$i = 0;
while (isset($dircont[$i])) {
if ($dirco... | [
"public",
"static",
"function",
"getAllFiles",
"(",
"$",
"dir",
",",
"$",
"subdir",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"''",
";",
"$",
"stack",
"[",
"]",
"=",
"$",
"dir",
";",
"while",
"(",
"$",
"stack",
")",
"{",
"$",
"thisdir",
"=",
"a... | Get all directory files and directories
@param string $dir directory location
@param boolean $subdir include subdirectories of directory
@return array | [
"Get",
"all",
"directory",
"files",
"and",
"directories"
] | 54933740f4500a7a1ebd37c7226cc00bc36e58db | https://github.com/WesamMikhail/Utils/blob/54933740f4500a7a1ebd37c7226cc00bc36e58db/src/Explorer.php#L18-L42 | train |
WesamMikhail/Utils | src/Explorer.php | Explorer.getAllSubdirectories | public static function getAllSubdirectories($dir, $subdir = false) {
$path = '';
$stack[] = $dir;
while ($stack) {
$thisdir = array_shift($stack);
if ($dircont = scandir($thisdir)) {
$i = 0;
while (isset($dircont[$i])) {
... | php | public static function getAllSubdirectories($dir, $subdir = false) {
$path = '';
$stack[] = $dir;
while ($stack) {
$thisdir = array_shift($stack);
if ($dircont = scandir($thisdir)) {
$i = 0;
while (isset($dircont[$i])) {
... | [
"public",
"static",
"function",
"getAllSubdirectories",
"(",
"$",
"dir",
",",
"$",
"subdir",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"''",
";",
"$",
"stack",
"[",
"]",
"=",
"$",
"dir",
";",
"while",
"(",
"$",
"stack",
")",
"{",
"$",
"thisdir",
... | Get all subdirectories of directory
@param string $dir directory location
@param boolean $subdir include subdirectories of subdirectory
@return array | [
"Get",
"all",
"subdirectories",
"of",
"directory"
] | 54933740f4500a7a1ebd37c7226cc00bc36e58db | https://github.com/WesamMikhail/Utils/blob/54933740f4500a7a1ebd37c7226cc00bc36e58db/src/Explorer.php#L51-L74 | train |
LitGroup/enumerable.php | src/Enumerable.php | Enumerable.getValueOf | final public static function getValueOf($rawValue)
{
$values = static::getValues();
if (!array_key_exists($rawValue, $values)) {
throw new OutOfBoundsException(
sprintf('Enum "%s" has no value with raw value "%s".', get_called_class(), $rawValue)
);
}
... | php | final public static function getValueOf($rawValue)
{
$values = static::getValues();
if (!array_key_exists($rawValue, $values)) {
throw new OutOfBoundsException(
sprintf('Enum "%s" has no value with raw value "%s".', get_called_class(), $rawValue)
);
}
... | [
"final",
"public",
"static",
"function",
"getValueOf",
"(",
"$",
"rawValue",
")",
"{",
"$",
"values",
"=",
"static",
"::",
"getValues",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"rawValue",
",",
"$",
"values",
")",
")",
"{",
"throw",... | Returns an instance of Enumerable by raw value.
@param int|string $rawValue
@return static | [
"Returns",
"an",
"instance",
"of",
"Enumerable",
"by",
"raw",
"value",
"."
] | 35e49d360a1ceade4c849a6322d0aeed8e120a64 | https://github.com/LitGroup/enumerable.php/blob/35e49d360a1ceade4c849a6322d0aeed8e120a64/src/Enumerable.php#L54-L64 | train |
LitGroup/enumerable.php | src/Enumerable.php | Enumerable.initializeEnum | private static function initializeEnum($enumClass)
{
self::$isInInitializationState = true;
try {
$classReflection = new ReflectionClass($enumClass);
// Enumerable must be final:
if (!$classReflection->isFinal()) {
throw new LogicException(
... | php | private static function initializeEnum($enumClass)
{
self::$isInInitializationState = true;
try {
$classReflection = new ReflectionClass($enumClass);
// Enumerable must be final:
if (!$classReflection->isFinal()) {
throw new LogicException(
... | [
"private",
"static",
"function",
"initializeEnum",
"(",
"$",
"enumClass",
")",
"{",
"self",
"::",
"$",
"isInInitializationState",
"=",
"true",
";",
"try",
"{",
"$",
"classReflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"enumClass",
")",
";",
"// Enumerab... | Initializes values of enumerable class.
@param string $enumClass | [
"Initializes",
"values",
"of",
"enumerable",
"class",
"."
] | 35e49d360a1ceade4c849a6322d0aeed8e120a64 | https://github.com/LitGroup/enumerable.php/blob/35e49d360a1ceade4c849a6322d0aeed8e120a64/src/Enumerable.php#L121-L175 | train |
LitGroup/enumerable.php | src/Enumerable.php | Enumerable.isServiceMethod | private static function isServiceMethod(ReflectionMethod $method)
{
return !$method->isPublic() || in_array($method->getShortName(), self::getServiceMethods());
} | php | private static function isServiceMethod(ReflectionMethod $method)
{
return !$method->isPublic() || in_array($method->getShortName(), self::getServiceMethods());
} | [
"private",
"static",
"function",
"isServiceMethod",
"(",
"ReflectionMethod",
"$",
"method",
")",
"{",
"return",
"!",
"$",
"method",
"->",
"isPublic",
"(",
")",
"||",
"in_array",
"(",
"$",
"method",
"->",
"getShortName",
"(",
")",
",",
"self",
"::",
"getSer... | Checks that given method is for the internal use.
@param ReflectionMethod $method
@return boolean | [
"Checks",
"that",
"given",
"method",
"is",
"for",
"the",
"internal",
"use",
"."
] | 35e49d360a1ceade4c849a6322d0aeed8e120a64 | https://github.com/LitGroup/enumerable.php/blob/35e49d360a1ceade4c849a6322d0aeed8e120a64/src/Enumerable.php#L194-L197 | train |
agentmedia/phine-core | src/Core/Modules/Backend/JsonPageTree.php | JsonPageTree.BeforeDelete | protected function BeforeDelete()
{
foreach (self::$deleteHooks as $hook)
{
$hook->BeforeDelete($this->item);
}
$logger = new Logger(BackendModule::Guard()->GetUser());
$logger->ReportPageAction($this->item, Action::Delete());
$file = Path::Combin... | php | protected function BeforeDelete()
{
foreach (self::$deleteHooks as $hook)
{
$hook->BeforeDelete($this->item);
}
$logger = new Logger(BackendModule::Guard()->GetUser());
$logger->ReportPageAction($this->item, Action::Delete());
$file = Path::Combin... | [
"protected",
"function",
"BeforeDelete",
"(",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"deleteHooks",
"as",
"$",
"hook",
")",
"{",
"$",
"hook",
"->",
"BeforeDelete",
"(",
"$",
"this",
"->",
"item",
")",
";",
"}",
"$",
"logger",
"=",
"new",
"Logge... | Remove htaccess page commands before page is deleted | [
"Remove",
"htaccess",
"page",
"commands",
"before",
"page",
"is",
"deleted"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/JsonPageTree.php#L51-L66 | train |
TiMESPLiNTER/tsFramework | src/ch/timesplinter/core/HttpRequest.php | HttpRequest.sanitize | private function sanitize($value, $sanitizers) {
if(is_string($sanitizers) === true)
return call_user_func($sanitizers, $value);
if(is_array($sanitizers) === true) {
$valueFiltered = $value;
if(count($sanitizers) === 2 && is_callable($sanitizers) === true)
return call_user_func($sanitizers, $valueFil... | php | private function sanitize($value, $sanitizers) {
if(is_string($sanitizers) === true)
return call_user_func($sanitizers, $value);
if(is_array($sanitizers) === true) {
$valueFiltered = $value;
if(count($sanitizers) === 2 && is_callable($sanitizers) === true)
return call_user_func($sanitizers, $valueFil... | [
"private",
"function",
"sanitize",
"(",
"$",
"value",
",",
"$",
"sanitizers",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"sanitizers",
")",
"===",
"true",
")",
"return",
"call_user_func",
"(",
"$",
"sanitizers",
",",
"$",
"value",
")",
";",
"if",
"(",... | Sanitizes a value with the given functions and callbacks
@param string|int|null $value The value to sanitize
@param string|array $sanitizers The functions to sanitize the string. A simple function as string or a callback
as array or an array with simple functions and callback arrays
@return string|int|null The sanitize... | [
"Sanitizes",
"a",
"value",
"with",
"the",
"given",
"functions",
"and",
"callbacks"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/core/HttpRequest.php#L252-L269 | train |
MARCspec/php-marc-spec | src/MARCspecParser.php | MARCspecParser.parse | public function parse($marcspec)
{
if (!preg_match_all('/'.$this->MARCSPEC.'/', $marcspec, $this->parsed, PREG_SET_ORDER)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::FS.
InvalidMARCspecException::MISSINGFIELD,
$marcspec
... | php | public function parse($marcspec)
{
if (!preg_match_all('/'.$this->MARCSPEC.'/', $marcspec, $this->parsed, PREG_SET_ORDER)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::FS.
InvalidMARCspecException::MISSINGFIELD,
$marcspec
... | [
"public",
"function",
"parse",
"(",
"$",
"marcspec",
")",
"{",
"if",
"(",
"!",
"preg_match_all",
"(",
"'/'",
".",
"$",
"this",
"->",
"MARCSPEC",
".",
"'/'",
",",
"$",
"marcspec",
",",
"$",
"this",
"->",
"parsed",
",",
"PREG_SET_ORDER",
")",
")",
"{",... | parses MARCspec.
@param string $marcspec The MARCspec
@throws CK\MARCspec\Exception\InvalidMARCspecException | [
"parses",
"MARCspec",
"."
] | 853d77ad3d510ce05c33535bfa3f1068dccdeef6 | https://github.com/MARCspec/php-marc-spec/blob/853d77ad3d510ce05c33535bfa3f1068dccdeef6/src/MARCspecParser.php#L126-L198 | train |
MARCspec/php-marc-spec | src/MARCspecParser.php | MARCspecParser.parseSubfields | public function parseSubfields($subfieldspec)
{
if (!preg_match_all('/'.$this->SUBFIELD.'/', $subfieldspec, $_subfieldMatches, PREG_SET_ORDER)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SF.
InvalidMARCspecException::SFCHAR,
$s... | php | public function parseSubfields($subfieldspec)
{
if (!preg_match_all('/'.$this->SUBFIELD.'/', $subfieldspec, $_subfieldMatches, PREG_SET_ORDER)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SF.
InvalidMARCspecException::SFCHAR,
$s... | [
"public",
"function",
"parseSubfields",
"(",
"$",
"subfieldspec",
")",
"{",
"if",
"(",
"!",
"preg_match_all",
"(",
"'/'",
".",
"$",
"this",
"->",
"SUBFIELD",
".",
"'/'",
",",
"$",
"subfieldspec",
",",
"$",
"_subfieldMatches",
",",
"PREG_SET_ORDER",
")",
")... | Matches subfieldspecs.
@param string $subfieldspec A string of one or more subfieldspecs | [
"Matches",
"subfieldspecs",
"."
] | 853d77ad3d510ce05c33535bfa3f1068dccdeef6 | https://github.com/MARCspec/php-marc-spec/blob/853d77ad3d510ce05c33535bfa3f1068dccdeef6/src/MARCspecParser.php#L205-L260 | train |
MARCspec/php-marc-spec | src/MARCspecParser.php | MARCspecParser.subfieldToArray | public function subfieldToArray($subfieldspec)
{
if (!$_sf = $this->parseSubfields($subfieldspec)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SF.
InvalidMARCspecException::UNKNOWN,
$subfieldspec
);
}
... | php | public function subfieldToArray($subfieldspec)
{
if (!$_sf = $this->parseSubfields($subfieldspec)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SF.
InvalidMARCspecException::UNKNOWN,
$subfieldspec
);
}
... | [
"public",
"function",
"subfieldToArray",
"(",
"$",
"subfieldspec",
")",
"{",
"if",
"(",
"!",
"$",
"_sf",
"=",
"$",
"this",
"->",
"parseSubfields",
"(",
"$",
"subfieldspec",
")",
")",
"{",
"throw",
"new",
"InvalidMARCspecException",
"(",
"InvalidMARCspecExcepti... | calls parseSubfields but makes sure only one subfield is present.
@param string $subfieldspec A subfieldspec
@return array An Array of subfieldspec | [
"calls",
"parseSubfields",
"but",
"makes",
"sure",
"only",
"one",
"subfield",
"is",
"present",
"."
] | 853d77ad3d510ce05c33535bfa3f1068dccdeef6 | https://github.com/MARCspec/php-marc-spec/blob/853d77ad3d510ce05c33535bfa3f1068dccdeef6/src/MARCspecParser.php#L269-L296 | train |
MARCspec/php-marc-spec | src/MARCspecParser.php | MARCspecParser.matchSubSpecs | private function matchSubSpecs($subSpecs)
{
$_subSpecs = [];
if (!preg_match_all('/'.$this->SUBSPEC.'/U', $subSpecs, $_subSpecMatches, PREG_SET_ORDER)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SS.
InvalidMARCspecException::UNKNOWN,
... | php | private function matchSubSpecs($subSpecs)
{
$_subSpecs = [];
if (!preg_match_all('/'.$this->SUBSPEC.'/U', $subSpecs, $_subSpecMatches, PREG_SET_ORDER)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SS.
InvalidMARCspecException::UNKNOWN,
... | [
"private",
"function",
"matchSubSpecs",
"(",
"$",
"subSpecs",
")",
"{",
"$",
"_subSpecs",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"preg_match_all",
"(",
"'/'",
".",
"$",
"this",
"->",
"SUBSPEC",
".",
"'/U'",
",",
"$",
"subSpecs",
",",
"$",
"_subSpecMatches... | parses subspecs into an array.
@param string $subSpecs One or more subspecs
@return array Array of subspecs | [
"parses",
"subspecs",
"into",
"an",
"array",
"."
] | 853d77ad3d510ce05c33535bfa3f1068dccdeef6 | https://github.com/MARCspec/php-marc-spec/blob/853d77ad3d510ce05c33535bfa3f1068dccdeef6/src/MARCspecParser.php#L305-L329 | train |
MARCspec/php-marc-spec | src/MARCspecParser.php | MARCspecParser.matchSubTerms | private function matchSubTerms($subSpec)
{
if (preg_match('/(?<![\\\\\$])[\{\}]/', $subSpec, $_error, PREG_OFFSET_CAPTURE)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SS.
InvalidMARCspecException::ESCAPE,
$subSpec
)... | php | private function matchSubTerms($subSpec)
{
if (preg_match('/(?<![\\\\\$])[\{\}]/', $subSpec, $_error, PREG_OFFSET_CAPTURE)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::SS.
InvalidMARCspecException::ESCAPE,
$subSpec
)... | [
"private",
"function",
"matchSubTerms",
"(",
"$",
"subSpec",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/(?<![\\\\\\\\\\$])[\\{\\}]/'",
",",
"$",
"subSpec",
",",
"$",
"_error",
",",
"PREG_OFFSET_CAPTURE",
")",
")",
"{",
"throw",
"new",
"InvalidMARCspecException",
... | Parses a single SubSpec into sunTerms.
@param string $subSpec A single SubSpec
@return array subTerms as array | [
"Parses",
"a",
"single",
"SubSpec",
"into",
"sunTerms",
"."
] | 853d77ad3d510ce05c33535bfa3f1068dccdeef6 | https://github.com/MARCspec/php-marc-spec/blob/853d77ad3d510ce05c33535bfa3f1068dccdeef6/src/MARCspecParser.php#L338-L368 | train |
codemojo-dr/startkit-php-sdk | src/CodeMojo/Client/Services/WalletService.php | WalletService.getBalance | public function getBalance($user_id, $type = -1){
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET . Endpoints::WALLET_CREDITS_BALANCE;
$url = sprintf($url, $user_id, $type);
$result = $this->authenticationService->getTransport()->fetch($url)... | php | public function getBalance($user_id, $type = -1){
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET . Endpoints::WALLET_CREDITS_BALANCE;
$url = sprintf($url, $user_id, $type);
$result = $this->authenticationService->getTransport()->fetch($url)... | [
"public",
"function",
"getBalance",
"(",
"$",
"user_id",
",",
"$",
"type",
"=",
"-",
"1",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"authenticationService",
"->",
"getServerEndPoint",
"(",
")",
".",
"Endpoints",
"::",
"VERSION",
".",
"Endpoints",
"::... | Get the wallet balance of a user
@param $user_id
@param int $type
@return float
@throws Exception
@throws \CodeMojo\Client\Http\InvalidArgumentException | [
"Get",
"the",
"wallet",
"balance",
"of",
"a",
"user"
] | cd2227e1a221be2cd75dc96d1c9e0acfda936fb3 | https://github.com/codemojo-dr/startkit-php-sdk/blob/cd2227e1a221be2cd75dc96d1c9e0acfda936fb3/src/CodeMojo/Client/Services/WalletService.php#L50-L60 | train |
codemojo-dr/startkit-php-sdk | src/CodeMojo/Client/Services/WalletService.php | WalletService.getTransactionDetail | public function getTransactionDetail($transaction_id){
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET . Endpoints::WALLET_TRANSACTION;
$url = sprintf($url,$transaction_id);
$result = $this->authenticationService->getTransport()->fetch($url)... | php | public function getTransactionDetail($transaction_id){
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET . Endpoints::WALLET_TRANSACTION;
$url = sprintf($url,$transaction_id);
$result = $this->authenticationService->getTransport()->fetch($url)... | [
"public",
"function",
"getTransactionDetail",
"(",
"$",
"transaction_id",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"authenticationService",
"->",
"getServerEndPoint",
"(",
")",
".",
"Endpoints",
"::",
"VERSION",
".",
"Endpoints",
"::",
"BASE_WALLET",
".",
... | Get details about a particular transaction
@param $transaction_id
@return array
@throws Exception
@throws InvalidArgumentException | [
"Get",
"details",
"about",
"a",
"particular",
"transaction"
] | cd2227e1a221be2cd75dc96d1c9e0acfda936fb3 | https://github.com/codemojo-dr/startkit-php-sdk/blob/cd2227e1a221be2cd75dc96d1c9e0acfda936fb3/src/CodeMojo/Client/Services/WalletService.php#L69-L82 | train |
codemojo-dr/startkit-php-sdk | src/CodeMojo/Client/Services/WalletService.php | WalletService.getTransactionDetailsForUser | public function getTransactionDetailsForUser($user_id, $count = 10, $paginated_url = null, $page = 1){
if($paginated_url) {
$url = $paginated_url;
}else {
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET
. Endp... | php | public function getTransactionDetailsForUser($user_id, $count = 10, $paginated_url = null, $page = 1){
if($paginated_url) {
$url = $paginated_url;
}else {
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET
. Endp... | [
"public",
"function",
"getTransactionDetailsForUser",
"(",
"$",
"user_id",
",",
"$",
"count",
"=",
"10",
",",
"$",
"paginated_url",
"=",
"null",
",",
"$",
"page",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"paginated_url",
")",
"{",
"$",
"url",
"=",
"$",
"p... | Get all transactions for a particular user
@param $user_id
@param int $count
@param null $paginated_url
@param int $page
@return PaginatedResults
@throws Exception
@throws \CodeMojo\Client\Http\InvalidArgumentException | [
"Get",
"all",
"transactions",
"for",
"a",
"particular",
"user"
] | cd2227e1a221be2cd75dc96d1c9e0acfda936fb3 | https://github.com/codemojo-dr/startkit-php-sdk/blob/cd2227e1a221be2cd75dc96d1c9e0acfda936fb3/src/CodeMojo/Client/Services/WalletService.php#L94-L113 | train |
codemojo-dr/startkit-php-sdk | src/CodeMojo/Client/Services/WalletService.php | WalletService.addBalance | public function addBalance($user_id, $value_to_add, $transaction_type = WalletTransactionTypes::TRANSACTIONAL, $expires_in_days = 0, $transaction_id = null, $meta_data = null, $tag = null, $frozen = false){
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET . ... | php | public function addBalance($user_id, $value_to_add, $transaction_type = WalletTransactionTypes::TRANSACTIONAL, $expires_in_days = 0, $transaction_id = null, $meta_data = null, $tag = null, $frozen = false){
$url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_WALLET . ... | [
"public",
"function",
"addBalance",
"(",
"$",
"user_id",
",",
"$",
"value_to_add",
",",
"$",
"transaction_type",
"=",
"WalletTransactionTypes",
"::",
"TRANSACTIONAL",
",",
"$",
"expires_in_days",
"=",
"0",
",",
"$",
"transaction_id",
"=",
"null",
",",
"$",
"me... | Add balance to a particular user's wallet
@param $user_id
@param $value_to_add
@param int $transaction_type
@param int|null $expires_in_days
@param null $transaction_id
@param null $meta_data
@param null $tag
@param bool|false $frozen
@return bool
@throws QuotaExceededException | [
"Add",
"balance",
"to",
"a",
"particular",
"user",
"s",
"wallet"
] | cd2227e1a221be2cd75dc96d1c9e0acfda936fb3 | https://github.com/codemojo-dr/startkit-php-sdk/blob/cd2227e1a221be2cd75dc96d1c9e0acfda936fb3/src/CodeMojo/Client/Services/WalletService.php#L223-L239 | train |
zapheus/zapheus | src/Http/Message/UriFactory.php | UriFactory.make | public function make()
{
$authority = $this->host;
$fragment = $this->fragment;
$query = $this->query;
if ($this->host !== '' && $this->user !== null)
{
$user = $this->user;
if ($this->pass)
{
$user = $this->user . ':' .... | php | public function make()
{
$authority = $this->host;
$fragment = $this->fragment;
$query = $this->query;
if ($this->host !== '' && $this->user !== null)
{
$user = $this->user;
if ($this->pass)
{
$user = $this->user . ':' .... | [
"public",
"function",
"make",
"(",
")",
"{",
"$",
"authority",
"=",
"$",
"this",
"->",
"host",
";",
"$",
"fragment",
"=",
"$",
"this",
"->",
"fragment",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"query",
";",
"if",
"(",
"$",
"this",
"->",
"host"... | Creates the URI instance.
@return \Zapheus\Http\Message\UriInterface | [
"Creates",
"the",
"URI",
"instance",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Http/Message/UriFactory.php#L116-L149 | train |
zapheus/zapheus | src/Http/Message/UriFactory.php | UriFactory.user | public function user($user, $pass = null)
{
if ($pass)
{
$this->pass = $pass;
}
$this->user = $user;
return $this;
} | php | public function user($user, $pass = null)
{
if ($pass)
{
$this->pass = $pass;
}
$this->user = $user;
return $this;
} | [
"public",
"function",
"user",
"(",
"$",
"user",
",",
"$",
"pass",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"pass",
")",
"{",
"$",
"this",
"->",
"pass",
"=",
"$",
"pass",
";",
"}",
"$",
"this",
"->",
"user",
"=",
"$",
"user",
";",
"return",
"$",... | Sets the user component.
@param string $user
@return self | [
"Sets",
"the",
"user",
"component",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Http/Message/UriFactory.php#L209-L219 | train |
RocketPropelledTortoise/Core | src/Taxonomy/TaxonomyTrait.php | TaxonomyTrait.getTerms | public function getTerms($vocabulary_id)
{
if (!$data = Cache::get($this->getTaxonomyCacheKey())) {
$data = $this->cacheTermsForContent();
}
if (!is_numeric($vocabulary_id)) {
$vocabulary_id = T::vocabulary($vocabulary_id);
}
$results = new Collectio... | php | public function getTerms($vocabulary_id)
{
if (!$data = Cache::get($this->getTaxonomyCacheKey())) {
$data = $this->cacheTermsForContent();
}
if (!is_numeric($vocabulary_id)) {
$vocabulary_id = T::vocabulary($vocabulary_id);
}
$results = new Collectio... | [
"public",
"function",
"getTerms",
"(",
"$",
"vocabulary_id",
")",
"{",
"if",
"(",
"!",
"$",
"data",
"=",
"Cache",
"::",
"get",
"(",
"$",
"this",
"->",
"getTaxonomyCacheKey",
"(",
")",
")",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"cacheTermsFor... | Get the terms from a content
@param int|string $vocabulary_id
@return Collection | [
"Get",
"the",
"terms",
"from",
"a",
"content"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/TaxonomyTrait.php#L85-L103 | train |
RocketPropelledTortoise/Core | src/Taxonomy/TaxonomyTrait.php | TaxonomyTrait.addTerm | public function addTerm($term_id)
{
TermContainer::findOrFail($term_id);
// Cancel if the user wants to add the same term again
if ($this->getTaxonomyQuery()->where('term_id', $term_id)->count()) {
return;
}
$this->taxonomies()->attach($term_id);
Cache:... | php | public function addTerm($term_id)
{
TermContainer::findOrFail($term_id);
// Cancel if the user wants to add the same term again
if ($this->getTaxonomyQuery()->where('term_id', $term_id)->count()) {
return;
}
$this->taxonomies()->attach($term_id);
Cache:... | [
"public",
"function",
"addTerm",
"(",
"$",
"term_id",
")",
"{",
"TermContainer",
"::",
"findOrFail",
"(",
"$",
"term_id",
")",
";",
"// Cancel if the user wants to add the same term again",
"if",
"(",
"$",
"this",
"->",
"getTaxonomyQuery",
"(",
")",
"->",
"where",... | Link a term to this content
@param int $term_id | [
"Link",
"a",
"term",
"to",
"this",
"content"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/TaxonomyTrait.php#L110-L122 | train |
RocketPropelledTortoise/Core | src/Taxonomy/TaxonomyTrait.php | TaxonomyTrait.removeTerms | public function removeTerms($vocabulary_id = null)
{
if ($vocabulary_id === null) {
return $this->getTaxonomyQuery()->delete();
}
if (!is_numeric($vocabulary_id)) {
$vocabulary_id = T::vocabulary($vocabulary_id);
}
return $this->getTaxonomyQuery()->w... | php | public function removeTerms($vocabulary_id = null)
{
if ($vocabulary_id === null) {
return $this->getTaxonomyQuery()->delete();
}
if (!is_numeric($vocabulary_id)) {
$vocabulary_id = T::vocabulary($vocabulary_id);
}
return $this->getTaxonomyQuery()->w... | [
"public",
"function",
"removeTerms",
"(",
"$",
"vocabulary_id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"vocabulary_id",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getTaxonomyQuery",
"(",
")",
"->",
"delete",
"(",
")",
";",
"}",
"if",
"(",
... | Removes terms specified by a vocabulary, or all
@param int|string $vocabulary_id
@return bool | [
"Removes",
"terms",
"specified",
"by",
"a",
"vocabulary",
"or",
"all"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/TaxonomyTrait.php#L145-L158 | train |
RocketPropelledTortoise/Core | src/Taxonomy/TaxonomyTrait.php | TaxonomyTrait.getTaxonomyQuery | private function getTaxonomyQuery()
{
$t = $this->taxonomies();
return $t->newPivotStatement()
->where($t->getForeignKey(), $this->getKey())
->where($t->getMorphType(), $t->getMorphClass());
} | php | private function getTaxonomyQuery()
{
$t = $this->taxonomies();
return $t->newPivotStatement()
->where($t->getForeignKey(), $this->getKey())
->where($t->getMorphType(), $t->getMorphClass());
} | [
"private",
"function",
"getTaxonomyQuery",
"(",
")",
"{",
"$",
"t",
"=",
"$",
"this",
"->",
"taxonomies",
"(",
")",
";",
"return",
"$",
"t",
"->",
"newPivotStatement",
"(",
")",
"->",
"where",
"(",
"$",
"t",
"->",
"getForeignKey",
"(",
")",
",",
"$",... | Get a new plain query builder for the pivot table.
@return Builder | [
"Get",
"a",
"new",
"plain",
"query",
"builder",
"for",
"the",
"pivot",
"table",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/TaxonomyTrait.php#L202-L209 | train |
codeblanche/Web | src/Web/Response/Cookie.php | Cookie.commit | public function commit()
{
return setcookie(
$this->name,
$this->value,
$this->expires,
$this->path,
$this->domain,
$this->secure,
$this->httpOnly
);
} | php | public function commit()
{
return setcookie(
$this->name,
$this->value,
$this->expires,
$this->path,
$this->domain,
$this->secure,
$this->httpOnly
);
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"return",
"setcookie",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"value",
",",
"$",
"this",
"->",
"expires",
",",
"$",
"this",
"->",
"path",
",",
"$",
"this",
"->",
"domain",
",",
"$",
... | Send the cookie | [
"Send",
"the",
"cookie"
] | 3e9ebf1943d3ea468f619ba99f7cc10714cb16e9 | https://github.com/codeblanche/Web/blob/3e9ebf1943d3ea468f619ba99f7cc10714cb16e9/src/Web/Response/Cookie.php#L39-L50 | train |
linpax/microphp-framework | src/base/Dispatcher.php | Dispatcher.addListener | public function addListener($listener, $event, $prior = null)
{
if (!is_callable($event)) {
return false;
}
if (!array_key_exists($listener, $this->listeners)) {
$this->listeners[$listener] = [];
}
if (!$prior) {
$this->listeners[$listene... | php | public function addListener($listener, $event, $prior = null)
{
if (!is_callable($event)) {
return false;
}
if (!array_key_exists($listener, $this->listeners)) {
$this->listeners[$listener] = [];
}
if (!$prior) {
$this->listeners[$listene... | [
"public",
"function",
"addListener",
"(",
"$",
"listener",
",",
"$",
"event",
",",
"$",
"prior",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"event",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
... | Add listener on event
@access public
@param string $listener listener name
@param array $event ['Object', 'method'] or callable
@param int|null $prior priority
@return bool | [
"Add",
"listener",
"on",
"event"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/base/Dispatcher.php#L36-L53 | train |
linpax/microphp-framework | src/base/Dispatcher.php | Dispatcher.signal | public function signal($listener, array $params = [])
{
$result = null;
if (array_key_exists($listener, $this->listeners) && 0 !== count($this->listeners[$listener])) {
/** @noinspection ForeachSourceInspection */
foreach ($this->listeners[$listener] as $listen) {
... | php | public function signal($listener, array $params = [])
{
$result = null;
if (array_key_exists($listener, $this->listeners) && 0 !== count($this->listeners[$listener])) {
/** @noinspection ForeachSourceInspection */
foreach ($this->listeners[$listener] as $listen) {
... | [
"public",
"function",
"signal",
"(",
"$",
"listener",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"listener",
",",
"$",
"this",
"->",
"listeners",
")",
"&&",
"0",
"... | Send signal to run event
@access public
@param string $listener listener name
@param array $params Signal parameters
@return mixed | [
"Send",
"signal",
"to",
"run",
"event"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/base/Dispatcher.php#L65-L81 | train |
koolkode/security | src/Authentication/Token/NtlmAuthToken.php | NtlmAuthToken.isValidResponse | public function isValidResponse($username, $hash, $challenge)
{
if(self::NTLM_BLOB_HEADER != substr($this->clientBlob, 0, 8))
{
return false;
}
// Timstamp, seconds since january 1, 1601, used in replay-attack prevention.
// $str = (float)vsprintf('%u%04u%04u%04u', array_reverse(unpack('vt1/vt2/vt3/vt4... | php | public function isValidResponse($username, $hash, $challenge)
{
if(self::NTLM_BLOB_HEADER != substr($this->clientBlob, 0, 8))
{
return false;
}
// Timstamp, seconds since january 1, 1601, used in replay-attack prevention.
// $str = (float)vsprintf('%u%04u%04u%04u', array_reverse(unpack('vt1/vt2/vt3/vt4... | [
"public",
"function",
"isValidResponse",
"(",
"$",
"username",
",",
"$",
"hash",
",",
"$",
"challenge",
")",
"{",
"if",
"(",
"self",
"::",
"NTLM_BLOB_HEADER",
"!=",
"substr",
"(",
"$",
"this",
"->",
"clientBlob",
",",
"0",
",",
"8",
")",
")",
"{",
"r... | Needs the MD4 hash of the UTF-16LE encoded password of the user in hex- or binary format.
@param string $username
@param string $hash
@param unknown $challenge | [
"Needs",
"the",
"MD4",
"hash",
"of",
"the",
"UTF",
"-",
"16LE",
"encoded",
"password",
"of",
"the",
"user",
"in",
"hex",
"-",
"or",
"binary",
"format",
"."
] | d3d8d42392f520754847d29b6df19aaa38c79e8e | https://github.com/koolkode/security/blob/d3d8d42392f520754847d29b6df19aaa38c79e8e/src/Authentication/Token/NtlmAuthToken.php#L389-L422 | train |
gocom/rah_beacon | src/Rah/Beacon.php | Rah_Beacon.light | public function light()
{
$forms = safe_column(
'name',
'txp_form',
'1 = 1'
);
$beacon = new Rah_Beacon_Handler();
foreach ($forms as $name) {
if (!preg_match('/^[a-z][a-z0-9_]*$/', $name)) {
trace_add('[rah_beacon: '.... | php | public function light()
{
$forms = safe_column(
'name',
'txp_form',
'1 = 1'
);
$beacon = new Rah_Beacon_Handler();
foreach ($forms as $name) {
if (!preg_match('/^[a-z][a-z0-9_]*$/', $name)) {
trace_add('[rah_beacon: '.... | [
"public",
"function",
"light",
"(",
")",
"{",
"$",
"forms",
"=",
"safe_column",
"(",
"'name'",
",",
"'txp_form'",
",",
"'1 = 1'",
")",
";",
"$",
"beacon",
"=",
"new",
"Rah_Beacon_Handler",
"(",
")",
";",
"foreach",
"(",
"$",
"forms",
"as",
"$",
"name",... | Registers forms as tags. | [
"Registers",
"forms",
"as",
"tags",
"."
] | a5cacf3c7293fb3524c55cc073c820cfbf31e8f7 | https://github.com/gocom/rah_beacon/blob/a5cacf3c7293fb3524c55cc073c820cfbf31e8f7/src/Rah/Beacon.php#L44-L62 | train |
gocom/rah_beacon | src/Rah/Beacon.php | Rah_Beacon.atts | public function atts($atts)
{
global $variable;
foreach (lAtts($atts, $variable, false) as $name => $value) {
$variable[$name] = $value;
}
} | php | public function atts($atts)
{
global $variable;
foreach (lAtts($atts, $variable, false) as $name => $value) {
$variable[$name] = $value;
}
} | [
"public",
"function",
"atts",
"(",
"$",
"atts",
")",
"{",
"global",
"$",
"variable",
";",
"foreach",
"(",
"lAtts",
"(",
"$",
"atts",
",",
"$",
"variable",
",",
"false",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"variable",
"[",
"... | A tag for assigning attribute defaults for tags.
This tag should be called within the Form partial if
it requires defaults for it's variables.
<code>
<txp:rah_beacon_atts color="blue" size="small" />
</code>
The above would create a variable named "color" and "size"
with values "blue" and "small" if one of them isn'... | [
"A",
"tag",
"for",
"assigning",
"attribute",
"defaults",
"for",
"tags",
"."
] | a5cacf3c7293fb3524c55cc073c820cfbf31e8f7 | https://github.com/gocom/rah_beacon/blob/a5cacf3c7293fb3524c55cc073c820cfbf31e8f7/src/Rah/Beacon.php#L82-L89 | train |
eureka-framework/component-application | src/Application/Applicationv3.php | Applicationv3.loadConfigPackages | private function loadConfigPackages()
{
$config = Container::getInstance()->get('config');
$list = $config->get('global.package');
if (empty($list) || !is_array($list)) {
return;
}
foreach ($list as $name => $data) {
if (!isset($data['config'])) {
... | php | private function loadConfigPackages()
{
$config = Container::getInstance()->get('config');
$list = $config->get('global.package');
if (empty($list) || !is_array($list)) {
return;
}
foreach ($list as $name => $data) {
if (!isset($data['config'])) {
... | [
"private",
"function",
"loadConfigPackages",
"(",
")",
"{",
"$",
"config",
"=",
"Container",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"'config'",
")",
";",
"$",
"list",
"=",
"$",
"config",
"->",
"get",
"(",
"'global.package'",
")",
";",
"if",
"... | Load configs from packages.
@return void | [
"Load",
"configs",
"from",
"packages",
"."
] | 5bf70f20967ef15515abe764b465641277a51537 | https://github.com/eureka-framework/component-application/blob/5bf70f20967ef15515abe764b465641277a51537/src/Application/Applicationv3.php#L55-L71 | train |
realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Executor.php | Executor._merge_values | private function _merge_values($data, $values, $columns)
{
foreach ($values as $key => $value) {
if (!is_numeric($key) && $key != '[]') {
if (isset($columns[$key])) {
$type = strtolower($columns[$key]);
if ($value === null) {
... | php | private function _merge_values($data, $values, $columns)
{
foreach ($values as $key => $value) {
if (!is_numeric($key) && $key != '[]') {
if (isset($columns[$key])) {
$type = strtolower($columns[$key]);
if ($value === null) {
... | [
"private",
"function",
"_merge_values",
"(",
"$",
"data",
",",
"$",
"values",
",",
"$",
"columns",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"key",
")",
"&&",
... | Attach Value to row data.
@param array|\Realboard\Component\Database\DBInstance\DBInterface\DataInterface $data data
@param array $values
@param array $columns
@return array|\Realbo... | [
"Attach",
"Value",
"to",
"row",
"data",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Executor.php#L169-L212 | train |
realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Executor.php | Executor._define_column_types | private function _define_column_types(\PDOStatement $result)
{
$columns = array();
$intTypes = array('int', 'integer', 'long', 'tiny', 'smallint', 'int4');
try {
for ($i = 0; $i < $result->columnCount(); ++$i) {
$meta = $result->getColumnMeta($i);
... | php | private function _define_column_types(\PDOStatement $result)
{
$columns = array();
$intTypes = array('int', 'integer', 'long', 'tiny', 'smallint', 'int4');
try {
for ($i = 0; $i < $result->columnCount(); ++$i) {
$meta = $result->getColumnMeta($i);
... | [
"private",
"function",
"_define_column_types",
"(",
"\\",
"PDOStatement",
"$",
"result",
")",
"{",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"$",
"intTypes",
"=",
"array",
"(",
"'int'",
",",
"'integer'",
",",
"'long'",
",",
"'tiny'",
",",
"'smallint'",
... | Define columns from result.
@param \PDOStatement $result
@return array | [
"Define",
"columns",
"from",
"result",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Executor.php#L221-L246 | train |
Stillat/Common | src/Stillat/Common/Collections/Sorting/CollectionSortMap.php | CollectionSortMap.addThreshold | public function addThreshold($threshold, $driver)
{
if (!is_int($threshold) || $threshold <= 0) {
throw new InvalidArgumentException("The threshold '{$threshold}' is invalid. The threshold must be an integer and greater than '0'.");
}
$this->sortThresholds[$threshold] = $driver;... | php | public function addThreshold($threshold, $driver)
{
if (!is_int($threshold) || $threshold <= 0) {
throw new InvalidArgumentException("The threshold '{$threshold}' is invalid. The threshold must be an integer and greater than '0'.");
}
$this->sortThresholds[$threshold] = $driver;... | [
"public",
"function",
"addThreshold",
"(",
"$",
"threshold",
",",
"$",
"driver",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"threshold",
")",
"||",
"$",
"threshold",
"<=",
"0",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"The threshold ... | Adds a new sorting algorithm with the specified threshold
@throws InvalidArgumentException if the $threshold is not an integer, or is not greater than 0
@param int $threshold The collection count threshold
@param string $driver The sorting driver to use at the threshold | [
"Adds",
"a",
"new",
"sorting",
"algorithm",
"with",
"the",
"specified",
"threshold"
] | 9f69105292740c307aece588cf58a85892bad350 | https://github.com/Stillat/Common/blob/9f69105292740c307aece588cf58a85892bad350/src/Stillat/Common/Collections/Sorting/CollectionSortMap.php#L20-L27 | train |
Stillat/Common | src/Stillat/Common/Collections/Sorting/CollectionSortMap.php | CollectionSortMap.determineDriver | public function determineDriver($collectionCount)
{
$determinedDriver = 'native';
ksort($this->sortThresholds, SORT_NUMERIC);
foreach ($this->sortThresholds as $threshold => $driver) {
if ($collectionCount <= $threshold) {
$determinedDriver = $driver;
... | php | public function determineDriver($collectionCount)
{
$determinedDriver = 'native';
ksort($this->sortThresholds, SORT_NUMERIC);
foreach ($this->sortThresholds as $threshold => $driver) {
if ($collectionCount <= $threshold) {
$determinedDriver = $driver;
... | [
"public",
"function",
"determineDriver",
"(",
"$",
"collectionCount",
")",
"{",
"$",
"determinedDriver",
"=",
"'native'",
";",
"ksort",
"(",
"$",
"this",
"->",
"sortThresholds",
",",
"SORT_NUMERIC",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"sortThresholds"... | Determines the driver to use based on a collection's size
@param int $collectionCount The size of the collection
@return string The driver to use | [
"Determines",
"the",
"driver",
"to",
"use",
"based",
"on",
"a",
"collection",
"s",
"size"
] | 9f69105292740c307aece588cf58a85892bad350 | https://github.com/Stillat/Common/blob/9f69105292740c307aece588cf58a85892bad350/src/Stillat/Common/Collections/Sorting/CollectionSortMap.php#L46-L61 | train |
Scoilnet/PhpSDK | scoilnetsdk/ScoilnetClient.php | ScoilnetClient.getSessionObject | protected function getSessionObject($access_token = NULL) {
$session = NULL;
// Try generate local version of session cookie.
if (!empty($access_token) && isset($access_token['access_token'])) {
$session['access_token'] = $access_token['access_token'];
$session['base_domain'] = $this->get... | php | protected function getSessionObject($access_token = NULL) {
$session = NULL;
// Try generate local version of session cookie.
if (!empty($access_token) && isset($access_token['access_token'])) {
$session['access_token'] = $access_token['access_token'];
$session['base_domain'] = $this->get... | [
"protected",
"function",
"getSessionObject",
"(",
"$",
"access_token",
"=",
"NULL",
")",
"{",
"$",
"session",
"=",
"NULL",
";",
"// Try generate local version of session cookie.\r",
"if",
"(",
"!",
"empty",
"(",
"$",
"access_token",
")",
"&&",
"isset",
"(",
"$",... | Try to get session object from custom method.
By default we generate session object based on access_token response, or
if it is provided from server with $_REQUEST. For sure, if it is provided
by server it should follow our session object format.
Session object provided by server can ensure the correct expires and
ba... | [
"Try",
"to",
"get",
"session",
"object",
"from",
"custom",
"method",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/ScoilnetClient.php#L157-L193 | train |
Scoilnet/PhpSDK | scoilnetsdk/ScoilnetClient.php | ScoilnetClient.makeOAuth2Request | protected function makeOAuth2Request($path, $method = 'GET', $params = array()) {
if ((!isset($params['access_token']) || empty($params['access_token'])) && $oauth_token = $this->getAccessToken()) {
$params['access_token'] = $oauth_token;
}
return $this->makeRequest($path, $method, $params);... | php | protected function makeOAuth2Request($path, $method = 'GET', $params = array()) {
if ((!isset($params['access_token']) || empty($params['access_token'])) && $oauth_token = $this->getAccessToken()) {
$params['access_token'] = $oauth_token;
}
return $this->makeRequest($path, $method, $params);... | [
"protected",
"function",
"makeOAuth2Request",
"(",
"$",
"path",
",",
"$",
"method",
"=",
"'GET'",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'access_token'",
"]",
")",
"||",
"empty",
... | Make an OAuth2.0 Request.
Automatically append "oauth_token" in query parameters if not yet
exists and able to discover a valid access token from session. Otherwise
just ignore setup with "oauth_token" and handle the API call AS-IS, and
so may issue a plain API call without OAuth2.0 protection.
@param $path
The targe... | [
"Make",
"an",
"OAuth2",
".",
"0",
"Request",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/ScoilnetClient.php#L247-L253 | train |
PatrolServer/patrolsdk-php | lib/Exploit.php | Exploit.all | public function all($scopes = []) {
return $this->_get('servers/' . $this->server_id . '/software/' . $this->software_id . '/exploits', null, $scopes);
} | php | public function all($scopes = []) {
return $this->_get('servers/' . $this->server_id . '/software/' . $this->software_id . '/exploits', null, $scopes);
} | [
"public",
"function",
"all",
"(",
"$",
"scopes",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_get",
"(",
"'servers/'",
".",
"$",
"this",
"->",
"server_id",
".",
"'/software/'",
".",
"$",
"this",
"->",
"software_id",
".",
"'/exploits'",
",",
... | Gets a list of all exploits of this particular software
@param array $scopes optional
@return array List of PatrolSdk\Exploit | [
"Gets",
"a",
"list",
"of",
"all",
"exploits",
"of",
"this",
"particular",
"software"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Exploit.php#L38-L40 | train |
Stinger-Soft/DoctrineCommons | src/StingerSoft/DoctrineCommons/Utils/Helper/ImportListener.php | ImportListener.tableExists | protected function tableExists($tableName) {
if(isset($this->nonExistingTables[$tableName]))
return false;
if(isset($this->existingTables[$tableName]))
return true;
$exists = $this->schemaManager->tablesExist(array(
$tableName
));
if(!$exists) {
$this->nonExistingTables[$tableName] = 1;
} else ... | php | protected function tableExists($tableName) {
if(isset($this->nonExistingTables[$tableName]))
return false;
if(isset($this->existingTables[$tableName]))
return true;
$exists = $this->schemaManager->tablesExist(array(
$tableName
));
if(!$exists) {
$this->nonExistingTables[$tableName] = 1;
} else ... | [
"protected",
"function",
"tableExists",
"(",
"$",
"tableName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"nonExistingTables",
"[",
"$",
"tableName",
"]",
")",
")",
"return",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"existin... | Checks if the given table exists
@param string $tableName
The table name to check
@return boolean Returns true if the table exists, otherwise false | [
"Checks",
"if",
"the",
"given",
"table",
"exists"
] | 1f0dd56a94654c8de63927d7eec2175aab3cf809 | https://github.com/Stinger-Soft/DoctrineCommons/blob/1f0dd56a94654c8de63927d7eec2175aab3cf809/src/StingerSoft/DoctrineCommons/Utils/Helper/ImportListener.php#L257-L271 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Expression/Condition/Operator/Operator.php | Operator.validateMappings | protected function validateMappings($mappings, $allowAssociations)
{
$type = null;
foreach ($mappings as $mapping) {
//compatible date or number types are identical for our purposes here
switch ($mapping->type) {
case Type::TIMESTAMP:
$this... | php | protected function validateMappings($mappings, $allowAssociations)
{
$type = null;
foreach ($mappings as $mapping) {
//compatible date or number types are identical for our purposes here
switch ($mapping->type) {
case Type::TIMESTAMP:
$this... | [
"protected",
"function",
"validateMappings",
"(",
"$",
"mappings",
",",
"$",
"allowAssociations",
")",
"{",
"$",
"type",
"=",
"null",
";",
"foreach",
"(",
"$",
"mappings",
"as",
"$",
"mapping",
")",
"{",
"//compatible date or number types are identical for our purpo... | Validate that the provided mappings use compatible serialization strategies.
Adhere to the fail-fast principle by throwing exceptions here rather than
processing nonsensical queries that return misleading results.
@param PropertyMetadata[] $mappings
@param bool $allowAssociations
@return void
@throws ... | [
"Validate",
"that",
"the",
"provided",
"mappings",
"use",
"compatible",
"serialization",
"strategies",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Condition/Operator/Operator.php#L79-L162 | train |
ibonly/Potato-ORM | src/Database/DatabaseQuery.php | DatabaseQuery.checkTableExist | public function checkTableExist($table, $con=NULL)
{
$connection = $this->checkConnection($con);
$query = $connection->query("SELECT 1 FROM {$table} LIMIT 1");
if($query !== false)
{
return true;
}
} | php | public function checkTableExist($table, $con=NULL)
{
$connection = $this->checkConnection($con);
$query = $connection->query("SELECT 1 FROM {$table} LIMIT 1");
if($query !== false)
{
return true;
}
} | [
"public",
"function",
"checkTableExist",
"(",
"$",
"table",
",",
"$",
"con",
"=",
"NULL",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"checkConnection",
"(",
"$",
"con",
")",
";",
"$",
"query",
"=",
"$",
"connection",
"->",
"query",
"(",
"\"... | checkTableExist Check if table already in the database
@param $tablename
@param $con
@return bool | [
"checkTableExist",
"Check",
"if",
"table",
"already",
"in",
"the",
"database"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DatabaseQuery.php#L128-L136 | train |
ibonly/Potato-ORM | src/Database/DatabaseQuery.php | DatabaseQuery.checkTableName | protected static function checkTableName($tableName, $con=NULL)
{
$connection = self::checkConnection($con);
$query = $connection->query("SELECT 1 FROM {$tableName} LIMIT 1");
if($query !== false)
{
return $tableName;
}
throw new TableDoesNotExistExceptio... | php | protected static function checkTableName($tableName, $con=NULL)
{
$connection = self::checkConnection($con);
$query = $connection->query("SELECT 1 FROM {$tableName} LIMIT 1");
if($query !== false)
{
return $tableName;
}
throw new TableDoesNotExistExceptio... | [
"protected",
"static",
"function",
"checkTableName",
"(",
"$",
"tableName",
",",
"$",
"con",
"=",
"NULL",
")",
"{",
"$",
"connection",
"=",
"self",
"::",
"checkConnection",
"(",
"$",
"con",
")",
";",
"$",
"query",
"=",
"$",
"connection",
"->",
"query",
... | checkTableName Return the table name
@param $tablename
@param $con
@return string | [
"checkTableName",
"Return",
"the",
"table",
"name"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DatabaseQuery.php#L146-L156 | train |
ibonly/Potato-ORM | src/Database/DatabaseQuery.php | DatabaseQuery.checkColumn | protected static function checkColumn($tableName, $columnName, $con=NULL)
{
$connection = self::checkConnection($con);
$result = $connection->prepare("SELECT {$columnName} FROM {$tableName}");
$result->execute();
if (! $result->columnCount())
{
... | php | protected static function checkColumn($tableName, $columnName, $con=NULL)
{
$connection = self::checkConnection($con);
$result = $connection->prepare("SELECT {$columnName} FROM {$tableName}");
$result->execute();
if (! $result->columnCount())
{
... | [
"protected",
"static",
"function",
"checkColumn",
"(",
"$",
"tableName",
",",
"$",
"columnName",
",",
"$",
"con",
"=",
"NULL",
")",
"{",
"$",
"connection",
"=",
"self",
"::",
"checkConnection",
"(",
"$",
"con",
")",
";",
"$",
"result",
"=",
"$",
"conne... | checkColumn Check if column exist in table
@param $tableName
@param $columnName
@param $con
@return string | [
"checkColumn",
"Check",
"if",
"column",
"exist",
"in",
"table"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DatabaseQuery.php#L167-L178 | train |
ibonly/Potato-ORM | src/Database/DatabaseQuery.php | DatabaseQuery.buildColumn | protected static function buildColumn($data)
{
$counter = 0;
$insertQuery = "";
$arraySize = count($data);
foreach ($data as $key => $value)
{
$counter++;
$insertQuery .= self::sanitize($key);
if($arraySize > $counter)
$ins... | php | protected static function buildColumn($data)
{
$counter = 0;
$insertQuery = "";
$arraySize = count($data);
foreach ($data as $key => $value)
{
$counter++;
$insertQuery .= self::sanitize($key);
if($arraySize > $counter)
$ins... | [
"protected",
"static",
"function",
"buildColumn",
"(",
"$",
"data",
")",
"{",
"$",
"counter",
"=",
"0",
";",
"$",
"insertQuery",
"=",
"\"\"",
";",
"$",
"arraySize",
"=",
"count",
"(",
"$",
"data",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"... | buildColumn Build the column name
@param $data
@return string | [
"buildColumn",
"Build",
"the",
"column",
"name"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DatabaseQuery.php#L187-L201 | train |
ibonly/Potato-ORM | src/Database/DatabaseQuery.php | DatabaseQuery.buildClause | protected static function buildClause($tableName, $data)
{
$counter = 0;
$updateQuery = "";
$arraySize = count($data);
foreach ($data as $key => $value)
{
$counter++;
$columnName = self::checkColumn($tableName, self::sanitize($key));
$upda... | php | protected static function buildClause($tableName, $data)
{
$counter = 0;
$updateQuery = "";
$arraySize = count($data);
foreach ($data as $key => $value)
{
$counter++;
$columnName = self::checkColumn($tableName, self::sanitize($key));
$upda... | [
"protected",
"static",
"function",
"buildClause",
"(",
"$",
"tableName",
",",
"$",
"data",
")",
"{",
"$",
"counter",
"=",
"0",
";",
"$",
"updateQuery",
"=",
"\"\"",
";",
"$",
"arraySize",
"=",
"count",
"(",
"$",
"data",
")",
";",
"foreach",
"(",
"$",... | buildClause Build the clause value
@param $data
@return string | [
"buildClause",
"Build",
"the",
"clause",
"value"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DatabaseQuery.php#L233-L250 | train |
ibonly/Potato-ORM | src/Database/DatabaseQuery.php | DatabaseQuery.fields | protected function fields()
{
if (isset($this->fillables)) {
$this->output = (sizeof($this->fillables) > 0) ? implode($this->fillables, ',') : '*';
} else {
$this->output = '*';
}
return $this->output;
} | php | protected function fields()
{
if (isset($this->fillables)) {
$this->output = (sizeof($this->fillables) > 0) ? implode($this->fillables, ',') : '*';
} else {
$this->output = '*';
}
return $this->output;
} | [
"protected",
"function",
"fields",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fillables",
")",
")",
"{",
"$",
"this",
"->",
"output",
"=",
"(",
"sizeof",
"(",
"$",
"this",
"->",
"fillables",
")",
">",
"0",
")",
"?",
"implode",
"(... | Get the fields to be fillables defined in the model
@return string | [
"Get",
"the",
"fields",
"to",
"be",
"fillables",
"defined",
"in",
"the",
"model"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DatabaseQuery.php#L257-L266 | train |
Wedeto/DB | src/Migrate/Repository.php | Repository.addModule | public function addModule(Module $module)
{
if ($this->db !== $module->getDB())
throw new MigrationException("The DB instances should be the same");
$name = self::normalizeModule($module->getModule());
$this->modules[$name] = $module;
return $this;
} | php | public function addModule(Module $module)
{
if ($this->db !== $module->getDB())
throw new MigrationException("The DB instances should be the same");
$name = self::normalizeModule($module->getModule());
$this->modules[$name] = $module;
return $this;
} | [
"public",
"function",
"addModule",
"(",
"Module",
"$",
"module",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"db",
"!==",
"$",
"module",
"->",
"getDB",
"(",
")",
")",
"throw",
"new",
"MigrationException",
"(",
"\"The DB instances should be the same\"",
")",
";",... | Register a module that has already been instantiated
@param $module The module to register
@return Repository Provide fluent interface | [
"Register",
"a",
"module",
"that",
"has",
"already",
"been",
"instantiated"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Migrate/Repository.php#L63-L71 | train |
Wedeto/DB | src/Migrate/Repository.php | Repository.addMigration | public function addMigration(string $module, string $path)
{
$module = self::normalizeModule($module);
if (isset($this->modules[$module]))
throw new MigrationException("Duplicate module: " . $module);
$instance = new Module($module, $path, $this->db);
$this->modules[$mod... | php | public function addMigration(string $module, string $path)
{
$module = self::normalizeModule($module);
if (isset($this->modules[$module]))
throw new MigrationException("Duplicate module: " . $module);
$instance = new Module($module, $path, $this->db);
$this->modules[$mod... | [
"public",
"function",
"addMigration",
"(",
"string",
"$",
"module",
",",
"string",
"$",
"path",
")",
"{",
"$",
"module",
"=",
"self",
"::",
"normalizeModule",
"(",
"$",
"module",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"modules",
"[",
"... | Add a new migration using a module name and a path
The module object will be instantiated and registered.
@return Module The module instance | [
"Add",
"a",
"new",
"migration",
"using",
"a",
"module",
"name",
"and",
"a",
"path"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Migrate/Repository.php#L80-L89 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/version/VersionService.php | VersionService.getDeploymentRevision | public function getDeploymentRevision()
{
if ($this->version === false) {
$version = $this->cache->get('DeploymentRevision');
if ($version === false) {
$version = $this->versionDao->getSystemVersion();
if ($version === false)
$ve... | php | public function getDeploymentRevision()
{
if ($this->version === false) {
$version = $this->cache->get('DeploymentRevision');
if ($version === false) {
$version = $this->versionDao->getSystemVersion();
if ($version === false)
$ve... | [
"public",
"function",
"getDeploymentRevision",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"version",
"===",
"false",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"cache",
"->",
"get",
"(",
"'DeploymentRevision'",
")",
";",
"if",
"(",
"$",
"versi... | Returns the current system version
@return integer | [
"Returns",
"the",
"current",
"system",
"version"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/version/VersionService.php#L58-L77 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/version/VersionService.php | VersionService.incrementDeploymentRevision | public function incrementDeploymentRevision($details = null)
{
if (!$this->incrementedOnce) {
$backtrace = null;//serialize(debug_backtrace());
$version = $this->versionDao->insertSystemVersion($details, $backtrace);
$this->Events->trigger('SystemVersion.increment', $v... | php | public function incrementDeploymentRevision($details = null)
{
if (!$this->incrementedOnce) {
$backtrace = null;//serialize(debug_backtrace());
$version = $this->versionDao->insertSystemVersion($details, $backtrace);
$this->Events->trigger('SystemVersion.increment', $v... | [
"public",
"function",
"incrementDeploymentRevision",
"(",
"$",
"details",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"incrementedOnce",
")",
"{",
"$",
"backtrace",
"=",
"null",
";",
"//serialize(debug_backtrace());",
"$",
"version",
"=",
"$",
... | Increases the current SystemVersion by one
should invalidate all cached object which use this version number in their key
details are stored in log; details describe circumstance of version update
@param string $details A string explaining the reason for the new version
@return integer The new version | [
"Increases",
"the",
"current",
"SystemVersion",
"by",
"one"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/version/VersionService.php#L112-L132 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.build | private function build( $pString ) {
for ( $i=0; $i < strlen( $pString ); $i++ ) {
$this->addChar( $pString[$i] );
}
} | php | private function build( $pString ) {
for ( $i=0; $i < strlen( $pString ); $i++ ) {
$this->addChar( $pString[$i] );
}
} | [
"private",
"function",
"build",
"(",
"$",
"pString",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"strlen",
"(",
"$",
"pString",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"this",
"->",
"addChar",
"(",
"$",
"pString",
"[",
"$",... | Builds the suffix tree off the given string
@param string $pString String to build the suffix tree of | [
"Builds",
"the",
"suffix",
"tree",
"off",
"the",
"given",
"string"
] | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L106-L110 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.addSuffixLink | private function addSuffixLink( $pNode ) {
if ( $this->needSuffixLink > 0 ) {
$this->nodes[$this->needSuffixLink]->link = $pNode;
}
$this->needSuffixLink = $pNode;
} | php | private function addSuffixLink( $pNode ) {
if ( $this->needSuffixLink > 0 ) {
$this->nodes[$this->needSuffixLink]->link = $pNode;
}
$this->needSuffixLink = $pNode;
} | [
"private",
"function",
"addSuffixLink",
"(",
"$",
"pNode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"needSuffixLink",
">",
"0",
")",
"{",
"$",
"this",
"->",
"nodes",
"[",
"$",
"this",
"->",
"needSuffixLink",
"]",
"->",
"link",
"=",
"$",
"pNode",
";",
... | Adds the given node as target of the
current suffix link
@param integer $pNode Index of target node of the suffix link | [
"Adds",
"the",
"given",
"node",
"as",
"target",
"of",
"the",
"current",
"suffix",
"link"
] | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L118-L123 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.newNode | private function newNode( $pStart, $pEnd ) {
$this->nodes[++$this->currentNode] = new Node( $pStart, $pEnd, $this->currentNode );
return $this->currentNode;
} | php | private function newNode( $pStart, $pEnd ) {
$this->nodes[++$this->currentNode] = new Node( $pStart, $pEnd, $this->currentNode );
return $this->currentNode;
} | [
"private",
"function",
"newNode",
"(",
"$",
"pStart",
",",
"$",
"pEnd",
")",
"{",
"$",
"this",
"->",
"nodes",
"[",
"++",
"$",
"this",
"->",
"currentNode",
"]",
"=",
"new",
"Node",
"(",
"$",
"pStart",
",",
"$",
"pEnd",
",",
"$",
"this",
"->",
"cur... | Creates as new node with given start and end indexes. Increases
the current node by one.
@param integer $pStart Start index of node in string represented
by this tree
@param integer $pEnd End index of node in string represented
by this tree
@return integer Index of the current node | [
"Creates",
"as",
"new",
"node",
"with",
"given",
"start",
"and",
"end",
"indexes",
".",
"Increases",
"the",
"current",
"node",
"by",
"one",
"."
] | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L159-L163 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.addChar | private function addChar( $pChar ) {
$this->text[++$this->position] = $pChar;
$this->needSuffixLink = -1;
$this->remainder++;
while( $this->remainder > 0 ) {
if ( $this->activeLength === 0 ) {
$this->activeEdge = $this->position;
}
... | php | private function addChar( $pChar ) {
$this->text[++$this->position] = $pChar;
$this->needSuffixLink = -1;
$this->remainder++;
while( $this->remainder > 0 ) {
if ( $this->activeLength === 0 ) {
$this->activeEdge = $this->position;
}
... | [
"private",
"function",
"addChar",
"(",
"$",
"pChar",
")",
"{",
"$",
"this",
"->",
"text",
"[",
"++",
"$",
"this",
"->",
"position",
"]",
"=",
"$",
"pChar",
";",
"$",
"this",
"->",
"needSuffixLink",
"=",
"-",
"1",
";",
"$",
"this",
"->",
"remainder"... | Adds a single character to the suffix tree.
Updates edges as well as nodes
@param string $pChar A single character | [
"Adds",
"a",
"single",
"character",
"to",
"the",
"suffix",
"tree",
".",
"Updates",
"edges",
"as",
"well",
"as",
"nodes"
] | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L171-L218 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.getAllSurpriseValues | public function getAllSurpriseValues() {
$allSurprises = array();
foreach ( $this->nodes as $node ) {
if ( $node->start != -1 && $node->end != -1 ) {
$allSurprises[] = $node->surpriseValue;
}
}
return $allSurprises;
} | php | public function getAllSurpriseValues() {
$allSurprises = array();
foreach ( $this->nodes as $node ) {
if ( $node->start != -1 && $node->end != -1 ) {
$allSurprises[] = $node->surpriseValue;
}
}
return $allSurprises;
} | [
"public",
"function",
"getAllSurpriseValues",
"(",
")",
"{",
"$",
"allSurprises",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"->",
"start",
"!=",
"-",
"1",
"&&",
"$"... | Returns an array containing the surprise values of
each node of this tree.
@return array The array | [
"Returns",
"an",
"array",
"containing",
"the",
"surprise",
"values",
"of",
"each",
"node",
"of",
"this",
"tree",
"."
] | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L236-L244 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.findSurpriseValue | private function findSurpriseValue( Node $pNode, $pSubstring ) {
$length = $pNode->end - $pNode->start;
$text = implode('', $this->text);
if ( ($pNode->start != -1 && $pNode->end != -1 ) ) {
// node is not the root node
if ( substr( $text , $pNode->start, $length ) ===... | php | private function findSurpriseValue( Node $pNode, $pSubstring ) {
$length = $pNode->end - $pNode->start;
$text = implode('', $this->text);
if ( ($pNode->start != -1 && $pNode->end != -1 ) ) {
// node is not the root node
if ( substr( $text , $pNode->start, $length ) ===... | [
"private",
"function",
"findSurpriseValue",
"(",
"Node",
"$",
"pNode",
",",
"$",
"pSubstring",
")",
"{",
"$",
"length",
"=",
"$",
"pNode",
"->",
"end",
"-",
"$",
"pNode",
"->",
"start",
";",
"$",
"text",
"=",
"implode",
"(",
"''",
",",
"$",
"this",
... | Tries to find the surprise value of the given substring in the given node.
If not successfull for the given string and a child node starts with
the first letter of the given string, it will try its corresponding child.
Used in a recursive manner with given node representing the root node
at the begin
@param Node $p... | [
"Tries",
"to",
"find",
"the",
"surprise",
"value",
"of",
"the",
"given",
"substring",
"in",
"the",
"given",
"node",
".",
"If",
"not",
"successfull",
"for",
"the",
"given",
"string",
"and",
"a",
"child",
"node",
"starts",
"with",
"the",
"first",
"letter",
... | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L257-L303 | train |
rmatil/SAX | lib/Sax/SuffixTree/SuffixTree.php | SuffixTree.hasSubstring | public function hasSubstring( $pSubstring ) {
if ( strlen( $pSubstring ) < 1 ) {
return -1;
}
return $this->findSubstring( $this->nodes[$this->root], $pSubstring );
} | php | public function hasSubstring( $pSubstring ) {
if ( strlen( $pSubstring ) < 1 ) {
return -1;
}
return $this->findSubstring( $this->nodes[$this->root], $pSubstring );
} | [
"public",
"function",
"hasSubstring",
"(",
"$",
"pSubstring",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"pSubstring",
")",
"<",
"1",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"$",
"this",
"->",
"findSubstring",
"(",
"$",
"this",
"->",
"nodes",... | Scan tree for occurences of the given substring.
@param string $pSubstring String to check whether it is contained or not
@return integer Returns 1 if found, -1 if not | [
"Scan",
"tree",
"for",
"occurences",
"of",
"the",
"given",
"substring",
"."
] | f42cb97300c9f8e87c66644ccc236309db2396e2 | https://github.com/rmatil/SAX/blob/f42cb97300c9f8e87c66644ccc236309db2396e2/lib/Sax/SuffixTree/SuffixTree.php#L372-L378 | train |
rafrsr/generic-api | src/Client/RequestOptions.php | RequestOptions.setSSLKey | public function setSSLKey($certificateFile, $password = null)
{
if ($password) {
$this->options[GuzzleRequestOptions::SSL_KEY] = [$certificateFile, $password];
} else {
$this->options[GuzzleRequestOptions::SSL_KEY] = $certificateFile;
}
} | php | public function setSSLKey($certificateFile, $password = null)
{
if ($password) {
$this->options[GuzzleRequestOptions::SSL_KEY] = [$certificateFile, $password];
} else {
$this->options[GuzzleRequestOptions::SSL_KEY] = $certificateFile;
}
} | [
"public",
"function",
"setSSLKey",
"(",
"$",
"certificateFile",
",",
"$",
"password",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"GuzzleRequestOptions",
"::",
"SSL_KEY",
"]",
"=",
"[",
"$",
"certificat... | Specify the path to a file containing a private SSL key in PEM format.
@param string $certificateFile
@param null $password | [
"Specify",
"the",
"path",
"to",
"a",
"file",
"containing",
"a",
"private",
"SSL",
"key",
"in",
"PEM",
"format",
"."
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/Client/RequestOptions.php#L83-L90 | train |
rafrsr/generic-api | src/Client/RequestOptions.php | RequestOptions.setCertificate | public function setCertificate($certificateFile, $password = null)
{
if ($password) {
$this->options[GuzzleRequestOptions::CERT] = [$certificateFile, $password];
} else {
$this->options[GuzzleRequestOptions::CERT] = $certificateFile;
}
} | php | public function setCertificate($certificateFile, $password = null)
{
if ($password) {
$this->options[GuzzleRequestOptions::CERT] = [$certificateFile, $password];
} else {
$this->options[GuzzleRequestOptions::CERT] = $certificateFile;
}
} | [
"public",
"function",
"setCertificate",
"(",
"$",
"certificateFile",
",",
"$",
"password",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"GuzzleRequestOptions",
"::",
"CERT",
"]",
"=",
"[",
"$",
"certific... | Set to a string to specify the path to a file containing a PEM formatted client side certificate
@param string $certificateFile
@param null $password | [
"Set",
"to",
"a",
"string",
"to",
"specify",
"the",
"path",
"to",
"a",
"file",
"containing",
"a",
"PEM",
"formatted",
"client",
"side",
"certificate"
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/Client/RequestOptions.php#L98-L105 | train |
rafrsr/generic-api | src/Client/RequestOptions.php | RequestOptions.addHeader | public function addHeader($key, $value)
{
$this->options[GuzzleRequestOptions::HEADERS][$key] = $value;
return $this;
} | php | public function addHeader($key, $value)
{
$this->options[GuzzleRequestOptions::HEADERS][$key] = $value;
return $this;
} | [
"public",
"function",
"addHeader",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"GuzzleRequestOptions",
"::",
"HEADERS",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Headers to add to the request.
@param $key
@param $value
@return $this | [
"Headers",
"to",
"add",
"to",
"the",
"request",
"."
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/Client/RequestOptions.php#L174-L179 | train |
rafrsr/generic-api | src/Client/RequestOptions.php | RequestOptions.addQuery | public function addQuery($param, $value)
{
if (!isset($this->options[GuzzleRequestOptions::QUERY])) {
$this->options[GuzzleRequestOptions::QUERY] = [];
}
if (!is_array($this->options[GuzzleRequestOptions::QUERY])) {
throw new \LogicException('The query has been set ... | php | public function addQuery($param, $value)
{
if (!isset($this->options[GuzzleRequestOptions::QUERY])) {
$this->options[GuzzleRequestOptions::QUERY] = [];
}
if (!is_array($this->options[GuzzleRequestOptions::QUERY])) {
throw new \LogicException('The query has been set ... | [
"public",
"function",
"addQuery",
"(",
"$",
"param",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"GuzzleRequestOptions",
"::",
"QUERY",
"]",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"GuzzleRe... | Add Query string parameter
@param string $param
@param mixed $value
@return $this | [
"Add",
"Query",
"string",
"parameter"
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/Client/RequestOptions.php#L189-L202 | train |
rafrsr/generic-api | src/Client/RequestOptions.php | RequestOptions.setAuth | public function setAuth($username, $password, $type = 'basic')
{
$this->options[GuzzleRequestOptions::AUTH] = [$username, $password, $type];
return $this;
} | php | public function setAuth($username, $password, $type = 'basic')
{
$this->options[GuzzleRequestOptions::AUTH] = [$username, $password, $type];
return $this;
} | [
"public",
"function",
"setAuth",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"type",
"=",
"'basic'",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"GuzzleRequestOptions",
"::",
"AUTH",
"]",
"=",
"[",
"$",
"username",
",",
"$",
"password",
",",... | Specifies HTTP authorization parameters to use with the request
This is currently only supported when using the cURL handler.
@param string $username
@param string $password
@param string $type authentication type: "basic" (default), "digest"
@return $this | [
"Specifies",
"HTTP",
"authorization",
"parameters",
"to",
"use",
"with",
"the",
"request"
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/Client/RequestOptions.php#L595-L600 | train |
rafrsr/generic-api | src/Client/RequestOptions.php | RequestOptions.get | public function get($option)
{
return (isset($this->options[$option]) ? $this->options[$option] : null);
} | php | public function get($option)
{
return (isset($this->options[$option]) ? $this->options[$option] : null);
} | [
"public",
"function",
"get",
"(",
"$",
"option",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"$",
"option",
"]",
")",
"?",
"$",
"this",
"->",
"options",
"[",
"$",
"option",
"]",
":",
"null",
")",
";",
"}"
] | Get a option value
@param $option
@return null | [
"Get",
"a",
"option",
"value"
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/Client/RequestOptions.php#L620-L623 | train |
kambalabs/KmbDomain | src/KmbDomain/Model/GroupClass.php | GroupClass.dump | public function dump()
{
$dump = [];
if ($this->hasParameters()) {
foreach ($this->parameters as $parameter) {
$dump[$parameter->getName()] = $parameter->dump();
}
}
return $dump;
} | php | public function dump()
{
$dump = [];
if ($this->hasParameters()) {
foreach ($this->parameters as $parameter) {
$dump[$parameter->getName()] = $parameter->dump();
}
}
return $dump;
} | [
"public",
"function",
"dump",
"(",
")",
"{",
"$",
"dump",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"hasParameters",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"parameter",
")",
"{",
"$",
"dump",
"[",
... | Dump parameters.
@return array | [
"Dump",
"parameters",
"."
] | b1631bd936c6c6798076b51dfaebd706e1bdc8c2 | https://github.com/kambalabs/KmbDomain/blob/b1631bd936c6c6798076b51dfaebd706e1bdc8c2/src/KmbDomain/Model/GroupClass.php#L226-L235 | train |
agentmedia/phine-core | src/Core/Logic/Installation/InstallUtil/Content.php | Content.ClassFile | private function ClassFile()
{
if (!$this->classFile)
{
$class = new \ReflectionClass($this);
$this->classFile = $class->getFileName();
}
return $this->classFile;
} | php | private function ClassFile()
{
if (!$this->classFile)
{
$class = new \ReflectionClass($this);
$this->classFile = $class->getFileName();
}
return $this->classFile;
} | [
"private",
"function",
"ClassFile",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"classFile",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"classFile",
"=",
"$",
"class",
"->",
"ge... | The class definition file
@return string Returns the path of the file where the content is defined | [
"The",
"class",
"definition",
"file"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/InstallUtil/Content.php#L50-L59 | train |
agentmedia/phine-core | src/Core/Logic/Installation/InstallUtil/Content.php | Content.Render | function Render()
{
$templateDir = Path::Combine(__DIR__, 'Templates');
$templateFile = Path::AddExtension(Path::Filename($this->ClassFile()), 'phtml', true);
ob_start();
require Path::Combine($templateDir, $templateFile);
return ob_get_clean();
} | php | function Render()
{
$templateDir = Path::Combine(__DIR__, 'Templates');
$templateFile = Path::AddExtension(Path::Filename($this->ClassFile()), 'phtml', true);
ob_start();
require Path::Combine($templateDir, $templateFile);
return ob_get_clean();
} | [
"function",
"Render",
"(",
")",
"{",
"$",
"templateDir",
"=",
"Path",
"::",
"Combine",
"(",
"__DIR__",
",",
"'Templates'",
")",
";",
"$",
"templateFile",
"=",
"Path",
"::",
"AddExtension",
"(",
"Path",
"::",
"Filename",
"(",
"$",
"this",
"->",
"ClassFile... | Renders and returns the html output
@return string Returns the html of the content | [
"Renders",
"and",
"returns",
"the",
"html",
"output"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/InstallUtil/Content.php#L81-L88 | train |
agentmedia/phine-core | src/Core/Logic/Installation/InstallUtil/Content.php | Content.Value | function Value($field, $trim = true)
{
$result = Request::IsPost() ? Request::PostData($field) : $this->DefaultValue($field);
if ($trim)
{
return trim($result);
}
return $result;
} | php | function Value($field, $trim = true)
{
$result = Request::IsPost() ? Request::PostData($field) : $this->DefaultValue($field);
if ($trim)
{
return trim($result);
}
return $result;
} | [
"function",
"Value",
"(",
"$",
"field",
",",
"$",
"trim",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"Request",
"::",
"IsPost",
"(",
")",
"?",
"Request",
"::",
"PostData",
"(",
"$",
"field",
")",
":",
"$",
"this",
"->",
"DefaultValue",
"(",
"$",
... | Gets the value of a field
@param string $field The field name
@param bool $trim True if the value shall be trimmed by whitespace characters | [
"Gets",
"the",
"value",
"of",
"a",
"field"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/InstallUtil/Content.php#L138-L146 | train |
agentmedia/phine-core | src/Core/Logic/Installation/InstallUtil/Content.php | Content.GotoNext | function GotoNext()
{
$next = Page::NextStep($this->Step());
Response::Redirect(Path::AddExtension($next, 'php'));
} | php | function GotoNext()
{
$next = Page::NextStep($this->Step());
Response::Redirect(Path::AddExtension($next, 'php'));
} | [
"function",
"GotoNext",
"(",
")",
"{",
"$",
"next",
"=",
"Page",
"::",
"NextStep",
"(",
"$",
"this",
"->",
"Step",
"(",
")",
")",
";",
"Response",
"::",
"Redirect",
"(",
"Path",
"::",
"AddExtension",
"(",
"$",
"next",
",",
"'php'",
")",
")",
";",
... | Redirects to the next step | [
"Redirects",
"to",
"the",
"next",
"step"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/InstallUtil/Content.php#L160-L164 | train |
fardus/CRUDBundle | Fardus/Bundle/CrudBundle/Generator/FardusCrudGenerator.php | FardusCrudGenerator.generateDeleteView | protected function generateDeleteView($dir)
{
$this->renderFile('crud/views/delete.html.twig.twig', $dir.'/delete.html.twig', [
'route_prefix' => $this->routePrefix,
'route_name_prefix' => $this->routeNamePrefix,
'entity' => $this->entity,
'bun... | php | protected function generateDeleteView($dir)
{
$this->renderFile('crud/views/delete.html.twig.twig', $dir.'/delete.html.twig', [
'route_prefix' => $this->routePrefix,
'route_name_prefix' => $this->routeNamePrefix,
'entity' => $this->entity,
'bun... | [
"protected",
"function",
"generateDeleteView",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"renderFile",
"(",
"'crud/views/delete.html.twig.twig'",
",",
"$",
"dir",
".",
"'/delete.html.twig'",
",",
"[",
"'route_prefix'",
"=>",
"$",
"this",
"->",
"routePrefix",
... | Generates the delete.html.twig template in the final bundle.
@param string $dir The path to the folder that hosts templates in the bundle | [
"Generates",
"the",
"delete",
".",
"html",
".",
"twig",
"template",
"in",
"the",
"final",
"bundle",
"."
] | 5d4180f2a1f30da0fc4cbb16a70f656e9e083c5c | https://github.com/fardus/CRUDBundle/blob/5d4180f2a1f30da0fc4cbb16a70f656e9e083c5c/Fardus/Bundle/CrudBundle/Generator/FardusCrudGenerator.php#L156-L165 | train |
FuzeWorks/Core | src/FuzeWorks/Models.php | Models.get | public function get($modelName, $directory = null)
{
if (empty($modelName))
{
throw new ModelException("Could not load model. No name provided", 1);
}
// First get the directories where the model can be located
$directories = (is_null($directory) ? $this->modelPa... | php | public function get($modelName, $directory = null)
{
if (empty($modelName))
{
throw new ModelException("Could not load model. No name provided", 1);
}
// First get the directories where the model can be located
$directories = (is_null($directory) ? $this->modelPa... | [
"public",
"function",
"get",
"(",
"$",
"modelName",
",",
"$",
"directory",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"modelName",
")",
")",
"{",
"throw",
"new",
"ModelException",
"(",
"\"Could not load model. No name provided\"",
",",
"1",
")",
... | Get a model.
Supply the name and the model will be loaded from the supplied directory,
or from one of the modelPaths (which you can add).
@param string $modelName Name of the model
@param string|null $directory Directory to load the model from, will ignore $modelPaths
@return ModelAbstract|bool The M... | [
"Get",
"a",
"model",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Models.php#L75-L98 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.