repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
vgrem/phpSPO
src/SharePoint/GroupCollection.php
GroupCollection.removeByLoginName
public function removeByLoginName($groupName) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "removeByLoginName", array($groupName)); $this->getContext()->addQuery($qry); }
php
public function removeByLoginName($groupName) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "removeByLoginName", array($groupName)); $this->getContext()->addQuery($qry); }
[ "public", "function", "removeByLoginName", "(", "$", "groupName", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"removeByLoginName\"", ",", "array", "(", "$", "groupName", ")", ")", ";"...
Removes the cross-site group with the specified name from the collection. @param string $groupName The name of the group to remove. The group name is specified in its LoginName property. @throws \Exception
[ "Removes", "the", "cross", "-", "site", "group", "with", "the", "specified", "name", "from", "the", "collection", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/GroupCollection.php#L78-L82
sastrawi/sastrawi
src/Sastrawi/Stemmer/Context/Context.php
Context.execute
public function execute() { // step 1 - 5 $this->startStemmingProcess(); // step 6 if ($this->dictionary->contains($this->getCurrentWord())) { $this->result = $this->getCurrentWord(); } else { $this->result = $this->originalWord; } }
php
public function execute() { // step 1 - 5 $this->startStemmingProcess(); // step 6 if ($this->dictionary->contains($this->getCurrentWord())) { $this->result = $this->getCurrentWord(); } else { $this->result = $this->originalWord; } }
[ "public", "function", "execute", "(", ")", "{", "// step 1 - 5", "$", "this", "->", "startStemmingProcess", "(", ")", ";", "// step 6", "if", "(", "$", "this", "->", "dictionary", "->", "contains", "(", "$", "this", "->", "getCurrentWord", "(", ")", ")", ...
Execute stemming process; the result can be retrieved with getResult() @return void
[ "Execute", "stemming", "process", ";", "the", "result", "can", "be", "retrieved", "with", "getResult", "()" ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Context/Context.php#L151-L162
sastrawi/sastrawi
src/Sastrawi/Stemmer/Context/Context.php
Context.loopPengembalianAkhiran
public function loopPengembalianAkhiran() { // restore prefix to form [DP+[DP+[DP]]] + Root word $this->restorePrefix(); $removals = $this->removals; $reversedRemovals = array_reverse($removals); $currentWord = $this->getCurrentWord(); foreach ($reversedRemovals as ...
php
public function loopPengembalianAkhiran() { // restore prefix to form [DP+[DP+[DP]]] + Root word $this->restorePrefix(); $removals = $this->removals; $reversedRemovals = array_reverse($removals); $currentWord = $this->getCurrentWord(); foreach ($reversedRemovals as ...
[ "public", "function", "loopPengembalianAkhiran", "(", ")", "{", "// restore prefix to form [DP+[DP+[DP]]] + Root word", "$", "this", "->", "restorePrefix", "(", ")", ";", "$", "removals", "=", "$", "this", "->", "removals", ";", "$", "reversedRemovals", "=", "array_...
ECS Loop Pengembalian Akhiran
[ "ECS", "Loop", "Pengembalian", "Akhiran" ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Context/Context.php#L279-L316
sastrawi/sastrawi
src/Sastrawi/Stemmer/Context/Context.php
Context.restorePrefix
public function restorePrefix() { foreach ($this->removals as $i => $removal) { if ($removal->getAffixType() == 'DP') { // return the word before precoding (the subject of first prefix removal) $this->setCurrentWord($removal->getSubject()); break; ...
php
public function restorePrefix() { foreach ($this->removals as $i => $removal) { if ($removal->getAffixType() == 'DP') { // return the word before precoding (the subject of first prefix removal) $this->setCurrentWord($removal->getSubject()); break; ...
[ "public", "function", "restorePrefix", "(", ")", "{", "foreach", "(", "$", "this", "->", "removals", "as", "$", "i", "=>", "$", "removal", ")", "{", "if", "(", "$", "removal", "->", "getAffixType", "(", ")", "==", "'DP'", ")", "{", "// return the word ...
Restore prefix to proceed with ECS loop pengembalian akhiran @return void
[ "Restore", "prefix", "to", "proceed", "with", "ECS", "loop", "pengembalian", "akhiran" ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Context/Context.php#L336-L351
sastrawi/sastrawi
src/Sastrawi/Morphology/Disambiguator/DisambiguatorPrefixRule15a.php
DisambiguatorPrefixRule15a.disambiguate
public function disambiguate($word) { $matches = null; $contains = preg_match('/^men([aiueo])(.*)$/', $word, $matches); if ($contains === 1) { return 'n' . $matches[1] . $matches[2]; } }
php
public function disambiguate($word) { $matches = null; $contains = preg_match('/^men([aiueo])(.*)$/', $word, $matches); if ($contains === 1) { return 'n' . $matches[1] . $matches[2]; } }
[ "public", "function", "disambiguate", "(", "$", "word", ")", "{", "$", "matches", "=", "null", ";", "$", "contains", "=", "preg_match", "(", "'/^men([aiueo])(.*)$/'", ",", "$", "word", ",", "$", "matches", ")", ";", "if", "(", "$", "contains", "===", "...
Disambiguate Prefix Rule 15a Rule 15a : men{V} -> me-n{V}
[ "Disambiguate", "Prefix", "Rule", "15a", "Rule", "15a", ":", "men", "{", "V", "}", "-", ">", "me", "-", "n", "{", "V", "}" ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Morphology/Disambiguator/DisambiguatorPrefixRule15a.php#L21-L29
sastrawi/sastrawi
src/Sastrawi/Dictionary/ArrayDictionary.php
ArrayDictionary.addWordsFromTextFile
public function addWordsFromTextFile($filePath, $delimiter = "\n") { $words = explode($delimiter, file_get_contents($filePath)); $this->addWords($words); }
php
public function addWordsFromTextFile($filePath, $delimiter = "\n") { $words = explode($delimiter, file_get_contents($filePath)); $this->addWords($words); }
[ "public", "function", "addWordsFromTextFile", "(", "$", "filePath", ",", "$", "delimiter", "=", "\"\\n\"", ")", "{", "$", "words", "=", "explode", "(", "$", "delimiter", ",", "file_get_contents", "(", "$", "filePath", ")", ")", ";", "$", "this", "->", "a...
Add words from a text file to the dictionary @param string $word @return void
[ "Add", "words", "from", "a", "text", "file", "to", "the", "dictionary" ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Dictionary/ArrayDictionary.php#L87-L91
sastrawi/sastrawi
src/Sastrawi/StopWordRemover/StopWordRemover.php
StopWordRemover.remove
public function remove($text) { $words = explode(' ', $text); foreach ($words as $i => $word) { if ($this->dictionary->contains($word)) { unset($words[$i]); } } return implode(' ', $words); }
php
public function remove($text) { $words = explode(' ', $text); foreach ($words as $i => $word) { if ($this->dictionary->contains($word)) { unset($words[$i]); } } return implode(' ', $words); }
[ "public", "function", "remove", "(", "$", "text", ")", "{", "$", "words", "=", "explode", "(", "' '", ",", "$", "text", ")", ";", "foreach", "(", "$", "words", "as", "$", "i", "=>", "$", "word", ")", "{", "if", "(", "$", "this", "->", "dictiona...
Remove stop words. @param string $text The text which stop words to be removed @return string The text after removal
[ "Remove", "stop", "words", "." ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/StopWordRemover/StopWordRemover.php#L33-L44
sastrawi/sastrawi
src/Sastrawi/Stemmer/Stemmer.php
Stemmer.stem
public function stem($text) { $normalizedText = Filter\TextNormalizer::normalizeText($text); $words = explode(' ', $normalizedText); $stems = array(); foreach ($words as $word) { $stems[] = $this->stemWord($word); } return implode(' ', $stems); }
php
public function stem($text) { $normalizedText = Filter\TextNormalizer::normalizeText($text); $words = explode(' ', $normalizedText); $stems = array(); foreach ($words as $word) { $stems[] = $this->stemWord($word); } return implode(' ', $stems); }
[ "public", "function", "stem", "(", "$", "text", ")", "{", "$", "normalizedText", "=", "Filter", "\\", "TextNormalizer", "::", "normalizeText", "(", "$", "text", ")", ";", "$", "words", "=", "explode", "(", "' '", ",", "$", "normalizedText", ")", ";", "...
Stem a text string to its common stem form. @param string $text the text string to stem, e.g : memberdayakan pembangunan @return string common stem form, e.g : daya bangun
[ "Stem", "a", "text", "string", "to", "its", "common", "stem", "form", "." ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Stemmer.php#L57-L69
sastrawi/sastrawi
src/Sastrawi/Stemmer/Stemmer.php
Stemmer.stemWord
protected function stemWord($word) { if ($this->isPlural($word)) { return $this->stemPluralWord($word); } else { return $this->stemSingularWord($word); } }
php
protected function stemWord($word) { if ($this->isPlural($word)) { return $this->stemPluralWord($word); } else { return $this->stemSingularWord($word); } }
[ "protected", "function", "stemWord", "(", "$", "word", ")", "{", "if", "(", "$", "this", "->", "isPlural", "(", "$", "word", ")", ")", "{", "return", "$", "this", "->", "stemPluralWord", "(", "$", "word", ")", ";", "}", "else", "{", "return", "$", ...
Stem a word to its common stem form. @param string $word the word to stem, e.g : memberdayakan @return string common stem form, e.g : daya
[ "Stem", "a", "word", "to", "its", "common", "stem", "form", "." ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Stemmer.php#L77-L84
sastrawi/sastrawi
src/Sastrawi/Stemmer/Stemmer.php
Stemmer.stemPluralWord
protected function stemPluralWord($plural) { preg_match('/^(.*)-(.*)$/', $plural, $words); if (!isset($words[1]) || !isset($words[2])) { return $plural; } // malaikat-malaikat-nya -> malaikat malaikat-nya $suffix = $words[2]; if (in_array($suffix, array(...
php
protected function stemPluralWord($plural) { preg_match('/^(.*)-(.*)$/', $plural, $words); if (!isset($words[1]) || !isset($words[2])) { return $plural; } // malaikat-malaikat-nya -> malaikat malaikat-nya $suffix = $words[2]; if (in_array($suffix, array(...
[ "protected", "function", "stemPluralWord", "(", "$", "plural", ")", "{", "preg_match", "(", "'/^(.*)-(.*)$/'", ",", "$", "plural", ",", "$", "words", ")", ";", "if", "(", "!", "isset", "(", "$", "words", "[", "1", "]", ")", "||", "!", "isset", "(", ...
Stem a plural word to its common stem form. Asian J. (2007) “Effective Techniques for Indonesian Text Retrieval” page 76-77. @param string $plural the word to stem, e.g : bersama-sama @return string common stem form, e.g : sama @link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf
[ "Stem", "a", "plural", "word", "to", "its", "common", "stem", "form", ".", "Asian", "J", ".", "(", "2007", ")", "“Effective", "Techniques", "for", "Indonesian", "Text", "Retrieval”", "page", "76", "-", "77", "." ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Stemmer.php#L109-L138
sastrawi/sastrawi
src/Sastrawi/Stemmer/Stemmer.php
Stemmer.stemSingularWord
protected function stemSingularWord($word) { $context = new Context($word, $this->dictionary, $this->visitorProvider); $context->execute(); return $context->getResult(); }
php
protected function stemSingularWord($word) { $context = new Context($word, $this->dictionary, $this->visitorProvider); $context->execute(); return $context->getResult(); }
[ "protected", "function", "stemSingularWord", "(", "$", "word", ")", "{", "$", "context", "=", "new", "Context", "(", "$", "word", ",", "$", "this", "->", "dictionary", ",", "$", "this", "->", "visitorProvider", ")", ";", "$", "context", "->", "execute", ...
Stem a singular word to its common stem form. @param string $word the word to stem, e.g : mengalahkan @return string common stem form, e.g : kalah
[ "Stem", "a", "singular", "word", "to", "its", "common", "stem", "form", "." ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Stemmer.php#L146-L152
sastrawi/sastrawi
src/Sastrawi/Stemmer/Filter/TextNormalizer.php
TextNormalizer.normalizeText
public static function normalizeText($text) { $text = strtolower($text); $text = preg_replace('/[^a-z0-9 -]/im', ' ', $text); $text = preg_replace('/( +)/im', ' ', $text); return trim($text); }
php
public static function normalizeText($text) { $text = strtolower($text); $text = preg_replace('/[^a-z0-9 -]/im', ' ', $text); $text = preg_replace('/( +)/im', ' ', $text); return trim($text); }
[ "public", "static", "function", "normalizeText", "(", "$", "text", ")", "{", "$", "text", "=", "strtolower", "(", "$", "text", ")", ";", "$", "text", "=", "preg_replace", "(", "'/[^a-z0-9 -]/im'", ",", "' '", ",", "$", "text", ")", ";", "$", "text", ...
Removes symbols & characters other than alphabetics @param string $text @return string normalized text
[ "Removes", "symbols", "&", "characters", "other", "than", "alphabetics" ]
train
https://github.com/sastrawi/sastrawi/blob/09db1bda7756fae740767ed7eb8de1b01ae859d5/src/Sastrawi/Stemmer/Filter/TextNormalizer.php#L22-L29
davispeixoto/Laravel-5-Salesforce
src/Davispeixoto/Laravel5Salesforce/SalesforceServiceProvider.php
SalesforceServiceProvider.register
public function register() { $config = __DIR__ . '/config/config.php'; $this->mergeConfigFrom($config, 'salesforce'); $this->publishes([$config => config_path('salesforce.php')]); $this->app->singleton('salesforce', function ($app) { $sf = new Salesforce(new Client()); ...
php
public function register() { $config = __DIR__ . '/config/config.php'; $this->mergeConfigFrom($config, 'salesforce'); $this->publishes([$config => config_path('salesforce.php')]); $this->app->singleton('salesforce', function ($app) { $sf = new Salesforce(new Client()); ...
[ "public", "function", "register", "(", ")", "{", "$", "config", "=", "__DIR__", ".", "'/config/config.php'", ";", "$", "this", "->", "mergeConfigFrom", "(", "$", "config", ",", "'salesforce'", ")", ";", "$", "this", "->", "publishes", "(", "[", "$", "con...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/davispeixoto/Laravel-5-Salesforce/blob/e2b34e7292ecc6ecb8d5f7acbfd2cb7c1c966d0a/src/Davispeixoto/Laravel5Salesforce/SalesforceServiceProvider.php#L31-L43
davispeixoto/Laravel-5-Salesforce
src/Davispeixoto/Laravel5Salesforce/Salesforce.php
Salesforce.connect
public function connect($configExternal) { $wsdl = $configExternal->get('salesforce.wsdl'); if (empty($wsdl)) { $wsdl = __DIR__ . '/Wsdl/enterprise.wsdl.xml'; } $user = $configExternal->get('salesforce.username'); $pass = $configExternal->get('salesforce.passwor...
php
public function connect($configExternal) { $wsdl = $configExternal->get('salesforce.wsdl'); if (empty($wsdl)) { $wsdl = __DIR__ . '/Wsdl/enterprise.wsdl.xml'; } $user = $configExternal->get('salesforce.username'); $pass = $configExternal->get('salesforce.passwor...
[ "public", "function", "connect", "(", "$", "configExternal", ")", "{", "$", "wsdl", "=", "$", "configExternal", "->", "get", "(", "'salesforce.wsdl'", ")", ";", "if", "(", "empty", "(", "$", "wsdl", ")", ")", "{", "$", "wsdl", "=", "__DIR__", ".", "'...
Connect user into salesforce @param $configExternal @throws SalesforceException
[ "Connect", "user", "into", "salesforce" ]
train
https://github.com/davispeixoto/Laravel-5-Salesforce/blob/e2b34e7292ecc6ecb8d5f7acbfd2cb7c1c966d0a/src/Davispeixoto/Laravel5Salesforce/Salesforce.php#L44-L62
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Provider.php
Provider.findById
public function findById($id) { $model = $this->createModel(); $group = $model->where('id', '=', $id)->find(); if ( ! $group->loaded() ) { throw new GroupNotFoundException("A group could not be found with ID [$id]."); } return $group; }
php
public function findById($id) { $model = $this->createModel(); $group = $model->where('id', '=', $id)->find(); if ( ! $group->loaded() ) { throw new GroupNotFoundException("A group could not be found with ID [$id]."); } return $group; }
[ "public", "function", "findById", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "group", "=", "$", "model", "->", "where", "(", "'id'", ",", "'='", ",", "$", "id", ")", "->", "find", "(", ")"...
Find the group by ID. @param int $id @return \Cartalyst\Sentry\Groups\GroupInterface $group @throws \Cartalyst\Sentry\Groups\GroupNotFoundException
[ "Find", "the", "group", "by", "ID", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Provider.php#L55-L67
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Provider.php
Provider.findByName
public function findByName($name) { $model = $this->createModel(); $group = $model->where('name', '=', $name)->find(); if ( ! $group->loaded() ) { throw new GroupNotFoundException("A group could not be found with the name [$name]."); } return $group; }
php
public function findByName($name) { $model = $this->createModel(); $group = $model->where('name', '=', $name)->find(); if ( ! $group->loaded() ) { throw new GroupNotFoundException("A group could not be found with the name [$name]."); } return $group; }
[ "public", "function", "findByName", "(", "$", "name", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "group", "=", "$", "model", "->", "where", "(", "'name'", ",", "'='", ",", "$", "name", ")", "->", "find", "(...
Find the group by name. @param string $name @return \Cartalyst\Sentry\Groups\GroupInterface $group @throws \Cartalyst\Sentry\Groups\GroupNotFoundException
[ "Find", "the", "group", "by", "name", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Provider.php#L76-L88
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Provider.php
Provider.create
public function create(array $attributes) { if ( ! isset($credentials['permissions']) ) { $credentials['permissions'] = array(); } $group = $this->createModel(); $group->values($attributes, array('name', 'permissions')); $group->save(); return $group; }
php
public function create(array $attributes) { if ( ! isset($credentials['permissions']) ) { $credentials['permissions'] = array(); } $group = $this->createModel(); $group->values($attributes, array('name', 'permissions')); $group->save(); return $group; }
[ "public", "function", "create", "(", "array", "$", "attributes", ")", "{", "if", "(", "!", "isset", "(", "$", "credentials", "[", "'permissions'", "]", ")", ")", "{", "$", "credentials", "[", "'permissions'", "]", "=", "array", "(", ")", ";", "}", "$...
Creates a group. @param array $attributes @return \Cartalyst\Sentry\Groups\GroupInterface
[ "Creates", "a", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Provider.php#L108-L120
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.getPermissionsAttribute
public function getPermissionsAttribute($permissions) { if ( ! $permissions) { return array(); } if (is_array($permissions)) { return $permissions; } if ( ! $_permissions = json_decode($permissions, true)) { throw new \InvalidArgumentException("Cannot JSON decode permissions [$permissions]."...
php
public function getPermissionsAttribute($permissions) { if ( ! $permissions) { return array(); } if (is_array($permissions)) { return $permissions; } if ( ! $_permissions = json_decode($permissions, true)) { throw new \InvalidArgumentException("Cannot JSON decode permissions [$permissions]."...
[ "public", "function", "getPermissionsAttribute", "(", "$", "permissions", ")", "{", "if", "(", "!", "$", "permissions", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", "is_array", "(", "$", "permissions", ")", ")", "{", "return", "$", "perm...
Mutator for giving permissions. @param mixed $permissions @return array $_permissions
[ "Mutator", "for", "giving", "permissions", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L213-L231
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.validate
public function validate() { if ( ! $login = $this->{static::$loginAttribute}) { throw new LoginRequiredException("A login is required for a user, none given."); } if ( ! $password = $this->getPassword()) { throw new PasswordRequiredException("A password is required for user [$login], none given."); ...
php
public function validate() { if ( ! $login = $this->{static::$loginAttribute}) { throw new LoginRequiredException("A login is required for a user, none given."); } if ( ! $password = $this->getPassword()) { throw new PasswordRequiredException("A password is required for user [$login], none given."); ...
[ "public", "function", "validate", "(", ")", "{", "if", "(", "!", "$", "login", "=", "$", "this", "->", "{", "static", "::", "$", "loginAttribute", "}", ")", "{", "throw", "new", "LoginRequiredException", "(", "\"A login is required for a user, none given.\"", ...
Validates the user and throws a number of Exceptions if validation fails. @return bool @throws \Cartalyst\Sentry\Users\LoginRequiredException @throws \Cartalyst\Sentry\Users\PasswordRequiredException @throws \Cartalyst\Sentry\Users\UserExistsException
[ "Validates", "the", "user", "and", "throws", "a", "number", "of", "Exceptions", "if", "validation", "fails", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L283-L305
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.getPersistCode
public function getPersistCode() { $this->persist_code = $this->getRandomString(); // Our code got hashed $persistCode = $this->persist_code; $this->save(); return $persistCode; }
php
public function getPersistCode() { $this->persist_code = $this->getRandomString(); // Our code got hashed $persistCode = $this->persist_code; $this->save(); return $persistCode; }
[ "public", "function", "getPersistCode", "(", ")", "{", "$", "this", "->", "persist_code", "=", "$", "this", "->", "getRandomString", "(", ")", ";", "// Our code got hashed", "$", "persistCode", "=", "$", "this", "->", "persist_code", ";", "$", "this", "->", ...
Gets a code for when the user is persisted to a cookie or session which identifies the user. @return string
[ "Gets", "a", "code", "for", "when", "the", "user", "is", "persisted", "to", "a", "cookie", "or", "session", "which", "identifies", "the", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L338-L348
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.attemptResetPassword
public function attemptResetPassword($resetCode, $newPassword) { if ($this->checkResetPasswordCode($resetCode)) { $this->password = $newPassword; $this->reset_password_code = null; return $this->save(); } return false; }
php
public function attemptResetPassword($resetCode, $newPassword) { if ($this->checkResetPasswordCode($resetCode)) { $this->password = $newPassword; $this->reset_password_code = null; return $this->save(); } return false; }
[ "public", "function", "attemptResetPassword", "(", "$", "resetCode", ",", "$", "newPassword", ")", "{", "if", "(", "$", "this", "->", "checkResetPasswordCode", "(", "$", "resetCode", ")", ")", "{", "$", "this", "->", "password", "=", "$", "newPassword", ";...
Attempts to reset a user's password by matching the reset code generated with the user's. @param string $resetCode @param string $newPassword @return bool
[ "Attempts", "to", "reset", "a", "user", "s", "password", "by", "matching", "the", "reset", "code", "generated", "with", "the", "user", "s", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L456-L466
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.getGroups
public function getGroups() { if ( ! $this->userGroups) { $this->userGroups = $this->groups()->get(); } return $this->userGroups; }
php
public function getGroups() { if ( ! $this->userGroups) { $this->userGroups = $this->groups()->get(); } return $this->userGroups; }
[ "public", "function", "getGroups", "(", ")", "{", "if", "(", "!", "$", "this", "->", "userGroups", ")", "{", "$", "this", "->", "userGroups", "=", "$", "this", "->", "groups", "(", ")", "->", "get", "(", ")", ";", "}", "return", "$", "this", "->"...
Returns an array of groups which the given user belongs to. @return array
[ "Returns", "an", "array", "of", "groups", "which", "the", "given", "user", "belongs", "to", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L489-L497
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.addGroup
public function addGroup(GroupInterface $group) { if ( ! $this->inGroup($group)) { $this->groups()->attach($group); $this->invalidateUserGroupsCache(); $this->invalidateMergedPermissionsCache(); } return true; }
php
public function addGroup(GroupInterface $group) { if ( ! $this->inGroup($group)) { $this->groups()->attach($group); $this->invalidateUserGroupsCache(); $this->invalidateMergedPermissionsCache(); } return true; }
[ "public", "function", "addGroup", "(", "GroupInterface", "$", "group", ")", "{", "if", "(", "!", "$", "this", "->", "inGroup", "(", "$", "group", ")", ")", "{", "$", "this", "->", "groups", "(", ")", "->", "attach", "(", "$", "group", ")", ";", "...
Adds the user to the given group. @param \Cartalyst\Sentry\Groups\GroupInterface $group @return bool
[ "Adds", "the", "user", "to", "the", "given", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L521-L531
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.removeGroup
public function removeGroup(GroupInterface $group) { if ($this->inGroup($group)) { $this->groups()->detach($group); $this->invalidateUserGroupsCache(); $this->invalidateMergedPermissionsCache(); } return true; }
php
public function removeGroup(GroupInterface $group) { if ($this->inGroup($group)) { $this->groups()->detach($group); $this->invalidateUserGroupsCache(); $this->invalidateMergedPermissionsCache(); } return true; }
[ "public", "function", "removeGroup", "(", "GroupInterface", "$", "group", ")", "{", "if", "(", "$", "this", "->", "inGroup", "(", "$", "group", ")", ")", "{", "$", "this", "->", "groups", "(", ")", "->", "detach", "(", "$", "group", ")", ";", "$", ...
Removes the user from the given group. @param \Cartalyst\Sentry\Groups\GroupInterface $group @return bool
[ "Removes", "the", "user", "from", "the", "given", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L539-L549
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.inGroup
public function inGroup(GroupInterface $group) { foreach ($this->getGroups() as $_group) { if ($_group->getId() == $group->getId()) { return true; } } return false; }
php
public function inGroup(GroupInterface $group) { foreach ($this->getGroups() as $_group) { if ($_group->getId() == $group->getId()) { return true; } } return false; }
[ "public", "function", "inGroup", "(", "GroupInterface", "$", "group", ")", "{", "foreach", "(", "$", "this", "->", "getGroups", "(", ")", "as", "$", "_group", ")", "{", "if", "(", "$", "_group", "->", "getId", "(", ")", "==", "$", "group", "->", "g...
See if the user is in the given group. @param \Cartalyst\Sentry\Groups\GroupInterface $group @return bool
[ "See", "if", "the", "user", "is", "in", "the", "given", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L557-L568
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.getMergedPermissions
public function getMergedPermissions() { if ( ! $this->mergedPermissions) { $permissions = array(); foreach ($this->getGroups() as $group) { $permissions = array_merge($permissions, $group->getPermissions()); } $this->mergedPermissions = array_merge($permissions, $this->getPermissions()); } ...
php
public function getMergedPermissions() { if ( ! $this->mergedPermissions) { $permissions = array(); foreach ($this->getGroups() as $group) { $permissions = array_merge($permissions, $group->getPermissions()); } $this->mergedPermissions = array_merge($permissions, $this->getPermissions()); } ...
[ "public", "function", "getMergedPermissions", "(", ")", "{", "if", "(", "!", "$", "this", "->", "mergedPermissions", ")", "{", "$", "permissions", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getGroups", "(", ")", "as", "$", "group"...
Returns an array of merged permissions for each group the user is in. @return array
[ "Returns", "an", "array", "of", "merged", "permissions", "for", "each", "group", "the", "user", "is", "in", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L576-L591
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.hasAccess
public function hasAccess($permissions, $all = true) { if ($this->isSuperUser()) { return true; } return $this->hasPermission($permissions, $all); }
php
public function hasAccess($permissions, $all = true) { if ($this->isSuperUser()) { return true; } return $this->hasPermission($permissions, $all); }
[ "public", "function", "hasAccess", "(", "$", "permissions", ",", "$", "all", "=", "true", ")", "{", "if", "(", "$", "this", "->", "isSuperUser", "(", ")", ")", "{", "return", "true", ";", "}", "return", "$", "this", "->", "hasPermission", "(", "$", ...
See if a user has access to the passed permission(s). Permissions are merged from all groups the user belongs to and then are checked against the passed permission(s). If multiple permissions are passed, the user must have access to all permissions passed through, unless the "all" flag is set to false. Super users ha...
[ "See", "if", "a", "user", "has", "access", "to", "the", "passed", "permission", "(", "s", ")", ".", "Permissions", "are", "merged", "from", "all", "groups", "the", "user", "belongs", "to", "and", "then", "are", "checked", "against", "the", "passed", "per...
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L608-L616
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.getRandomString
public function getRandomString($length = 42) { // We'll check if the user has OpenSSL installed with PHP. If they do // we'll use a better method of getting a random string. Otherwise, we'll // fallback to a reasonably reliable method. if (function_exists('openssl_random_pseudo_bytes')) { // We generate ...
php
public function getRandomString($length = 42) { // We'll check if the user has OpenSSL installed with PHP. If they do // we'll use a better method of getting a random string. Otherwise, we'll // fallback to a reasonably reliable method. if (function_exists('openssl_random_pseudo_bytes')) { // We generate ...
[ "public", "function", "getRandomString", "(", "$", "length", "=", "42", ")", "{", "// We'll check if the user has OpenSSL installed with PHP. If they do", "// we'll use a better method of getting a random string. Otherwise, we'll", "// fallback to a reasonably reliable method.", "if", "(...
Generate a random string. @return string
[ "Generate", "a", "random", "string", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L833-L857
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.setAttribute
public function setAttribute($key, $value) { // Hash required fields when necessary if (in_array($key, $this->hashableAttributes) and ! empty($value)) { $value = $this->hash($value); } return parent::setAttribute($key, $value); }
php
public function setAttribute($key, $value) { // Hash required fields when necessary if (in_array($key, $this->hashableAttributes) and ! empty($value)) { $value = $this->hash($value); } return parent::setAttribute($key, $value); }
[ "public", "function", "setAttribute", "(", "$", "key", ",", "$", "value", ")", "{", "// Hash required fields when necessary", "if", "(", "in_array", "(", "$", "key", ",", "$", "this", "->", "hashableAttributes", ")", "and", "!", "empty", "(", "$", "value", ...
Set a given attribute on the model. @param string $key @param mixed $value @return void
[ "Set", "a", "given", "attribute", "on", "the", "model", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L876-L885
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/User.php
User.toArray
public function toArray() { $result = parent::toArray(); if (isset($result['activated'])) { $result['activated'] = $this->getActivatedAttribute($result['activated']); } if (isset($result['permissions'])) { $result['permissions'] = $this->getPermissionsAttribute($result['permissions']); } if (iss...
php
public function toArray() { $result = parent::toArray(); if (isset($result['activated'])) { $result['activated'] = $this->getActivatedAttribute($result['activated']); } if (isset($result['permissions'])) { $result['permissions'] = $this->getPermissionsAttribute($result['permissions']); } if (iss...
[ "public", "function", "toArray", "(", ")", "{", "$", "result", "=", "parent", "::", "toArray", "(", ")", ";", "if", "(", "isset", "(", "$", "result", "[", "'activated'", "]", ")", ")", "{", "$", "result", "[", "'activated'", "]", "=", "$", "this", ...
Convert the model instance to an array. @return array
[ "Convert", "the", "model", "instance", "to", "an", "array", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/User.php#L902-L920
cartalyst/sentry
src/Cartalyst/Sentry/Facades/ConnectionResolver.php
ConnectionResolver.getConnection
public function getConnection() { if ($this->connection === null) { $connection = null; // We will now provide the query grammar to the connection. switch ($this->driverName) { case 'mysql': $connection = '\Illuminate\Database\MySqlConnection'; break; case 'pgsql': $connection ...
php
public function getConnection() { if ($this->connection === null) { $connection = null; // We will now provide the query grammar to the connection. switch ($this->driverName) { case 'mysql': $connection = '\Illuminate\Database\MySqlConnection'; break; case 'pgsql': $connection ...
[ "public", "function", "getConnection", "(", ")", "{", "if", "(", "$", "this", "->", "connection", "===", "null", ")", "{", "$", "connection", "=", "null", ";", "// We will now provide the query grammar to the connection.", "switch", "(", "$", "this", "->", "driv...
Returns the database connection. @return \Illuminate\Database\Connection @throws \InvalidArgumentException
[ "Returns", "the", "database", "connection", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/ConnectionResolver.php#L115-L149
cartalyst/sentry
src/Cartalyst/Sentry/Facades/CI/Sentry.php
Sentry.createSentry
public static function createSentry() { // Get some resources $ci =& get_instance(); $ci->load->driver('session'); // If Eloquent doesn't exist, then we must assume they are using their own providers. if (class_exists('Illuminate\Database\Eloquent\Model')) { $ci->load->database(); // Let's connect ...
php
public static function createSentry() { // Get some resources $ci =& get_instance(); $ci->load->driver('session'); // If Eloquent doesn't exist, then we must assume they are using their own providers. if (class_exists('Illuminate\Database\Eloquent\Model')) { $ci->load->database(); // Let's connect ...
[ "public", "static", "function", "createSentry", "(", ")", "{", "// Get some resources", "$", "ci", "=", "&", "get_instance", "(", ")", ";", "$", "ci", "->", "load", "->", "driver", "(", "'session'", ")", ";", "// If Eloquent doesn't exist, then we must assume they...
Creates a new instance of Sentry. @return \Cartalyst\Sentry\Sentry @throws \RuntimeException
[ "Creates", "a", "new", "instance", "of", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/CI/Sentry.php#L56-L97
cartalyst/sentry
src/Cartalyst/Sentry/Cookies/FuelPHPCookie.php
FuelPHPCookie.put
public function put($value, $minutes) { \Cookie::set($this->getKey(), json_encode($value), $minutes); }
php
public function put($value, $minutes) { \Cookie::set($this->getKey(), json_encode($value), $minutes); }
[ "public", "function", "put", "(", "$", "value", ",", "$", "minutes", ")", "{", "\\", "Cookie", "::", "set", "(", "$", "this", "->", "getKey", "(", ")", ",", "json_encode", "(", "$", "value", ")", ",", "$", "minutes", ")", ";", "}" ]
Put a value in the Sentry cookie. @param mixed $value @param int $minutes @return void
[ "Put", "a", "value", "in", "the", "Sentry", "cookie", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Cookies/FuelPHPCookie.php#L60-L63
cartalyst/sentry
src/Cartalyst/Sentry/Hashing/NativeHasher.php
NativeHasher.hash
public function hash($string) { // Usually caused by an old PHP environment, see // https://github.com/cartalyst/sentry/issues/98#issuecomment-12974603 // and https://github.com/ircmaxell/password_compat/issues/10 if ( ! function_exists('password_hash')) { throw new \RuntimeException('The function passwor...
php
public function hash($string) { // Usually caused by an old PHP environment, see // https://github.com/cartalyst/sentry/issues/98#issuecomment-12974603 // and https://github.com/ircmaxell/password_compat/issues/10 if ( ! function_exists('password_hash')) { throw new \RuntimeException('The function passwor...
[ "public", "function", "hash", "(", "$", "string", ")", "{", "// Usually caused by an old PHP environment, see", "// https://github.com/cartalyst/sentry/issues/98#issuecomment-12974603", "// and https://github.com/ircmaxell/password_compat/issues/10", "if", "(", "!", "function_exists", ...
Hash string. @param string $string @return string @throws \RuntimeException
[ "Hash", "string", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Hashing/NativeHasher.php#L52-L68
cartalyst/sentry
src/Cartalyst/Sentry/Hashing/NativeHasher.php
NativeHasher.checkhash
public function checkhash($string, $hashedString) { $verified = password_verify($string, $hashedString); if ( ! $verified) { // Try the fallbacks foreach (static::$fallbacks as $algo => $fallback) { $verified = $fallback['function']($string, $hashedString, $fallback['options']); if ($verified) ...
php
public function checkhash($string, $hashedString) { $verified = password_verify($string, $hashedString); if ( ! $verified) { // Try the fallbacks foreach (static::$fallbacks as $algo => $fallback) { $verified = $fallback['function']($string, $hashedString, $fallback['options']); if ($verified) ...
[ "public", "function", "checkhash", "(", "$", "string", ",", "$", "hashedString", ")", "{", "$", "verified", "=", "password_verify", "(", "$", "string", ",", "$", "hashedString", ")", ";", "if", "(", "!", "$", "verified", ")", "{", "// Try the fallbacks", ...
Check string against hashed string. @param string $string @param string $hashedString @return bool
[ "Check", "string", "against", "hashed", "string", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Hashing/NativeHasher.php#L77-L90
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Eloquent/Group.php
Group.toArray
public function toArray() { $attributes = parent::toArray(); if (isset($attributes['permissions'])) { $attributes['permissions'] = $this->getPermissionsAttribute($attributes['permissions']); } return $attributes; }
php
public function toArray() { $attributes = parent::toArray(); if (isset($attributes['permissions'])) { $attributes['permissions'] = $this->getPermissionsAttribute($attributes['permissions']); } return $attributes; }
[ "public", "function", "toArray", "(", ")", "{", "$", "attributes", "=", "parent", "::", "toArray", "(", ")", ";", "if", "(", "isset", "(", "$", "attributes", "[", "'permissions'", "]", ")", ")", "{", "$", "attributes", "[", "'permissions'", "]", "=", ...
Convert the model instance to an array. @return array
[ "Convert", "the", "model", "instance", "to", "an", "array", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Eloquent/Group.php#L342-L352
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Eloquent/Group.php
Group.validate
public function validate() { // Check if name field was passed if ( ! $name = $this->name) { throw new NameRequiredException("A name is required for a group, none given."); } // Check if group already exists $query = $this->newQuery(); $persistedGroup = $query->where('name', '=', $name)->first(); ...
php
public function validate() { // Check if name field was passed if ( ! $name = $this->name) { throw new NameRequiredException("A name is required for a group, none given."); } // Check if group already exists $query = $this->newQuery(); $persistedGroup = $query->where('name', '=', $name)->first(); ...
[ "public", "function", "validate", "(", ")", "{", "// Check if name field was passed", "if", "(", "!", "$", "name", "=", "$", "this", "->", "name", ")", "{", "throw", "new", "NameRequiredException", "(", "\"A name is required for a group, none given.\"", ")", ";", ...
Validates the group and throws a number of Exceptions if validation fails. @return bool @throws \Cartalyst\Sentry\Groups\NameRequiredException @throws \Cartalyst\Sentry\Groups\GroupExistsException
[ "Validates", "the", "group", "and", "throws", "a", "number", "of", "Exceptions", "if", "validation", "fails", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Eloquent/Group.php#L362-L380
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Provider.php
Provider.findByUser
public function findByUser(UserInterface $user, $ipAddress = null) { $model = $this->createModel(); $query = $model->where('user_id', '=', ($userId = $user->getId())); if ($ipAddress) { $query->where(function($query) use ($ipAddress) { $query->where('ip_address', '=', $ipAddress); $query->orWhere('...
php
public function findByUser(UserInterface $user, $ipAddress = null) { $model = $this->createModel(); $query = $model->where('user_id', '=', ($userId = $user->getId())); if ($ipAddress) { $query->where(function($query) use ($ipAddress) { $query->where('ip_address', '=', $ipAddress); $query->orWhere('...
[ "public", "function", "findByUser", "(", "UserInterface", "$", "user", ",", "$", "ipAddress", "=", "null", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "query", "=", "$", "model", "->", "where", "(", "'user_id'", ...
Finds a throttler by the given Model. @param \Cartalyst\Sentry\Users\UserInterface $user @param string $ipAddress @return \Cartalyst\Sentry\Throttling\ThrottleInterface
[ "Finds", "a", "throttler", "by", "the", "given", "Model", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Provider.php#L74-L96
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Provider.php
Provider.findByUserId
public function findByUserId($id, $ipAddress = null) { return $this->findByUser($this->userProvider->findById($id),$ipAddress); }
php
public function findByUserId($id, $ipAddress = null) { return $this->findByUser($this->userProvider->findById($id),$ipAddress); }
[ "public", "function", "findByUserId", "(", "$", "id", ",", "$", "ipAddress", "=", "null", ")", "{", "return", "$", "this", "->", "findByUser", "(", "$", "this", "->", "userProvider", "->", "findById", "(", "$", "id", ")", ",", "$", "ipAddress", ")", ...
Finds a throttler by the given user ID. @param mixed $id @param string $ipAddress @return \Cartalyst\Sentry\Throttling\ThrottleInterface
[ "Finds", "a", "throttler", "by", "the", "given", "user", "ID", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Provider.php#L104-L107
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Provider.php
Provider.findByUserLogin
public function findByUserLogin($login, $ipAddress = null) { return $this->findByUser($this->userProvider->findByLogin($login),$ipAddress); }
php
public function findByUserLogin($login, $ipAddress = null) { return $this->findByUser($this->userProvider->findByLogin($login),$ipAddress); }
[ "public", "function", "findByUserLogin", "(", "$", "login", ",", "$", "ipAddress", "=", "null", ")", "{", "return", "$", "this", "->", "findByUser", "(", "$", "this", "->", "userProvider", "->", "findByLogin", "(", "$", "login", ")", ",", "$", "ipAddress...
Finds a throttling interface by the given user login. @param string $login @param string $ipAddress @return \Cartalyst\Sentry\Throttling\ThrottleInterface
[ "Finds", "a", "throttling", "interface", "by", "the", "given", "user", "login", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Provider.php#L116-L119
cartalyst/sentry
src/Cartalyst/Sentry/Sentry.php
Sentry.register
public function register(array $credentials, $activate = false) { $user = $this->userProvider->create($credentials); if ($activate) { $user->attemptActivation($user->getActivationCode()); } return $this->user = $user; }
php
public function register(array $credentials, $activate = false) { $user = $this->userProvider->create($credentials); if ($activate) { $user->attemptActivation($user->getActivationCode()); } return $this->user = $user; }
[ "public", "function", "register", "(", "array", "$", "credentials", ",", "$", "activate", "=", "false", ")", "{", "$", "user", "=", "$", "this", "->", "userProvider", "->", "create", "(", "$", "credentials", ")", ";", "if", "(", "$", "activate", ")", ...
Registers a user by giving the required credentials and an optional flag for whether to activate the user. @param array $credentials @param bool $activate @return \Cartalyst\Sentry\Users\UserInterface
[ "Registers", "a", "user", "by", "giving", "the", "required", "credentials", "and", "an", "optional", "flag", "for", "whether", "to", "activate", "the", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Sentry.php#L139-L149
cartalyst/sentry
src/Cartalyst/Sentry/Sentry.php
Sentry.authenticate
public function authenticate(array $credentials, $remember = false) { // We'll default to the login name field, but fallback to a hard-coded // 'login' key in the array that was passed. $loginName = $this->userProvider->getEmptyUser()->getLoginName(); $loginCredentialKey = (isset($credentials[$loginName])) ? $...
php
public function authenticate(array $credentials, $remember = false) { // We'll default to the login name field, but fallback to a hard-coded // 'login' key in the array that was passed. $loginName = $this->userProvider->getEmptyUser()->getLoginName(); $loginCredentialKey = (isset($credentials[$loginName])) ? $...
[ "public", "function", "authenticate", "(", "array", "$", "credentials", ",", "$", "remember", "=", "false", ")", "{", "// We'll default to the login name field, but fallback to a hard-coded", "// 'login' key in the array that was passed.", "$", "loginName", "=", "$", "this", ...
Attempts to authenticate the given user according to the passed credentials. @param array $credentials @param bool $remember @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Throttling\UserBannedException @throws \Cartalyst\Sentry\Throttling\UserSuspendedException @throws \Cartalyst\Sentry\...
[ "Attempts", "to", "authenticate", "the", "given", "user", "according", "to", "the", "passed", "credentials", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Sentry.php#L165-L226
cartalyst/sentry
src/Cartalyst/Sentry/Sentry.php
Sentry.check
public function check() { if (is_null($this->user)) { // Check session first, follow by cookie if ( ! $userArray = $this->session->get() and ! $userArray = $this->cookie->get()) { return false; } // Now check our user is an array with two elements, // the username followed by the persist cod...
php
public function check() { if (is_null($this->user)) { // Check session first, follow by cookie if ( ! $userArray = $this->session->get() and ! $userArray = $this->cookie->get()) { return false; } // Now check our user is an array with two elements, // the username followed by the persist cod...
[ "public", "function", "check", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "user", ")", ")", "{", "// Check session first, follow by cookie", "if", "(", "!", "$", "userArray", "=", "$", "this", "->", "session", "->", "get", "(", ")", "...
Check to see if the user is logged in and activated, and hasn't been banned or suspended. @return bool
[ "Check", "to", "see", "if", "the", "user", "is", "logged", "in", "and", "activated", "and", "hasn", "t", "been", "banned", "or", "suspended", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Sentry.php#L244-L305
cartalyst/sentry
src/Cartalyst/Sentry/Sentry.php
Sentry.login
public function login(UserInterface $user, $remember = false) { if ( ! $user->isActivated()) { $login = $user->getLogin(); throw new UserNotActivatedException("Cannot login user [$login] as they are not activated."); } $this->user = $user; // Create an array of data to persist to the session and / or...
php
public function login(UserInterface $user, $remember = false) { if ( ! $user->isActivated()) { $login = $user->getLogin(); throw new UserNotActivatedException("Cannot login user [$login] as they are not activated."); } $this->user = $user; // Create an array of data to persist to the session and / or...
[ "public", "function", "login", "(", "UserInterface", "$", "user", ",", "$", "remember", "=", "false", ")", "{", "if", "(", "!", "$", "user", "->", "isActivated", "(", ")", ")", "{", "$", "login", "=", "$", "user", "->", "getLogin", "(", ")", ";", ...
Logs in the given user and sets properties in the session. @param \Cartalyst\Sentry\Users\UserInterface $user @param bool $remember @return void @throws \Cartalyst\Sentry\Users\UserNotActivatedException
[ "Logs", "in", "the", "given", "user", "and", "sets", "properties", "in", "the", "session", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Sentry.php#L316-L340
cartalyst/sentry
src/Cartalyst/Sentry/Sentry.php
Sentry.logout
public function logout() { $this->user = null; $this->session->forget(); $this->cookie->forget(); }
php
public function logout() { $this->user = null; $this->session->forget(); $this->cookie->forget(); }
[ "public", "function", "logout", "(", ")", "{", "$", "this", "->", "user", "=", "null", ";", "$", "this", "->", "session", "->", "forget", "(", ")", ";", "$", "this", "->", "cookie", "->", "forget", "(", ")", ";", "}" ]
Logs the current user out. @return void
[ "Logs", "the", "current", "user", "out", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Sentry.php#L357-L363
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.addLoginAttempt
public function addLoginAttempt() { $this->attempts++; $this->last_attempt_at = new DateTime; if ($this->getLoginAttempts() >= static::$attemptLimit) { $this->suspend(); } else { $this->save(); } }
php
public function addLoginAttempt() { $this->attempts++; $this->last_attempt_at = new DateTime; if ($this->getLoginAttempts() >= static::$attemptLimit) { $this->suspend(); } else { $this->save(); } }
[ "public", "function", "addLoginAttempt", "(", ")", "{", "$", "this", "->", "attempts", "++", ";", "$", "this", "->", "last_attempt_at", "=", "new", "DateTime", ";", "if", "(", "$", "this", "->", "getLoginAttempts", "(", ")", ">=", "static", "::", "$", ...
Add a new login attempt. @return void
[ "Add", "a", "new", "login", "attempt", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L115-L128
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.clearLoginAttempts
public function clearLoginAttempts() { // If our login attempts is already at zero // we do not need to do anything. Additionally, // if we are suspended, we are not going to do // anything either as clearing login attempts // makes us unsuspended. We need to manually // call unsuspend() in order to unsusp...
php
public function clearLoginAttempts() { // If our login attempts is already at zero // we do not need to do anything. Additionally, // if we are suspended, we are not going to do // anything either as clearing login attempts // makes us unsuspended. We need to manually // call unsuspend() in order to unsusp...
[ "public", "function", "clearLoginAttempts", "(", ")", "{", "// If our login attempts is already at zero", "// we do not need to do anything. Additionally,", "// if we are suspended, we are not going to do", "// anything either as clearing login attempts", "// makes us unsuspended. We need to man...
Clear all login attempts @return void
[ "Clear", "all", "login", "attempts" ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L135-L153
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.suspend
public function suspend() { if ( ! $this->suspended) { $this->suspended = true; $this->suspended_at = new DateTime; $this->save(); } }
php
public function suspend() { if ( ! $this->suspended) { $this->suspended = true; $this->suspended_at = new DateTime; $this->save(); } }
[ "public", "function", "suspend", "(", ")", "{", "if", "(", "!", "$", "this", "->", "suspended", ")", "{", "$", "this", "->", "suspended", "=", "true", ";", "$", "this", "->", "suspended_at", "=", "new", "DateTime", ";", "$", "this", "->", "save", "...
Suspend the user associated with the throttle @return void
[ "Suspend", "the", "user", "associated", "with", "the", "throttle" ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L160-L168
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.unsuspend
public function unsuspend() { if ($this->suspended) { $this->attempts = 0; $this->last_attempt_at = null; $this->suspended = false; $this->suspended_at = null; $this->save(); } }
php
public function unsuspend() { if ($this->suspended) { $this->attempts = 0; $this->last_attempt_at = null; $this->suspended = false; $this->suspended_at = null; $this->save(); } }
[ "public", "function", "unsuspend", "(", ")", "{", "if", "(", "$", "this", "->", "suspended", ")", "{", "$", "this", "->", "attempts", "=", "0", ";", "$", "this", "->", "last_attempt_at", "=", "null", ";", "$", "this", "->", "suspended", "=", "false",...
Unsuspend the user. @return void
[ "Unsuspend", "the", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L175-L185
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.isSuspended
public function isSuspended() { if ($this->suspended and $this->suspended_at) { $this->removeSuspensionIfAllowed(); return (bool) $this->suspended; } return false; }
php
public function isSuspended() { if ($this->suspended and $this->suspended_at) { $this->removeSuspensionIfAllowed(); return (bool) $this->suspended; } return false; }
[ "public", "function", "isSuspended", "(", ")", "{", "if", "(", "$", "this", "->", "suspended", "and", "$", "this", "->", "suspended_at", ")", "{", "$", "this", "->", "removeSuspensionIfAllowed", "(", ")", ";", "return", "(", "bool", ")", "$", "this", "...
Check if the user is suspended. @return bool
[ "Check", "if", "the", "user", "is", "suspended", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L192-L201
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.ban
public function ban() { if ( ! $this->banned) { $this->banned = true; $this->banned_at = new DateTime; $this->save(); } }
php
public function ban() { if ( ! $this->banned) { $this->banned = true; $this->banned_at = new DateTime; $this->save(); } }
[ "public", "function", "ban", "(", ")", "{", "if", "(", "!", "$", "this", "->", "banned", ")", "{", "$", "this", "->", "banned", "=", "true", ";", "$", "this", "->", "banned_at", "=", "new", "DateTime", ";", "$", "this", "->", "save", "(", ")", ...
Ban the user. @return void
[ "Ban", "the", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L208-L216
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.unban
public function unban() { if ($this->banned) { $this->banned = false; $this->banned_at = null; $this->save(); } }
php
public function unban() { if ($this->banned) { $this->banned = false; $this->banned_at = null; $this->save(); } }
[ "public", "function", "unban", "(", ")", "{", "if", "(", "$", "this", "->", "banned", ")", "{", "$", "this", "->", "banned", "=", "false", ";", "$", "this", "->", "banned_at", "=", "null", ";", "$", "this", "->", "save", "(", ")", ";", "}", "}"...
Unban the user. @return void
[ "Unban", "the", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L223-L231
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.check
public function check(\Validation $extra_validation = NULL) { if ($this->isBanned()) { throw new UserBannedException(sprintf( 'User [%s] has been banned.', $this->getUser()->getLogin() )); } else if ($this->isSuspended()) { throw new UserSuspendedException(sprintf( 'User [%s] has been su...
php
public function check(\Validation $extra_validation = NULL) { if ($this->isBanned()) { throw new UserBannedException(sprintf( 'User [%s] has been banned.', $this->getUser()->getLogin() )); } else if ($this->isSuspended()) { throw new UserSuspendedException(sprintf( 'User [%s] has been su...
[ "public", "function", "check", "(", "\\", "Validation", "$", "extra_validation", "=", "NULL", ")", "{", "if", "(", "$", "this", "->", "isBanned", "(", ")", ")", "{", "throw", "new", "UserBannedException", "(", "sprintf", "(", "'User [%s] has been banned.'", ...
Check user throttle status. @param \Validation $extra_validation @return bool @throws \Cartalyst\Sentry\Throttling\UserBannedException @throws \Cartalyst\Sentry\Throttling\UserSuspendedException
[ "Check", "user", "throttle", "status", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L251-L269
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.clearLoginAttemptsIfAllowed
public function clearLoginAttemptsIfAllowed() { $lastAttempt = new DateTime($this->last_attempt_at); $suspensionTime = static::$suspensionTime; $clearAttemptsAt = $lastAttempt->modify("+{$suspensionTime} minutes"); $now = new DateTime; if ($clearAttemptsAt <= $now) { $this->attempts = 0; ...
php
public function clearLoginAttemptsIfAllowed() { $lastAttempt = new DateTime($this->last_attempt_at); $suspensionTime = static::$suspensionTime; $clearAttemptsAt = $lastAttempt->modify("+{$suspensionTime} minutes"); $now = new DateTime; if ($clearAttemptsAt <= $now) { $this->attempts = 0; ...
[ "public", "function", "clearLoginAttemptsIfAllowed", "(", ")", "{", "$", "lastAttempt", "=", "new", "DateTime", "(", "$", "this", "->", "last_attempt_at", ")", ";", "$", "suspensionTime", "=", "static", "::", "$", "suspensionTime", ";", "$", "clearAttemptsAt", ...
Inspects the last attempt vs the suspension time (the time in which attempts must space before the account is suspended). If we can clear our attempts now, we'll do so and save. @return void
[ "Inspects", "the", "last", "attempt", "vs", "the", "suspension", "time", "(", "the", "time", "in", "which", "attempts", "must", "space", "before", "the", "account", "is", "suspended", ")", ".", "If", "we", "can", "clear", "our", "attempts", "now", "we", ...
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L279-L296
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.removeSuspensionIfAllowed
public function removeSuspensionIfAllowed() { $suspended = new DateTime($this->suspended_at); $suspensionTime = static::$suspensionTime; $unsuspendAt = $suspended->modify("+{$suspensionTime} minutes"); $now = new DateTime; if ($unsuspendAt <= $now) { $this->unsuspend(); } unset($sus...
php
public function removeSuspensionIfAllowed() { $suspended = new DateTime($this->suspended_at); $suspensionTime = static::$suspensionTime; $unsuspendAt = $suspended->modify("+{$suspensionTime} minutes"); $now = new DateTime; if ($unsuspendAt <= $now) { $this->unsuspend(); } unset($sus...
[ "public", "function", "removeSuspensionIfAllowed", "(", ")", "{", "$", "suspended", "=", "new", "DateTime", "(", "$", "this", "->", "suspended_at", ")", ";", "$", "suspensionTime", "=", "static", "::", "$", "suspensionTime", ";", "$", "unsuspendAt", "=", "$"...
Inspects to see if the user can become unsuspended or not, based on the suspension time provided. If so, unsuspends. @return void
[ "Inspects", "to", "see", "if", "the", "user", "can", "become", "unsuspended", "or", "not", "based", "on", "the", "suspension", "time", "provided", ".", "If", "so", "unsuspends", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L305-L321
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php
Throttle.getRemainingSuspensionTime
public function getRemainingSuspensionTime() { if(!$this->isSuspended()) return 0; $lastAttempt = clone $this->last_attempt_at; $suspensionTime = static::$suspensionTime; $clearAttemptsAt = $lastAttempt->modify("+{$suspensionTime} minutes"); $now = new Datetime; $timeLeft = $clearAttempt...
php
public function getRemainingSuspensionTime() { if(!$this->isSuspended()) return 0; $lastAttempt = clone $this->last_attempt_at; $suspensionTime = static::$suspensionTime; $clearAttemptsAt = $lastAttempt->modify("+{$suspensionTime} minutes"); $now = new Datetime; $timeLeft = $clearAttempt...
[ "public", "function", "getRemainingSuspensionTime", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isSuspended", "(", ")", ")", "return", "0", ";", "$", "lastAttempt", "=", "clone", "$", "this", "->", "last_attempt_at", ";", "$", "suspensionTime", "=",...
Get the remaining time on a suspension in minutes rounded up. Returns 0 if user is not suspended. @return int
[ "Get", "the", "remaining", "time", "on", "a", "suspension", "in", "minutes", "rounded", "up", ".", "Returns", "0", "if", "user", "is", "not", "suspended", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Throttle.php#L403-L421
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findById
public function findById($id) { $model = $this->createModel(); $user = $model->where('id', '=', $id)->find(); if ( ! $user->loaded() ) { throw new UserNotFoundException("A user could not be found with ID [$id]."); } return $user; }
php
public function findById($id) { $model = $this->createModel(); $user = $model->where('id', '=', $id)->find(); if ( ! $user->loaded() ) { throw new UserNotFoundException("A user could not be found with ID [$id]."); } return $user; }
[ "public", "function", "findById", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "user", "=", "$", "model", "->", "where", "(", "'id'", ",", "'='", ",", "$", "id", ")", "->", "find", "(", ")",...
Finds a user by the given user ID. @param mixed $id @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException
[ "Finds", "a", "user", "by", "the", "given", "user", "ID", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L71-L83
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findByLogin
public function findByLogin($login) { $model = $this->createModel(); $user = $model->where($model->getLoginName(), '=', $login)->find(); if ( ! $user->loaded() ) { throw new UserNotFoundException("A user could not be found with a login value of [$login]."); } return $user; }
php
public function findByLogin($login) { $model = $this->createModel(); $user = $model->where($model->getLoginName(), '=', $login)->find(); if ( ! $user->loaded() ) { throw new UserNotFoundException("A user could not be found with a login value of [$login]."); } return $user; }
[ "public", "function", "findByLogin", "(", "$", "login", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "user", "=", "$", "model", "->", "where", "(", "$", "model", "->", "getLoginName", "(", ")", ",", "'='", ",",...
Finds a user by the login value. @param string $login @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException
[ "Finds", "a", "user", "by", "the", "login", "value", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L92-L104
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findByCredentials
public function findByCredentials(array $credentials) { $model = $this->createModel(); $loginName = $model->getLoginName(); if ( ! array_key_exists($loginName, $credentials)) { throw new \InvalidArgumentException("Login attribute [$loginName] was not provided."); } $passwordName = $model->getPassw...
php
public function findByCredentials(array $credentials) { $model = $this->createModel(); $loginName = $model->getLoginName(); if ( ! array_key_exists($loginName, $credentials)) { throw new \InvalidArgumentException("Login attribute [$loginName] was not provided."); } $passwordName = $model->getPassw...
[ "public", "function", "findByCredentials", "(", "array", "$", "credentials", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "loginName", "=", "$", "model", "->", "getLoginName", "(", ")", ";", "if", "(", "!", "array_...
Finds a user by the given credentials. @param array $credentials @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException
[ "Finds", "a", "user", "by", "the", "given", "credentials", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L113-L167
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findByActivationCode
public function findByActivationCode($code) { if ( ! $code) { throw new \InvalidArgumentException("No activation code passed."); } $model = $this->createModel(); $result = $model->where('activation_code', '=', $code)->get(); if (($count = $result->count()) > 1) { throw new \RuntimeException("Fou...
php
public function findByActivationCode($code) { if ( ! $code) { throw new \InvalidArgumentException("No activation code passed."); } $model = $this->createModel(); $result = $model->where('activation_code', '=', $code)->get(); if (($count = $result->count()) > 1) { throw new \RuntimeException("Fou...
[ "public", "function", "findByActivationCode", "(", "$", "code", ")", "{", "if", "(", "!", "$", "code", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"No activation code passed.\"", ")", ";", "}", "$", "model", "=", "$", "this", "->", "...
Finds a user by the given activation code. @param string $code @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException @throws InvalidArgumentException @throws RuntimeException
[ "Finds", "a", "user", "by", "the", "given", "activation", "code", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L178-L202
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findAllInGroup
public function findAllInGroup(GroupInterface $group) { return array_filter($this->findAll(), function($user) use ($group) { return $user->inGroup($group); }); }
php
public function findAllInGroup(GroupInterface $group) { return array_filter($this->findAll(), function($user) use ($group) { return $user->inGroup($group); }); }
[ "public", "function", "findAllInGroup", "(", "GroupInterface", "$", "group", ")", "{", "return", "array_filter", "(", "$", "this", "->", "findAll", "(", ")", ",", "function", "(", "$", "user", ")", "use", "(", "$", "group", ")", "{", "return", "$", "us...
Returns all users who belong to a group. @param \Cartalyst\Sentry\Groups\GroupInterface $group @return array
[ "Returns", "all", "users", "who", "belong", "to", "a", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L250-L256
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findAllWithAccess
public function findAllWithAccess($permissions) { return array_filter($this->findAll(), function($user) use ($permissions) { return $user->hasAccess($permissions); }); }
php
public function findAllWithAccess($permissions) { return array_filter($this->findAll(), function($user) use ($permissions) { return $user->hasAccess($permissions); }); }
[ "public", "function", "findAllWithAccess", "(", "$", "permissions", ")", "{", "return", "array_filter", "(", "$", "this", "->", "findAll", "(", ")", ",", "function", "(", "$", "user", ")", "use", "(", "$", "permissions", ")", "{", "return", "$", "user", ...
Returns all users with access to a permission(s). @param string|array $permissions @return array
[ "Returns", "all", "users", "with", "access", "to", "a", "permission", "(", "s", ")", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L265-L271
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.findAllWithAnyAccess
public function findAllWithAnyAccess(array $permissions) { return array_filter($this->findAll(), function($user) use ($permissions) { return $user->hasAnyAccess($permissions); }); }
php
public function findAllWithAnyAccess(array $permissions) { return array_filter($this->findAll(), function($user) use ($permissions) { return $user->hasAnyAccess($permissions); }); }
[ "public", "function", "findAllWithAnyAccess", "(", "array", "$", "permissions", ")", "{", "return", "array_filter", "(", "$", "this", "->", "findAll", "(", ")", ",", "function", "(", "$", "user", ")", "use", "(", "$", "permissions", ")", "{", "return", "...
Returns all users with access to any given permission(s). @param array $permissions @return array
[ "Returns", "all", "users", "with", "access", "to", "any", "given", "permission", "(", "s", ")", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L280-L286
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/Provider.php
Provider.create
public function create(array $credentials) { if ( ! isset($credentials['permissions']) ) { $credentials['permissions'] = array(); } $user = $this->createModel(); $user->values($credentials); $user->save(); return $user; }
php
public function create(array $credentials) { if ( ! isset($credentials['permissions']) ) { $credentials['permissions'] = array(); } $user = $this->createModel(); $user->values($credentials); $user->save(); return $user; }
[ "public", "function", "create", "(", "array", "$", "credentials", ")", "{", "if", "(", "!", "isset", "(", "$", "credentials", "[", "'permissions'", "]", ")", ")", "{", "$", "credentials", "[", "'permissions'", "]", "=", "array", "(", ")", ";", "}", "...
Creates a user. @param array $credentials @return \Cartalyst\Sentry\Users\UserInterface
[ "Creates", "a", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/Provider.php#L294-L306
cartalyst/sentry
src/Cartalyst/Sentry/Facades/FuelPHP/Sentry.php
Sentry.createSentry
public static function createSentry() { // If Eloquent doesn't exist, then we must assume they are using their own providers. if (class_exists('Illuminate\Database\Eloquent\Model')) { // Retrieve what we need for our resolver $database = Database_Connection::instance(); $pdo = $database->conn...
php
public static function createSentry() { // If Eloquent doesn't exist, then we must assume they are using their own providers. if (class_exists('Illuminate\Database\Eloquent\Model')) { // Retrieve what we need for our resolver $database = Database_Connection::instance(); $pdo = $database->conn...
[ "public", "static", "function", "createSentry", "(", ")", "{", "// If Eloquent doesn't exist, then we must assume they are using their own providers.", "if", "(", "class_exists", "(", "'Illuminate\\Database\\Eloquent\\Model'", ")", ")", "{", "// Retrieve what we need for our resolver...
Creates a new instance of Sentry. @return \Cartalyst\Sentry\Sentry @throws \RuntimeException
[ "Creates", "a", "new", "instance", "of", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/FuelPHP/Sentry.php#L44-L72
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Kohana/Provider.php
Provider.findByUser
public function findByUser(UserInterface $user, $ipAddress = null) { $model = $this->createModel(); $query = $model->where('user_id', '=', ($user_id = $user->id)); if ($ipAddress) { $query->where('ip_address', '=', $ipAddress); } $throttle = $query->find(); if ( ! $throttle->loaded() ) { $thro...
php
public function findByUser(UserInterface $user, $ipAddress = null) { $model = $this->createModel(); $query = $model->where('user_id', '=', ($user_id = $user->id)); if ($ipAddress) { $query->where('ip_address', '=', $ipAddress); } $throttle = $query->find(); if ( ! $throttle->loaded() ) { $thro...
[ "public", "function", "findByUser", "(", "UserInterface", "$", "user", ",", "$", "ipAddress", "=", "null", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "query", "=", "$", "model", "->", "where", "(", "'user_id'", ...
Finds a throttler by the given user ID. @param mixed $id @param string $ipAddress @return \Cartalyst\Sentry\Throttling\ThrottleInterface
[ "Finds", "a", "throttler", "by", "the", "given", "user", "ID", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Kohana/Provider.php#L74-L95
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Eloquent/Provider.php
Provider.findById
public function findById($id) { $model = $this->createModel(); if ( ! $group = $model->newQuery()->find($id)) { throw new GroupNotFoundException("A group could not be found with ID [$id]."); } return $group; }
php
public function findById($id) { $model = $this->createModel(); if ( ! $group = $model->newQuery()->find($id)) { throw new GroupNotFoundException("A group could not be found with ID [$id]."); } return $group; }
[ "public", "function", "findById", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "if", "(", "!", "$", "group", "=", "$", "model", "->", "newQuery", "(", ")", "->", "find", "(", "$", "id", ")", ")",...
Find the group by ID. @param int $id @return \Cartalyst\Sentry\Groups\GroupInterface $group @throws \Cartalyst\Sentry\Groups\GroupNotFoundException
[ "Find", "the", "group", "by", "ID", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Eloquent/Provider.php#L55-L65
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Eloquent/Provider.php
Provider.findByName
public function findByName($name) { $model = $this->createModel(); if ( ! $group = $model->newQuery()->where('name', '=', $name)->first()) { throw new GroupNotFoundException("A group could not be found with the name [$name]."); } return $group; }
php
public function findByName($name) { $model = $this->createModel(); if ( ! $group = $model->newQuery()->where('name', '=', $name)->first()) { throw new GroupNotFoundException("A group could not be found with the name [$name]."); } return $group; }
[ "public", "function", "findByName", "(", "$", "name", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "if", "(", "!", "$", "group", "=", "$", "model", "->", "newQuery", "(", ")", "->", "where", "(", "'name'", ",", "'...
Find the group by name. @param string $name @return \Cartalyst\Sentry\Groups\GroupInterface $group @throws \Cartalyst\Sentry\Groups\GroupNotFoundException
[ "Find", "the", "group", "by", "name", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Eloquent/Provider.php#L74-L84
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Eloquent/Provider.php
Provider.create
public function create(array $attributes) { $group = $this->createModel(); $group->fill($attributes); $group->save(); return $group; }
php
public function create(array $attributes) { $group = $this->createModel(); $group->fill($attributes); $group->save(); return $group; }
[ "public", "function", "create", "(", "array", "$", "attributes", ")", "{", "$", "group", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "group", "->", "fill", "(", "$", "attributes", ")", ";", "$", "group", "->", "save", "(", ")", ";", ...
Creates a group. @param array $attributes @return \Cartalyst\Sentry\Groups\GroupInterface
[ "Creates", "a", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Eloquent/Provider.php#L104-L110
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Group.php
Group.hasAccess
public function hasAccess($permissions, $all = true) { $groupPermissions = $this->getPermissions(); foreach ((array) $permissions as $permission) { // We will set a flag now for whether this permission was // matched at all. $matched = true; // Now, let's check if the permission ends in a wildcard ...
php
public function hasAccess($permissions, $all = true) { $groupPermissions = $this->getPermissions(); foreach ((array) $permissions as $permission) { // We will set a flag now for whether this permission was // matched at all. $matched = true; // Now, let's check if the permission ends in a wildcard ...
[ "public", "function", "hasAccess", "(", "$", "permissions", ",", "$", "all", "=", "true", ")", "{", "$", "groupPermissions", "=", "$", "this", "->", "getPermissions", "(", ")", ";", "foreach", "(", "(", "array", ")", "$", "permissions", "as", "$", "per...
See if a group has access to the passed permission(s). If multiple permissions are passed, the group must have access to all permissions passed through, unless the "all" flag is set to false. @param string|array $permissions @param bool $all @return bool
[ "See", "if", "a", "group", "has", "access", "to", "the", "passed", "permission", "(", "s", ")", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Group.php#L121-L227
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Group.php
Group.delete
public function delete() { \DB::delete('users_groups') ->where('group_id', '=', $this->pk()) ->execute($this->_db); return parent::delete(); }
php
public function delete() { \DB::delete('users_groups') ->where('group_id', '=', $this->pk()) ->execute($this->_db); return parent::delete(); }
[ "public", "function", "delete", "(", ")", "{", "\\", "DB", "::", "delete", "(", "'users_groups'", ")", "->", "where", "(", "'group_id'", ",", "'='", ",", "$", "this", "->", "pk", "(", ")", ")", "->", "execute", "(", "$", "this", "->", "_db", ")", ...
Delete the group. @return bool
[ "Delete", "the", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Group.php#L246-L253
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Group.php
Group.setPermissionsAttribute
public function setPermissionsAttribute(array $permissions) { // Merge permissions $permissions = array_merge($this->getPermissions(), $permissions); // Loop through and adjust permissions as needed foreach ($permissions as $permission => &$value) { // Lets make sure their is a valid permission value ...
php
public function setPermissionsAttribute(array $permissions) { // Merge permissions $permissions = array_merge($this->getPermissions(), $permissions); // Loop through and adjust permissions as needed foreach ($permissions as $permission => &$value) { // Lets make sure their is a valid permission value ...
[ "public", "function", "setPermissionsAttribute", "(", "array", "$", "permissions", ")", "{", "// Merge permissions", "$", "permissions", "=", "array_merge", "(", "$", "this", "->", "getPermissions", "(", ")", ",", "$", "permissions", ")", ";", "// Loop through and...
Mutator for taking permissions. @param array $permissions @return void @throws \InvalidArgumentException
[ "Mutator", "for", "taking", "permissions", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Group.php#L289-L311
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Group.php
Group.validate
public function validate() { // Check if name field was passed $name = $this->name; if ( empty($name) ) { throw new NameRequiredException("A name is required for a group, none given."); } // Check if group already exists $persistedGroup = $this->unique_key_exists($name, 'name'); if (! $persistedG...
php
public function validate() { // Check if name field was passed $name = $this->name; if ( empty($name) ) { throw new NameRequiredException("A name is required for a group, none given."); } // Check if group already exists $persistedGroup = $this->unique_key_exists($name, 'name'); if (! $persistedG...
[ "public", "function", "validate", "(", ")", "{", "// Check if name field was passed", "$", "name", "=", "$", "this", "->", "name", ";", "if", "(", "empty", "(", "$", "name", ")", ")", "{", "throw", "new", "NameRequiredException", "(", "\"A name is required for...
Validates the group and throws a number of Exceptions if validation fails. @return bool @throws \Cartalyst\Sentry\Groups\NameRequiredException @throws \Cartalyst\Sentry\Groups\GroupExistsException
[ "Validates", "the", "group", "and", "throws", "a", "number", "of", "Exceptions", "if", "validation", "fails", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Group.php#L322-L341
cartalyst/sentry
src/Cartalyst/Sentry/Groups/Kohana/Group.php
Group.unique_key_exists
public function unique_key_exists($value, $field) { $total = \DB::select(array(\DB::expr('COUNT(*)'), 'total_count')) ->from($this->_table_name) ->where($field, '=', $value) ->where($this->_primary_key, '!=', $this->pk()) ->execute($this->_db) ->get('total_count'); return ($total == 0); }
php
public function unique_key_exists($value, $field) { $total = \DB::select(array(\DB::expr('COUNT(*)'), 'total_count')) ->from($this->_table_name) ->where($field, '=', $value) ->where($this->_primary_key, '!=', $this->pk()) ->execute($this->_db) ->get('total_count'); return ($total == 0); }
[ "public", "function", "unique_key_exists", "(", "$", "value", ",", "$", "field", ")", "{", "$", "total", "=", "\\", "DB", "::", "select", "(", "array", "(", "\\", "DB", "::", "expr", "(", "'COUNT(*)'", ")", ",", "'total_count'", ")", ")", "->", "from...
Tests if a unique key value exists in the database. @param mixed $value the value to test @param string $field field name @return boolean
[ "Tests", "if", "a", "unique", "key", "value", "exists", "in", "the", "database", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Groups/Kohana/Group.php#L350-L360
cartalyst/sentry
src/Cartalyst/Sentry/Hashing/WhirlpoolHasher.php
WhirlpoolHasher.checkhash
public function checkhash($string, $hashedString) { $salt = substr($hashedString, 0, $this->saltLength); return $this->slowEquals($salt.hash('whirlpool', $salt.$string), $hashedString); }
php
public function checkhash($string, $hashedString) { $salt = substr($hashedString, 0, $this->saltLength); return $this->slowEquals($salt.hash('whirlpool', $salt.$string), $hashedString); }
[ "public", "function", "checkhash", "(", "$", "string", ",", "$", "hashedString", ")", "{", "$", "salt", "=", "substr", "(", "$", "hashedString", ",", "0", ",", "$", "this", "->", "saltLength", ")", ";", "return", "$", "this", "->", "slowEquals", "(", ...
Check string against hashed string. @param string $string @param string $hashedString @return bool
[ "Check", "string", "against", "hashed", "string", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Hashing/WhirlpoolHasher.php#L51-L56
cartalyst/sentry
src/Cartalyst/Sentry/Facades/Kohana/Sentry.php
Sentry.createSentry
public static function createSentry() { $config = \Kohana::$config->load('sentry')->as_array(); //If the user hasn't defined a config file offer defaults if ( count($config) == 0 ) { $config = array( 'session_driver' => 'native', 'session_key' => 'cartalyst_sentry', 'cookie_key' => 'cartalyst_s...
php
public static function createSentry() { $config = \Kohana::$config->load('sentry')->as_array(); //If the user hasn't defined a config file offer defaults if ( count($config) == 0 ) { $config = array( 'session_driver' => 'native', 'session_key' => 'cartalyst_sentry', 'cookie_key' => 'cartalyst_s...
[ "public", "static", "function", "createSentry", "(", ")", "{", "$", "config", "=", "\\", "Kohana", "::", "$", "config", "->", "load", "(", "'sentry'", ")", "->", "as_array", "(", ")", ";", "//If the user hasn't defined a config file offer defaults", "if", "(", ...
Creates a new instance of Sentry. @return \Cartalyst\Sentry\Sentry
[ "Creates", "a", "new", "instance", "of", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/Kohana/Sentry.php#L36-L74
cartalyst/sentry
src/Cartalyst/Sentry/Cookies/IlluminateCookie.php
IlluminateCookie.put
public function put($value, $minutes) { $cookie = $this->jar->make($this->getKey(), $value, $minutes); $this->jar->queue($cookie); }
php
public function put($value, $minutes) { $cookie = $this->jar->make($this->getKey(), $value, $minutes); $this->jar->queue($cookie); }
[ "public", "function", "put", "(", "$", "value", ",", "$", "minutes", ")", "{", "$", "cookie", "=", "$", "this", "->", "jar", "->", "make", "(", "$", "this", "->", "getKey", "(", ")", ",", "$", "value", ",", "$", "minutes", ")", ";", "$", "this"...
Put a value in the Sentry cookie. @param mixed $value @param int $minutes @return void
[ "Put", "a", "value", "in", "the", "Sentry", "cookie", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Cookies/IlluminateCookie.php#L100-L104
cartalyst/sentry
src/Cartalyst/Sentry/Cookies/IlluminateCookie.php
IlluminateCookie.forever
public function forever($value) { $cookie = $this->jar->forever($this->getKey(), $value); $this->jar->queue($cookie); }
php
public function forever($value) { $cookie = $this->jar->forever($this->getKey(), $value); $this->jar->queue($cookie); }
[ "public", "function", "forever", "(", "$", "value", ")", "{", "$", "cookie", "=", "$", "this", "->", "jar", "->", "forever", "(", "$", "this", "->", "getKey", "(", ")", ",", "$", "value", ")", ";", "$", "this", "->", "jar", "->", "queue", "(", ...
Put a value in the Sentry cookie forever. @param mixed $value @return void
[ "Put", "a", "value", "in", "the", "Sentry", "cookie", "forever", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Cookies/IlluminateCookie.php#L112-L116
cartalyst/sentry
src/Cartalyst/Sentry/Cookies/IlluminateCookie.php
IlluminateCookie.get
public function get() { $key = $this->getKey(); $queued = $this->jar->getQueuedCookies(); if (isset($queued[$key])) { return $queued[$key]; } if ($this->strategy === 'request') { return $this->request->cookie($key); } else { return $this->jar->get($key); } }
php
public function get() { $key = $this->getKey(); $queued = $this->jar->getQueuedCookies(); if (isset($queued[$key])) { return $queued[$key]; } if ($this->strategy === 'request') { return $this->request->cookie($key); } else { return $this->jar->get($key); } }
[ "public", "function", "get", "(", ")", "{", "$", "key", "=", "$", "this", "->", "getKey", "(", ")", ";", "$", "queued", "=", "$", "this", "->", "jar", "->", "getQueuedCookies", "(", ")", ";", "if", "(", "isset", "(", "$", "queued", "[", "$", "k...
Get the Sentry cookie value. @return mixed
[ "Get", "the", "Sentry", "cookie", "value", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Cookies/IlluminateCookie.php#L123-L141
cartalyst/sentry
src/Cartalyst/Sentry/Cookies/IlluminateCookie.php
IlluminateCookie.forget
public function forget() { $cookie = $this->jar->forget($this->getKey()); $this->jar->queue($cookie); }
php
public function forget() { $cookie = $this->jar->forget($this->getKey()); $this->jar->queue($cookie); }
[ "public", "function", "forget", "(", ")", "{", "$", "cookie", "=", "$", "this", "->", "jar", "->", "forget", "(", "$", "this", "->", "getKey", "(", ")", ")", ";", "$", "this", "->", "jar", "->", "queue", "(", "$", "cookie", ")", ";", "}" ]
Remove the Sentry cookie. @return void
[ "Remove", "the", "Sentry", "cookie", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Cookies/IlluminateCookie.php#L148-L152
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.register
public function register() { $this->registerHasher(); $this->registerUserProvider(); $this->registerGroupProvider(); $this->registerThrottleProvider(); $this->registerSession(); $this->registerCookie(); $this->registerSentry(); }
php
public function register() { $this->registerHasher(); $this->registerUserProvider(); $this->registerGroupProvider(); $this->registerThrottleProvider(); $this->registerSession(); $this->registerCookie(); $this->registerSentry(); }
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "registerHasher", "(", ")", ";", "$", "this", "->", "registerUserProvider", "(", ")", ";", "$", "this", "->", "registerGroupProvider", "(", ")", ";", "$", "this", "->", "registerThrottlePr...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L50-L59
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerHasher
protected function registerHasher() { $this->app['sentry.hasher'] = $this->app->share(function($app) { $hasher = $app['config']['cartalyst/sentry::hasher']; switch ($hasher) { case 'native': return new NativeHasher; break; case 'bcrypt': return new BcryptHasher; break; c...
php
protected function registerHasher() { $this->app['sentry.hasher'] = $this->app->share(function($app) { $hasher = $app['config']['cartalyst/sentry::hasher']; switch ($hasher) { case 'native': return new NativeHasher; break; case 'bcrypt': return new BcryptHasher; break; c...
[ "protected", "function", "registerHasher", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry.hasher'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "$", "hasher", "=", "$", "app", "[", "'config'"...
Register the hasher used by Sentry. @return void
[ "Register", "the", "hasher", "used", "by", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L66-L93
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerUserProvider
protected function registerUserProvider() { $this->app['sentry.user'] = $this->app->share(function($app) { $model = $app['config']['cartalyst/sentry::users.model']; // We will never be accessing a user in Sentry without accessing // the user provider first. So, we can lazily set up our user // model's...
php
protected function registerUserProvider() { $this->app['sentry.user'] = $this->app->share(function($app) { $model = $app['config']['cartalyst/sentry::users.model']; // We will never be accessing a user in Sentry without accessing // the user provider first. So, we can lazily set up our user // model's...
[ "protected", "function", "registerUserProvider", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry.user'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", "'confi...
Register the user provider used by Sentry. @return void
[ "Register", "the", "user", "provider", "used", "by", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L100-L145
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerGroupProvider
protected function registerGroupProvider() { $this->app['sentry.group'] = $this->app->share(function($app) { $model = $app['config']['cartalyst/sentry::groups.model']; // Define the User model to use for relationships. if (method_exists($model, 'setUserModel')) { $userModel = $app['config']['carta...
php
protected function registerGroupProvider() { $this->app['sentry.group'] = $this->app->share(function($app) { $model = $app['config']['cartalyst/sentry::groups.model']; // Define the User model to use for relationships. if (method_exists($model, 'setUserModel')) { $userModel = $app['config']['carta...
[ "protected", "function", "registerGroupProvider", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry.group'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", "'con...
Register the group provider used by Sentry. @return void
[ "Register", "the", "group", "provider", "used", "by", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L152-L182
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerThrottleProvider
protected function registerThrottleProvider() { $this->app['sentry.throttle'] = $this->app->share(function($app) { $model = $app['config']['cartalyst/sentry::throttling.model']; $throttleProvider = new ThrottleProvider($app['sentry.user'], $model); if ($app['config']['cartalyst/sentry::throttling.enable...
php
protected function registerThrottleProvider() { $this->app['sentry.throttle'] = $this->app->share(function($app) { $model = $app['config']['cartalyst/sentry::throttling.model']; $throttleProvider = new ThrottleProvider($app['sentry.user'], $model); if ($app['config']['cartalyst/sentry::throttling.enable...
[ "protected", "function", "registerThrottleProvider", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry.throttle'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", ...
Register the throttle provider used by Sentry. @return void
[ "Register", "the", "throttle", "provider", "used", "by", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L189-L234
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerSession
protected function registerSession() { $this->app['sentry.session'] = $this->app->share(function($app) { $key = $app['config']['cartalyst/sentry::cookie.key']; return new IlluminateSession($app['session.store'], $key); }); }
php
protected function registerSession() { $this->app['sentry.session'] = $this->app->share(function($app) { $key = $app['config']['cartalyst/sentry::cookie.key']; return new IlluminateSession($app['session.store'], $key); }); }
[ "protected", "function", "registerSession", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry.session'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "$", "key", "=", "$", "app", "[", "'config'",...
Register the session driver used by Sentry. @return void
[ "Register", "the", "session", "driver", "used", "by", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L241-L249
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerCookie
protected function registerCookie() { $this->app['sentry.cookie'] = $this->app->share(function($app) { $key = $app['config']['cartalyst/sentry::cookie.key']; /** * We'll default to using the 'request' strategy, but switch to * 'jar' if the Laravel version in use is 4.0.* */ $strategy = 'requ...
php
protected function registerCookie() { $this->app['sentry.cookie'] = $this->app->share(function($app) { $key = $app['config']['cartalyst/sentry::cookie.key']; /** * We'll default to using the 'request' strategy, but switch to * 'jar' if the Laravel version in use is 4.0.* */ $strategy = 'requ...
[ "protected", "function", "registerCookie", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry.cookie'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "$", "key", "=", "$", "app", "[", "'config'", ...
Register the cookie driver used by Sentry. @return void
[ "Register", "the", "cookie", "driver", "used", "by", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L256-L276
cartalyst/sentry
src/Cartalyst/Sentry/SentryServiceProvider.php
SentryServiceProvider.registerSentry
protected function registerSentry() { $this->app['sentry'] = $this->app->share(function($app) { return new Sentry( $app['sentry.user'], $app['sentry.group'], $app['sentry.throttle'], $app['sentry.session'], $app['sentry.cookie'], $app['request']->getClientIp() ); }); $this->app->...
php
protected function registerSentry() { $this->app['sentry'] = $this->app->share(function($app) { return new Sentry( $app['sentry.user'], $app['sentry.group'], $app['sentry.throttle'], $app['sentry.session'], $app['sentry.cookie'], $app['request']->getClientIp() ); }); $this->app->...
[ "protected", "function", "registerSentry", "(", ")", "{", "$", "this", "->", "app", "[", "'sentry'", "]", "=", "$", "this", "->", "app", "->", "share", "(", "function", "(", "$", "app", ")", "{", "return", "new", "Sentry", "(", "$", "app", "[", "'s...
Takes all the components of Sentry and glues them together to create Sentry. @return void
[ "Takes", "all", "the", "components", "of", "Sentry", "and", "glues", "them", "together", "to", "create", "Sentry", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/SentryServiceProvider.php#L284-L299
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php
Throttle.suspend
public function suspend() { if ( ! $this->suspended) { $this->suspended = true; $this->suspended_at = $this->freshTimeStamp(); $this->save(); } }
php
public function suspend() { if ( ! $this->suspended) { $this->suspended = true; $this->suspended_at = $this->freshTimeStamp(); $this->save(); } }
[ "public", "function", "suspend", "(", ")", "{", "if", "(", "!", "$", "this", "->", "suspended", ")", "{", "$", "this", "->", "suspended", "=", "true", ";", "$", "this", "->", "suspended_at", "=", "$", "this", "->", "freshTimeStamp", "(", ")", ";", ...
Suspend the user associated with the throttle @return void
[ "Suspend", "the", "user", "associated", "with", "the", "throttle" ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php#L164-L172
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php
Throttle.ban
public function ban() { if ( ! $this->banned) { $this->banned = true; $this->banned_at = $this->freshTimeStamp(); $this->save(); } }
php
public function ban() { if ( ! $this->banned) { $this->banned = true; $this->banned_at = $this->freshTimeStamp(); $this->save(); } }
[ "public", "function", "ban", "(", ")", "{", "if", "(", "!", "$", "this", "->", "banned", ")", "{", "$", "this", "->", "banned", "=", "true", ";", "$", "this", "->", "banned_at", "=", "$", "this", "->", "freshTimeStamp", "(", ")", ";", "$", "this"...
Ban the user. @return void
[ "Ban", "the", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php#L212-L220
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php
Throttle.check
public function check() { if ($this->isBanned()) { throw new UserBannedException(sprintf( 'User [%s] has been banned.', $this->getUser()->getLogin() )); } if ($this->isSuspended()) { throw new UserSuspendedException(sprintf( 'User [%s] has been suspended.', $this->getUser()->getLogi...
php
public function check() { if ($this->isBanned()) { throw new UserBannedException(sprintf( 'User [%s] has been banned.', $this->getUser()->getLogin() )); } if ($this->isSuspended()) { throw new UserSuspendedException(sprintf( 'User [%s] has been suspended.', $this->getUser()->getLogi...
[ "public", "function", "check", "(", ")", "{", "if", "(", "$", "this", "->", "isBanned", "(", ")", ")", "{", "throw", "new", "UserBannedException", "(", "sprintf", "(", "'User [%s] has been banned.'", ",", "$", "this", "->", "getUser", "(", ")", "->", "ge...
Check user throttle status. @return bool @throws \Cartalyst\Sentry\Throttling\UserBannedException @throws \Cartalyst\Sentry\Throttling\UserSuspendedException
[ "Check", "user", "throttle", "status", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php#L254-L273
cartalyst/sentry
src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php
Throttle.toArray
public function toArray() { $result = parent::toArray(); if (isset($result['suspended'])) { $result['suspended'] = $this->getSuspendedAttribute($result['suspended']); } if (isset($result['banned'])) { $result['banned'] = $this->getBannedAttribute($result['banned']); } if (isset($result['last_att...
php
public function toArray() { $result = parent::toArray(); if (isset($result['suspended'])) { $result['suspended'] = $this->getSuspendedAttribute($result['suspended']); } if (isset($result['banned'])) { $result['banned'] = $this->getBannedAttribute($result['banned']); } if (isset($result['last_att...
[ "public", "function", "toArray", "(", ")", "{", "$", "result", "=", "parent", "::", "toArray", "(", ")", ";", "if", "(", "isset", "(", "$", "result", "[", "'suspended'", "]", ")", ")", "{", "$", "result", "[", "'suspended'", "]", "=", "$", "this", ...
Convert the model instance to an array. @return array
[ "Convert", "the", "model", "instance", "to", "an", "array", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Throttling/Eloquent/Throttle.php#L386-L408
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/User.php
User.attemptActivation
public function attemptActivation($activationCode) { if ($this->activated) { throw new UserAlreadyActivatedException('Cannot attempt activation on an already activated user.'); } if ($activationCode == $this->activation_code) { $this->activation_code = null; $this->activated = true; $this-...
php
public function attemptActivation($activationCode) { if ($this->activated) { throw new UserAlreadyActivatedException('Cannot attempt activation on an already activated user.'); } if ($activationCode == $this->activation_code) { $this->activation_code = null; $this->activated = true; $this-...
[ "public", "function", "attemptActivation", "(", "$", "activationCode", ")", "{", "if", "(", "$", "this", "->", "activated", ")", "{", "throw", "new", "UserAlreadyActivatedException", "(", "'Cannot attempt activation on an already activated user.'", ")", ";", "}", "if"...
Attempts to activate the given user by checking the activate code. If the user is activated already, an Exception is thrown. @param string $activationCode @return bool @throws \Cartalyst\Sentry\Users\UserAlreadyActivatedException
[ "Attempts", "to", "activate", "the", "given", "user", "by", "checking", "the", "activate", "code", ".", "If", "the", "user", "is", "activated", "already", "an", "Exception", "is", "thrown", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/User.php#L392-L408
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/User.php
User.getGroups
public function getGroups() { if ( ! $this->userGroups) { $this->userGroups = $this->groups->find_all(); } return $this->userGroups; }
php
public function getGroups() { if ( ! $this->userGroups) { $this->userGroups = $this->groups->find_all(); } return $this->userGroups; }
[ "public", "function", "getGroups", "(", ")", "{", "if", "(", "!", "$", "this", "->", "userGroups", ")", "{", "$", "this", "->", "userGroups", "=", "$", "this", "->", "groups", "->", "find_all", "(", ")", ";", "}", "return", "$", "this", "->", "user...
Returns an array of groups which the given user belongs to. @return array
[ "Returns", "an", "array", "of", "groups", "which", "the", "given", "user", "belongs", "to", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/User.php#L492-L500
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/User.php
User.addGroup
public function addGroup(GroupInterface $group) { if ( ! $this->inGroup($group)) { $this->add('groups', $group); } return true; }
php
public function addGroup(GroupInterface $group) { if ( ! $this->inGroup($group)) { $this->add('groups', $group); } return true; }
[ "public", "function", "addGroup", "(", "GroupInterface", "$", "group", ")", "{", "if", "(", "!", "$", "this", "->", "inGroup", "(", "$", "group", ")", ")", "{", "$", "this", "->", "add", "(", "'groups'", ",", "$", "group", ")", ";", "}", "return", ...
Adds the user to the given group. @param \Cartalyst\Sentry\Groups\GroupInterface $group @return bool
[ "Adds", "the", "user", "to", "the", "given", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/User.php#L508-L516
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/User.php
User.removeGroup
public function removeGroup(GroupInterface $group) { if ($this->inGroup($group)) { $this->remove('groups', $group); } return true; }
php
public function removeGroup(GroupInterface $group) { if ($this->inGroup($group)) { $this->remove('groups', $group); } return true; }
[ "public", "function", "removeGroup", "(", "GroupInterface", "$", "group", ")", "{", "if", "(", "$", "this", "->", "inGroup", "(", "$", "group", ")", ")", "{", "$", "this", "->", "remove", "(", "'groups'", ",", "$", "group", ")", ";", "}", "return", ...
Removes the user from the given group. @param \Cartalyst\Sentry\Groups\GroupInterface $group @return bool
[ "Removes", "the", "user", "from", "the", "given", "group", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/User.php#L524-L532
cartalyst/sentry
src/Cartalyst/Sentry/Users/Kohana/User.php
User.hasPermission
public function hasPermission($permissions, $all = true) { $mergedPermissions = $this->getMergedPermissions(); foreach ((array) $permissions as $permission) { // We will set a flag now for whether this permission was // matched at all. $matched = true; // Now, let's check if the permission ends in ...
php
public function hasPermission($permissions, $all = true) { $mergedPermissions = $this->getMergedPermissions(); foreach ((array) $permissions as $permission) { // We will set a flag now for whether this permission was // matched at all. $matched = true; // Now, let's check if the permission ends in ...
[ "public", "function", "hasPermission", "(", "$", "permissions", ",", "$", "all", "=", "true", ")", "{", "$", "mergedPermissions", "=", "$", "this", "->", "getMergedPermissions", "(", ")", ";", "foreach", "(", "(", "array", ")", "$", "permissions", "as", ...
See if a user has access to the passed permission(s). Permissions are merged from all groups the user belongs to and then are checked against the passed permission(s). If multiple permissions are passed, the user must have access to all permissions passed through, unless the "all" flag is set to false. Super users DO...
[ "See", "if", "a", "user", "has", "access", "to", "the", "passed", "permission", "(", "s", ")", ".", "Permissions", "are", "merged", "from", "all", "groups", "the", "user", "belongs", "to", "and", "then", "are", "checked", "against", "the", "passed", "per...
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Kohana/User.php#L608-L711
cartalyst/sentry
src/Cartalyst/Sentry/Hashing/BcryptHasher.php
BcryptHasher.hash
public function hash($string) { // Format strength $strength = str_pad($this->strength, 2, '0', STR_PAD_LEFT); // Create salt $salt = $this->createSalt(); //create prefix; $2y$ fixes blowfish weakness $prefix = PHP_VERSION_ID < 50307 ? '$2a$' : '$2y$'; return crypt($string, $prefix.$strength.'$'.$salt...
php
public function hash($string) { // Format strength $strength = str_pad($this->strength, 2, '0', STR_PAD_LEFT); // Create salt $salt = $this->createSalt(); //create prefix; $2y$ fixes blowfish weakness $prefix = PHP_VERSION_ID < 50307 ? '$2a$' : '$2y$'; return crypt($string, $prefix.$strength.'$'.$salt...
[ "public", "function", "hash", "(", "$", "string", ")", "{", "// Format strength", "$", "strength", "=", "str_pad", "(", "$", "this", "->", "strength", ",", "2", ",", "'0'", ",", "STR_PAD_LEFT", ")", ";", "// Create salt", "$", "salt", "=", "$", "this", ...
Hash string. @param string $string @return string
[ "Hash", "string", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Hashing/BcryptHasher.php#L43-L55
cartalyst/sentry
src/Cartalyst/Sentry/Facades/Native/Sentry.php
Sentry.createSentry
public static function createSentry( UserProviderInterface $userProvider = null, GroupProviderInterface $groupProvider = null, ThrottleProviderInterface $throttleProvider = null, SessionInterface $session = null, CookieInterface $cookie = null, $ipAddress = null ) { $userProvider = $userProvider ?: new ...
php
public static function createSentry( UserProviderInterface $userProvider = null, GroupProviderInterface $groupProvider = null, ThrottleProviderInterface $throttleProvider = null, SessionInterface $session = null, CookieInterface $cookie = null, $ipAddress = null ) { $userProvider = $userProvider ?: new ...
[ "public", "static", "function", "createSentry", "(", "UserProviderInterface", "$", "userProvider", "=", "null", ",", "GroupProviderInterface", "$", "groupProvider", "=", "null", ",", "ThrottleProviderInterface", "$", "throttleProvider", "=", "null", ",", "SessionInterfa...
Creates a Sentry instance. @param \Cartalyst\Sentry\Users\ProviderInterface $userProvider @param \Cartalyst\Sentry\Groups\ProviderInterface $groupProvider @param \Cartalyst\Sentry\Throttling\ProviderInterface $throttleProvider @param \Cartalyst\Sentry\Sessions\SessionInterface $session @param \Cartalyst\Sentry\Co...
[ "Creates", "a", "Sentry", "instance", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/Native/Sentry.php#L51-L70
cartalyst/sentry
src/Cartalyst/Sentry/Facades/Native/Sentry.php
Sentry.setupDatabaseResolver
public static function setupDatabaseResolver(PDO $pdo, $driverName = null, $tablePrefix = '') { // If Eloquent doesn't exist, then we must assume they are using their own providers. if (class_exists('Illuminate\Database\Eloquent\Model')) { if (is_null($driverName)) { $driverName = $pdo->getAttribute(PD...
php
public static function setupDatabaseResolver(PDO $pdo, $driverName = null, $tablePrefix = '') { // If Eloquent doesn't exist, then we must assume they are using their own providers. if (class_exists('Illuminate\Database\Eloquent\Model')) { if (is_null($driverName)) { $driverName = $pdo->getAttribute(PD...
[ "public", "static", "function", "setupDatabaseResolver", "(", "PDO", "$", "pdo", ",", "$", "driverName", "=", "null", ",", "$", "tablePrefix", "=", "''", ")", "{", "// If Eloquent doesn't exist, then we must assume they are using their own providers.", "if", "(", "class...
Sets up the Eloquent Connection Resolver with the given PDO connection. @param PDO $pdo @param string $driverName @param string $tablePrefix @return void
[ "Sets", "up", "the", "Eloquent", "Connection", "Resolver", "with", "the", "given", "PDO", "connection", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/Native/Sentry.php#L80-L92