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 |
|---|---|---|---|---|---|---|---|---|---|---|
dauxio/daux.io | libs/ContentTypes/Markdown/TableOfContentsParser.php | TableOfContentsParser.parse | public function parse(ContextInterface $context, Cursor $cursor)
{
if ($cursor->isIndented()) {
return false;
}
$previousState = $cursor->saveState();
$cursor->advanceToNextNonSpaceOrNewline();
$fence = $cursor->match('/^\[TOC\]/');
if (is_null($fence)) {... | php | public function parse(ContextInterface $context, Cursor $cursor)
{
if ($cursor->isIndented()) {
return false;
}
$previousState = $cursor->saveState();
$cursor->advanceToNextNonSpaceOrNewline();
$fence = $cursor->match('/^\[TOC\]/');
if (is_null($fence)) {... | [
"public",
"function",
"parse",
"(",
"ContextInterface",
"$",
"context",
",",
"Cursor",
"$",
"cursor",
")",
"{",
"if",
"(",
"$",
"cursor",
"->",
"isIndented",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"previousState",
"=",
"$",
"cursor",
"->... | @param ContextInterface $context
@param Cursor $cursor
@return bool | [
"@param",
"ContextInterface",
"$context",
"@param",
"Cursor",
"$cursor"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/ContentTypes/Markdown/TableOfContentsParser.php#L15-L33 |
dauxio/daux.io | libs/Format/Confluence/Generator.php | Generator.generateAll | public function generateAll(InputInterface $input, OutputInterface $output, $width)
{
$params = $this->daux->getParams();
$confluence = $params['confluence'];
$this->prefix = trim($confluence['prefix']) . ' ';
if ($this->prefix == ' ') {
$this->prefix = '';
}
... | php | public function generateAll(InputInterface $input, OutputInterface $output, $width)
{
$params = $this->daux->getParams();
$confluence = $params['confluence'];
$this->prefix = trim($confluence['prefix']) . ' ';
if ($this->prefix == ' ') {
$this->prefix = '';
}
... | [
"public",
"function",
"generateAll",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"width",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"daux",
"->",
"getParams",
"(",
")",
";",
"$",
"confluence",
"=",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/Generator.php#L70-L97 |
dauxio/daux.io | libs/Format/Confluence/Api.php | Api.getClient | public function getClient()
{
$options = [
'base_uri' => $this->base_url . 'rest/api/',
'auth' => [$this->user, $this->pass],
];
return new Client($options);
} | php | public function getClient()
{
$options = [
'base_uri' => $this->base_url . 'rest/api/',
'auth' => [$this->user, $this->pass],
];
return new Client($options);
} | [
"public",
"function",
"getClient",
"(",
")",
"{",
"$",
"options",
"=",
"[",
"'base_uri'",
"=>",
"$",
"this",
"->",
"base_url",
".",
"'rest/api/'",
",",
"'auth'",
"=>",
"[",
"$",
"this",
"->",
"user",
",",
"$",
"this",
"->",
"pass",
"]",
",",
"]",
"... | This method is public due to test purposes
@return Client | [
"This",
"method",
"is",
"public",
"due",
"to",
"test",
"purposes"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/Api.php#L30-L38 |
dauxio/daux.io | libs/Format/Confluence/Api.php | Api.handleError | protected function handleError(BadResponseException $e)
{
$request = $e->getRequest();
$response = $e->getResponse();
$level = floor($response->getStatusCode() / 100);
if ($level == '4') {
$label = 'Client error response';
} elseif ($level == '5') {
... | php | protected function handleError(BadResponseException $e)
{
$request = $e->getRequest();
$response = $e->getResponse();
$level = floor($response->getStatusCode() / 100);
if ($level == '4') {
$label = 'Client error response';
} elseif ($level == '5') {
... | [
"protected",
"function",
"handleError",
"(",
"BadResponseException",
"$",
"e",
")",
"{",
"$",
"request",
"=",
"$",
"e",
"->",
"getRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"e",
"->",
"getResponse",
"(",
")",
";",
"$",
"level",
"=",
"floor",
... | The standard error message from guzzle is quite poor in informations,
this will give little bit more sense to it and return it
@param BadResponseException $e
@return \Exception | [
"The",
"standard",
"error",
"message",
"from",
"guzzle",
"is",
"quite",
"poor",
"in",
"informations",
"this",
"will",
"give",
"little",
"bit",
"more",
"sense",
"to",
"it",
"and",
"return",
"it"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/Api.php#L47-L76 |
dauxio/daux.io | libs/Format/Confluence/Api.php | Api.getList | public function getList($rootPage, $recursive = false)
{
$increment = 15;
// We set a limit of 15 as it appears that
// Confluence fails silently when retrieving
// more than 20 entries with "body.storage"
$base_url = $url = "content/$rootPage/child/page?expand=version,body.... | php | public function getList($rootPage, $recursive = false)
{
$increment = 15;
// We set a limit of 15 as it appears that
// Confluence fails silently when retrieving
// more than 20 entries with "body.storage"
$base_url = $url = "content/$rootPage/child/page?expand=version,body.... | [
"public",
"function",
"getList",
"(",
"$",
"rootPage",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"$",
"increment",
"=",
"15",
";",
"// We set a limit of 15 as it appears that",
"// Confluence fails silently when retrieving",
"// more than 20 entries with \"body.storage\"... | Get a list of pages
@param int $rootPage
@param bool $recursive
@return array | [
"Get",
"a",
"list",
"of",
"pages"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/Api.php#L110-L150 |
dauxio/daux.io | libs/Format/Confluence/Api.php | Api.deletePage | public function deletePage($page_id)
{
try {
return json_decode($this->getClient()->delete('content/' . $page_id)->getBody(), true);
} catch (BadResponseException $e) {
throw $this->handleError($e);
}
} | php | public function deletePage($page_id)
{
try {
return json_decode($this->getClient()->delete('content/' . $page_id)->getBody(), true);
} catch (BadResponseException $e) {
throw $this->handleError($e);
}
} | [
"public",
"function",
"deletePage",
"(",
"$",
"page_id",
")",
"{",
"try",
"{",
"return",
"json_decode",
"(",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"delete",
"(",
"'content/'",
".",
"$",
"page_id",
")",
"->",
"getBody",
"(",
")",
",",
"true",
... | Delete a page
@param int $page_id
@return mixed | [
"Delete",
"a",
"page"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/Api.php#L251-L258 |
dauxio/daux.io | libs/DauxHelper.php | DauxHelper.rebaseConfiguration | public static function rebaseConfiguration(Config $config, $base_url)
{
// Avoid changing the url if it is already correct
if ($config['base_url'] == $base_url && !empty($config['theme'])) {
return;
}
// Change base url for all links on the pages
$config['base_ur... | php | public static function rebaseConfiguration(Config $config, $base_url)
{
// Avoid changing the url if it is already correct
if ($config['base_url'] == $base_url && !empty($config['theme'])) {
return;
}
// Change base url for all links on the pages
$config['base_ur... | [
"public",
"static",
"function",
"rebaseConfiguration",
"(",
"Config",
"$",
"config",
",",
"$",
"base_url",
")",
"{",
"// Avoid changing the url if it is already correct",
"if",
"(",
"$",
"config",
"[",
"'base_url'",
"]",
"==",
"$",
"base_url",
"&&",
"!",
"empty",
... | Set a new base_url for the configuration
@param Config $config
@param string $base_url | [
"Set",
"a",
"new",
"base_url",
"for",
"the",
"configuration"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/DauxHelper.php#L14-L25 |
dauxio/daux.io | libs/DauxHelper.php | DauxHelper.getFilenames | public static function getFilenames(Config $config, $part)
{
$extensions = implode('|', array_map('preg_quote', $config['valid_content_extensions'])) . '|html';
$raw = preg_replace('/(.*)?\\.(' . $extensions . ')$/', '$1', $part);
$raw = Builder::removeSortingInformations($raw);
re... | php | public static function getFilenames(Config $config, $part)
{
$extensions = implode('|', array_map('preg_quote', $config['valid_content_extensions'])) . '|html';
$raw = preg_replace('/(.*)?\\.(' . $extensions . ')$/', '$1', $part);
$raw = Builder::removeSortingInformations($raw);
re... | [
"public",
"static",
"function",
"getFilenames",
"(",
"Config",
"$",
"config",
",",
"$",
"part",
")",
"{",
"$",
"extensions",
"=",
"implode",
"(",
"'|'",
",",
"array_map",
"(",
"'preg_quote'",
",",
"$",
"config",
"[",
"'valid_content_extensions'",
"]",
")",
... | Get the possible output file names for a source file.
@param Config $config
@param string $part
@return string[] | [
"Get",
"the",
"possible",
"output",
"file",
"names",
"for",
"a",
"source",
"file",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/DauxHelper.php#L155-L163 |
dauxio/daux.io | libs/DauxHelper.php | DauxHelper.getFile | public static function getFile($tree, $request)
{
$request = explode('/', $request);
foreach ($request as $node) {
// If the element we're in currently is not a
// directory, we failed to find the requested file
if (!$tree instanceof Directory) {
r... | php | public static function getFile($tree, $request)
{
$request = explode('/', $request);
foreach ($request as $node) {
// If the element we're in currently is not a
// directory, we failed to find the requested file
if (!$tree instanceof Directory) {
r... | [
"public",
"static",
"function",
"getFile",
"(",
"$",
"tree",
",",
"$",
"request",
")",
"{",
"$",
"request",
"=",
"explode",
"(",
"'/'",
",",
"$",
"request",
")",
";",
"foreach",
"(",
"$",
"request",
"as",
"$",
"node",
")",
"{",
"// If the element we're... | Locate a file in the tree. Returns the file if found or false
@param Directory $tree
@param string $request
@return Tree\Content|Tree\Raw|false | [
"Locate",
"a",
"file",
"in",
"the",
"tree",
".",
"Returns",
"the",
"file",
"if",
"found",
"or",
"false"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/DauxHelper.php#L172-L232 |
dauxio/daux.io | libs/DauxHelper.php | DauxHelper.slug | public static function slug($title)
{
foreach (static::charsArray() as $key => $value) {
$title = str_replace($value, $key, $title);
}
$title = preg_replace('/[^\x20-\x7E]/u', '', $title);
$separator = '_';
// Convert all dashes into underscores
$title =... | php | public static function slug($title)
{
foreach (static::charsArray() as $key => $value) {
$title = str_replace($value, $key, $title);
}
$title = preg_replace('/[^\x20-\x7E]/u', '', $title);
$separator = '_';
// Convert all dashes into underscores
$title =... | [
"public",
"static",
"function",
"slug",
"(",
"$",
"title",
")",
"{",
"foreach",
"(",
"static",
"::",
"charsArray",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"title",
"=",
"str_replace",
"(",
"$",
"value",
",",
"$",
"key",
",",
... | Generate a URL friendly "slug" from a given string.
Taken from Stringy
@param string $title
@return string | [
"Generate",
"a",
"URL",
"friendly",
"slug",
"from",
"a",
"given",
"string",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/DauxHelper.php#L242-L261 |
dauxio/daux.io | libs/BaseConfig.php | BaseConfig.merge | public function merge($newValues, $override = true)
{
foreach ($newValues as $key => $value) {
// If the key doesn't exist yet,
// we can simply set it.
if (!array_key_exists($key, $this)) {
$this[$key] = $value;
continue;
}
... | php | public function merge($newValues, $override = true)
{
foreach ($newValues as $key => $value) {
// If the key doesn't exist yet,
// we can simply set it.
if (!array_key_exists($key, $this)) {
$this[$key] = $value;
continue;
}
... | [
"public",
"function",
"merge",
"(",
"$",
"newValues",
",",
"$",
"override",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"newValues",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"// If the key doesn't exist yet,",
"// we can simply set it.",
"if",
"(",
"!... | Merge an array into the object
@param array $newValues
@param bool $override | [
"Merge",
"an",
"array",
"into",
"the",
"object"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/BaseConfig.php#L13-L38 |
dauxio/daux.io | libs/ContentTypes/ContentTypeHandler.php | ContentTypeHandler.getContentExtensions | public function getContentExtensions()
{
$extensions = [];
foreach ($this->types as $type) {
$extensions = array_merge($extensions, $type->getExtensions());
}
return array_unique($extensions);
} | php | public function getContentExtensions()
{
$extensions = [];
foreach ($this->types as $type) {
$extensions = array_merge($extensions, $type->getExtensions());
}
return array_unique($extensions);
} | [
"public",
"function",
"getContentExtensions",
"(",
")",
"{",
"$",
"extensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"types",
"as",
"$",
"type",
")",
"{",
"$",
"extensions",
"=",
"array_merge",
"(",
"$",
"extensions",
",",
"$",
"type"... | Get all valid content file extensions
@return string[] | [
"Get",
"all",
"valid",
"content",
"file",
"extensions"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/ContentTypes/ContentTypeHandler.php#L25-L33 |
dauxio/daux.io | libs/ContentTypes/ContentTypeHandler.php | ContentTypeHandler.getType | public function getType(Content $node)
{
$path = $node->getPath() ?: $node->getName();
$extension = pathinfo($path, PATHINFO_EXTENSION);
foreach ($this->types as $type) {
if (in_array($extension, $type->getExtensions())) {
return $type;
}
}
... | php | public function getType(Content $node)
{
$path = $node->getPath() ?: $node->getName();
$extension = pathinfo($path, PATHINFO_EXTENSION);
foreach ($this->types as $type) {
if (in_array($extension, $type->getExtensions())) {
return $type;
}
}
... | [
"public",
"function",
"getType",
"(",
"Content",
"$",
"node",
")",
"{",
"$",
"path",
"=",
"$",
"node",
"->",
"getPath",
"(",
")",
"?",
":",
"$",
"node",
"->",
"getName",
"(",
")",
";",
"$",
"extension",
"=",
"pathinfo",
"(",
"$",
"path",
",",
"PA... | Get the ContentType able to handle this node
@param Content $node
@return ContentType | [
"Get",
"the",
"ContentType",
"able",
"to",
"handle",
"this",
"node"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/ContentTypes/ContentTypeHandler.php#L41-L53 |
dauxio/daux.io | libs/Format/Confluence/ContentTypes/Markdown/LinkRenderer.php | LinkRenderer.render | public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
{
// This can't be in the method type as
// the method is an abstract and should
// have the same interface
if (!$inline instanceof Link) {
throw new \RuntimeException(
... | php | public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
{
// This can't be in the method type as
// the method is an abstract and should
// have the same interface
if (!$inline instanceof Link) {
throw new \RuntimeException(
... | [
"public",
"function",
"render",
"(",
"AbstractInline",
"$",
"inline",
",",
"ElementRendererInterface",
"$",
"htmlRenderer",
")",
"{",
"// This can't be in the method type as",
"// the method is an abstract and should",
"// have the same interface",
"if",
"(",
"!",
"$",
"inlin... | @param AbstractInline|Link $inline
@param ElementRendererInterface $htmlRenderer
@return HtmlElement | [
"@param",
"AbstractInline|Link",
"$inline",
"@param",
"ElementRendererInterface",
"$htmlRenderer"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/ContentTypes/Markdown/LinkRenderer.php#L16-L57 |
dauxio/daux.io | libs/Cache.php | Cache.put | public static function put($key, $value)
{
Cache::ensureCacheDirectoryExists($path = Cache::path($key));
file_put_contents($path, $value);
} | php | public static function put($key, $value)
{
Cache::ensureCacheDirectoryExists($path = Cache::path($key));
file_put_contents($path, $value);
} | [
"public",
"static",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Cache",
"::",
"ensureCacheDirectoryExists",
"(",
"$",
"path",
"=",
"Cache",
"::",
"path",
"(",
"$",
"key",
")",
")",
";",
"file_put_contents",
"(",
"$",
"path",
",",
... | Store an item in the cache for a given number of minutes.
@param string $key
@param mixed $value
@return void | [
"Store",
"an",
"item",
"in",
"the",
"cache",
"for",
"a",
"given",
"number",
"of",
"minutes",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Cache.php#L30-L34 |
dauxio/daux.io | libs/Cache.php | Cache.ensureCacheDirectoryExists | protected static function ensureCacheDirectoryExists($path)
{
$parent = dirname($path);
if (!file_exists($parent)) {
mkdir($parent, 0777, true);
}
} | php | protected static function ensureCacheDirectoryExists($path)
{
$parent = dirname($path);
if (!file_exists($parent)) {
mkdir($parent, 0777, true);
}
} | [
"protected",
"static",
"function",
"ensureCacheDirectoryExists",
"(",
"$",
"path",
")",
"{",
"$",
"parent",
"=",
"dirname",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"parent",
")",
")",
"{",
"mkdir",
"(",
"$",
"parent",
",",
... | Create the file cache directory if necessary.
@param string $path
@return void | [
"Create",
"the",
"file",
"cache",
"directory",
"if",
"necessary",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Cache.php#L42-L49 |
dauxio/daux.io | libs/Cache.php | Cache.forget | public static function forget($key)
{
$path = Cache::path($key);
if (file_exists($path)) {
return unlink($path);
}
return false;
} | php | public static function forget($key)
{
$path = Cache::path($key);
if (file_exists($path)) {
return unlink($path);
}
return false;
} | [
"public",
"static",
"function",
"forget",
"(",
"$",
"key",
")",
"{",
"$",
"path",
"=",
"Cache",
"::",
"path",
"(",
"$",
"key",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"unlink",
"(",
"$",
"path",
")",
";",
... | Remove an item from the cache.
@param string $key
@return bool | [
"Remove",
"an",
"item",
"from",
"the",
"cache",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Cache.php#L57-L66 |
dauxio/daux.io | libs/Cache.php | Cache.get | public static function get($key)
{
$path = Cache::path($key);
if (file_exists($path)) {
return file_get_contents($path);
}
return null;
} | php | public static function get($key)
{
$path = Cache::path($key);
if (file_exists($path)) {
return file_get_contents($path);
}
return null;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"path",
"=",
"Cache",
"::",
"path",
"(",
"$",
"key",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"file_get_contents",
"(",
"$",
"path",
")",
... | Retrieve an item from the cache by key.
@param string|array $key
@return mixed | [
"Retrieve",
"an",
"item",
"from",
"the",
"cache",
"by",
"key",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Cache.php#L74-L83 |
dauxio/daux.io | libs/Cache.php | Cache.path | protected static function path($key)
{
$parts = array_slice(str_split($hash = sha1($key), 2), 0, 2);
return Cache::getDirectory() . '/' . implode('/', $parts) . '/' . $hash;
} | php | protected static function path($key)
{
$parts = array_slice(str_split($hash = sha1($key), 2), 0, 2);
return Cache::getDirectory() . '/' . implode('/', $parts) . '/' . $hash;
} | [
"protected",
"static",
"function",
"path",
"(",
"$",
"key",
")",
"{",
"$",
"parts",
"=",
"array_slice",
"(",
"str_split",
"(",
"$",
"hash",
"=",
"sha1",
"(",
"$",
"key",
")",
",",
"2",
")",
",",
"0",
",",
"2",
")",
";",
"return",
"Cache",
"::",
... | Get the full path for the given cache key.
@param string $key
@return string | [
"Get",
"the",
"full",
"path",
"for",
"the",
"given",
"cache",
"key",
"."
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Cache.php#L91-L95 |
dauxio/daux.io | libs/Format/Confluence/ContentPage.php | ContentPage.createImageTag | private function createImageTag($filename, $attributes)
{
$img = '<ac:image';
foreach ($attributes as $name => $value) {
if ($name == 'style') {
$re = '/float:\s*?(left|right);?/';
if (preg_match($re, $value, $matches)) {
$img .= ' ac:... | php | private function createImageTag($filename, $attributes)
{
$img = '<ac:image';
foreach ($attributes as $name => $value) {
if ($name == 'style') {
$re = '/float:\s*?(left|right);?/';
if (preg_match($re, $value, $matches)) {
$img .= ' ac:... | [
"private",
"function",
"createImageTag",
"(",
"$",
"filename",
",",
"$",
"attributes",
")",
"{",
"$",
"img",
"=",
"'<ac:image'",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"'... | Create an image tag for the specified filename
@param string $filename
@param array $attributes
@return string | [
"Create",
"an",
"image",
"tag",
"for",
"the",
"specified",
"filename"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/ContentPage.php#L55-L74 |
dauxio/daux.io | libs/Format/HTMLFile/Generator.php | Generator.generateAll | public function generateAll(InputInterface $input, OutputInterface $output, $width)
{
$destination = $input->getOption('destination');
$params = $this->daux->getParams();
if (is_null($destination)) {
$destination = $this->daux->local_base . DIRECTORY_SEPARATOR . 'static';
... | php | public function generateAll(InputInterface $input, OutputInterface $output, $width)
{
$destination = $input->getOption('destination');
$params = $this->daux->getParams();
if (is_null($destination)) {
$destination = $this->daux->local_base . DIRECTORY_SEPARATOR . 'static';
... | [
"public",
"function",
"generateAll",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"width",
")",
"{",
"$",
"destination",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'destination'",
")",
";",
"$",
"params",
"=",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/HTMLFile/Generator.php#L43-L87 |
dauxio/daux.io | libs/Format/Confluence/ContentTypes/Markdown/FencedCodeRenderer.php | FencedCodeRenderer.render | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
{
if (!($block instanceof FencedCode)) {
throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
}
$language = $this->getLanguage($block->getI... | php | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
{
if (!($block instanceof FencedCode)) {
throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
}
$language = $this->getLanguage($block->getI... | [
"public",
"function",
"render",
"(",
"AbstractBlock",
"$",
"block",
",",
"ElementRendererInterface",
"$",
"htmlRenderer",
",",
"$",
"inTightList",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"block",
"instanceof",
"FencedCode",
")",
")",
"{",
"throw",
... | @param AbstractBlock $block
@param HtmlRendererInterface $htmlRenderer
@param bool $inTightList
@return HtmlElement|string | [
"@param",
"AbstractBlock",
"$block",
"@param",
"HtmlRendererInterface",
"$htmlRenderer",
"@param",
"bool",
"$inTightList"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Format/Confluence/ContentTypes/Markdown/FencedCodeRenderer.php#L45-L54 |
dauxio/daux.io | libs/Tree/Builder.php | Builder.build | public static function build($node, $ignore)
{
if (($it = new \FilesystemIterator($node->getPath())) == false) {
return;
}
if ($node instanceof Root) {
// Ignore config.json in the root directory
$ignore['files'][] = 'config.json';
}
/** ... | php | public static function build($node, $ignore)
{
if (($it = new \FilesystemIterator($node->getPath())) == false) {
return;
}
if ($node instanceof Root) {
// Ignore config.json in the root directory
$ignore['files'][] = 'config.json';
}
/** ... | [
"public",
"static",
"function",
"build",
"(",
"$",
"node",
",",
"$",
"ignore",
")",
"{",
"if",
"(",
"(",
"$",
"it",
"=",
"new",
"\\",
"FilesystemIterator",
"(",
"$",
"node",
"->",
"getPath",
"(",
")",
")",
")",
"==",
"false",
")",
"{",
"return",
... | Build the initial tree
@param Directory $node
@param array $ignore | [
"Build",
"the",
"initial",
"tree"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Tree/Builder.php#L60-L94 |
dauxio/daux.io | libs/Tree/Builder.php | Builder.sortTree | public static function sortTree(Directory $current) {
$current->sort();
foreach ($current->getEntries() as $entry) {
if ($entry instanceof Directory) {
Builder::sortTree($entry);
}
}
} | php | public static function sortTree(Directory $current) {
$current->sort();
foreach ($current->getEntries() as $entry) {
if ($entry instanceof Directory) {
Builder::sortTree($entry);
}
}
} | [
"public",
"static",
"function",
"sortTree",
"(",
"Directory",
"$",
"current",
")",
"{",
"$",
"current",
"->",
"sort",
"(",
")",
";",
"foreach",
"(",
"$",
"current",
"->",
"getEntries",
"(",
")",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"$",
"entry",
... | Sort the tree recursively
@param Directory $current | [
"Sort",
"the",
"tree",
"recursively"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Tree/Builder.php#L218-L225 |
dauxio/daux.io | libs/Tree/Builder.php | Builder.finalizeTree | public static function finalizeTree(Directory $current, $prev = null)
{
foreach ($current->getEntries() as $entry) {
if ($entry instanceof Directory) {
$prev = Builder::finalizeTree($entry, $prev);
} elseif ($entry instanceof Content) {
if ($prev) {
... | php | public static function finalizeTree(Directory $current, $prev = null)
{
foreach ($current->getEntries() as $entry) {
if ($entry instanceof Directory) {
$prev = Builder::finalizeTree($entry, $prev);
} elseif ($entry instanceof Content) {
if ($prev) {
... | [
"public",
"static",
"function",
"finalizeTree",
"(",
"Directory",
"$",
"current",
",",
"$",
"prev",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"current",
"->",
"getEntries",
"(",
")",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"$",
"entry",
"instanceof"... | Calculate next and previous for all pages
@param Directory $current
@param null|Content $prev
@return null|Content | [
"Calculate",
"next",
"and",
"previous",
"for",
"all",
"pages"
] | train | https://github.com/dauxio/daux.io/blob/d02ebe093bcf15bbe32aaa1712370c7c70165f8e/libs/Tree/Builder.php#L234-L250 |
Spomky-Labs/otphp | src/ParameterTrait.php | ParameterTrait.getParameter | public function getParameter(string $parameter)
{
if ($this->hasParameter($parameter)) {
return $this->getParameters()[$parameter];
}
throw new \InvalidArgumentException(sprintf('Parameter "%s" does not exist', $parameter));
} | php | public function getParameter(string $parameter)
{
if ($this->hasParameter($parameter)) {
return $this->getParameters()[$parameter];
}
throw new \InvalidArgumentException(sprintf('Parameter "%s" does not exist', $parameter));
} | [
"public",
"function",
"getParameter",
"(",
"string",
"$",
"parameter",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasParameter",
"(",
"$",
"parameter",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getParameters",
"(",
")",
"[",
"$",
"parameter",
"]",
";"... | @param string $parameter
@return mixed | [
"@param",
"string",
"$parameter"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/ParameterTrait.php#L166-L173 |
Spomky-Labs/otphp | src/ParameterTrait.php | ParameterTrait.hasColon | private function hasColon($value)
{
$colons = [':', '%3A', '%3a'];
foreach ($colons as $colon) {
if (false !== strpos($value, $colon)) {
return true;
}
}
return false;
} | php | private function hasColon($value)
{
$colons = [':', '%3A', '%3a'];
foreach ($colons as $colon) {
if (false !== strpos($value, $colon)) {
return true;
}
}
return false;
} | [
"private",
"function",
"hasColon",
"(",
"$",
"value",
")",
"{",
"$",
"colons",
"=",
"[",
"':'",
",",
"'%3A'",
",",
"'%3a'",
"]",
";",
"foreach",
"(",
"$",
"colons",
"as",
"$",
"colon",
")",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"val... | @param string $value
@return bool | [
"@param",
"string",
"$value"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/ParameterTrait.php#L238-L248 |
Spomky-Labs/otphp | src/HOTP.php | HOTP.create | public static function create(?string $secret = null, int $counter = 0, string $digest = 'sha1', int $digits = 6): self
{
return new self($secret, $counter, $digest, $digits);
} | php | public static function create(?string $secret = null, int $counter = 0, string $digest = 'sha1', int $digits = 6): self
{
return new self($secret, $counter, $digest, $digits);
} | [
"public",
"static",
"function",
"create",
"(",
"?",
"string",
"$",
"secret",
"=",
"null",
",",
"int",
"$",
"counter",
"=",
"0",
",",
"string",
"$",
"digest",
"=",
"'sha1'",
",",
"int",
"$",
"digits",
"=",
"6",
")",
":",
"self",
"{",
"return",
"new"... | @param string|null $secret
@param int $counter
@param string $digest
@param int $digits
@return self | [
"@param",
"string|null",
"$secret",
"@param",
"int",
"$counter",
"@param",
"string",
"$digest",
"@param",
"int",
"$digits"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/HOTP.php#L42-L45 |
Spomky-Labs/otphp | src/HOTP.php | HOTP.verify | public function verify(string $otp, ?int $counter = null, ?int $window = null): bool
{
Assertion::greaterOrEqualThan($counter, 0, 'The counter must be at least 0.');
if (null === $counter) {
$counter = $this->getCounter();
} elseif ($counter < $this->getCounter()) {
... | php | public function verify(string $otp, ?int $counter = null, ?int $window = null): bool
{
Assertion::greaterOrEqualThan($counter, 0, 'The counter must be at least 0.');
if (null === $counter) {
$counter = $this->getCounter();
} elseif ($counter < $this->getCounter()) {
... | [
"public",
"function",
"verify",
"(",
"string",
"$",
"otp",
",",
"?",
"int",
"$",
"counter",
"=",
"null",
",",
"?",
"int",
"$",
"window",
"=",
"null",
")",
":",
"bool",
"{",
"Assertion",
"::",
"greaterOrEqualThan",
"(",
"$",
"counter",
",",
"0",
",",
... | If the counter is not provided, the OTP is verified at the actual counter.
{@inheritdoc} | [
"If",
"the",
"counter",
"is",
"not",
"provided",
"the",
"OTP",
"is",
"verified",
"at",
"the",
"actual",
"counter",
"."
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/HOTP.php#L84-L95 |
Spomky-Labs/otphp | src/HOTP.php | HOTP.verifyOtpWithWindow | private function verifyOtpWithWindow(string $otp, int $counter, ?int $window): bool
{
$window = $this->getWindow($window);
for ($i = $counter; $i <= $counter + $window; $i++) {
if ($this->compareOTP($this->at($i), $otp)) {
$this->updateCounter($i + 1);
r... | php | private function verifyOtpWithWindow(string $otp, int $counter, ?int $window): bool
{
$window = $this->getWindow($window);
for ($i = $counter; $i <= $counter + $window; $i++) {
if ($this->compareOTP($this->at($i), $otp)) {
$this->updateCounter($i + 1);
r... | [
"private",
"function",
"verifyOtpWithWindow",
"(",
"string",
"$",
"otp",
",",
"int",
"$",
"counter",
",",
"?",
"int",
"$",
"window",
")",
":",
"bool",
"{",
"$",
"window",
"=",
"$",
"this",
"->",
"getWindow",
"(",
"$",
"window",
")",
";",
"for",
"(",
... | @param string $otp
@param int $counter
@param int|null $window
@return bool | [
"@param",
"string",
"$otp",
"@param",
"int",
"$counter",
"@param",
"int|null",
"$window"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/HOTP.php#L114-L127 |
Spomky-Labs/otphp | src/HOTP.php | HOTP.getParameterMap | protected function getParameterMap(): array
{
$v = array_merge(
parent::getParameterMap(),
['counter' => function ($value) {
Assertion::greaterOrEqualThan((int) $value, 0, 'Counter must be at least 0.');
return (int) $value;
}]
);
... | php | protected function getParameterMap(): array
{
$v = array_merge(
parent::getParameterMap(),
['counter' => function ($value) {
Assertion::greaterOrEqualThan((int) $value, 0, 'Counter must be at least 0.');
return (int) $value;
}]
);
... | [
"protected",
"function",
"getParameterMap",
"(",
")",
":",
"array",
"{",
"$",
"v",
"=",
"array_merge",
"(",
"parent",
"::",
"getParameterMap",
"(",
")",
",",
"[",
"'counter'",
"=>",
"function",
"(",
"$",
"value",
")",
"{",
"Assertion",
"::",
"greaterOrEqua... | {@inheritdoc} | [
"{"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/HOTP.php#L132-L144 |
Spomky-Labs/otphp | src/Factory.php | Factory.loadFromProvisioningUri | public static function loadFromProvisioningUri(string $uri): OTPInterface
{
$parsed_url = parse_url($uri);
Assertion::isArray($parsed_url, 'Not a valid OTP provisioning URI');
self::checkData($parsed_url);
$otp = self::createOTP($parsed_url);
self::populateOTP($otp, $parsed... | php | public static function loadFromProvisioningUri(string $uri): OTPInterface
{
$parsed_url = parse_url($uri);
Assertion::isArray($parsed_url, 'Not a valid OTP provisioning URI');
self::checkData($parsed_url);
$otp = self::createOTP($parsed_url);
self::populateOTP($otp, $parsed... | [
"public",
"static",
"function",
"loadFromProvisioningUri",
"(",
"string",
"$",
"uri",
")",
":",
"OTPInterface",
"{",
"$",
"parsed_url",
"=",
"parse_url",
"(",
"$",
"uri",
")",
";",
"Assertion",
"::",
"isArray",
"(",
"$",
"parsed_url",
",",
"'Not a valid OTP pr... | This method is the unique public method of the class.
It can load a provisioning Uri and convert it into an OTP object.
@param string $uri
@throws \InvalidArgumentException
@return OTPInterface | [
"This",
"method",
"is",
"the",
"unique",
"public",
"method",
"of",
"the",
"class",
".",
"It",
"can",
"load",
"a",
"provisioning",
"Uri",
"and",
"convert",
"it",
"into",
"an",
"OTP",
"object",
"."
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/Factory.php#L33-L44 |
Spomky-Labs/otphp | src/Factory.php | Factory.createOTP | private static function createOTP(array $parsed_url): OTPInterface
{
switch ($parsed_url['host']) {
case 'totp':
$totp = TOTP::create($parsed_url['query']['secret']);
$totp->setLabel(self::getLabel($parsed_url['path']));
return $totp;
... | php | private static function createOTP(array $parsed_url): OTPInterface
{
switch ($parsed_url['host']) {
case 'totp':
$totp = TOTP::create($parsed_url['query']['secret']);
$totp->setLabel(self::getLabel($parsed_url['path']));
return $totp;
... | [
"private",
"static",
"function",
"createOTP",
"(",
"array",
"$",
"parsed_url",
")",
":",
"OTPInterface",
"{",
"switch",
"(",
"$",
"parsed_url",
"[",
"'host'",
"]",
")",
"{",
"case",
"'totp'",
":",
"$",
"totp",
"=",
"TOTP",
"::",
"create",
"(",
"$",
"pa... | @param array $parsed_url
@return OTPInterface | [
"@param",
"array",
"$parsed_url"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/Factory.php#L97-L113 |
Spomky-Labs/otphp | src/Factory.php | Factory.getLabel | private static function getLabel(string $data): string
{
$result = explode(':', rawurldecode(substr($data, 1)));
return 2 === count($result) ? $result[1] : $result[0];
} | php | private static function getLabel(string $data): string
{
$result = explode(':', rawurldecode(substr($data, 1)));
return 2 === count($result) ? $result[1] : $result[0];
} | [
"private",
"static",
"function",
"getLabel",
"(",
"string",
"$",
"data",
")",
":",
"string",
"{",
"$",
"result",
"=",
"explode",
"(",
"':'",
",",
"rawurldecode",
"(",
"substr",
"(",
"$",
"data",
",",
"1",
")",
")",
")",
";",
"return",
"2",
"===",
"... | @param string $data
@return string | [
"@param",
"string",
"$data"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/Factory.php#L120-L125 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.create | public static function create(?string $secret = null, int $period = 30, string $digest = 'sha1', int $digits = 6, int $epoch = 0): self
{
return new self($secret, $period, $digest, $digits, $epoch);
} | php | public static function create(?string $secret = null, int $period = 30, string $digest = 'sha1', int $digits = 6, int $epoch = 0): self
{
return new self($secret, $period, $digest, $digits, $epoch);
} | [
"public",
"static",
"function",
"create",
"(",
"?",
"string",
"$",
"secret",
"=",
"null",
",",
"int",
"$",
"period",
"=",
"30",
",",
"string",
"$",
"digest",
"=",
"'sha1'",
",",
"int",
"$",
"digits",
"=",
"6",
",",
"int",
"$",
"epoch",
"=",
"0",
... | TOTP constructor.
@param string|null $secret
@param int $period
@param string $digest
@param int $digits
@param int $epoch
@return self | [
"TOTP",
"constructor",
"."
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L47-L50 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.verify | public function verify(string $otp, ?int $timestamp = null, ?int $window = null): bool
{
$timestamp = $this->getTimestamp($timestamp);
if (null === $window) {
return $this->compareOTP($this->at($timestamp), $otp);
}
return $this->verifyOtpWithWindow($otp, $timestamp, $w... | php | public function verify(string $otp, ?int $timestamp = null, ?int $window = null): bool
{
$timestamp = $this->getTimestamp($timestamp);
if (null === $window) {
return $this->compareOTP($this->at($timestamp), $otp);
}
return $this->verifyOtpWithWindow($otp, $timestamp, $w... | [
"public",
"function",
"verify",
"(",
"string",
"$",
"otp",
",",
"?",
"int",
"$",
"timestamp",
"=",
"null",
",",
"?",
"int",
"$",
"window",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"getTimestamp",
"(",
"$",
"time... | If no timestamp is provided, the OTP is verified at the actual timestamp
{@inheritdoc} | [
"If",
"no",
"timestamp",
"is",
"provided",
"the",
"OTP",
"is",
"verified",
"at",
"the",
"actual",
"timestamp",
"{"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L104-L113 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.verifyOtpWithWindow | private function verifyOtpWithWindow(string $otp, int $timestamp, int $window): bool
{
$window = abs($window);
for ($i = 0; $i <= $window; $i++) {
$next = (int) $i * $this->getPeriod() + $timestamp;
$previous = (int) -$i * $this->getPeriod() + $timestamp;
$valid ... | php | private function verifyOtpWithWindow(string $otp, int $timestamp, int $window): bool
{
$window = abs($window);
for ($i = 0; $i <= $window; $i++) {
$next = (int) $i * $this->getPeriod() + $timestamp;
$previous = (int) -$i * $this->getPeriod() + $timestamp;
$valid ... | [
"private",
"function",
"verifyOtpWithWindow",
"(",
"string",
"$",
"otp",
",",
"int",
"$",
"timestamp",
",",
"int",
"$",
"window",
")",
":",
"bool",
"{",
"$",
"window",
"=",
"abs",
"(",
"$",
"window",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
... | @param string $otp
@param int $timestamp
@param int $window
@return bool | [
"@param",
"string",
"$otp",
"@param",
"int",
"$timestamp",
"@param",
"int",
"$window"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L122-L138 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.getTimestamp | private function getTimestamp(?int $timestamp): int
{
$timestamp = $timestamp ?? time();
Assertion::greaterOrEqualThan($timestamp, 0, 'Timestamp must be at least 0.');
return $timestamp;
} | php | private function getTimestamp(?int $timestamp): int
{
$timestamp = $timestamp ?? time();
Assertion::greaterOrEqualThan($timestamp, 0, 'Timestamp must be at least 0.');
return $timestamp;
} | [
"private",
"function",
"getTimestamp",
"(",
"?",
"int",
"$",
"timestamp",
")",
":",
"int",
"{",
"$",
"timestamp",
"=",
"$",
"timestamp",
"??",
"time",
"(",
")",
";",
"Assertion",
"::",
"greaterOrEqualThan",
"(",
"$",
"timestamp",
",",
"0",
",",
"'Timesta... | @param int|null $timestamp
@return int | [
"@param",
"int|null",
"$timestamp"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L145-L151 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.getProvisioningUri | public function getProvisioningUri(): string
{
$params = [];
if (30 !== $this->getPeriod()) {
$params['period'] = $this->getPeriod();
}
if (0 !== $this->getEpoch()) {
$params['epoch'] = $this->getEpoch();
}
return $this->generateURI('totp', $... | php | public function getProvisioningUri(): string
{
$params = [];
if (30 !== $this->getPeriod()) {
$params['period'] = $this->getPeriod();
}
if (0 !== $this->getEpoch()) {
$params['epoch'] = $this->getEpoch();
}
return $this->generateURI('totp', $... | [
"public",
"function",
"getProvisioningUri",
"(",
")",
":",
"string",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"30",
"!==",
"$",
"this",
"->",
"getPeriod",
"(",
")",
")",
"{",
"$",
"params",
"[",
"'period'",
"]",
"=",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L156-L168 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.timecode | private function timecode(int $timestamp): int
{
return (int) floor(($timestamp - $this->getEpoch()) / $this->getPeriod());
} | php | private function timecode(int $timestamp): int
{
return (int) floor(($timestamp - $this->getEpoch()) / $this->getPeriod());
} | [
"private",
"function",
"timecode",
"(",
"int",
"$",
"timestamp",
")",
":",
"int",
"{",
"return",
"(",
"int",
")",
"floor",
"(",
"(",
"$",
"timestamp",
"-",
"$",
"this",
"->",
"getEpoch",
"(",
")",
")",
"/",
"$",
"this",
"->",
"getPeriod",
"(",
")",... | @param int $timestamp
@return int | [
"@param",
"int",
"$timestamp"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L175-L178 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.getParameterMap | protected function getParameterMap(): array
{
$v = array_merge(
parent::getParameterMap(),
[
'period' => function ($value) {
Assertion::greaterThan((int) $value, 0, 'Period must be at least 1.');
return (int) $value;
... | php | protected function getParameterMap(): array
{
$v = array_merge(
parent::getParameterMap(),
[
'period' => function ($value) {
Assertion::greaterThan((int) $value, 0, 'Period must be at least 1.');
return (int) $value;
... | [
"protected",
"function",
"getParameterMap",
"(",
")",
":",
"array",
"{",
"$",
"v",
"=",
"array_merge",
"(",
"parent",
"::",
"getParameterMap",
"(",
")",
",",
"[",
"'period'",
"=>",
"function",
"(",
"$",
"value",
")",
"{",
"Assertion",
"::",
"greaterThan",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L183-L202 |
Spomky-Labs/otphp | src/TOTP.php | TOTP.filterOptions | protected function filterOptions(array &$options)
{
parent::filterOptions($options);
if (isset($options['epoch']) && 0 === $options['epoch']) {
unset($options['epoch']);
}
ksort($options);
} | php | protected function filterOptions(array &$options)
{
parent::filterOptions($options);
if (isset($options['epoch']) && 0 === $options['epoch']) {
unset($options['epoch']);
}
ksort($options);
} | [
"protected",
"function",
"filterOptions",
"(",
"array",
"&",
"$",
"options",
")",
"{",
"parent",
"::",
"filterOptions",
"(",
"$",
"options",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'epoch'",
"]",
")",
"&&",
"0",
"===",
"$",
"options",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/TOTP.php#L207-L216 |
Spomky-Labs/otphp | src/OTP.php | OTP.getQrCodeUri | public function getQrCodeUri(string $uri = 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}', string $placeholder = '{PROVISIONING_URI}'): string
{
$provisioning_uri = urlencode($this->getProvisioningUri());
return str_replace($placeholder, $provisioning_uri, $... | php | public function getQrCodeUri(string $uri = 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}', string $placeholder = '{PROVISIONING_URI}'): string
{
$provisioning_uri = urlencode($this->getProvisioningUri());
return str_replace($placeholder, $provisioning_uri, $... | [
"public",
"function",
"getQrCodeUri",
"(",
"string",
"$",
"uri",
"=",
"'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl={PROVISIONING_URI}'",
",",
"string",
"$",
"placeholder",
"=",
"'{PROVISIONING_URI}'",
")",
":",
"string",
"{",
"$",
"provisioning_uri",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/OTP.php#L40-L45 |
Spomky-Labs/otphp | src/OTP.php | OTP.generateOTP | protected function generateOTP(int $input): string
{
$hash = hash_hmac($this->getDigest(), $this->intToByteString($input), $this->getDecodedSecret());
$hmac = [];
foreach (str_split($hash, 2) as $hex) {
$hmac[] = hexdec($hex);
}
$offset = $hmac[count($hmac) - 1] &... | php | protected function generateOTP(int $input): string
{
$hash = hash_hmac($this->getDigest(), $this->intToByteString($input), $this->getDecodedSecret());
$hmac = [];
foreach (str_split($hash, 2) as $hex) {
$hmac[] = hexdec($hex);
}
$offset = $hmac[count($hmac) - 1] &... | [
"protected",
"function",
"generateOTP",
"(",
"int",
"$",
"input",
")",
":",
"string",
"{",
"$",
"hash",
"=",
"hash_hmac",
"(",
"$",
"this",
"->",
"getDigest",
"(",
")",
",",
"$",
"this",
"->",
"intToByteString",
"(",
"$",
"input",
")",
",",
"$",
"thi... | @param int $input
@return string The OTP at the specified input | [
"@param",
"int",
"$input"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/OTP.php#L52-L64 |
Spomky-Labs/otphp | src/OTP.php | OTP.generateURI | protected function generateURI(string $type, array $options): string
{
$label = $this->getLabel();
Assertion::string($label, 'The label is not set.');
Assertion::false($this->hasColon($label), 'Label must not contain a colon.');
$options = array_merge($options, $this->getParameters()... | php | protected function generateURI(string $type, array $options): string
{
$label = $this->getLabel();
Assertion::string($label, 'The label is not set.');
Assertion::false($this->hasColon($label), 'Label must not contain a colon.');
$options = array_merge($options, $this->getParameters()... | [
"protected",
"function",
"generateURI",
"(",
"string",
"$",
"type",
",",
"array",
"$",
"options",
")",
":",
"string",
"{",
"$",
"label",
"=",
"$",
"this",
"->",
"getLabel",
"(",
")",
";",
"Assertion",
"::",
"string",
"(",
"$",
"label",
",",
"'The label... | @param string $type
@param array $options
@return string | [
"@param",
"string",
"$type",
"@param",
"array",
"$options"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/OTP.php#L94-L104 |
Spomky-Labs/otphp | src/OTP.php | OTP.intToByteString | private function intToByteString(int $int): string
{
$result = [];
while (0 !== $int) {
$result[] = chr($int & 0xFF);
$int >>= 8;
}
return str_pad(implode(array_reverse($result)), 8, "\000", STR_PAD_LEFT);
} | php | private function intToByteString(int $int): string
{
$result = [];
while (0 !== $int) {
$result[] = chr($int & 0xFF);
$int >>= 8;
}
return str_pad(implode(array_reverse($result)), 8, "\000", STR_PAD_LEFT);
} | [
"private",
"function",
"intToByteString",
"(",
"int",
"$",
"int",
")",
":",
"string",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"while",
"(",
"0",
"!==",
"$",
"int",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"chr",
"(",
"$",
"int",
"&",
"0xFF",
")"... | @param int $int
@return string | [
"@param",
"int",
"$int"
] | train | https://github.com/Spomky-Labs/otphp/blob/48d463cf909320399fe08eab2e1cd18d899d5068/src/OTP.php#L125-L134 |
thujohn/twitter | src/Thujohn/Twitter/TwitterServiceProvider.php | TwitterServiceProvider.register | public function register()
{
$app = $this->app ?: app();
$appVersion = method_exists($app, 'version') ? $app->version() : $app::VERSION;
$laravelVersion = substr($appVersion, 0, strpos($appVersion, '.'));
$isLumen = false;
if (strpos(strtolower($laravelVersion), 'lumen') !== false)
{
$isLumen = true... | php | public function register()
{
$app = $this->app ?: app();
$appVersion = method_exists($app, 'version') ? $app->version() : $app::VERSION;
$laravelVersion = substr($appVersion, 0, strpos($appVersion, '.'));
$isLumen = false;
if (strpos(strtolower($laravelVersion), 'lumen') !== false)
{
$isLumen = true... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
"?",
":",
"app",
"(",
")",
";",
"$",
"appVersion",
"=",
"method_exists",
"(",
"$",
"app",
",",
"'version'",
")",
"?",
"$",
"app",
"->",
"version",
"(",
")... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/thujohn/twitter/blob/ff414bdadba3f1570ca211355e5359ec266552d8/src/Thujohn/Twitter/TwitterServiceProvider.php#L31-L73 |
thujohn/twitter | src/Thujohn/Twitter/Twitter.php | Twitter.reconfig | public function reconfig($config)
{
// The consumer key and secret must always be included when reconfiguring
$config = array_merge($this->parent_config, $config);
parent::reconfigure($config);
return $this;
} | php | public function reconfig($config)
{
// The consumer key and secret must always be included when reconfiguring
$config = array_merge($this->parent_config, $config);
parent::reconfigure($config);
return $this;
} | [
"public",
"function",
"reconfig",
"(",
"$",
"config",
")",
"{",
"// The consumer key and secret must always be included when reconfiguring",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"parent_config",
",",
"$",
"config",
")",
";",
"parent",
"::",
"re... | Set new config values for the OAuth class like different tokens.
@param Array $config An array containing the values that should be overwritten.
@return void | [
"Set",
"new",
"config",
"values",
"for",
"the",
"OAuth",
"class",
"like",
"different",
"tokens",
"."
] | train | https://github.com/thujohn/twitter/blob/ff414bdadba3f1570ca211355e5359ec266552d8/src/Thujohn/Twitter/Twitter.php#L107-L115 |
thujohn/twitter | src/Thujohn/Twitter/Twitter.php | Twitter.getRequestToken | public function getRequestToken($oauth_callback = null)
{
$parameters = [];
if (!empty($oauth_callback))
{
$parameters['oauth_callback'] = $oauth_callback;
}
parent::request('GET', parent::url($this->tconfig['REQUEST_TOKEN_URL'], ''), $parameters);
$response = $this->response;
if (isset($response... | php | public function getRequestToken($oauth_callback = null)
{
$parameters = [];
if (!empty($oauth_callback))
{
$parameters['oauth_callback'] = $oauth_callback;
}
parent::request('GET', parent::url($this->tconfig['REQUEST_TOKEN_URL'], ''), $parameters);
$response = $this->response;
if (isset($response... | [
"public",
"function",
"getRequestToken",
"(",
"$",
"oauth_callback",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"oauth_callback",
")",
")",
"{",
"$",
"parameters",
"[",
"'oauth_callback'",
"]",
"=",
... | Get a request_token from Twitter
@param String $oauth_callback [Optional] The callback provided for Twitter's API. The user will be redirected there after authorizing your app on Twitter.
@returns Array|Bool a key/value array containing oauth_token and oauth_token_secret in case of success | [
"Get",
"a",
"request_token",
"from",
"Twitter"
] | train | https://github.com/thujohn/twitter/blob/ff414bdadba3f1570ca211355e5359ec266552d8/src/Thujohn/Twitter/Twitter.php#L137-L166 |
thujohn/twitter | src/Thujohn/Twitter/Twitter.php | Twitter.getAccessToken | public function getAccessToken($oauth_verifier = null)
{
$parameters = [];
if (!empty($oauth_verifier))
{
$parameters['oauth_verifier'] = $oauth_verifier;
}
parent::request('GET', parent::url($this->tconfig['ACCESS_TOKEN_URL'], ''), $parameters);
$response = $this->response;
if (isset($response['... | php | public function getAccessToken($oauth_verifier = null)
{
$parameters = [];
if (!empty($oauth_verifier))
{
$parameters['oauth_verifier'] = $oauth_verifier;
}
parent::request('GET', parent::url($this->tconfig['ACCESS_TOKEN_URL'], ''), $parameters);
$response = $this->response;
if (isset($response['... | [
"public",
"function",
"getAccessToken",
"(",
"$",
"oauth_verifier",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"oauth_verifier",
")",
")",
"{",
"$",
"parameters",
"[",
"'oauth_verifier'",
"]",
"=",
... | Get an access token for a logged in user
@returns Array|Bool key/value array containing the token in case of success | [
"Get",
"an",
"access",
"token",
"for",
"a",
"logged",
"in",
"user"
] | train | https://github.com/thujohn/twitter/blob/ff414bdadba3f1570ca211355e5359ec266552d8/src/Thujohn/Twitter/Twitter.php#L173-L202 |
thujohn/twitter | src/Thujohn/Twitter/Twitter.php | Twitter.getAuthorizeURL | public function getAuthorizeURL($token, $sign_in_with_twitter = true, $force_login = false)
{
if (is_array($token))
{
$token = $token['oauth_token'];
}
if ($force_login)
{
return $this->tconfig['AUTHENTICATE_URL'] . "?oauth_token={$token}&force_login=true";
}
else if (empty($sign_in_with_twitter))... | php | public function getAuthorizeURL($token, $sign_in_with_twitter = true, $force_login = false)
{
if (is_array($token))
{
$token = $token['oauth_token'];
}
if ($force_login)
{
return $this->tconfig['AUTHENTICATE_URL'] . "?oauth_token={$token}&force_login=true";
}
else if (empty($sign_in_with_twitter))... | [
"public",
"function",
"getAuthorizeURL",
"(",
"$",
"token",
",",
"$",
"sign_in_with_twitter",
"=",
"true",
",",
"$",
"force_login",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"token",
")",
")",
"{",
"$",
"token",
"=",
"$",
"token",
"[",
... | Get the authorize URL
@returns string | [
"Get",
"the",
"authorize",
"URL"
] | train | https://github.com/thujohn/twitter/blob/ff414bdadba3f1570ca211355e5359ec266552d8/src/Thujohn/Twitter/Twitter.php#L209-L228 |
PHPAuth/PHPAuth | Config.php | Config.setForgottenDefaults | protected function setForgottenDefaults()
{
// ==== unchecked values ====
$this->repairConfigValue('bcrypt_cost', 10);
// cookies* values
$this->repairConfigValue('cookie_name', 'phpauth_session_cookie');
// verify* values
$this->repairConfigValue('verify_password_m... | php | protected function setForgottenDefaults()
{
// ==== unchecked values ====
$this->repairConfigValue('bcrypt_cost', 10);
// cookies* values
$this->repairConfigValue('cookie_name', 'phpauth_session_cookie');
// verify* values
$this->repairConfigValue('verify_password_m... | [
"protected",
"function",
"setForgottenDefaults",
"(",
")",
"{",
"// ==== unchecked values ====",
"$",
"this",
"->",
"repairConfigValue",
"(",
"'bcrypt_cost'",
",",
"10",
")",
";",
"// cookies* values",
"$",
"this",
"->",
"repairConfigValue",
"(",
"'cookie_name'",
",",... | Danger foreseen is half avoided.
Set default values.
REQUIRED FOR USERS THAT DOES NOT UPDATE THEIR `config` TABLES. | [
"Danger",
"foreseen",
"is",
"half",
"avoided",
"."
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Config.php#L261-L288 |
PHPAuth/PHPAuth | Config.php | Config.repairConfigValue | protected function repairConfigValue($setting, $default_value)
{
if (!isset($this->config[$setting]))
$this->config[$setting] = $default_value;
} | php | protected function repairConfigValue($setting, $default_value)
{
if (!isset($this->config[$setting]))
$this->config[$setting] = $default_value;
} | [
"protected",
"function",
"repairConfigValue",
"(",
"$",
"setting",
",",
"$",
"default_value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"setting",
"]",
")",
")",
"$",
"this",
"->",
"config",
"[",
"$",
"setting",
"... | Set configuration value if it is not present.
@param $setting
@param $default_value | [
"Set",
"configuration",
"value",
"if",
"it",
"is",
"not",
"present",
"."
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Config.php#L295-L299 |
PHPAuth/PHPAuth | Config.php | Config.setForgottenDictionary | private function setForgottenDictionary()
{
$lang = array();
$lang['user_blocked'] = "You are currently locked out of the system.";
$lang['user_verify_failed'] = "Captcha Code was invalid.";
//new
$lang['account_email_invalid'] = "Email address is incorrect or banned";
... | php | private function setForgottenDictionary()
{
$lang = array();
$lang['user_blocked'] = "You are currently locked out of the system.";
$lang['user_verify_failed'] = "Captcha Code was invalid.";
//new
$lang['account_email_invalid'] = "Email address is incorrect or banned";
... | [
"private",
"function",
"setForgottenDictionary",
"(",
")",
"{",
"$",
"lang",
"=",
"array",
"(",
")",
";",
"$",
"lang",
"[",
"'user_blocked'",
"]",
"=",
"\"You are currently locked out of the system.\"",
";",
"$",
"lang",
"[",
"'user_verify_failed'",
"]",
"=",
"\... | Returns forgotten translation dictionary
@return array | [
"Returns",
"forgotten",
"translation",
"dictionary"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Config.php#L306-L392 |
PHPAuth/PHPAuth | Auth.php | Auth.activate | public function activate($activate_token) //@todo: rename to 'activateUserAccount'
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "block") {
$return['message'] = $this->__lang("user_blocked");
return $return;
}
i... | php | public function activate($activate_token) //@todo: rename to 'activateUserAccount'
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "block") {
$return['message'] = $this->__lang("user_blocked");
return $return;
}
i... | [
"public",
"function",
"activate",
"(",
"$",
"activate_token",
")",
"//@todo: rename to 'activateUserAccount'",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"block_status",
"=",
"$",
"this",
"->",
"isBlocked",
"(",
")",
";",
"if",
"(",
"$",... | Activates a user's account
@param string $activate_token
@return array $return | [
"Activates",
"a",
"user",
"s",
"account"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L260-L311 |
PHPAuth/PHPAuth | Auth.php | Auth.logout | public function logout($hash)
{
if (strlen($hash) != self::HASH_LENGTH) {
return false;
}
$this->isAuthenticated = false;
$this->currentuser = null;
return $this->deleteSession($hash);
} | php | public function logout($hash)
{
if (strlen($hash) != self::HASH_LENGTH) {
return false;
}
$this->isAuthenticated = false;
$this->currentuser = null;
return $this->deleteSession($hash);
} | [
"public",
"function",
"logout",
"(",
"$",
"hash",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"hash",
")",
"!=",
"self",
"::",
"HASH_LENGTH",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"isAuthenticated",
"=",
"false",
";",
"$",
"this",
... | Logs out the session, identified by hash
@param string $hash
@return boolean | [
"Logs",
"out",
"the",
"session",
"identified",
"by",
"hash"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L371-L381 |
PHPAuth/PHPAuth | Auth.php | Auth.logoutAll | public function logoutAll($uid)
{
$this->isAuthenticated = false;
$this->currentuser = null;
return $this->deleteExistingSessions($uid);
} | php | public function logoutAll($uid)
{
$this->isAuthenticated = false;
$this->currentuser = null;
return $this->deleteExistingSessions($uid);
} | [
"public",
"function",
"logoutAll",
"(",
"$",
"uid",
")",
"{",
"$",
"this",
"->",
"isAuthenticated",
"=",
"false",
";",
"$",
"this",
"->",
"currentuser",
"=",
"null",
";",
"return",
"$",
"this",
"->",
"deleteExistingSessions",
"(",
"$",
"uid",
")",
";",
... | Logs out of all sessions for specified uid
@param int $uid
@return boolean | [
"Logs",
"out",
"of",
"all",
"sessions",
"for",
"specified",
"uid"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L388-L394 |
PHPAuth/PHPAuth | Auth.php | Auth.getUID | public function getUID($email)
{
$query = "SELECT id FROM {$this->config->table_users} WHERE email = :email";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['email' => $email]);
if ($query_prepared->rowCount() == 0) {
return false;
}
... | php | public function getUID($email)
{
$query = "SELECT id FROM {$this->config->table_users} WHERE email = :email";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['email' => $email]);
if ($query_prepared->rowCount() == 0) {
return false;
}
... | [
"public",
"function",
"getUID",
"(",
"$",
"email",
")",
"{",
"$",
"query",
"=",
"\"SELECT id FROM {$this->config->table_users} WHERE email = :email\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query",
")",
";",
"$",
... | Gets UID for a given email address, return int
@param string $email
@return int $uid | [
"Gets",
"UID",
"for",
"a",
"given",
"email",
"address",
"return",
"int"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L411-L422 |
PHPAuth/PHPAuth | Auth.php | Auth.addSession | protected function addSession($uid, $remember)
{
$ip = $this->getIp();
$user = $this->getBaseUser($uid);
if (!$user) {
return false;
}
$data['hash'] = sha1($this->config->site_key . microtime());
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HT... | php | protected function addSession($uid, $remember)
{
$ip = $this->getIp();
$user = $this->getBaseUser($uid);
if (!$user) {
return false;
}
$data['hash'] = sha1($this->config->site_key . microtime());
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HT... | [
"protected",
"function",
"addSession",
"(",
"$",
"uid",
",",
"$",
"remember",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"getIp",
"(",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getBaseUser",
"(",
"$",
"uid",
")",
";",
"if",
"(",
"!",
"$... | Creates a session for a specified user id
@param int $uid
@param boolean $remember
@return array $data | [
"Creates",
"a",
"session",
"for",
"a",
"specified",
"user",
"id"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L430-L478 |
PHPAuth/PHPAuth | Auth.php | Auth.deleteExistingSessions | protected function deleteExistingSessions($uid)
{
$query = "DELETE FROM {$this->config->table_sessions} WHERE uid = :uid";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['uid' => $uid]);
return $query_prepared->rowCount() > 0;
} | php | protected function deleteExistingSessions($uid)
{
$query = "DELETE FROM {$this->config->table_sessions} WHERE uid = :uid";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['uid' => $uid]);
return $query_prepared->rowCount() > 0;
} | [
"protected",
"function",
"deleteExistingSessions",
"(",
"$",
"uid",
")",
"{",
"$",
"query",
"=",
"\"DELETE FROM {$this->config->table_sessions} WHERE uid = :uid\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query",
")",
... | Removes all existing sessions for a given UID
@param int $uid
@return boolean | [
"Removes",
"all",
"existing",
"sessions",
"for",
"a",
"given",
"UID"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L487-L494 |
PHPAuth/PHPAuth | Auth.php | Auth.deleteSession | protected function deleteSession($hash)
{
$query = "DELETE FROM {$this->config->table_sessions} WHERE hash = :hash";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['hash' => $hash]);
return $query_prepared->rowCount() == 1;
} | php | protected function deleteSession($hash)
{
$query = "DELETE FROM {$this->config->table_sessions} WHERE hash = :hash";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['hash' => $hash]);
return $query_prepared->rowCount() == 1;
} | [
"protected",
"function",
"deleteSession",
"(",
"$",
"hash",
")",
"{",
"$",
"query",
"=",
"\"DELETE FROM {$this->config->table_sessions} WHERE hash = :hash\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query",
")",
";",
... | Removes a session based on hash
@param string $hash
@return boolean | [
"Removes",
"a",
"session",
"based",
"on",
"hash"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L502-L508 |
PHPAuth/PHPAuth | Auth.php | Auth.checkSession | public function checkSession($hash)
{
$ip = $this->getIp();
$block_status = $this->isBlocked();
if ($block_status == "block") {
$return['message'] = $this->__lang("user_blocked");
return false;
}
if (strlen($hash) != self::HASH_LENGTH) {
... | php | public function checkSession($hash)
{
$ip = $this->getIp();
$block_status = $this->isBlocked();
if ($block_status == "block") {
$return['message'] = $this->__lang("user_blocked");
return false;
}
if (strlen($hash) != self::HASH_LENGTH) {
... | [
"public",
"function",
"checkSession",
"(",
"$",
"hash",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"getIp",
"(",
")",
";",
"$",
"block_status",
"=",
"$",
"this",
"->",
"isBlocked",
"(",
")",
";",
"if",
"(",
"$",
"block_status",
"==",
"\"block\"",
... | Function to check if a session is valid
@param string $hash
@return boolean | [
"Function",
"to",
"check",
"if",
"a",
"session",
"is",
"valid"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L515-L568 |
PHPAuth/PHPAuth | Auth.php | Auth.getSessionUID | public function getSessionUID($hash)
{
$query = "SELECT uid FROM {$this->config->table_sessions} WHERE hash = :hash";
$query_prepared = $this->dbh->prepare($query);
$query_params = [
'hash' => $hash
];
$query_prepared->execute($query_params);
if ($query_p... | php | public function getSessionUID($hash)
{
$query = "SELECT uid FROM {$this->config->table_sessions} WHERE hash = :hash";
$query_prepared = $this->dbh->prepare($query);
$query_params = [
'hash' => $hash
];
$query_prepared->execute($query_params);
if ($query_p... | [
"public",
"function",
"getSessionUID",
"(",
"$",
"hash",
")",
"{",
"$",
"query",
"=",
"\"SELECT uid FROM {$this->config->table_sessions} WHERE hash = :hash\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query",
")",
";",... | Retrieves the UID associated with a given session hash
@param string $hash
@return int $uid | [
"Retrieves",
"the",
"UID",
"associated",
"with",
"a",
"given",
"session",
"hash"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L575-L589 |
PHPAuth/PHPAuth | Auth.php | Auth.isEmailTaken | public function isEmailTaken($email)
{
$query = "SELECT count(*) FROM {$this->config->table_users} WHERE email = :email";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['email' => $email]);
if ($query_prepared->fetchColumn() == 0) {
return false... | php | public function isEmailTaken($email)
{
$query = "SELECT count(*) FROM {$this->config->table_users} WHERE email = :email";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['email' => $email]);
if ($query_prepared->fetchColumn() == 0) {
return false... | [
"public",
"function",
"isEmailTaken",
"(",
"$",
"email",
")",
"{",
"$",
"query",
"=",
"\"SELECT count(*) FROM {$this->config->table_users} WHERE email = :email\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query",
")",
... | Checks if an email is already in use
@param string $email
@return boolean | [
"Checks",
"if",
"an",
"email",
"is",
"already",
"in",
"use"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L596-L607 |
PHPAuth/PHPAuth | Auth.php | Auth.isEmailBanned | public function isEmailBanned($email)
{
if (! $this->dbh->query("SHOW TABLES LIKE '{$this->config->table_emails_banned}'")->fetchAll() ) {
return false;
};
$query = "SELECT count(*) FROM {$this->config->table_emails_banned} WHERE domain = :domain";
$query_prepared = $thi... | php | public function isEmailBanned($email)
{
if (! $this->dbh->query("SHOW TABLES LIKE '{$this->config->table_emails_banned}'")->fetchAll() ) {
return false;
};
$query = "SELECT count(*) FROM {$this->config->table_emails_banned} WHERE domain = :domain";
$query_prepared = $thi... | [
"public",
"function",
"isEmailBanned",
"(",
"$",
"email",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"dbh",
"->",
"query",
"(",
"\"SHOW TABLES LIKE '{$this->config->table_emails_banned}'\"",
")",
"->",
"fetchAll",
"(",
")",
")",
"{",
"return",
"false",
";",
... | Checks if an email is banned
@param string $email
@return boolean | [
"Checks",
"if",
"an",
"email",
"is",
"banned"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L614-L631 |
PHPAuth/PHPAuth | Auth.php | Auth.addUser | protected function addUser($email, $password, $params = [], &$use_email_activation)
{
$return['error'] = true;
$query = "INSERT INTO {$this->config->table_users} (isactive) VALUES (0)";
$query_prepared = $this->dbh->prepare($query);
if (!$query_prepared->execute()) {
$r... | php | protected function addUser($email, $password, $params = [], &$use_email_activation)
{
$return['error'] = true;
$query = "INSERT INTO {$this->config->table_users} (isactive) VALUES (0)";
$query_prepared = $this->dbh->prepare($query);
if (!$query_prepared->execute()) {
$r... | [
"protected",
"function",
"addUser",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"params",
"=",
"[",
"]",
",",
"&",
"$",
"use_email_activation",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"query",
"=",
"\"INSERT INTO {$t... | Adds a new user to database
@param string $email -- email
@param string $password -- password
@param array $params -- additional params
@param boolean $use_email_activation -- activate email confirm or not
@return int $uid | [
"Adds",
"a",
"new",
"user",
"to",
"database"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L641-L707 |
PHPAuth/PHPAuth | Auth.php | Auth.getBaseUser | protected function getBaseUser($uid)
{
$query = "SELECT email, password, isactive FROM {$this->config->table_users} WHERE id = :id";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['id' => $uid]);
$data = $query_prepared->fetch(\PDO::FETCH_ASSOC);
i... | php | protected function getBaseUser($uid)
{
$query = "SELECT email, password, isactive FROM {$this->config->table_users} WHERE id = :id";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute(['id' => $uid]);
$data = $query_prepared->fetch(\PDO::FETCH_ASSOC);
i... | [
"protected",
"function",
"getBaseUser",
"(",
"$",
"uid",
")",
"{",
"$",
"query",
"=",
"\"SELECT email, password, isactive FROM {$this->config->table_users} WHERE id = :id\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query"... | Gets basic user data for a given UID and returns an array
@param int $uid
@return array $data | [
"Gets",
"basic",
"user",
"data",
"for",
"a",
"given",
"UID",
"and",
"returns",
"an",
"array"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L714-L729 |
PHPAuth/PHPAuth | Auth.php | Auth.deleteUser | public function deleteUser($uid, $password, $captcha_response = null)
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha_response) == false) {
$return['message'] = $this->__lang("user_v... | php | public function deleteUser($uid, $password, $captcha_response = null)
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha_response) == false) {
$return['message'] = $this->__lang("user_v... | [
"public",
"function",
"deleteUser",
"(",
"$",
"uid",
",",
"$",
"password",
",",
"$",
"captcha_response",
"=",
"null",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"block_status",
"=",
"$",
"this",
"->",
"isBlocked",
"(",
")",
... | Allows a user to delete their account
@param int $uid
@param string $password
@param string $captcha_response = null
@return array $return | [
"Allows",
"a",
"user",
"to",
"delete",
"their",
"account"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L765-L833 |
PHPAuth/PHPAuth | Auth.php | Auth.deleteUserForced | public function deleteUserForced($uid)
{
$return['error'] = true;
$query = "DELETE FROM {$this->config->table_users} WHERE id = :uid";
$query_prepared = $this->dbh->prepare($query);
if (!$query_prepared->execute(['uid' => $uid])) {
$return['message'] = $this->__lang("sy... | php | public function deleteUserForced($uid)
{
$return['error'] = true;
$query = "DELETE FROM {$this->config->table_users} WHERE id = :uid";
$query_prepared = $this->dbh->prepare($query);
if (!$query_prepared->execute(['uid' => $uid])) {
$return['message'] = $this->__lang("sy... | [
"public",
"function",
"deleteUserForced",
"(",
"$",
"uid",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"query",
"=",
"\"DELETE FROM {$this->config->table_users} WHERE id = :uid\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh... | Force delete user without password or captcha verification.
@param $uid
@return mixed | [
"Force",
"delete",
"user",
"without",
"password",
"or",
"captcha",
"verification",
"."
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L841-L876 |
PHPAuth/PHPAuth | Auth.php | Auth.addRequest | protected function addRequest($uid, $email, $type, &$use_email_activation)
{
$return['error'] = true;
$dictionary_key__request_exists = '';
if ($type == 'activation') {
$dictionary_key__request_exists = 'activation_exists';
} elseif ($type == 'reset') {
$... | php | protected function addRequest($uid, $email, $type, &$use_email_activation)
{
$return['error'] = true;
$dictionary_key__request_exists = '';
if ($type == 'activation') {
$dictionary_key__request_exists = 'activation_exists';
} elseif ($type == 'reset') {
$... | [
"protected",
"function",
"addRequest",
"(",
"$",
"uid",
",",
"$",
"email",
",",
"$",
"type",
",",
"&",
"$",
"use_email_activation",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"dictionary_key__request_exists",
"=",
"''",
";",
"if... | Creates an activation entry and sends email to user
@param int $uid
@param string $email
@param string $type
@param boolean $use_email_activation
@return boolean | [
"Creates",
"an",
"activation",
"entry",
"and",
"sends",
"email",
"to",
"user"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L888-L987 |
PHPAuth/PHPAuth | Auth.php | Auth.getRequest | public function getRequest($key, $type)
{
$return['error'] = true;
$query = "SELECT id, uid, expire FROM {$this->config->table_requests} WHERE token = ? AND type = ?";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute([$key, $type]);
if ($query_prepare... | php | public function getRequest($key, $type)
{
$return['error'] = true;
$query = "SELECT id, uid, expire FROM {$this->config->table_requests} WHERE token = ? AND type = ?";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute([$key, $type]);
if ($query_prepare... | [
"public",
"function",
"getRequest",
"(",
"$",
"key",
",",
"$",
"type",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"query",
"=",
"\"SELECT id, uid, expire FROM {$this->config->table_requests} WHERE token = ? AND type = ?\"",
";",
"$",
"query... | Returns request data if key is valid
@param string $key
@param string $type
@return array $return | [
"Returns",
"request",
"data",
"if",
"key",
"is",
"valid"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L995-L1028 |
PHPAuth/PHPAuth | Auth.php | Auth.deleteRequest | protected function deleteRequest($id)
{
$query = "DELETE FROM {$this->config->table_requests} WHERE id = :id";
$query_prepared = $this->dbh->prepare($query);
return $query_prepared->execute(['id' => $id]);
} | php | protected function deleteRequest($id)
{
$query = "DELETE FROM {$this->config->table_requests} WHERE id = :id";
$query_prepared = $this->dbh->prepare($query);
return $query_prepared->execute(['id' => $id]);
} | [
"protected",
"function",
"deleteRequest",
"(",
"$",
"id",
")",
"{",
"$",
"query",
"=",
"\"DELETE FROM {$this->config->table_requests} WHERE id = :id\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",
"(",
"$",
"query",
")",
";",
"ret... | Deletes request from database
@param int $id
@return boolean | [
"Deletes",
"request",
"from",
"database"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1035-L1040 |
PHPAuth/PHPAuth | Auth.php | Auth.validatePassword | protected function validatePassword($password) {
$state['error'] = true;
if (strlen($password) < (int)$this->config->verify_password_min_length ) {
$state['message'] = $this->__lang("password_short");
return $state;
}
$state['error'] = false;
return $s... | php | protected function validatePassword($password) {
$state['error'] = true;
if (strlen($password) < (int)$this->config->verify_password_min_length ) {
$state['message'] = $this->__lang("password_short");
return $state;
}
$state['error'] = false;
return $s... | [
"protected",
"function",
"validatePassword",
"(",
"$",
"password",
")",
"{",
"$",
"state",
"[",
"'error'",
"]",
"=",
"true",
";",
"if",
"(",
"strlen",
"(",
"$",
"password",
")",
"<",
"(",
"int",
")",
"$",
"this",
"->",
"config",
"->",
"verify_password_... | Verifies that a password is greater than minimal length
security requirements (ZxcvbnPhp\Zxcvbn) not checked now.
@param string $password
@return array $return ['error', 'message'] | [
"Verifies",
"that",
"a",
"password",
"is",
"greater",
"than",
"minimal",
"length"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1049-L1061 |
PHPAuth/PHPAuth | Auth.php | Auth.validateEmail | protected function validateEmail($email) {
$state['error'] = true;
if (strlen($email) < (int)$this->config->verify_email_min_length ) {
$state['message'] = $this->__lang("email_short", (int)$this->config->verify_email_min_length);
return $state;
} elseif (strlen($email)... | php | protected function validateEmail($email) {
$state['error'] = true;
if (strlen($email) < (int)$this->config->verify_email_min_length ) {
$state['message'] = $this->__lang("email_short", (int)$this->config->verify_email_min_length);
return $state;
} elseif (strlen($email)... | [
"protected",
"function",
"validateEmail",
"(",
"$",
"email",
")",
"{",
"$",
"state",
"[",
"'error'",
"]",
"=",
"true",
";",
"if",
"(",
"strlen",
"(",
"$",
"email",
")",
"<",
"(",
"int",
")",
"$",
"this",
"->",
"config",
"->",
"verify_email_min_length",... | Verifies that an email is valid
@param string $email
@return array $return | [
"Verifies",
"that",
"an",
"email",
"is",
"valid"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1068-L1095 |
PHPAuth/PHPAuth | Auth.php | Auth.resetPass | public function resetPass($key, $password, $repeatpassword, $captcha_response = null)
{
$state['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha_response) == false) {
$state['message'] = $this->... | php | public function resetPass($key, $password, $repeatpassword, $captcha_response = null)
{
$state['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha_response) == false) {
$state['message'] = $this->... | [
"public",
"function",
"resetPass",
"(",
"$",
"key",
",",
"$",
"password",
",",
"$",
"repeatpassword",
",",
"$",
"captcha_response",
"=",
"null",
")",
"{",
"$",
"state",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"block_status",
"=",
"$",
"this",
"->",... | Allows a user to reset their password after requesting a reset key.
@param string $key
@param string $password
@param string $repeatpassword
@param string $captcha_response = null
@return array $return | [
"Allows",
"a",
"user",
"to",
"reset",
"their",
"password",
"after",
"requesting",
"a",
"reset",
"key",
"."
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1106-L1207 |
PHPAuth/PHPAuth | Auth.php | Auth.resendActivation | public function resendActivation($email, $use_email_activation = null)
{
$state['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "block") {
$state['message'] = $this->__lang("user_blocked");
return $state;
}
if ($use_email_a... | php | public function resendActivation($email, $use_email_activation = null)
{
$state['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "block") {
$state['message'] = $this->__lang("user_blocked");
return $state;
}
if ($use_email_a... | [
"public",
"function",
"resendActivation",
"(",
"$",
"email",
",",
"$",
"use_email_activation",
"=",
"null",
")",
"{",
"$",
"state",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"block_status",
"=",
"$",
"this",
"->",
"isBlocked",
"(",
")",
";",
"if",
"(... | Recreates activation email for a given email and sends
@param string $email
@param null $use_email_activation
@return array $return | [
"Recreates",
"activation",
"email",
"for",
"a",
"given",
"email",
"and",
"sends"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1215-L1277 |
PHPAuth/PHPAuth | Auth.php | Auth.changePassword | public function changePassword($uid, $currpass, $newpass, $repeatnewpass, $captcha_response = null)
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha_response) == false) {
$return['mes... | php | public function changePassword($uid, $currpass, $newpass, $repeatnewpass, $captcha_response = null)
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha_response) == false) {
$return['mes... | [
"public",
"function",
"changePassword",
"(",
"$",
"uid",
",",
"$",
"currpass",
",",
"$",
"newpass",
",",
"$",
"repeatnewpass",
",",
"$",
"captcha_response",
"=",
"null",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"block_status",... | Changes a user's password
@param int $uid
@param string $currpass
@param string $newpass
@param string $repeatnewpass
@param string $captcha_response = null
@return array $return | [
"Changes",
"a",
"user",
"s",
"password"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1288-L1361 |
PHPAuth/PHPAuth | Auth.php | Auth.changeEmail | public function changeEmail($uid, $email, $password, $captcha = null)
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha) == false) {
$return['message'] = $this->__lang("user_verify_fai... | php | public function changeEmail($uid, $email, $password, $captcha = null)
{
$return['error'] = true;
$block_status = $this->isBlocked();
if ($block_status == "verify") {
if ($this->checkCaptcha($captcha) == false) {
$return['message'] = $this->__lang("user_verify_fai... | [
"public",
"function",
"changeEmail",
"(",
"$",
"uid",
",",
"$",
"email",
",",
"$",
"password",
",",
"$",
"captcha",
"=",
"null",
")",
"{",
"$",
"return",
"[",
"'error'",
"]",
"=",
"true",
";",
"$",
"block_status",
"=",
"$",
"this",
"->",
"isBlocked",... | Changes a user's email
@param int $uid
@param string $email
@param string $password
@param string $captcha = null
@return array $return | [
"Changes",
"a",
"user",
"s",
"email"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1371-L1450 |
PHPAuth/PHPAuth | Auth.php | Auth.isBlocked | public function isBlocked()
{
$ip = $this->getIp();
$this->deleteAttempts($ip, false);
// INET_ATON
$query = "SELECT count(*) FROM {$this->config->table_attempts} WHERE ip = :ip";
$query_prepared = $this->dbh->prepare($query); // INET_ATON(:ip)
$query_prepared->execu... | php | public function isBlocked()
{
$ip = $this->getIp();
$this->deleteAttempts($ip, false);
// INET_ATON
$query = "SELECT count(*) FROM {$this->config->table_attempts} WHERE ip = :ip";
$query_prepared = $this->dbh->prepare($query); // INET_ATON(:ip)
$query_prepared->execu... | [
"public",
"function",
"isBlocked",
"(",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"getIp",
"(",
")",
";",
"$",
"this",
"->",
"deleteAttempts",
"(",
"$",
"ip",
",",
"false",
")",
";",
"// INET_ATON",
"$",
"query",
"=",
"\"SELECT count(*) FROM {$this->c... | Informs if a user is locked out
@return string | [
"Informs",
"if",
"a",
"user",
"is",
"locked",
"out"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1456-L1476 |
PHPAuth/PHPAuth | Auth.php | Auth.checkReCaptcha | protected function checkReCaptcha($captcha_response)
{
if (empty($this->recaptcha_config)) return true;
if ($this->recaptcha_config['recaptcha_enabled']) {
if (empty($this->recaptcha_config['recaptcha_secret_key'])) throw new \RuntimeException('No secret provided');
if (!is... | php | protected function checkReCaptcha($captcha_response)
{
if (empty($this->recaptcha_config)) return true;
if ($this->recaptcha_config['recaptcha_enabled']) {
if (empty($this->recaptcha_config['recaptcha_secret_key'])) throw new \RuntimeException('No secret provided');
if (!is... | [
"protected",
"function",
"checkReCaptcha",
"(",
"$",
"captcha_response",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"recaptcha_config",
")",
")",
"return",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"recaptcha_config",
"[",
"'recaptcha_enabled'",
... | Check Google Recaptcha code.
If reCaptcha disabled in config or config not defined - return TRUE (captcha passed)
@param $captcha_response
@return bool | [
"Check",
"Google",
"Recaptcha",
"code",
".",
"If",
"reCaptcha",
"disabled",
"in",
"config",
"or",
"config",
"not",
"defined",
"-",
"return",
"TRUE",
"(",
"captcha",
"passed",
")"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1497-L1515 |
PHPAuth/PHPAuth | Auth.php | Auth.addAttempt | protected function addAttempt()
{
$ip = $this->getIp();
$attempt_expiredate = date("Y-m-d H:i:s", strtotime($this->config->attack_mitigation_time));
$query = "INSERT INTO {$this->config->table_attempts} (ip, expiredate) VALUES (:ip, :expiredate)";
$query_prepared = $this->dbh->prepa... | php | protected function addAttempt()
{
$ip = $this->getIp();
$attempt_expiredate = date("Y-m-d H:i:s", strtotime($this->config->attack_mitigation_time));
$query = "INSERT INTO {$this->config->table_attempts} (ip, expiredate) VALUES (:ip, :expiredate)";
$query_prepared = $this->dbh->prepa... | [
"protected",
"function",
"addAttempt",
"(",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"getIp",
"(",
")",
";",
"$",
"attempt_expiredate",
"=",
"date",
"(",
"\"Y-m-d H:i:s\"",
",",
"strtotime",
"(",
"$",
"this",
"->",
"config",
"->",
"attack_mitigation_ti... | Adds an attempt to database
@return boolean | [
"Adds",
"an",
"attempt",
"to",
"database"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1523-L1534 |
PHPAuth/PHPAuth | Auth.php | Auth.deleteAttempts | protected function deleteAttempts($ip, $all = false)
{
// NEXT : 'ip = INET_ATON(:ip)'
$query = ($all)
? "DELETE FROM {$this->config->table_attempts} WHERE ip = :ip"
: "DELETE FROM {$this->config->table_attempts} WHERE ip = :ip AND NOW() > expiredate ";
$sth = $this-... | php | protected function deleteAttempts($ip, $all = false)
{
// NEXT : 'ip = INET_ATON(:ip)'
$query = ($all)
? "DELETE FROM {$this->config->table_attempts} WHERE ip = :ip"
: "DELETE FROM {$this->config->table_attempts} WHERE ip = :ip AND NOW() > expiredate ";
$sth = $this-... | [
"protected",
"function",
"deleteAttempts",
"(",
"$",
"ip",
",",
"$",
"all",
"=",
"false",
")",
"{",
"// NEXT : 'ip = INET_ATON(:ip)'",
"$",
"query",
"=",
"(",
"$",
"all",
")",
"?",
"\"DELETE FROM {$this->config->table_attempts} WHERE ip = :ip\"",
":",
"\"DELETE FROM {... | Deletes all attempts for a given IP from database
@param string $ip
@param bool|false $all
@return bool | [
"Deletes",
"all",
"attempts",
"for",
"a",
"given",
"IP",
"from",
"database"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1543-L1554 |
PHPAuth/PHPAuth | Auth.php | Auth.getRandomKey | public function getRandomKey($length = self::TOKEN_LENGTH)
{
$chars = "A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0U1V2W3X4Y5Z6a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6";
$key = "";
for ($i = 0; $i < $length; $i++) {
$key .= $chars{mt_rand(0, strlen($chars) - 1)};
... | php | public function getRandomKey($length = self::TOKEN_LENGTH)
{
$chars = "A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0U1V2W3X4Y5Z6a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6";
$key = "";
for ($i = 0; $i < $length; $i++) {
$key .= $chars{mt_rand(0, strlen($chars) - 1)};
... | [
"public",
"function",
"getRandomKey",
"(",
"$",
"length",
"=",
"self",
"::",
"TOKEN_LENGTH",
")",
"{",
"$",
"chars",
"=",
"\"A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0U1V2W3X4Y5Z6a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6\"",
";",
"$",
"key",
"=",
"\"\"",
";",
"fo... | Returns a random string of a specified length
@param int $length
@return string $key | [
"Returns",
"a",
"random",
"string",
"of",
"a",
"specified",
"length"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1561-L1571 |
PHPAuth/PHPAuth | Auth.php | Auth.getIp | protected function getIp()
{
if (getenv('HTTP_CLIENT_IP')) {
$ipAddress = getenv('HTTP_CLIENT_IP');
} elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ipAddress = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_X_FORWARDED')) {
$ipAddress = getenv('HTTP_X... | php | protected function getIp()
{
if (getenv('HTTP_CLIENT_IP')) {
$ipAddress = getenv('HTTP_CLIENT_IP');
} elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ipAddress = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_X_FORWARDED')) {
$ipAddress = getenv('HTTP_X... | [
"protected",
"function",
"getIp",
"(",
")",
"{",
"if",
"(",
"getenv",
"(",
"'HTTP_CLIENT_IP'",
")",
")",
"{",
"$",
"ipAddress",
"=",
"getenv",
"(",
"'HTTP_CLIENT_IP'",
")",
";",
"}",
"elseif",
"(",
"getenv",
"(",
"'HTTP_X_FORWARDED_FOR'",
")",
")",
"{",
... | Returns IP address
@return string $ip | [
"Returns",
"IP",
"address"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1577-L1596 |
PHPAuth/PHPAuth | Auth.php | Auth.getCurrentSessionHash | public function getCurrentSessionHash(){
return isset($_COOKIE[$this->config->cookie_name]) ? $_COOKIE[$this->config->cookie_name] : false;
} | php | public function getCurrentSessionHash(){
return isset($_COOKIE[$this->config->cookie_name]) ? $_COOKIE[$this->config->cookie_name] : false;
} | [
"public",
"function",
"getCurrentSessionHash",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"_COOKIE",
"[",
"$",
"this",
"->",
"config",
"->",
"cookie_name",
"]",
")",
"?",
"$",
"_COOKIE",
"[",
"$",
"this",
"->",
"config",
"->",
"cookie_name",
"]",
":",
... | Returns current session hash
@return string
@return boolean, false if no cookie | [
"Returns",
"current",
"session",
"hash"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1603-L1605 |
PHPAuth/PHPAuth | Auth.php | Auth.isLogged | public function isLogged() {
if ($this->isAuthenticated === false) {
$this->isAuthenticated = $this->checkSession($this->getCurrentSessionHash());
}
return $this->isAuthenticated;
} | php | public function isLogged() {
if ($this->isAuthenticated === false) {
$this->isAuthenticated = $this->checkSession($this->getCurrentSessionHash());
}
return $this->isAuthenticated;
} | [
"public",
"function",
"isLogged",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAuthenticated",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"isAuthenticated",
"=",
"$",
"this",
"->",
"checkSession",
"(",
"$",
"this",
"->",
"getCurrentSessionHash",
"(",
... | Returns is user logged in
@return boolean | [
"Returns",
"is",
"user",
"logged",
"in"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1611-L1616 |
PHPAuth/PHPAuth | Auth.php | Auth.getCurrentUser | public function getCurrentUser()
{
if ($this->currentuser === null) {
$hash = $this->getCurrentSessionHash();
if ($hash === false) {
return false;
}
$uid = $this->getSessionUID($hash);
if ($uid === false) {
return f... | php | public function getCurrentUser()
{
if ($this->currentuser === null) {
$hash = $this->getCurrentSessionHash();
if ($hash === false) {
return false;
}
$uid = $this->getSessionUID($hash);
if ($uid === false) {
return f... | [
"public",
"function",
"getCurrentUser",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentuser",
"===",
"null",
")",
"{",
"$",
"hash",
"=",
"$",
"this",
"->",
"getCurrentSessionHash",
"(",
")",
";",
"if",
"(",
"$",
"hash",
"===",
"false",
")",
"{"... | Gets user data for current user (from cookie/session_hash) and returns an array, password is not returned
@return array $data
@return boolean false if no current user | [
"Gets",
"user",
"data",
"for",
"current",
"user",
"(",
"from",
"cookie",
"/",
"session_hash",
")",
"and",
"returns",
"an",
"array",
"password",
"is",
"not",
"returned"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1623-L1639 |
PHPAuth/PHPAuth | Auth.php | Auth.comparePasswords | public function comparePasswords($userid, $password_for_check)
{
$query = "SELECT password FROM {$this->config->table_users} WHERE id = ?";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute([$userid]);
$data = $query_prepared->fetch(\PDO::FETCH_ASSOC);
... | php | public function comparePasswords($userid, $password_for_check)
{
$query = "SELECT password FROM {$this->config->table_users} WHERE id = ?";
$query_prepared = $this->dbh->prepare($query);
$query_prepared->execute([$userid]);
$data = $query_prepared->fetch(\PDO::FETCH_ASSOC);
... | [
"public",
"function",
"comparePasswords",
"(",
"$",
"userid",
",",
"$",
"password_for_check",
")",
"{",
"$",
"query",
"=",
"\"SELECT password FROM {$this->config->table_users} WHERE id = ?\"",
";",
"$",
"query_prepared",
"=",
"$",
"this",
"->",
"dbh",
"->",
"prepare",... | Compare user's password with given password
@param int $userid
@param string $password_for_check
@return bool | [
"Compare",
"user",
"s",
"password",
"with",
"given",
"password"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1647-L1660 |
PHPAuth/PHPAuth | Auth.php | Auth.password_verify_with_rehash | public function password_verify_with_rehash($password, $hash, $uid)
{
if (!password_verify($password, $hash)) {
return false;
}
if (password_needs_rehash($hash, PASSWORD_DEFAULT, ['cost' => $this->config->bcrypt_cost])) {
$hash = $this->getHash($password);
... | php | public function password_verify_with_rehash($password, $hash, $uid)
{
if (!password_verify($password, $hash)) {
return false;
}
if (password_needs_rehash($hash, PASSWORD_DEFAULT, ['cost' => $this->config->bcrypt_cost])) {
$hash = $this->getHash($password);
... | [
"public",
"function",
"password_verify_with_rehash",
"(",
"$",
"password",
",",
"$",
"hash",
",",
"$",
"uid",
")",
"{",
"if",
"(",
"!",
"password_verify",
"(",
"$",
"password",
",",
"$",
"hash",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
... | Check if users password needs to be rehashed
@param string $password
@param string $hash
@param int $uid
@return bool | [
"Check",
"if",
"users",
"password",
"needs",
"to",
"be",
"rehashed"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1669-L1684 |
PHPAuth/PHPAuth | Auth.php | Auth.__lang | public function __lang($key, ...$args)
{
$string = array_key_exists($key, $this->messages_dictionary) ? $this->messages_dictionary[$key] : $key;
return (func_num_args() > 1) ? vsprintf($string, $args) : $string;
} | php | public function __lang($key, ...$args)
{
$string = array_key_exists($key, $this->messages_dictionary) ? $this->messages_dictionary[$key] : $key;
return (func_num_args() > 1) ? vsprintf($string, $args) : $string;
} | [
"public",
"function",
"__lang",
"(",
"$",
"key",
",",
"...",
"$",
"args",
")",
"{",
"$",
"string",
"=",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"messages_dictionary",
")",
"?",
"$",
"this",
"->",
"messages_dictionary",
"[",
"$",
"k... | Translates key-message to defined language using substitutional params
@param $key
@return mixed | [
"Translates",
"key",
"-",
"message",
"to",
"defined",
"language",
"using",
"substitutional",
"params"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1692-L1696 |
PHPAuth/PHPAuth | Auth.php | Auth.do_SendMail | public function do_SendMail($email, $type, $key)
{
$return = [
'error' => true
];
$mail = new PHPMailer();
// Check configuration for custom SMTP parameters
try {
// Server settings
if ($this->config->smtp) {
if ($this->co... | php | public function do_SendMail($email, $type, $key)
{
$return = [
'error' => true
];
$mail = new PHPMailer();
// Check configuration for custom SMTP parameters
try {
// Server settings
if ($this->config->smtp) {
if ($this->co... | [
"public",
"function",
"do_SendMail",
"(",
"$",
"email",
",",
"$",
"type",
",",
"$",
"key",
")",
"{",
"$",
"return",
"=",
"[",
"'error'",
"=>",
"true",
"]",
";",
"$",
"mail",
"=",
"new",
"PHPMailer",
"(",
")",
";",
"// Check configuration for custom SMTP ... | Send email via PHPMailer
@param $email
@param $type
@param $key
@return array $return (contains error code and error message) | [
"Send",
"email",
"via",
"PHPMailer"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1707-L1773 |
PHPAuth/PHPAuth | Auth.php | Auth.updateUser | public function updateUser($uid, $params)
{
$setParams = '';
if (is_array($params) && count($params) > 0) {
$setParams = implode(', ', array_map( function($key, $value){
return $key . ' = ?';
}, array_keys($params), $params ));
}
$query = "UP... | php | public function updateUser($uid, $params)
{
$setParams = '';
if (is_array($params) && count($params) > 0) {
$setParams = implode(', ', array_map( function($key, $value){
return $key . ' = ?';
}, array_keys($params), $params ));
}
$query = "UP... | [
"public",
"function",
"updateUser",
"(",
"$",
"uid",
",",
"$",
"params",
")",
"{",
"$",
"setParams",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"params",
")",
"&&",
"count",
"(",
"$",
"params",
")",
">",
"0",
")",
"{",
"$",
"setParams",
"="... | Update userinfo for user with given id = $uid
@param int $uid
@param array $params
@return array $return[error/message] | [
"Update",
"userinfo",
"for",
"user",
"with",
"given",
"id",
"=",
"$uid"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1781-L1807 |
PHPAuth/PHPAuth | Auth.php | Auth.getCurrentSessionUserInfo | public function getCurrentSessionUserInfo()
{
$ts = $this->config->table_sessions;
$tu = $this->config->table_users;
$query = "
SELECT {$ts}.uid, {$ts}.expiredate, {$ts}.ip, {$tu}.email, {$tu}.username
FROM {$ts}, {$tu}
WHERE hash = :hash AND {$ts}.uid = {$tu}.id";
$query = $... | php | public function getCurrentSessionUserInfo()
{
$ts = $this->config->table_sessions;
$tu = $this->config->table_users;
$query = "
SELECT {$ts}.uid, {$ts}.expiredate, {$ts}.ip, {$tu}.email, {$tu}.username
FROM {$ts}, {$tu}
WHERE hash = :hash AND {$ts}.uid = {$tu}.id";
$query = $... | [
"public",
"function",
"getCurrentSessionUserInfo",
"(",
")",
"{",
"$",
"ts",
"=",
"$",
"this",
"->",
"config",
"->",
"table_sessions",
";",
"$",
"tu",
"=",
"$",
"this",
"->",
"config",
"->",
"table_users",
";",
"$",
"query",
"=",
"\"\n\t\tSELECT {$ts}.uid, {... | Return current user sesssion info
@return bool|mixed | [
"Return",
"current",
"user",
"sesssion",
"info"
] | train | https://github.com/PHPAuth/PHPAuth/blob/a74fd70201d354ef0b1e9929df9a25a7e81331f3/Auth.php#L1824-L1844 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.register | public function register(array $credentials, $callback = null)
{
if ($callback !== null && ! $callback instanceof Closure && ! is_bool($callback)) {
throw new InvalidArgumentException('You must provide a closure or a boolean.');
}
$this->fireEvent('sentinel.registering', $creden... | php | public function register(array $credentials, $callback = null)
{
if ($callback !== null && ! $callback instanceof Closure && ! is_bool($callback)) {
throw new InvalidArgumentException('You must provide a closure or a boolean.');
}
$this->fireEvent('sentinel.registering', $creden... | [
"public",
"function",
"register",
"(",
"array",
"$",
"credentials",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"callback",
"!==",
"null",
"&&",
"!",
"$",
"callback",
"instanceof",
"Closure",
"&&",
"!",
"is_bool",
"(",
"$",
"callback",
... | Registers a user. You may provide a callback to occur before the user
is saved, or provide a true boolean as a shortcut to activation.
@param array $credentials
@param \Closure|bool $callback
@return \Cartalyst\Sentinel\Users\UserInterface|bool
@throws \InvalidArgumentException | [
"Registers",
"a",
"user",
".",
"You",
"may",
"provide",
"a",
"callback",
"to",
"occur",
"before",
"the",
"user",
"is",
"saved",
"or",
"provide",
"a",
"true",
"boolean",
"as",
"a",
"shortcut",
"to",
"activation",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L163-L188 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.activate | public function activate($user)
{
if (is_string($user) || is_array($user)) {
$users = $this->getUserRepository();
$method = 'findBy'.(is_string($user) ? 'Id' : 'Credentials');
$user = $users->{$method}($user);
}
if (! $user instanceof UserInterface) {
... | php | public function activate($user)
{
if (is_string($user) || is_array($user)) {
$users = $this->getUserRepository();
$method = 'findBy'.(is_string($user) ? 'Id' : 'Credentials');
$user = $users->{$method}($user);
}
if (! $user instanceof UserInterface) {
... | [
"public",
"function",
"activate",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"user",
")",
"||",
"is_array",
"(",
"$",
"user",
")",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"getUserRepository",
"(",
")",
";",
"$",
"method",... | Activates the given user.
@param mixed $user
@return bool
@throws \InvalidArgumentException | [
"Activates",
"the",
"given",
"user",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L208-L231 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.check | public function check()
{
if ($this->user !== null) {
return $this->user;
}
if (! $code = $this->persistences->check()) {
return false;
}
if (! $user = $this->persistences->findUserByPersistenceCode($code)) {
return false;
}
... | php | public function check()
{
if ($this->user !== null) {
return $this->user;
}
if (! $code = $this->persistences->check()) {
return false;
}
if (! $user = $this->persistences->findUserByPersistenceCode($code)) {
return false;
}
... | [
"public",
"function",
"check",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"user",
";",
"}",
"if",
"(",
"!",
"$",
"code",
"=",
"$",
"this",
"->",
"persistences",
"->",
"check",
"(",
... | Checks to see if a user is logged in.
@return \Cartalyst\Sentinel\Users\UserInterface|bool | [
"Checks",
"to",
"see",
"if",
"a",
"user",
"is",
"logged",
"in",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L238-L257 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.authenticate | public function authenticate($credentials, $remember = false, $login = true)
{
$response = $this->fireEvent('sentinel.authenticating', $credentials, true);
if ($response === false) {
return false;
}
if ($credentials instanceof UserInterface) {
$user = $crede... | php | public function authenticate($credentials, $remember = false, $login = true)
{
$response = $this->fireEvent('sentinel.authenticating', $credentials, true);
if ($response === false) {
return false;
}
if ($credentials instanceof UserInterface) {
$user = $crede... | [
"public",
"function",
"authenticate",
"(",
"$",
"credentials",
",",
"$",
"remember",
"=",
"false",
",",
"$",
"login",
"=",
"true",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"fireEvent",
"(",
"'sentinel.authenticating'",
",",
"$",
"credentials",
",... | Authenticates a user, with "remember" flag.
@param \Cartalyst\Sentinel\Users\UserInterface|array $credentials
@param bool $remember
@param bool $login
@return \Cartalyst\Sentinel\Users\UserInterface|bool | [
"Authenticates",
"a",
"user",
"with",
"remember",
"flag",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L289-L326 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.forceAuthenticate | public function forceAuthenticate($credentials, $remember = false)
{
return $this->bypassCheckpoints(function ($sentinel) use ($credentials, $remember) {
return $sentinel->authenticate($credentials, $remember);
});
} | php | public function forceAuthenticate($credentials, $remember = false)
{
return $this->bypassCheckpoints(function ($sentinel) use ($credentials, $remember) {
return $sentinel->authenticate($credentials, $remember);
});
} | [
"public",
"function",
"forceAuthenticate",
"(",
"$",
"credentials",
",",
"$",
"remember",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"bypassCheckpoints",
"(",
"function",
"(",
"$",
"sentinel",
")",
"use",
"(",
"$",
"credentials",
",",
"$",
"remem... | Forces an authentication to bypass checkpoints.
@param \Cartalyst\Sentinel\Users\UserInterface|array $credentials
@param bool $remember
@return \Cartalyst\Sentinel\Users\UserInterface|bool | [
"Forces",
"an",
"authentication",
"to",
"bypass",
"checkpoints",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L346-L351 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.basic | public function basic()
{
$credentials = $this->getRequestCredentials();
// We don't really want to add a throttling record for the
// first failed login attempt, which actually occurs when
// the user first hits a protected route.
if ($credentials === null) {
re... | php | public function basic()
{
$credentials = $this->getRequestCredentials();
// We don't really want to add a throttling record for the
// first failed login attempt, which actually occurs when
// the user first hits a protected route.
if ($credentials === null) {
re... | [
"public",
"function",
"basic",
"(",
")",
"{",
"$",
"credentials",
"=",
"$",
"this",
"->",
"getRequestCredentials",
"(",
")",
";",
"// We don't really want to add a throttling record for the",
"// first failed login attempt, which actually occurs when",
"// the user first hits a p... | Attempt to authenticate using HTTP Basic Auth.
@return mixed | [
"Attempt",
"to",
"authenticate",
"using",
"HTTP",
"Basic",
"Auth",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L380-L398 |
cartalyst/sentinel | src/Sentinel.php | Sentinel.getRequestCredentials | public function getRequestCredentials()
{
if ($this->requestCredentials === null) {
$this->requestCredentials = function () {
$credentials = [];
if (isset($_SERVER['PHP_AUTH_USER'])) {
$credentials['login'] = $_SERVER['PHP_AUTH_USER'];
... | php | public function getRequestCredentials()
{
if ($this->requestCredentials === null) {
$this->requestCredentials = function () {
$credentials = [];
if (isset($_SERVER['PHP_AUTH_USER'])) {
$credentials['login'] = $_SERVER['PHP_AUTH_USER'];
... | [
"public",
"function",
"getRequestCredentials",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"requestCredentials",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"requestCredentials",
"=",
"function",
"(",
")",
"{",
"$",
"credentials",
"=",
"[",
"]",
";",
"i... | Returns the request credentials.
@return array | [
"Returns",
"the",
"request",
"credentials",
"."
] | train | https://github.com/cartalyst/sentinel/blob/cc7796cdfde980655e30f9a1b6a822bcab3b8834/src/Sentinel.php#L405-L428 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.