repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
fisharebest/webtrees | app/Http/Controllers/Admin/FixLevel0MediaController.php | FixLevel0MediaController.fixLevel0MediaAction | public function fixLevel0MediaAction(ServerRequestInterface $request): ResponseInterface
{
$fact_id = $request->getParsedBody()['fact_id'];
$indi_xref = $request->getParsedBody()['indi_xref'];
$obje_xref = $request->getParsedBody()['obje_xref'];
$tree_id = (int) $request->getPars... | php | public function fixLevel0MediaAction(ServerRequestInterface $request): ResponseInterface
{
$fact_id = $request->getParsedBody()['fact_id'];
$indi_xref = $request->getParsedBody()['indi_xref'];
$obje_xref = $request->getParsedBody()['obje_xref'];
$tree_id = (int) $request->getPars... | [
"public",
"function",
"fixLevel0MediaAction",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"$",
"fact_id",
"=",
"$",
"request",
"->",
"getParsedBody",
"(",
")",
"[",
"'fact_id'",
"]",
";",
"$",
"indi_xref",
"=",
"$",
"requ... | Move a link to a media object from a level 0 record to a level 1 record.
@param ServerRequestInterface $request
@return ResponseInterface | [
"Move",
"a",
"link",
"to",
"a",
"media",
"object",
"from",
"a",
"level",
"0",
"record",
"to",
"a",
"level",
"1",
"record",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/FixLevel0MediaController.php#L57-L83 | train |
fisharebest/webtrees | app/Module/PedigreeMapModule.php | PedigreeMapModule.getSosaName | private function getSosaName(int $sosa): string
{
$path = '';
while ($sosa > 1) {
if ($sosa % 2 === 1) {
$path = 'mot' . $path;
} else {
$path = 'fat' . $path;
}
$sosa = intdiv($sosa, 2);
}
return Funct... | php | private function getSosaName(int $sosa): string
{
$path = '';
while ($sosa > 1) {
if ($sosa % 2 === 1) {
$path = 'mot' . $path;
} else {
$path = 'fat' . $path;
}
$sosa = intdiv($sosa, 2);
}
return Funct... | [
"private",
"function",
"getSosaName",
"(",
"int",
"$",
"sosa",
")",
":",
"string",
"{",
"$",
"path",
"=",
"''",
";",
"while",
"(",
"$",
"sosa",
">",
"1",
")",
"{",
"if",
"(",
"$",
"sosa",
"%",
"2",
"===",
"1",
")",
"{",
"$",
"path",
"=",
"'mo... | builds and returns sosa relationship name in the active language
@param int $sosa Sosa number
@return string | [
"builds",
"and",
"returns",
"sosa",
"relationship",
"name",
"in",
"the",
"active",
"language"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/PedigreeMapModule.php#L439-L453 | train |
fisharebest/webtrees | app/Functions/FunctionsPrint.php | FunctionsPrint.printFactNotes | public static function printFactNotes(Tree $tree, $factrec, $level): string
{
$data = '';
$previous_spos = 0;
$nlevel = $level + 1;
$ct = preg_match_all("/$level NOTE (.*)/", $factrec, $match, PREG_SET_ORDER);
for ($j = 0; $j < $ct; $j++) {
... | php | public static function printFactNotes(Tree $tree, $factrec, $level): string
{
$data = '';
$previous_spos = 0;
$nlevel = $level + 1;
$ct = preg_match_all("/$level NOTE (.*)/", $factrec, $match, PREG_SET_ORDER);
for ($j = 0; $j < $ct; $j++) {
... | [
"public",
"static",
"function",
"printFactNotes",
"(",
"Tree",
"$",
"tree",
",",
"$",
"factrec",
",",
"$",
"level",
")",
":",
"string",
"{",
"$",
"data",
"=",
"''",
";",
"$",
"previous_spos",
"=",
"0",
";",
"$",
"nlevel",
"=",
"$",
"level",
"+",
"1... | Print all of the notes in this fact record
@param Tree $tree
@param string $factrec The factrecord to print the notes from
@param int $level The level of the factrecord
@return string HTML | [
"Print",
"all",
"of",
"the",
"notes",
"in",
"this",
"fact",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsPrint.php#L104-L138 | train |
fisharebest/webtrees | app/Functions/FunctionsPrint.php | FunctionsPrint.helpLink | public static function helpLink($topic): string
{
return
'<a href="#" data-toggle="modal" data-target="#wt-ajax-modal" data-href="' . e(route('help-text', ['topic' => $topic])) . '" title="' . I18N::translate('Help') . '">' .
view('icons/help') .
'<span class="sr-only">' ... | php | public static function helpLink($topic): string
{
return
'<a href="#" data-toggle="modal" data-target="#wt-ajax-modal" data-href="' . e(route('help-text', ['topic' => $topic])) . '" title="' . I18N::translate('Help') . '">' .
view('icons/help') .
'<span class="sr-only">' ... | [
"public",
"static",
"function",
"helpLink",
"(",
"$",
"topic",
")",
":",
"string",
"{",
"return",
"'<a href=\"#\" data-toggle=\"modal\" data-target=\"#wt-ajax-modal\" data-href=\"'",
".",
"e",
"(",
"route",
"(",
"'help-text'",
",",
"[",
"'topic'",
"=>",
"$",
"topic",
... | Print a link for a popup help window.
@param string $topic
@return string | [
"Print",
"a",
"link",
"for",
"a",
"popup",
"help",
"window",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsPrint.php#L147-L154 | train |
fisharebest/webtrees | app/Functions/FunctionsPrint.php | FunctionsPrint.checkFactUnique | public static function checkFactUnique(array $uniquefacts, Collection $recfacts): array
{
foreach ($recfacts as $factarray) {
$fact = $factarray->getTag();
$key = array_search($fact, $uniquefacts, true);
if ($key !== false) {
unset($uniquefacts[$key]);
... | php | public static function checkFactUnique(array $uniquefacts, Collection $recfacts): array
{
foreach ($recfacts as $factarray) {
$fact = $factarray->getTag();
$key = array_search($fact, $uniquefacts, true);
if ($key !== false) {
unset($uniquefacts[$key]);
... | [
"public",
"static",
"function",
"checkFactUnique",
"(",
"array",
"$",
"uniquefacts",
",",
"Collection",
"$",
"recfacts",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"recfacts",
"as",
"$",
"factarray",
")",
"{",
"$",
"fact",
"=",
"$",
"factarray",
"->",
... | Check for facts that may exist only once for a certain record type.
If the fact already exists in the second array, delete it from the first one.
@param string[] $uniquefacts
@param Collection $recfacts
@return string[] | [
"Check",
"for",
"facts",
"that",
"may",
"exist",
"only",
"once",
"for",
"a",
"certain",
"record",
"type",
".",
"If",
"the",
"fact",
"already",
"exists",
"in",
"the",
"second",
"array",
"delete",
"it",
"from",
"the",
"first",
"one",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsPrint.php#L407-L419 | train |
fisharebest/webtrees | app/Http/Middleware/UseTheme.php | UseTheme.themes | private function themes(): Generator
{
$themes = $this->module_service->findByInterface(ModuleThemeInterface::class);
// Last theme used
yield $themes->get(Session::get('theme', ''));
// Default for tree
$tree = app(Tree::class);
if ($tree instanceof Tree) {
... | php | private function themes(): Generator
{
$themes = $this->module_service->findByInterface(ModuleThemeInterface::class);
// Last theme used
yield $themes->get(Session::get('theme', ''));
// Default for tree
$tree = app(Tree::class);
if ($tree instanceof Tree) {
... | [
"private",
"function",
"themes",
"(",
")",
":",
"Generator",
"{",
"$",
"themes",
"=",
"$",
"this",
"->",
"module_service",
"->",
"findByInterface",
"(",
"ModuleThemeInterface",
"::",
"class",
")",
";",
"// Last theme used",
"yield",
"$",
"themes",
"->",
"get",... | The theme can be chosen in various ways.
@return Generator | [
"The",
"theme",
"can",
"be",
"chosen",
"in",
"various",
"ways",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Middleware/UseTheme.php#L78-L97 | train |
fisharebest/webtrees | app/Services/MigrationService.php | MigrationService.updateSchema | public function updateSchema($namespace, $schema_name, $target_version): bool
{
try {
$current_version = (int) Site::getPreference($schema_name);
} catch (PDOException $ex) {
// During initial installation, the site_preference table won’t exist.
$current_version =... | php | public function updateSchema($namespace, $schema_name, $target_version): bool
{
try {
$current_version = (int) Site::getPreference($schema_name);
} catch (PDOException $ex) {
// During initial installation, the site_preference table won’t exist.
$current_version =... | [
"public",
"function",
"updateSchema",
"(",
"$",
"namespace",
",",
"$",
"schema_name",
",",
"$",
"target_version",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"current_version",
"=",
"(",
"int",
")",
"Site",
"::",
"getPreference",
"(",
"$",
"schema_name",
")",
... | Run a series of scripts to bring the database schema up to date.
@param string $namespace Where to find our MigrationXXX classes
@param string $schema_name Which schema to update.
@param int $target_version Updade to this version
@throws PDOException
@return bool Were any updates applied | [
"Run",
"a",
"series",
"of",
"scripts",
"to",
"bring",
"the",
"database",
"schema",
"up",
"to",
"date",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/MigrationService.php#L44-L67 | train |
fisharebest/webtrees | app/Services/MigrationService.php | MigrationService.seedDatabase | public function seedDatabase(): void
{
(new SeedSiteSettingTable())->run();
(new SeedUserTable())->run();
(new SeedGedcomTable())->run();
(new SeedGedcomSettingTable())->run();
(new SeedDefaultResnTable())->run();
} | php | public function seedDatabase(): void
{
(new SeedSiteSettingTable())->run();
(new SeedUserTable())->run();
(new SeedGedcomTable())->run();
(new SeedGedcomSettingTable())->run();
(new SeedDefaultResnTable())->run();
} | [
"public",
"function",
"seedDatabase",
"(",
")",
":",
"void",
"{",
"(",
"new",
"SeedSiteSettingTable",
"(",
")",
")",
"->",
"run",
"(",
")",
";",
"(",
"new",
"SeedUserTable",
"(",
")",
")",
"->",
"run",
"(",
")",
";",
"(",
"new",
"SeedGedcomTable",
"(... | Write default data to the database.
@return void | [
"Write",
"default",
"data",
"to",
"the",
"database",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/MigrationService.php#L74-L81 | train |
fisharebest/webtrees | app/Application.php | Application.dispatch | public function dispatch($object, string $method)
{
$reflector = new ReflectionMethod($object, $method);
$parameters = $this->makeParameters($reflector->getParameters());
return $reflector->invoke($object, ...$parameters);
} | php | public function dispatch($object, string $method)
{
$reflector = new ReflectionMethod($object, $method);
$parameters = $this->makeParameters($reflector->getParameters());
return $reflector->invoke($object, ...$parameters);
} | [
"public",
"function",
"dispatch",
"(",
"$",
"object",
",",
"string",
"$",
"method",
")",
"{",
"$",
"reflector",
"=",
"new",
"ReflectionMethod",
"(",
"$",
"object",
",",
"$",
"method",
")",
";",
"$",
"parameters",
"=",
"$",
"this",
"->",
"makeParameters",... | Call an object's method, injecting all its dependencies.
@param object $object
@param string $method
@return mixed | [
"Call",
"an",
"object",
"s",
"method",
"injecting",
"all",
"its",
"dependencies",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Application.php#L39-L46 | train |
fisharebest/webtrees | app/MediaFile.php | MediaFile.fileSizeKB | public function fileSizeKB(): string
{
$size = $this->fileSizeBytes();
$size = intdiv($size + 1023, 1024);
/* I18N: size of file in KB */
return I18N::translate('%s KB', I18N::number($size));
} | php | public function fileSizeKB(): string
{
$size = $this->fileSizeBytes();
$size = intdiv($size + 1023, 1024);
/* I18N: size of file in KB */
return I18N::translate('%s KB', I18N::number($size));
} | [
"public",
"function",
"fileSizeKB",
"(",
")",
":",
"string",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"fileSizeBytes",
"(",
")",
";",
"$",
"size",
"=",
"intdiv",
"(",
"$",
"size",
"+",
"1023",
",",
"1024",
")",
";",
"/* I18N: size of file in KB */",
"... | get the media file size in KB
@return string | [
"get",
"the",
"media",
"file",
"size",
"in",
"KB"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/MediaFile.php#L340-L347 | train |
fisharebest/webtrees | app/MediaFile.php | MediaFile.downloadUrl | public function downloadUrl(): string
{
return route('media-download', [
'xref' => $this->media->xref(),
'ged' => $this->media->tree()->name(),
'fact_id' => $this->fact_id,
]);
} | php | public function downloadUrl(): string
{
return route('media-download', [
'xref' => $this->media->xref(),
'ged' => $this->media->tree()->name(),
'fact_id' => $this->fact_id,
]);
} | [
"public",
"function",
"downloadUrl",
"(",
")",
":",
"string",
"{",
"return",
"route",
"(",
"'media-download'",
",",
"[",
"'xref'",
"=>",
"$",
"this",
"->",
"media",
"->",
"xref",
"(",
")",
",",
"'ged'",
"=>",
"$",
"this",
"->",
"media",
"->",
"tree",
... | Generate a URL to download a non-image media file.
@return string | [
"Generate",
"a",
"URL",
"to",
"download",
"a",
"non",
"-",
"image",
"media",
"file",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/MediaFile.php#L373-L380 | train |
fisharebest/webtrees | app/MediaFile.php | MediaFile.imageUrl | public function imageUrl($width, $height, $fit): string
{
// Sign the URL, to protect against mass-resize attacks.
$glide_key = Site::getPreference('glide-key');
if (empty($glide_key)) {
$glide_key = bin2hex(random_bytes(128));
Site::setPreference('glide-key', $glide_... | php | public function imageUrl($width, $height, $fit): string
{
// Sign the URL, to protect against mass-resize attacks.
$glide_key = Site::getPreference('glide-key');
if (empty($glide_key)) {
$glide_key = bin2hex(random_bytes(128));
Site::setPreference('glide-key', $glide_... | [
"public",
"function",
"imageUrl",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"fit",
")",
":",
"string",
"{",
"// Sign the URL, to protect against mass-resize attacks.",
"$",
"glide_key",
"=",
"Site",
"::",
"getPreference",
"(",
"'glide-key'",
")",
";",
"if... | Generate a URL for an image.
@param int $width Maximum width in pixels
@param int $height Maximum height in pixels
@param string $fit "crop" or "contain"
@return string | [
"Generate",
"a",
"URL",
"for",
"an",
"image",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/MediaFile.php#L391-L425 | train |
fisharebest/webtrees | app/Statistics.php | Statistics.getAllTagsTable | public function getAllTagsTable(): string
{
$examples = [];
foreach (get_class_methods($this) as $method) {
$reflection = new ReflectionMethod($this, $method);
if ($reflection->isPublic() && !in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->get... | php | public function getAllTagsTable(): string
{
$examples = [];
foreach (get_class_methods($this) as $method) {
$reflection = new ReflectionMethod($this, $method);
if ($reflection->isPublic() && !in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->get... | [
"public",
"function",
"getAllTagsTable",
"(",
")",
":",
"string",
"{",
"$",
"examples",
"=",
"[",
"]",
";",
"foreach",
"(",
"get_class_methods",
"(",
"$",
"this",
")",
"as",
"$",
"method",
")",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionMethod",
"(",... | Return a string of all supported tags and an example of its output in table row form.
@return string | [
"Return",
"a",
"string",
"of",
"all",
"supported",
"tags",
"and",
"an",
"example",
"of",
"its",
"output",
"in",
"table",
"row",
"form",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics.php#L229-L249 | train |
fisharebest/webtrees | app/Statistics.php | Statistics.getAllTagsText | public function getAllTagsText(): string
{
$examples = [];
foreach (get_class_methods($this) as $method) {
$reflection = new ReflectionMethod($this, $method);
if ($reflection->isPublic() && !in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->getR... | php | public function getAllTagsText(): string
{
$examples = [];
foreach (get_class_methods($this) as $method) {
$reflection = new ReflectionMethod($this, $method);
if ($reflection->isPublic() && !in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->getR... | [
"public",
"function",
"getAllTagsText",
"(",
")",
":",
"string",
"{",
"$",
"examples",
"=",
"[",
"]",
";",
"foreach",
"(",
"get_class_methods",
"(",
"$",
"this",
")",
"as",
"$",
"method",
")",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionMethod",
"(",
... | Return a string of all supported tags in plain text.
@return string | [
"Return",
"a",
"string",
"of",
"all",
"supported",
"tags",
"in",
"plain",
"text",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics.php#L256-L270 | train |
fisharebest/webtrees | app/Statistics.php | Statistics.getTags | private function getTags(string $text): array
{
$tags = [];
$matches = [];
preg_match_all('/#([^#]+)#/', $text, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$params = explode(':', $match[1]);
$method = array_shift($params);
if (m... | php | private function getTags(string $text): array
{
$tags = [];
$matches = [];
preg_match_all('/#([^#]+)#/', $text, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$params = explode(':', $match[1]);
$method = array_shift($params);
if (m... | [
"private",
"function",
"getTags",
"(",
"string",
"$",
"text",
")",
":",
"array",
"{",
"$",
"tags",
"=",
"[",
"]",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"'/#([^#]+)#/'",
",",
"$",
"text",
",",
"$",
"matches",
",",
"PREG_SET_O... | Get tags and their parsed results.
@param string $text
@return string[] | [
"Get",
"tags",
"and",
"their",
"parsed",
"results",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics.php#L279-L296 | train |
fisharebest/webtrees | app/Statistics.php | Statistics.embedTags | public function embedTags(string $text): string
{
if (strpos($text, '#') !== false) {
$text = strtr($text, $this->getTags($text));
}
return $text;
} | php | public function embedTags(string $text): string
{
if (strpos($text, '#') !== false) {
$text = strtr($text, $this->getTags($text));
}
return $text;
} | [
"public",
"function",
"embedTags",
"(",
"string",
"$",
"text",
")",
":",
"string",
"{",
"if",
"(",
"strpos",
"(",
"$",
"text",
",",
"'#'",
")",
"!==",
"false",
")",
"{",
"$",
"text",
"=",
"strtr",
"(",
"$",
"text",
",",
"$",
"this",
"->",
"getTag... | Embed tags in text
@param string $text
@return string | [
"Embed",
"tags",
"in",
"text"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics.php#L305-L312 | train |
fisharebest/webtrees | app/Module/RecentChangesModule.php | RecentChangesModule.getRecentChanges | private function getRecentChanges(Tree $tree, int $days): array
{
return DB::table('change')
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'accepted')
->where('new_gedcom', '<>', '')
->where('change_time', '>', Carbon::now()->subDays($days))
... | php | private function getRecentChanges(Tree $tree, int $days): array
{
return DB::table('change')
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'accepted')
->where('new_gedcom', '<>', '')
->where('change_time', '>', Carbon::now()->subDays($days))
... | [
"private",
"function",
"getRecentChanges",
"(",
"Tree",
"$",
"tree",
",",
"int",
"$",
"days",
")",
":",
"array",
"{",
"return",
"DB",
"::",
"table",
"(",
"'change'",
")",
"->",
"where",
"(",
"'gedcom_id'",
",",
"'='",
",",
"$",
"tree",
"->",
"id",
"(... | Find records that have changed since a given julian day
@param Tree $tree Changes for which tree
@param int $days Number of days
@return GedcomRecord[] List of records with changes | [
"Find",
"records",
"that",
"have",
"changed",
"since",
"a",
"given",
"julian",
"day"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/RecentChangesModule.php#L220-L236 | train |
fisharebest/webtrees | app/Http/Controllers/HelpTextController.php | HelpTextController.formatDates | private function formatDates(array $gedcom_dates): array
{
$dates = [];
foreach ($gedcom_dates as $gedcom_date) {
// PHP converts numeric array keys ('1900') to integers (1900), so reverse this.
$gedcom_date = (string) $gedcom_date;
$date = new Da... | php | private function formatDates(array $gedcom_dates): array
{
$dates = [];
foreach ($gedcom_dates as $gedcom_date) {
// PHP converts numeric array keys ('1900') to integers (1900), so reverse this.
$gedcom_date = (string) $gedcom_date;
$date = new Da... | [
"private",
"function",
"formatDates",
"(",
"array",
"$",
"gedcom_dates",
")",
":",
"array",
"{",
"$",
"dates",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"gedcom_dates",
"as",
"$",
"gedcom_date",
")",
"{",
"// PHP converts numeric array keys ('1900') to integers (19... | Format GEDCOM dates in the local language.
@param string[] $gedcom_dates
@return string[] | [
"Format",
"GEDCOM",
"dates",
"in",
"the",
"local",
"language",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/HelpTextController.php#L277-L290 | train |
fisharebest/webtrees | app/Module/UserMessagesModule.php | UserMessagesModule.postDeleteMessageAction | public function postDeleteMessageAction(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$message_ids = (array) $request->get('message_id', []);
DB::table('message')
->where('user_id', '=', Auth::id())
->whereIn('message_id', $message_ids)
->dele... | php | public function postDeleteMessageAction(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$message_ids = (array) $request->get('message_id', []);
DB::table('message')
->where('user_id', '=', Auth::id())
->whereIn('message_id', $message_ids)
->dele... | [
"public",
"function",
"postDeleteMessageAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"message_ids",
"=",
"(",
"array",
")",
"$",
"request",
"->",
"get",
"(",
"'message_id'",
",",
"["... | Delete one or messages belonging to a user.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Delete",
"one",
"or",
"messages",
"belonging",
"to",
"a",
"user",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/UserMessagesModule.php#L86-L102 | train |
fisharebest/webtrees | app/Module/AlbumModule.php | AlbumModule.getMedia | private function getMedia(Individual $individual): array
{
if ($this->media_list === null) {
// Use facts from this individual and all their spouses
$facts = $individual->facts();
foreach ($individual->spouseFamilies() as $family) {
foreach ($family->facts... | php | private function getMedia(Individual $individual): array
{
if ($this->media_list === null) {
// Use facts from this individual and all their spouses
$facts = $individual->facts();
foreach ($individual->spouseFamilies() as $family) {
foreach ($family->facts... | [
"private",
"function",
"getMedia",
"(",
"Individual",
"$",
"individual",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"media_list",
"===",
"null",
")",
"{",
"// Use facts from this individual and all their spouses",
"$",
"facts",
"=",
"$",
"individual",
... | Get all facts containing media links for this person and their spouse-family records
@param Individual $individual
@return Media[] | [
"Get",
"all",
"facts",
"containing",
"media",
"links",
"for",
"this",
"person",
"and",
"their",
"spouse",
"-",
"family",
"records"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/AlbumModule.php#L113-L150 | train |
fisharebest/webtrees | app/Module/StatisticsChartModule.php | StatisticsChartModule.axisMonths | private function axisMonths(): array
{
return [
'JAN' => I18N::translateContext('NOMINATIVE', 'January'),
'FEB' => I18N::translateContext('NOMINATIVE', 'February'),
'MAR' => I18N::translateContext('NOMINATIVE', 'March'),
'APR' => I18N::translateContext('NOMINA... | php | private function axisMonths(): array
{
return [
'JAN' => I18N::translateContext('NOMINATIVE', 'January'),
'FEB' => I18N::translateContext('NOMINATIVE', 'February'),
'MAR' => I18N::translateContext('NOMINATIVE', 'March'),
'APR' => I18N::translateContext('NOMINA... | [
"private",
"function",
"axisMonths",
"(",
")",
":",
"array",
"{",
"return",
"[",
"'JAN'",
"=>",
"I18N",
"::",
"translateContext",
"(",
"'NOMINATIVE'",
",",
"'January'",
")",
",",
"'FEB'",
"=>",
"I18N",
"::",
"translateContext",
"(",
"'NOMINATIVE'",
",",
"'Fe... | Labels for the X axis
@return string[] | [
"Labels",
"for",
"the",
"X",
"axis"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/StatisticsChartModule.php#L783-L799 | train |
fisharebest/webtrees | app/Module/StatisticsChartModule.php | StatisticsChartModule.axisYears | private function axisYears(string $boundaries_csv): array
{
$boundaries = explode(',', $boundaries_csv);
$axis = [];
foreach ($boundaries as $n => $boundary) {
if ($n === 0) {
$date = new Date('BEF ' . $boundary);
} else {
$date = new ... | php | private function axisYears(string $boundaries_csv): array
{
$boundaries = explode(',', $boundaries_csv);
$axis = [];
foreach ($boundaries as $n => $boundary) {
if ($n === 0) {
$date = new Date('BEF ' . $boundary);
} else {
$date = new ... | [
"private",
"function",
"axisYears",
"(",
"string",
"$",
"boundaries_csv",
")",
":",
"array",
"{",
"$",
"boundaries",
"=",
"explode",
"(",
"','",
",",
"$",
"boundaries_csv",
")",
";",
"$",
"axis",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"boundaries",
"... | Convert a list of N year-boundaries into N+1 year-ranges for the z-axis.
@param string $boundaries_csv
@return string[] | [
"Convert",
"a",
"list",
"of",
"N",
"year",
"-",
"boundaries",
"into",
"N",
"+",
"1",
"year",
"-",
"ranges",
"for",
"the",
"z",
"-",
"axis",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/StatisticsChartModule.php#L808-L826 | train |
fisharebest/webtrees | app/Module/StatisticsChartModule.php | StatisticsChartModule.fillYData | private function fillYData($x, $z, $value, array $x_axis, array $z_axis, array &$ydata): void
{
$x = $this->findAxisEntry($x, $x_axis);
$z = $this->findAxisEntry($z, $z_axis);
if (!array_key_exists($z, $z_axis)) {
foreach (array_keys($z_axis) as $key) {
if ($valu... | php | private function fillYData($x, $z, $value, array $x_axis, array $z_axis, array &$ydata): void
{
$x = $this->findAxisEntry($x, $x_axis);
$z = $this->findAxisEntry($z, $z_axis);
if (!array_key_exists($z, $z_axis)) {
foreach (array_keys($z_axis) as $key) {
if ($valu... | [
"private",
"function",
"fillYData",
"(",
"$",
"x",
",",
"$",
"z",
",",
"$",
"value",
",",
"array",
"$",
"x_axis",
",",
"array",
"$",
"z_axis",
",",
"array",
"&",
"$",
"ydata",
")",
":",
"void",
"{",
"$",
"x",
"=",
"$",
"this",
"->",
"findAxisEntr... | Calculate the Y axis.
@param int|string $x
@param int|string $z
@param int|string $value
@param array $x_axis
@param array $z_axis
@param int[][] $ydata
@return void | [
"Calculate",
"the",
"Y",
"axis",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/StatisticsChartModule.php#L878-L894 | train |
fisharebest/webtrees | app/Module/StatisticsChartModule.php | StatisticsChartModule.myPlot | private function myPlot(
string $chart_title,
array $x_axis,
string $x_axis_title,
array $ydata,
string $y_axis_title,
array $z_axis,
int $y_axis_type
): string {
if (!count($ydata)) {
return I18N::translate('This information is not availab... | php | private function myPlot(
string $chart_title,
array $x_axis,
string $x_axis_title,
array $ydata,
string $y_axis_title,
array $z_axis,
int $y_axis_type
): string {
if (!count($ydata)) {
return I18N::translate('This information is not availab... | [
"private",
"function",
"myPlot",
"(",
"string",
"$",
"chart_title",
",",
"array",
"$",
"x_axis",
",",
"string",
"$",
"x_axis_title",
",",
"array",
"$",
"ydata",
",",
"string",
"$",
"y_axis_title",
",",
"array",
"$",
"z_axis",
",",
"int",
"$",
"y_axis_type"... | Plot the data.
@param string $chart_title
@param string[] $x_axis
@param string $x_axis_title
@param int[][] $ydata
@param string $y_axis_title
@param string[] $z_axis
@param int $y_axis_type
@return string | [
"Plot",
"the",
"data",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/StatisticsChartModule.php#L937-L1033 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.updatePlaces | public static function updatePlaces(string $xref, Tree $tree, string $gedrec): void
{
preg_match_all('/^[2-9] PLAC (.+)/m', $gedrec, $matches);
$places = array_unique($matches[1]);
foreach ($places as $place_name) {
$place = new Place($place_name, $tree);
// Callin... | php | public static function updatePlaces(string $xref, Tree $tree, string $gedrec): void
{
preg_match_all('/^[2-9] PLAC (.+)/m', $gedrec, $matches);
$places = array_unique($matches[1]);
foreach ($places as $place_name) {
$place = new Place($place_name, $tree);
// Callin... | [
"public",
"static",
"function",
"updatePlaces",
"(",
"string",
"$",
"xref",
",",
"Tree",
"$",
"tree",
",",
"string",
"$",
"gedrec",
")",
":",
"void",
"{",
"preg_match_all",
"(",
"'/^[2-9] PLAC (.+)/m'",
",",
"$",
"gedrec",
",",
"$",
"matches",
")",
";",
... | Extract all level 2 places from the given record and insert them into the places table
@param string $xref
@param Tree $tree
@param string $gedrec
@return void | [
"Extract",
"all",
"level",
"2",
"places",
"from",
"the",
"given",
"record",
"and",
"insert",
"them",
"into",
"the",
"places",
"table"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L813-L839 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.updateDates | public static function updateDates($xref, $ged_id, $gedrec): void
{
if (strpos($gedrec, '2 DATE ') && preg_match_all("/\n1 (\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/", $gedrec, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$fact = $match[1];
... | php | public static function updateDates($xref, $ged_id, $gedrec): void
{
if (strpos($gedrec, '2 DATE ') && preg_match_all("/\n1 (\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/", $gedrec, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$fact = $match[1];
... | [
"public",
"static",
"function",
"updateDates",
"(",
"$",
"xref",
",",
"$",
"ged_id",
",",
"$",
"gedrec",
")",
":",
"void",
"{",
"if",
"(",
"strpos",
"(",
"$",
"gedrec",
",",
"'2 DATE '",
")",
"&&",
"preg_match_all",
"(",
"\"/\\n1 (\\w+).*(?:\\n[2-9].*)*(?:\\... | Extract all the dates from the given record and insert them into the database.
@param string $xref
@param int $ged_id
@param string $gedrec
@return void | [
"Extract",
"all",
"the",
"dates",
"from",
"the",
"given",
"record",
"and",
"insert",
"them",
"into",
"the",
"database",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L850-L888 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.updateLinks | public static function updateLinks($xref, $ged_id, $gedrec): void
{
if (preg_match_all('/^\d+ (' . Gedcom::REGEX_TAG . ') @(' . Gedcom::REGEX_XREF . ')@/m', $gedrec, $matches, PREG_SET_ORDER)) {
$data = [];
foreach ($matches as $match) {
// Include each link once only... | php | public static function updateLinks($xref, $ged_id, $gedrec): void
{
if (preg_match_all('/^\d+ (' . Gedcom::REGEX_TAG . ') @(' . Gedcom::REGEX_XREF . ')@/m', $gedrec, $matches, PREG_SET_ORDER)) {
$data = [];
foreach ($matches as $match) {
// Include each link once only... | [
"public",
"static",
"function",
"updateLinks",
"(",
"$",
"xref",
",",
"$",
"ged_id",
",",
"$",
"gedrec",
")",
":",
"void",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/^\\d+ ('",
".",
"Gedcom",
"::",
"REGEX_TAG",
".",
"') @('",
".",
"Gedcom",
"::",
"REGEX_X... | Extract all the links from the given record and insert them into the database
@param string $xref
@param int $ged_id
@param string $gedrec
@return void | [
"Extract",
"all",
"the",
"links",
"from",
"the",
"given",
"record",
"and",
"insert",
"them",
"into",
"the",
"database"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L899-L920 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.updateNames | public static function updateNames($xref, $ged_id, GedcomRecord $record): void
{
foreach ($record->getAllNames() as $n => $name) {
if ($record instanceof Individual) {
if ($name['givn'] === '@P.N.') {
$soundex_givn_std = null;
$soundex_givn... | php | public static function updateNames($xref, $ged_id, GedcomRecord $record): void
{
foreach ($record->getAllNames() as $n => $name) {
if ($record instanceof Individual) {
if ($name['givn'] === '@P.N.') {
$soundex_givn_std = null;
$soundex_givn... | [
"public",
"static",
"function",
"updateNames",
"(",
"$",
"xref",
",",
"$",
"ged_id",
",",
"GedcomRecord",
"$",
"record",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"record",
"->",
"getAllNames",
"(",
")",
"as",
"$",
"n",
"=>",
"$",
"name",
")",
"{",... | Extract all the names from the given record and insert them into the database.
@param string $xref
@param int $ged_id
@param GedcomRecord $record
@return void | [
"Extract",
"all",
"the",
"names",
"from",
"the",
"given",
"record",
"and",
"insert",
"them",
"into",
"the",
"database",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L931-L975 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.convertInlineMedia | public static function convertInlineMedia(Tree $tree, $gedrec): string
{
while (preg_match('/\n1 OBJE(?:\n[2-9].+)+/', $gedrec, $match)) {
$gedrec = str_replace($match[0], self::createMediaObject(1, $match[0], $tree), $gedrec);
}
while (preg_match('/\n2 OBJE(?:\n[3-9].+)+/', $ged... | php | public static function convertInlineMedia(Tree $tree, $gedrec): string
{
while (preg_match('/\n1 OBJE(?:\n[2-9].+)+/', $gedrec, $match)) {
$gedrec = str_replace($match[0], self::createMediaObject(1, $match[0], $tree), $gedrec);
}
while (preg_match('/\n2 OBJE(?:\n[3-9].+)+/', $ged... | [
"public",
"static",
"function",
"convertInlineMedia",
"(",
"Tree",
"$",
"tree",
",",
"$",
"gedrec",
")",
":",
"string",
"{",
"while",
"(",
"preg_match",
"(",
"'/\\n1 OBJE(?:\\n[2-9].+)+/'",
",",
"$",
"gedrec",
",",
"$",
"match",
")",
")",
"{",
"$",
"gedrec... | Extract inline media data, and convert to media objects.
@param Tree $tree
@param string $gedrec
@return string | [
"Extract",
"inline",
"media",
"data",
"and",
"convert",
"to",
"media",
"objects",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L985-L998 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.createMediaObject | public static function createMediaObject($level, $gedrec, Tree $tree): string
{
if (preg_match('/\n\d FILE (.+)/', $gedrec, $file_match)) {
$file = $file_match[1];
} else {
$file = '';
}
if (preg_match('/\n\d TITL (.+)/', $gedrec, $file_match)) {
... | php | public static function createMediaObject($level, $gedrec, Tree $tree): string
{
if (preg_match('/\n\d FILE (.+)/', $gedrec, $file_match)) {
$file = $file_match[1];
} else {
$file = '';
}
if (preg_match('/\n\d TITL (.+)/', $gedrec, $file_match)) {
... | [
"public",
"static",
"function",
"createMediaObject",
"(",
"$",
"level",
",",
"$",
"gedrec",
",",
"Tree",
"$",
"tree",
")",
":",
"string",
"{",
"if",
"(",
"preg_match",
"(",
"'/\\n\\d FILE (.+)/'",
",",
"$",
"gedrec",
",",
"$",
"file_match",
")",
")",
"{"... | Create a new media object, from inline media data.
@param int $level
@param string $gedrec
@param Tree $tree
@return string | [
"Create",
"a",
"new",
"media",
"object",
"from",
"inline",
"media",
"data",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L1009-L1070 | train |
fisharebest/webtrees | app/Functions/FunctionsImport.php | FunctionsImport.acceptAllChanges | public static function acceptAllChanges($xref, Tree $tree): void
{
$changes = DB::table('change')
->join('gedcom', 'change.gedcom_id', '=', 'gedcom.gedcom_id')
->where('status', '=', 'pending')
->where('xref', '=', $xref)
->where('gedcom.gedcom_id', '=', $tree... | php | public static function acceptAllChanges($xref, Tree $tree): void
{
$changes = DB::table('change')
->join('gedcom', 'change.gedcom_id', '=', 'gedcom.gedcom_id')
->where('status', '=', 'pending')
->where('xref', '=', $xref)
->where('gedcom.gedcom_id', '=', $tree... | [
"public",
"static",
"function",
"acceptAllChanges",
"(",
"$",
"xref",
",",
"Tree",
"$",
"tree",
")",
":",
"void",
"{",
"$",
"changes",
"=",
"DB",
"::",
"table",
"(",
"'change'",
")",
"->",
"join",
"(",
"'gedcom'",
",",
"'change.gedcom_id'",
",",
"'='",
... | Accept all pending changes for a specified record.
@param string $xref
@param Tree $tree
@return void | [
"Accept",
"all",
"pending",
"changes",
"for",
"a",
"specified",
"record",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsImport.php#L1080-L1106 | train |
fisharebest/webtrees | app/Http/Controllers/NoteController.php | NoteController.show | public function show(ServerRequestInterface $request, Tree $tree, ClipboardService $clipboard_service): ResponseInterface
{
$xref = $request->get('xref', '');
$record = Note::getInstance($xref, $tree);
Auth::checkNoteAccess($record, false);
return $this->viewResponse('note-page',... | php | public function show(ServerRequestInterface $request, Tree $tree, ClipboardService $clipboard_service): ResponseInterface
{
$xref = $request->get('xref', '');
$record = Note::getInstance($xref, $tree);
Auth::checkNoteAccess($record, false);
return $this->viewResponse('note-page',... | [
"public",
"function",
"show",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
",",
"ClipboardService",
"$",
"clipboard_service",
")",
":",
"ResponseInterface",
"{",
"$",
"xref",
"=",
"$",
"request",
"->",
"get",
"(",
"'xref'",
",",
"... | Show a note's page.
@param ServerRequestInterface $request
@param Tree $tree
@param ClipboardService $clipboard_service
@return ResponseInterface | [
"Show",
"a",
"note",
"s",
"page",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/NoteController.php#L44-L64 | train |
fisharebest/webtrees | app/Module/GoogleAnalyticsModule.php | GoogleAnalyticsModule.analyticsSnippet | public function analyticsSnippet(array $parameters): string
{
// Add extra dimensions (i.e. filtering categories)
$tree = app(Tree::class);
$user = app(UserInterface::class);
$parameters['dimensions'] = (object) [
'dimension1' => $tree instanceof Tree ? $tree->name() : '... | php | public function analyticsSnippet(array $parameters): string
{
// Add extra dimensions (i.e. filtering categories)
$tree = app(Tree::class);
$user = app(UserInterface::class);
$parameters['dimensions'] = (object) [
'dimension1' => $tree instanceof Tree ? $tree->name() : '... | [
"public",
"function",
"analyticsSnippet",
"(",
"array",
"$",
"parameters",
")",
":",
"string",
"{",
"// Add extra dimensions (i.e. filtering categories)",
"$",
"tree",
"=",
"app",
"(",
"Tree",
"::",
"class",
")",
";",
"$",
"user",
"=",
"app",
"(",
"UserInterface... | Embed placeholders in the snippet.
@param string[] $parameters
@return string | [
"Embed",
"placeholders",
"in",
"the",
"snippet",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/GoogleAnalyticsModule.php#L93-L105 | train |
fisharebest/webtrees | app/GedcomCode/GedcomCodeStat.php | GedcomCodeStat.statusName | public static function statusName(string $status_code): string
{
switch ($status_code) {
case 'BIC':
/* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */
return I18N::translate('Born in the covenant');
case 'CANC... | php | public static function statusName(string $status_code): string
{
switch ($status_code) {
case 'BIC':
/* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */
return I18N::translate('Born in the covenant');
case 'CANC... | [
"public",
"static",
"function",
"statusName",
"(",
"string",
"$",
"status_code",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"status_code",
")",
"{",
"case",
"'BIC'",
":",
"/* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */",
"re... | Get the localized name for a status code
@param string $status_code
@return string | [
"Get",
"the",
"localized",
"name",
"for",
"a",
"status",
"code"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomCode/GedcomCodeStat.php#L98-L144 | train |
fisharebest/webtrees | app/GedcomCode/GedcomCodeStat.php | GedcomCodeStat.statusNames | public static function statusNames(string $tag): array
{
$status_names = [];
foreach (self::statusCodes($tag) as $status_code) {
$status_names[$status_code] = self::statusName($status_code);
}
uasort($status_names, '\Fisharebest\Webtrees\I18N::strcasecmp');
retur... | php | public static function statusNames(string $tag): array
{
$status_names = [];
foreach (self::statusCodes($tag) as $status_code) {
$status_names[$status_code] = self::statusName($status_code);
}
uasort($status_names, '\Fisharebest\Webtrees\I18N::strcasecmp');
retur... | [
"public",
"static",
"function",
"statusNames",
"(",
"string",
"$",
"tag",
")",
":",
"array",
"{",
"$",
"status_names",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"statusCodes",
"(",
"$",
"tag",
")",
"as",
"$",
"status_code",
")",
"{",
"$",
"st... | A sorted list of all status names, for a given GEDCOM tag
@param string $tag
@return string[] | [
"A",
"sorted",
"list",
"of",
"all",
"status",
"names",
"for",
"a",
"given",
"GEDCOM",
"tag"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomCode/GedcomCodeStat.php#L153-L162 | train |
fisharebest/webtrees | app/Http/Controllers/AbstractEditController.php | AbstractEditController.addNewFact | protected function addNewFact(ServerRequestInterface $request, Tree $tree, $fact): string
{
$FACT = $request->get($fact, '');
$DATE = $request->get($fact . '_DATE', '');
$PLAC = $request->get($fact . '_PLAC', '');
if ($DATE !== '' || $PLAC !== '' || $FACT !== '' && $FACT !== 'Y') {
... | php | protected function addNewFact(ServerRequestInterface $request, Tree $tree, $fact): string
{
$FACT = $request->get($fact, '');
$DATE = $request->get($fact . '_DATE', '');
$PLAC = $request->get($fact . '_PLAC', '');
if ($DATE !== '' || $PLAC !== '' || $FACT !== '' && $FACT !== 'Y') {
... | [
"protected",
"function",
"addNewFact",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
",",
"$",
"fact",
")",
":",
"string",
"{",
"$",
"FACT",
"=",
"$",
"request",
"->",
"get",
"(",
"$",
"fact",
",",
"''",
")",
";",
"$",
"DAT... | Create a form to add a new fact.
@param ServerRequestInterface $request
@param Tree $tree
@param string $fact
@return string | [
"Create",
"a",
"form",
"to",
"add",
"a",
"new",
"fact",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/AbstractEditController.php#L271-L318 | train |
fisharebest/webtrees | app/Http/Controllers/AbstractEditController.php | AbstractEditController.addNewName | protected function addNewName(ServerRequestInterface $request, Tree $tree): string
{
$gedrec = "\n1 NAME " . $request->get('NAME', '');
$tags = [
'NPFX',
'GIVN',
'SPFX',
'SURN',
'NSFX',
];
if (preg_match_all('/(' . Gedcom:... | php | protected function addNewName(ServerRequestInterface $request, Tree $tree): string
{
$gedrec = "\n1 NAME " . $request->get('NAME', '');
$tags = [
'NPFX',
'GIVN',
'SPFX',
'SURN',
'NSFX',
];
if (preg_match_all('/(' . Gedcom:... | [
"protected",
"function",
"addNewName",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"string",
"{",
"$",
"gedrec",
"=",
"\"\\n1 NAME \"",
".",
"$",
"request",
"->",
"get",
"(",
"'NAME'",
",",
"''",
")",
";",
"$",
"tag... | Assemble the pieces of a newly created record into gedcom
@param ServerRequestInterface $request
@param Tree $tree
@return string | [
"Assemble",
"the",
"pieces",
"of",
"a",
"newly",
"created",
"record",
"into",
"gedcom"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/AbstractEditController.php#L385-L415 | train |
fisharebest/webtrees | app/Http/RequestHandlers/ModuleAction.php | ModuleAction.handle | public function handle(ServerRequestInterface $request): ResponseInterface
{
$module_name = $request->getQueryParams()['module'] ?? $request->getParsedBody()['module'] ?? '';
$action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? '';
// Check that the ... | php | public function handle(ServerRequestInterface $request): ResponseInterface
{
$module_name = $request->getQueryParams()['module'] ?? $request->getParsedBody()['module'] ?? '';
$action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? '';
// Check that the ... | [
"public",
"function",
"handle",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"$",
"module_name",
"=",
"$",
"request",
"->",
"getQueryParams",
"(",
")",
"[",
"'module'",
"]",
"??",
"$",
"request",
"->",
"getParsedBody",
"("... | Perform an HTTP action for one of the modules.
@param ServerRequestInterface $request
@return ResponseInterface | [
"Perform",
"an",
"HTTP",
"action",
"for",
"one",
"of",
"the",
"modules",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/RequestHandlers/ModuleAction.php#L63-L91 | train |
fisharebest/webtrees | app/Module/MediaTabModule.php | MediaTabModule.getFactsWithMedia | private function getFactsWithMedia(Individual $individual): Collection
{
if ($this->facts === null) {
$facts = $individual->facts();
foreach ($individual->spouseFamilies() as $family) {
if ($family->canShow()) {
foreach ($family->facts() as $fact) ... | php | private function getFactsWithMedia(Individual $individual): Collection
{
if ($this->facts === null) {
$facts = $individual->facts();
foreach ($individual->spouseFamilies() as $family) {
if ($family->canShow()) {
foreach ($family->facts() as $fact) ... | [
"private",
"function",
"getFactsWithMedia",
"(",
"Individual",
"$",
"individual",
")",
":",
"Collection",
"{",
"if",
"(",
"$",
"this",
"->",
"facts",
"===",
"null",
")",
"{",
"$",
"facts",
"=",
"$",
"individual",
"->",
"facts",
"(",
")",
";",
"foreach",
... | Get all the facts for an individual which contain media objects.
@param Individual $individual
@return Collection
@return Fact[] | [
"Get",
"all",
"the",
"facts",
"for",
"an",
"individual",
"which",
"contain",
"media",
"objects",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/MediaTabModule.php#L113-L136 | train |
fisharebest/webtrees | app/Census/AbstractCensusColumn.php | AbstractCensusColumn.father | public function father(Individual $individual): ?Individual
{
$family = $individual->primaryChildFamily();
if ($family) {
return $family->husband();
}
return null;
} | php | public function father(Individual $individual): ?Individual
{
$family = $individual->primaryChildFamily();
if ($family) {
return $family->husband();
}
return null;
} | [
"public",
"function",
"father",
"(",
"Individual",
"$",
"individual",
")",
":",
"?",
"Individual",
"{",
"$",
"family",
"=",
"$",
"individual",
"->",
"primaryChildFamily",
"(",
")",
";",
"if",
"(",
"$",
"family",
")",
"{",
"return",
"$",
"family",
"->",
... | Find the father of an individual
@param Individual $individual
@return Individual|null | [
"Find",
"the",
"father",
"of",
"an",
"individual"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/AbstractCensusColumn.php#L69-L78 | train |
fisharebest/webtrees | app/Census/AbstractCensusColumn.php | AbstractCensusColumn.mother | public function mother(Individual $individual): ?Individual
{
$family = $individual->primaryChildFamily();
if ($family) {
return $family->wife();
}
return null;
} | php | public function mother(Individual $individual): ?Individual
{
$family = $individual->primaryChildFamily();
if ($family) {
return $family->wife();
}
return null;
} | [
"public",
"function",
"mother",
"(",
"Individual",
"$",
"individual",
")",
":",
"?",
"Individual",
"{",
"$",
"family",
"=",
"$",
"individual",
"->",
"primaryChildFamily",
"(",
")",
";",
"if",
"(",
"$",
"family",
")",
"{",
"return",
"$",
"family",
"->",
... | Find the mother of an individual
@param Individual $individual
@return Individual|null | [
"Find",
"the",
"mother",
"of",
"an",
"individual"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/AbstractCensusColumn.php#L87-L96 | train |
fisharebest/webtrees | app/Census/AbstractCensusColumn.php | AbstractCensusColumn.spouseFamily | public function spouseFamily(Individual $individual): ?Family
{
// Exclude families that were created after this census date
$families = [];
foreach ($individual->spouseFamilies() as $family) {
if (Date::compare($family->getMarriageDate(), $this->date()) <= 0) {
$... | php | public function spouseFamily(Individual $individual): ?Family
{
// Exclude families that were created after this census date
$families = [];
foreach ($individual->spouseFamilies() as $family) {
if (Date::compare($family->getMarriageDate(), $this->date()) <= 0) {
$... | [
"public",
"function",
"spouseFamily",
"(",
"Individual",
"$",
"individual",
")",
":",
"?",
"Family",
"{",
"// Exclude families that were created after this census date",
"$",
"families",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"individual",
"->",
"spouseFamilies",
... | Find the current spouse family of an individual
@param Individual $individual
@return Family|null | [
"Find",
"the",
"current",
"spouse",
"family",
"of",
"an",
"individual"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/AbstractCensusColumn.php#L105-L124 | train |
fisharebest/webtrees | app/Census/AbstractCensusColumn.php | AbstractCensusColumn.notCountry | protected function notCountry(string $place): string
{
$parts = explode(', ', $place);
if (end($parts) === $this->place()) {
return implode(', ', array_slice($parts, 0, -1));
}
return $place;
} | php | protected function notCountry(string $place): string
{
$parts = explode(', ', $place);
if (end($parts) === $this->place()) {
return implode(', ', array_slice($parts, 0, -1));
}
return $place;
} | [
"protected",
"function",
"notCountry",
"(",
"string",
"$",
"place",
")",
":",
"string",
"{",
"$",
"parts",
"=",
"explode",
"(",
"', '",
",",
"$",
"place",
")",
";",
"if",
"(",
"end",
"(",
"$",
"parts",
")",
"===",
"$",
"this",
"->",
"place",
"(",
... | Remove the country of a place name, where it is the same as the census place
@param string $place - e.g. "London, England"
@return string - e.g. "London" (for census of England) and "London, England" elsewhere | [
"Remove",
"the",
"country",
"of",
"a",
"place",
"name",
"where",
"it",
"is",
"the",
"same",
"as",
"the",
"census",
"place"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/AbstractCensusColumn.php#L167-L176 | train |
fisharebest/webtrees | app/Services/LocalizationService.php | LocalizationService.alphabet | public function alphabet(): array
{
$locale = $this->locale->languageTag();
$script = $this->locale->script()->code();
return self::ALPHABETS_FOR_LOCALE[$locale] ?? self::ALPHABETS_FOR_SCRIPT[$script] ?? self::LATIN_ALPHABET;
} | php | public function alphabet(): array
{
$locale = $this->locale->languageTag();
$script = $this->locale->script()->code();
return self::ALPHABETS_FOR_LOCALE[$locale] ?? self::ALPHABETS_FOR_SCRIPT[$script] ?? self::LATIN_ALPHABET;
} | [
"public",
"function",
"alphabet",
"(",
")",
":",
"array",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"locale",
"->",
"languageTag",
"(",
")",
";",
"$",
"script",
"=",
"$",
"this",
"->",
"locale",
"->",
"script",
"(",
")",
"->",
"code",
"(",
")",
... | Which alphabet is used in a locale?
@return array | [
"Which",
"alphabet",
"is",
"used",
"in",
"a",
"locale?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/LocalizationService.php#L112-L118 | train |
fisharebest/webtrees | app/Services/LocalizationService.php | LocalizationService.calendar | public function calendar(): CalendarInterface
{
$non_gregorian_calendars = [
'ar' => new ArabicCalendar(),
'fa' => new PersianCalendar(),
'he' => new JewishCalendar(),
'yi' => new JewishCalendar(),
];
return $non_gregorian_calendars[$this->loc... | php | public function calendar(): CalendarInterface
{
$non_gregorian_calendars = [
'ar' => new ArabicCalendar(),
'fa' => new PersianCalendar(),
'he' => new JewishCalendar(),
'yi' => new JewishCalendar(),
];
return $non_gregorian_calendars[$this->loc... | [
"public",
"function",
"calendar",
"(",
")",
":",
"CalendarInterface",
"{",
"$",
"non_gregorian_calendars",
"=",
"[",
"'ar'",
"=>",
"new",
"ArabicCalendar",
"(",
")",
",",
"'fa'",
"=>",
"new",
"PersianCalendar",
"(",
")",
",",
"'he'",
"=>",
"new",
"JewishCale... | Which calendar is used in a locale?
@return CalendarInterface | [
"Which",
"calendar",
"is",
"used",
"in",
"a",
"locale?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/LocalizationService.php#L125-L135 | train |
fisharebest/webtrees | app/Http/Controllers/Auth/LoginController.php | LoginController.loginPage | public function loginPage(ServerRequestInterface $request, ?Tree $tree): ResponseInterface
{
// Already logged in?
if (Auth::check()) {
$ged = $tree !== null ? $tree->name() : '';
return redirect(route('user-page', ['ged' => $ged]));
}
$error = $request->... | php | public function loginPage(ServerRequestInterface $request, ?Tree $tree): ResponseInterface
{
// Already logged in?
if (Auth::check()) {
$ged = $tree !== null ? $tree->name() : '';
return redirect(route('user-page', ['ged' => $ged]));
}
$error = $request->... | [
"public",
"function",
"loginPage",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"?",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"// Already logged in?",
"if",
"(",
"Auth",
"::",
"check",
"(",
")",
")",
"{",
"$",
"ged",
"=",
"$",
"tree"... | Show a login page.
@param ServerRequestInterface $request
@param Tree|null $tree
@return ResponseInterface | [
"Show",
"a",
"login",
"page",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Auth/LoginController.php#L64-L109 | train |
fisharebest/webtrees | app/Http/Controllers/Auth/LoginController.php | LoginController.loginAction | public function loginAction(ServerRequestInterface $request, UpgradeService $upgrade_service): ResponseInterface
{
$username = $request->get('username', '');
$password = $request->get('password', '');
$url = $request->get('url', '');
try {
$this->doLogin($username, ... | php | public function loginAction(ServerRequestInterface $request, UpgradeService $upgrade_service): ResponseInterface
{
$username = $request->get('username', '');
$password = $request->get('password', '');
$url = $request->get('url', '');
try {
$this->doLogin($username, ... | [
"public",
"function",
"loginAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"UpgradeService",
"$",
"upgrade_service",
")",
":",
"ResponseInterface",
"{",
"$",
"username",
"=",
"$",
"request",
"->",
"get",
"(",
"'username'",
",",
"''",
")",
";",
"$... | Perform a login.
@param ServerRequestInterface $request
@param UpgradeService $upgrade_service
@return ResponseInterface | [
"Perform",
"a",
"login",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Auth/LoginController.php#L119-L153 | train |
fisharebest/webtrees | app/Http/Controllers/Auth/LoginController.php | LoginController.doLogin | private function doLogin(string $username, string $password): void
{
if (!$_COOKIE) {
Log::addAuthenticationLog('Login failed (no session cookies): ' . $username);
throw new Exception(I18N::translate('You cannot sign in because your browser does not accept cookies.'));
}
... | php | private function doLogin(string $username, string $password): void
{
if (!$_COOKIE) {
Log::addAuthenticationLog('Login failed (no session cookies): ' . $username);
throw new Exception(I18N::translate('You cannot sign in because your browser does not accept cookies.'));
}
... | [
"private",
"function",
"doLogin",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"password",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"_COOKIE",
")",
"{",
"Log",
"::",
"addAuthenticationLog",
"(",
"'Login failed (no session cookies): '",
".",
"$",
"u... | Log in, if we can. Throw an exception, if we can't.
@param string $username
@param string $password
@return void
@throws Exception | [
"Log",
"in",
"if",
"we",
"can",
".",
"Throw",
"an",
"exception",
"if",
"we",
"can",
"t",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Auth/LoginController.php#L164-L200 | train |
fisharebest/webtrees | app/Http/Controllers/Auth/LoginController.php | LoginController.logoutAction | public function logoutAction(Tree $tree = null): ResponseInterface
{
if (Auth::check()) {
Log::addAuthenticationLog('Logout: ' . Auth::user()->userName() . '/' . Auth::user()->realName());
Auth::logout();
FlashMessages::addMessage(I18N::translate('You have signed out.'), ... | php | public function logoutAction(Tree $tree = null): ResponseInterface
{
if (Auth::check()) {
Log::addAuthenticationLog('Logout: ' . Auth::user()->userName() . '/' . Auth::user()->realName());
Auth::logout();
FlashMessages::addMessage(I18N::translate('You have signed out.'), ... | [
"public",
"function",
"logoutAction",
"(",
"Tree",
"$",
"tree",
"=",
"null",
")",
":",
"ResponseInterface",
"{",
"if",
"(",
"Auth",
"::",
"check",
"(",
")",
")",
"{",
"Log",
"::",
"addAuthenticationLog",
"(",
"'Logout: '",
".",
"Auth",
"::",
"user",
"(",... | Perform a logout.
@param Tree|null $tree
@return ResponseInterface | [
"Perform",
"a",
"logout",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Auth/LoginController.php#L209-L222 | train |
fisharebest/webtrees | app/Services/ChartService.php | ChartService.sosaStradonitzAncestors | public function sosaStradonitzAncestors(Individual $individual, int $generations): Collection
{
$ancestors = [1 => $individual];
$queue = [1];
$max = 2 ** ($generations - 1);
while (!empty($queue)) {
$sosa_stradonitz_number = array_shift($queue);
if ($sosa... | php | public function sosaStradonitzAncestors(Individual $individual, int $generations): Collection
{
$ancestors = [1 => $individual];
$queue = [1];
$max = 2 ** ($generations - 1);
while (!empty($queue)) {
$sosa_stradonitz_number = array_shift($queue);
if ($sosa... | [
"public",
"function",
"sosaStradonitzAncestors",
"(",
"Individual",
"$",
"individual",
",",
"int",
"$",
"generations",
")",
":",
"Collection",
"{",
"$",
"ancestors",
"=",
"[",
"1",
"=>",
"$",
"individual",
"]",
";",
"$",
"queue",
"=",
"[",
"1",
"]",
";",... | Find the ancestors of an individual, indexed by their Sosa-Stradonitz number.
@param Individual $individual Start with this individual
@param int $generations Fetch this number of generations
@return Collection
@return Individual[] | [
"Find",
"the",
"ancestors",
"of",
"an",
"individual",
"indexed",
"by",
"their",
"Sosa",
"-",
"Stradonitz",
"number",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/ChartService.php#L38-L69 | train |
fisharebest/webtrees | app/Services/ChartService.php | ChartService.descendants | public function descendants(Individual $individual, int $generations): Collection
{
$descendants = new Collection([$individual]);
if ($generations > 0) {
foreach ($individual->spouseFamilies() as $family) {
foreach ($family->children() as $child) {
$d... | php | public function descendants(Individual $individual, int $generations): Collection
{
$descendants = new Collection([$individual]);
if ($generations > 0) {
foreach ($individual->spouseFamilies() as $family) {
foreach ($family->children() as $child) {
$d... | [
"public",
"function",
"descendants",
"(",
"Individual",
"$",
"individual",
",",
"int",
"$",
"generations",
")",
":",
"Collection",
"{",
"$",
"descendants",
"=",
"new",
"Collection",
"(",
"[",
"$",
"individual",
"]",
")",
";",
"if",
"(",
"$",
"generations",... | Find the descendants of an individual.
@param Individual $individual Start with this individual
@param int $generations Fetch this number of generations
@return Collection
@return Individual[] | [
"Find",
"the",
"descendants",
"of",
"an",
"individual",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/ChartService.php#L80-L93 | train |
fisharebest/webtrees | app/Statistics/Service/CenturyService.php | CenturyService.centuryName | public function centuryName(int $century): string
{
if ($century < 0) {
return I18N::translate('%s BCE', $this->centuryName(-$century));
}
// The current chart engine (Google charts) can't handle <sup></sup> markup
switch ($century) {
case 21:
... | php | public function centuryName(int $century): string
{
if ($century < 0) {
return I18N::translate('%s BCE', $this->centuryName(-$century));
}
// The current chart engine (Google charts) can't handle <sup></sup> markup
switch ($century) {
case 21:
... | [
"public",
"function",
"centuryName",
"(",
"int",
"$",
"century",
")",
":",
"string",
"{",
"if",
"(",
"$",
"century",
"<",
"0",
")",
"{",
"return",
"I18N",
"::",
"translate",
"(",
"'%s BCE'",
",",
"$",
"this",
"->",
"centuryName",
"(",
"-",
"$",
"cent... | Century name, English => 21st, Polish => XXI, etc.
@param int $century
@return string | [
"Century",
"name",
"English",
"=",
">",
"21st",
"Polish",
"=",
">",
"XXI",
"etc",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Service/CenturyService.php#L34-L87 | train |
fisharebest/webtrees | app/DebugBar.php | DebugBar.enable | public static function enable(): void
{
self::$debugbar = new StandardDebugBar();
self::$debugbar->addCollector(new ViewCollector());
self::$renderer = self::$debugbar->getJavascriptRenderer('./vendor/maximebf/debugbar/src/DebugBar/Resources/');
} | php | public static function enable(): void
{
self::$debugbar = new StandardDebugBar();
self::$debugbar->addCollector(new ViewCollector());
self::$renderer = self::$debugbar->getJavascriptRenderer('./vendor/maximebf/debugbar/src/DebugBar/Resources/');
} | [
"public",
"static",
"function",
"enable",
"(",
")",
":",
"void",
"{",
"self",
"::",
"$",
"debugbar",
"=",
"new",
"StandardDebugBar",
"(",
")",
";",
"self",
"::",
"$",
"debugbar",
"->",
"addCollector",
"(",
"new",
"ViewCollector",
"(",
")",
")",
";",
"s... | Initialize the Debugbar.
@return void | [
"Initialize",
"the",
"Debugbar",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/DebugBar.php#L47-L53 | train |
fisharebest/webtrees | app/DebugBar.php | DebugBar.initPDO | public static function initPDO(PDO $pdo): PDO
{
if (self::$debugbar instanceof StandardDebugBar) {
$traceable_pdo = new TraceablePDO($pdo);
self::$debugbar->addCollector(new PDOCollector($traceable_pdo));
}
return $pdo;
} | php | public static function initPDO(PDO $pdo): PDO
{
if (self::$debugbar instanceof StandardDebugBar) {
$traceable_pdo = new TraceablePDO($pdo);
self::$debugbar->addCollector(new PDOCollector($traceable_pdo));
}
return $pdo;
} | [
"public",
"static",
"function",
"initPDO",
"(",
"PDO",
"$",
"pdo",
")",
":",
"PDO",
"{",
"if",
"(",
"self",
"::",
"$",
"debugbar",
"instanceof",
"StandardDebugBar",
")",
"{",
"$",
"traceable_pdo",
"=",
"new",
"TraceablePDO",
"(",
"$",
"pdo",
")",
";",
... | Initialize the PDO collector.
@param PDO $pdo
@return PDO | [
"Initialize",
"the",
"PDO",
"collector",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/DebugBar.php#L62-L70 | train |
fisharebest/webtrees | app/DebugBar.php | DebugBar.stopMeasure | public static function stopMeasure($name): void
{
if (self::$debugbar instanceof StandardDebugBar) {
$collector = self::$debugbar->getCollector('time');
if ($collector instanceof TimeDataCollector) {
$collector->stopMeasure($name);
}
}
} | php | public static function stopMeasure($name): void
{
if (self::$debugbar instanceof StandardDebugBar) {
$collector = self::$debugbar->getCollector('time');
if ($collector instanceof TimeDataCollector) {
$collector->stopMeasure($name);
}
}
} | [
"public",
"static",
"function",
"stopMeasure",
"(",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"self",
"::",
"$",
"debugbar",
"instanceof",
"StandardDebugBar",
")",
"{",
"$",
"collector",
"=",
"self",
"::",
"$",
"debugbar",
"->",
"getCollector",
"(",
... | Stop a timer.
@param string $name
@return void | [
"Stop",
"a",
"timer",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/DebugBar.php#L169-L178 | train |
fisharebest/webtrees | app/DebugBar/ViewCollector.php | ViewCollector.addView | public function addView(string $view, array $data): void
{
$num = count($this->views) + 1;
$key = '#' . $num . ' ' . $view;
$this->views[$key] = $this->getDataFormatter()->formatVar($data);
} | php | public function addView(string $view, array $data): void
{
$num = count($this->views) + 1;
$key = '#' . $num . ' ' . $view;
$this->views[$key] = $this->getDataFormatter()->formatVar($data);
} | [
"public",
"function",
"addView",
"(",
"string",
"$",
"view",
",",
"array",
"$",
"data",
")",
":",
"void",
"{",
"$",
"num",
"=",
"count",
"(",
"$",
"this",
"->",
"views",
")",
"+",
"1",
";",
"$",
"key",
"=",
"'#'",
".",
"$",
"num",
".",
"' '",
... | Add details about a view
@param string $view
@param array $data
@return void | [
"Add",
"details",
"about",
"a",
"view"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/DebugBar/ViewCollector.php#L40-L46 | train |
fisharebest/webtrees | app/Http/Controllers/EditMediaController.php | EditMediaController.editMediaFile | public function editMediaFile(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$xref = $request->get('xref', '');
$fact_id = $request->get('fact_id', '');
$media = Media::getInstance($xref, $tree);
try {
Auth::checkMediaAccess($media);
} cat... | php | public function editMediaFile(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$xref = $request->get('xref', '');
$fact_id = $request->get('fact_id', '');
$media = Media::getInstance($xref, $tree);
try {
Auth::checkMediaAccess($media);
} cat... | [
"public",
"function",
"editMediaFile",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"xref",
"=",
"$",
"request",
"->",
"get",
"(",
"'xref'",
",",
"''",
")",
";",
"$",
"fact_id",
"=",
"$... | Edit an existing media file.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Edit",
"an",
"existing",
"media",
"file",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditMediaController.php#L147-L175 | train |
fisharebest/webtrees | app/Http/Controllers/EditMediaController.php | EditMediaController.createMediaObject | public function createMediaObject(Tree $tree): ResponseInterface
{
return response(view('modals/create-media-object', [
'max_upload_size' => $this->maxUploadFilesize(),
'media_types' => $this->mediaTypes(),
'unused_files' => $this->unusedFiles($tree),
]));
... | php | public function createMediaObject(Tree $tree): ResponseInterface
{
return response(view('modals/create-media-object', [
'max_upload_size' => $this->maxUploadFilesize(),
'media_types' => $this->mediaTypes(),
'unused_files' => $this->unusedFiles($tree),
]));
... | [
"public",
"function",
"createMediaObject",
"(",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"return",
"response",
"(",
"view",
"(",
"'modals/create-media-object'",
",",
"[",
"'max_upload_size'",
"=>",
"$",
"this",
"->",
"maxUploadFilesize",
"(",
")",
... | Show a form to create a new media object.
@param Tree $tree
@return ResponseInterface | [
"Show",
"a",
"form",
"to",
"create",
"a",
"new",
"media",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditMediaController.php#L287-L294 | train |
fisharebest/webtrees | app/Http/Controllers/EditMediaController.php | EditMediaController.createMediaObjectAction | public function createMediaObjectAction(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$note = $request->get('note');
$title = $request->get('title');
$type = $request->get('type');
$privacy_restriction = $request->get('p... | php | public function createMediaObjectAction(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$note = $request->get('note');
$title = $request->get('title');
$type = $request->get('type');
$privacy_restriction = $request->get('p... | [
"public",
"function",
"createMediaObjectAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"note",
"=",
"$",
"request",
"->",
"get",
"(",
"'note'",
")",
";",
"$",
"title",
"=",
"$",
"r... | Process a form to create a new media object.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Process",
"a",
"form",
"to",
"create",
"a",
"new",
"media",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditMediaController.php#L344-L399 | train |
fisharebest/webtrees | app/Http/Controllers/EditMediaController.php | EditMediaController.createMediaFileGedcom | private function createMediaFileGedcom(string $file, string $type, string $title): string
{
if (preg_match('/\.([a-z0-9]+)/i', $file, $match)) {
$extension = strtolower($match[1]);
$extension = str_replace('jpg', 'jpeg', $extension);
$extension = ' ' . $extension;
... | php | private function createMediaFileGedcom(string $file, string $type, string $title): string
{
if (preg_match('/\.([a-z0-9]+)/i', $file, $match)) {
$extension = strtolower($match[1]);
$extension = str_replace('jpg', 'jpeg', $extension);
$extension = ' ' . $extension;
... | [
"private",
"function",
"createMediaFileGedcom",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"type",
",",
"string",
"$",
"title",
")",
":",
"string",
"{",
"if",
"(",
"preg_match",
"(",
"'/\\.([a-z0-9]+)/i'",
",",
"$",
"file",
",",
"$",
"match",
")",
"... | Convert the media file attributes into GEDCOM format.
@param string $file
@param string $type
@param string $title
@return string | [
"Convert",
"the",
"media",
"file",
"attributes",
"into",
"GEDCOM",
"format",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditMediaController.php#L483-L502 | train |
fisharebest/webtrees | app/Http/Controllers/EditMediaController.php | EditMediaController.maxUploadFilesize | private function maxUploadFilesize(): string
{
$bytes = UploadedFile::getMaxFilesize();
$kb = intdiv($bytes + 1023, 1024);
return I18N::translate('%s KB', I18N::number($kb));
} | php | private function maxUploadFilesize(): string
{
$bytes = UploadedFile::getMaxFilesize();
$kb = intdiv($bytes + 1023, 1024);
return I18N::translate('%s KB', I18N::number($kb));
} | [
"private",
"function",
"maxUploadFilesize",
"(",
")",
":",
"string",
"{",
"$",
"bytes",
"=",
"UploadedFile",
"::",
"getMaxFilesize",
"(",
")",
";",
"$",
"kb",
"=",
"intdiv",
"(",
"$",
"bytes",
"+",
"1023",
",",
"1024",
")",
";",
"return",
"I18N",
"::",... | What is the largest file a user may upload? | [
"What",
"is",
"the",
"largest",
"file",
"a",
"user",
"may",
"upload?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditMediaController.php#L507-L513 | train |
fisharebest/webtrees | app/Http/Controllers/EditMediaController.php | EditMediaController.unusedFiles | private function unusedFiles(Tree $tree): array
{
$used_files = DB::table('media_file')
->where('m_file', '=', $tree->id())
->where('multimedia_file_refn', 'NOT LIKE', 'http://%')
->where('multimedia_file_refn', 'NOT LIKE', 'https://%')
->pluck('multimedia_fil... | php | private function unusedFiles(Tree $tree): array
{
$used_files = DB::table('media_file')
->where('m_file', '=', $tree->id())
->where('multimedia_file_refn', 'NOT LIKE', 'http://%')
->where('multimedia_file_refn', 'NOT LIKE', 'https://%')
->pluck('multimedia_fil... | [
"private",
"function",
"unusedFiles",
"(",
"Tree",
"$",
"tree",
")",
":",
"array",
"{",
"$",
"used_files",
"=",
"DB",
"::",
"table",
"(",
"'media_file'",
")",
"->",
"where",
"(",
"'m_file'",
",",
"'='",
",",
"$",
"tree",
"->",
"id",
"(",
")",
")",
... | A list of media files not already linked to a media object.
@param Tree $tree
@return array | [
"A",
"list",
"of",
"media",
"files",
"not",
"already",
"linked",
"to",
"a",
"media",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditMediaController.php#L623-L651 | train |
fisharebest/webtrees | app/Report/ReportPdf.php | ReportPdf.setup | public function setup(): void
{
parent::setup();
// Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
$this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, [
$this->page_width,
... | php | public function setup(): void
{
parent::setup();
// Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
$this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, [
$this->page_width,
... | [
"public",
"function",
"setup",
"(",
")",
":",
"void",
"{",
"parent",
"::",
"setup",
"(",
")",
";",
"// Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4",
"$",
"this",
"->",
"pdf",
"=",
... | PDF Setup - ReportPdf
@return void | [
"PDF",
"Setup",
"-",
"ReportPdf"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportPdf.php#L69-L107 | train |
fisharebest/webtrees | app/Report/ReportPdf.php | ReportPdf.createImage | public function createImage(string $file, float $x, float $y, float $w, float $h, string $align, string $ln): ReportBaseImage
{
return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln);
} | php | public function createImage(string $file, float $x, float $y, float $w, float $h, string $align, string $ln): ReportBaseImage
{
return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln);
} | [
"public",
"function",
"createImage",
"(",
"string",
"$",
"file",
",",
"float",
"$",
"x",
",",
"float",
"$",
"y",
",",
"float",
"$",
"w",
",",
"float",
"$",
"h",
",",
"string",
"$",
"align",
",",
"string",
"$",
"ln",
")",
":",
"ReportBaseImage",
"{"... | Create a new image object.
@param string $file Filename
@param float $x
@param float $y
@param float $w Image width
@param float $h Image height
@param string $align L:left, C:center, R:right or empty to use x/y
@param string $ln T:same line, N:next line
@return ReportBaseImage | [
"Create",
"a",
"new",
"image",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportPdf.php#L276-L279 | train |
fisharebest/webtrees | app/Html.php | Html.url | public static function url($path, array $data): string
{
$path = str_replace(' ', '%20', $path);
return $path . '?' . http_build_query($data, '', '&', PHP_QUERY_RFC3986);
} | php | public static function url($path, array $data): string
{
$path = str_replace(' ', '%20', $path);
return $path . '?' . http_build_query($data, '', '&', PHP_QUERY_RFC3986);
} | [
"public",
"static",
"function",
"url",
"(",
"$",
"path",
",",
"array",
"$",
"data",
")",
":",
"string",
"{",
"$",
"path",
"=",
"str_replace",
"(",
"' '",
",",
"'%20'",
",",
"$",
"path",
")",
";",
"return",
"$",
"path",
".",
"'?'",
".",
"http_build_... | Encode a URL.
@param string $path
@param array $data
@return string | [
"Encode",
"a",
"URL",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Html.php#L56-L61 | train |
leafo/scssphp | src/Compiler.php | Compiler.findScopeSelectors | protected function findScopeSelectors($scope, $depth)
{
if ($scope->depth === $depth && $scope->selectors) {
return $scope->selectors;
}
if ($scope->children) {
foreach (array_reverse($scope->children) as $c) {
if ($s = $this->findScopeSelectors($c, $... | php | protected function findScopeSelectors($scope, $depth)
{
if ($scope->depth === $depth && $scope->selectors) {
return $scope->selectors;
}
if ($scope->children) {
foreach (array_reverse($scope->children) as $c) {
if ($s = $this->findScopeSelectors($c, $... | [
"protected",
"function",
"findScopeSelectors",
"(",
"$",
"scope",
",",
"$",
"depth",
")",
"{",
"if",
"(",
"$",
"scope",
"->",
"depth",
"===",
"$",
"depth",
"&&",
"$",
"scope",
"->",
"selectors",
")",
"{",
"return",
"$",
"scope",
"->",
"selectors",
";",... | Find a selector by the depth node in the scope
@param \Leafo\ScssPhp\Formatter\OutputBlock $scope
@param integer $depth
@return array | [
"Find",
"a",
"selector",
"by",
"the",
"depth",
"node",
"in",
"the",
"scope"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L927-L942 | train |
leafo/scssphp | src/Compiler.php | Compiler.compileChildren | protected function compileChildren($stms, OutputBlock $out)
{
foreach ($stms as $stm) {
$ret = $this->compileChild($stm, $out);
if (isset($ret)) {
return $ret;
}
}
return null;
} | php | protected function compileChildren($stms, OutputBlock $out)
{
foreach ($stms as $stm) {
$ret = $this->compileChild($stm, $out);
if (isset($ret)) {
return $ret;
}
}
return null;
} | [
"protected",
"function",
"compileChildren",
"(",
"$",
"stms",
",",
"OutputBlock",
"$",
"out",
")",
"{",
"foreach",
"(",
"$",
"stms",
"as",
"$",
"stm",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"compileChild",
"(",
"$",
"stm",
",",
"$",
"out",
"... | Compile children and return result
@param array $stms
@param \Leafo\ScssPhp\Formatter\OutputBlock $out
@return array|null | [
"Compile",
"children",
"and",
"return",
"result"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L1424-L1435 | train |
leafo/scssphp | src/Compiler.php | Compiler.joinSelectors | protected function joinSelectors($parent, $child, $selfParentSelectors = null)
{
$setSelf = false;
$out = [];
foreach ($child as $part) {
$newPart = [];
foreach ($part as $p) {
if ($p === static::$selfSelector) {
$setSelf = true;
... | php | protected function joinSelectors($parent, $child, $selfParentSelectors = null)
{
$setSelf = false;
$out = [];
foreach ($child as $part) {
$newPart = [];
foreach ($part as $p) {
if ($p === static::$selfSelector) {
$setSelf = true;
... | [
"protected",
"function",
"joinSelectors",
"(",
"$",
"parent",
",",
"$",
"child",
",",
"$",
"selfParentSelectors",
"=",
"null",
")",
"{",
"$",
"setSelf",
"=",
"false",
";",
"$",
"out",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"child",
"as",
"$",
"part... | Join selectors; looks for & to replace, or append parent before child
@param array $parent
@param array $child
@param array $selfParentSelectors
@return array | [
"Join",
"selectors",
";",
"looks",
"for",
"&",
"to",
"replace",
"or",
"append",
"parent",
"before",
"child"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L3132-L3174 | train |
leafo/scssphp | src/Compiler.php | Compiler.extractEnv | protected function extractEnv($envs)
{
for ($env = null; $e = array_pop($envs);) {
$e->parent = $env;
$env = $e;
}
return $env;
} | php | protected function extractEnv($envs)
{
for ($env = null; $e = array_pop($envs);) {
$e->parent = $env;
$env = $e;
}
return $env;
} | [
"protected",
"function",
"extractEnv",
"(",
"$",
"envs",
")",
"{",
"for",
"(",
"$",
"env",
"=",
"null",
";",
"$",
"e",
"=",
"array_pop",
"(",
"$",
"envs",
")",
";",
")",
"{",
"$",
"e",
"->",
"parent",
"=",
"$",
"env",
";",
"$",
"env",
"=",
"$... | Convert env stack to singly linked list
@param array $envs
@return \Leafo\ScssPhp\Compiler\Environment | [
"Convert",
"env",
"stack",
"to",
"singly",
"linked",
"list"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L3240-L3248 | train |
leafo/scssphp | src/Compiler.php | Compiler.setExisting | protected function setExisting($name, $value, Environment $env, $valueUnreduced = null)
{
$storeEnv = $env;
$hasNamespace = $name[0] === '^' || $name[0] === '@' || $name[0] === '%';
for (;;) {
if (array_key_exists($name, $env->store)) {
break;
}
... | php | protected function setExisting($name, $value, Environment $env, $valueUnreduced = null)
{
$storeEnv = $env;
$hasNamespace = $name[0] === '^' || $name[0] === '@' || $name[0] === '%';
for (;;) {
if (array_key_exists($name, $env->store)) {
break;
}
... | [
"protected",
"function",
"setExisting",
"(",
"$",
"name",
",",
"$",
"value",
",",
"Environment",
"$",
"env",
",",
"$",
"valueUnreduced",
"=",
"null",
")",
"{",
"$",
"storeEnv",
"=",
"$",
"env",
";",
"$",
"hasNamespace",
"=",
"$",
"name",
"[",
"0",
"]... | Set existing variable
@param string $name
@param mixed $value
@param \Leafo\ScssPhp\Compiler\Environment $env
@param mixed $valueUnreduced | [
"Set",
"existing",
"variable"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L3320-L3349 | train |
leafo/scssphp | src/Compiler.php | Compiler.setRaw | protected function setRaw($name, $value, Environment $env, $valueUnreduced = null)
{
$env->store[$name] = $value;
if ($valueUnreduced) {
$env->storeUnreduced[$name] = $valueUnreduced;
}
} | php | protected function setRaw($name, $value, Environment $env, $valueUnreduced = null)
{
$env->store[$name] = $value;
if ($valueUnreduced) {
$env->storeUnreduced[$name] = $valueUnreduced;
}
} | [
"protected",
"function",
"setRaw",
"(",
"$",
"name",
",",
"$",
"value",
",",
"Environment",
"$",
"env",
",",
"$",
"valueUnreduced",
"=",
"null",
")",
"{",
"$",
"env",
"->",
"store",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"if",
"(",
"$",
"... | Set raw variable
@param string $name
@param mixed $value
@param \Leafo\ScssPhp\Compiler\Environment $env
@param mixed $valueUnreduced | [
"Set",
"raw",
"variable"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L3359-L3366 | train |
leafo/scssphp | src/Compiler.php | Compiler.sortArgs | protected function sortArgs($prototype, $args)
{
$keyArgs = [];
$posArgs = [];
// separate positional and keyword arguments
foreach ($args as $arg) {
list($key, $value) = $arg;
$key = $key[1];
if (empty($key)) {
$posArgs[] = empt... | php | protected function sortArgs($prototype, $args)
{
$keyArgs = [];
$posArgs = [];
// separate positional and keyword arguments
foreach ($args as $arg) {
list($key, $value) = $arg;
$key = $key[1];
if (empty($key)) {
$posArgs[] = empt... | [
"protected",
"function",
"sortArgs",
"(",
"$",
"prototype",
",",
"$",
"args",
")",
"{",
"$",
"keyArgs",
"=",
"[",
"]",
";",
"$",
"posArgs",
"=",
"[",
"]",
";",
"// separate positional and keyword arguments",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
... | Sorts keyword arguments
@param array $prototype
@param array $args
@return array | [
"Sorts",
"keyword",
"arguments"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L3946-L3981 | train |
leafo/scssphp | src/Compiler.php | Compiler.coerceValue | protected function coerceValue($value)
{
if (is_array($value) || $value instanceof \ArrayAccess) {
return $value;
}
if (is_bool($value)) {
return $this->toBool($value);
}
if ($value === null) {
return static::$null;
}
if ... | php | protected function coerceValue($value)
{
if (is_array($value) || $value instanceof \ArrayAccess) {
return $value;
}
if (is_bool($value)) {
return $this->toBool($value);
}
if ($value === null) {
return static::$null;
}
if ... | [
"protected",
"function",
"coerceValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"||",
"$",
"value",
"instanceof",
"\\",
"ArrayAccess",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"is_bool",
"(",
"$",
"va... | Coerce a php value into a scss one
@param mixed $value
@return array|\Leafo\ScssPhp\Node\Number | [
"Coerce",
"a",
"php",
"value",
"into",
"a",
"scss",
"one"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L4108-L4154 | train |
leafo/scssphp | src/Compiler.php | Compiler.assertMap | public function assertMap($value)
{
$value = $this->coerceMap($value);
if ($value[0] !== Type::T_MAP) {
$this->throwError('expecting map, %s received', $value[0]);
}
return $value;
} | php | public function assertMap($value)
{
$value = $this->coerceMap($value);
if ($value[0] !== Type::T_MAP) {
$this->throwError('expecting map, %s received', $value[0]);
}
return $value;
} | [
"public",
"function",
"assertMap",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"coerceMap",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"value",
"[",
"0",
"]",
"!==",
"Type",
"::",
"T_MAP",
")",
"{",
"$",
"this",
"->",
"... | Assert value is a map
@api
@param array $value
@return array
@throws \Exception | [
"Assert",
"value",
"is",
"a",
"map"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L4305-L4314 | train |
leafo/scssphp | src/Compiler.php | Compiler.assertColor | public function assertColor($value)
{
if ($color = $this->coerceColor($value)) {
return $color;
}
$this->throwError('expecting color, %s received', $value[0]);
} | php | public function assertColor($value)
{
if ($color = $this->coerceColor($value)) {
return $color;
}
$this->throwError('expecting color, %s received', $value[0]);
} | [
"public",
"function",
"assertColor",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"color",
"=",
"$",
"this",
"->",
"coerceColor",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"color",
";",
"}",
"$",
"this",
"->",
"throwError",
"(",
"'expecting co... | Assert value is a color
@api
@param array $value
@return array
@throws \Exception | [
"Assert",
"value",
"is",
"a",
"color"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L4347-L4354 | train |
leafo/scssphp | src/Compiler.php | Compiler.hueToRGB | protected function hueToRGB($m1, $m2, $h)
{
if ($h < 0) {
$h += 1;
} elseif ($h > 1) {
$h -= 1;
}
if ($h * 6 < 1) {
return $m1 + ($m2 - $m1) * $h * 6;
}
if ($h * 2 < 1) {
return $m2;
}
if ($h * 3 < 2) ... | php | protected function hueToRGB($m1, $m2, $h)
{
if ($h < 0) {
$h += 1;
} elseif ($h > 1) {
$h -= 1;
}
if ($h * 6 < 1) {
return $m1 + ($m2 - $m1) * $h * 6;
}
if ($h * 2 < 1) {
return $m2;
}
if ($h * 3 < 2) ... | [
"protected",
"function",
"hueToRGB",
"(",
"$",
"m1",
",",
"$",
"m2",
",",
"$",
"h",
")",
"{",
"if",
"(",
"$",
"h",
"<",
"0",
")",
"{",
"$",
"h",
"+=",
"1",
";",
"}",
"elseif",
"(",
"$",
"h",
">",
"1",
")",
"{",
"$",
"h",
"-=",
"1",
";",... | Hue to RGB helper
@param float $m1
@param float $m2
@param float $h
@return float | [
"Hue",
"to",
"RGB",
"helper"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Compiler.php#L4447-L4468 | train |
leafo/scssphp | example/Server.php | Server.inputName | protected function inputName()
{
switch (true) {
case isset($_GET['p']):
return $_GET['p'];
case isset($_SERVER['PATH_INFO']):
return $_SERVER['PATH_INFO'];
case isset($_SERVER['DOCUMENT_URI']):
return substr($_SERVER['DOCUM... | php | protected function inputName()
{
switch (true) {
case isset($_GET['p']):
return $_GET['p'];
case isset($_SERVER['PATH_INFO']):
return $_SERVER['PATH_INFO'];
case isset($_SERVER['DOCUMENT_URI']):
return substr($_SERVER['DOCUM... | [
"protected",
"function",
"inputName",
"(",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"isset",
"(",
"$",
"_GET",
"[",
"'p'",
"]",
")",
":",
"return",
"$",
"_GET",
"[",
"'p'",
"]",
";",
"case",
"isset",
"(",
"$",
"_SERVER",
"[",
"'PATH_INFO'... | Get name of requested .scss file
@return string|null | [
"Get",
"name",
"of",
"requested",
".",
"scss",
"file"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/example/Server.php#L63-L73 | train |
leafo/scssphp | example/Server.php | Server.findInput | protected function findInput()
{
if (($input = $this->inputName())
&& strpos($input, '..') === false
&& substr($input, -5) === '.scss'
) {
$name = $this->join($this->dir, $input);
if (is_file($name) && is_readable($name)) {
return $nam... | php | protected function findInput()
{
if (($input = $this->inputName())
&& strpos($input, '..') === false
&& substr($input, -5) === '.scss'
) {
$name = $this->join($this->dir, $input);
if (is_file($name) && is_readable($name)) {
return $nam... | [
"protected",
"function",
"findInput",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"input",
"=",
"$",
"this",
"->",
"inputName",
"(",
")",
")",
"&&",
"strpos",
"(",
"$",
"input",
",",
"'..'",
")",
"===",
"false",
"&&",
"substr",
"(",
"$",
"input",
",",
"-... | Get path to requested .scss file
@return string | [
"Get",
"path",
"to",
"requested",
".",
"scss",
"file"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/example/Server.php#L80-L94 | train |
leafo/scssphp | example/Server.php | Server.getIfModifiedSinceHeader | protected function getIfModifiedSinceHeader()
{
$modifiedSince = null;
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
$modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
if (false !== ($semicolonPos = strpos($modifiedSince, ';'))) {
$modifiedSince = subst... | php | protected function getIfModifiedSinceHeader()
{
$modifiedSince = null;
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
$modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
if (false !== ($semicolonPos = strpos($modifiedSince, ';'))) {
$modifiedSince = subst... | [
"protected",
"function",
"getIfModifiedSinceHeader",
"(",
")",
"{",
"$",
"modifiedSince",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_IF_MODIFIED_SINCE'",
"]",
")",
")",
"{",
"$",
"modifiedSince",
"=",
"$",
"_SERVER",
"[",
"'HTTP_I... | Get If-Modified-Since header from client request
@return string|null | [
"Get",
"If",
"-",
"Modified",
"-",
"Since",
"header",
"from",
"client",
"request"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/example/Server.php#L164-L177 | train |
leafo/scssphp | example/Server.php | Server.checkedCompile | public function checkedCompile($in, $out)
{
if (! is_file($out) || filemtime($in) > filemtime($out)) {
$this->compileFile($in, $out);
return true;
}
return false;
} | php | public function checkedCompile($in, $out)
{
if (! is_file($out) || filemtime($in) > filemtime($out)) {
$this->compileFile($in, $out);
return true;
}
return false;
} | [
"public",
"function",
"checkedCompile",
"(",
"$",
"in",
",",
"$",
"out",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"out",
")",
"||",
"filemtime",
"(",
"$",
"in",
")",
">",
"filemtime",
"(",
"$",
"out",
")",
")",
"{",
"$",
"this",
"->",
"co... | Check if file need compiling
@param string $in Input file (.scss)
@param string $out Output file (.css)
@return bool | [
"Check",
"if",
"file",
"need",
"compiling"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/example/Server.php#L302-L311 | train |
leafo/scssphp | example/Server.php | Server.cachedCompile | public function cachedCompile($in, $force = false)
{
// assume no root
$root = null;
if (is_string($in)) {
$root = $in;
} elseif (is_array($in) and isset($in['root'])) {
if ($force or ! isset($in['files'])) {
// If we are forcing a recompile o... | php | public function cachedCompile($in, $force = false)
{
// assume no root
$root = null;
if (is_string($in)) {
$root = $in;
} elseif (is_array($in) and isset($in['root'])) {
if ($force or ! isset($in['files'])) {
// If we are forcing a recompile o... | [
"public",
"function",
"cachedCompile",
"(",
"$",
"in",
",",
"$",
"force",
"=",
"false",
")",
"{",
"// assume no root",
"$",
"root",
"=",
"null",
";",
"if",
"(",
"is_string",
"(",
"$",
"in",
")",
")",
"{",
"$",
"root",
"=",
"$",
"in",
";",
"}",
"e... | Execute scssphp on a .scss file or a scssphp cache structure
The scssphp cache structure contains information about a specific
scss file having been parsed. It can be used as a hint for future
calls to determine whether or not a rebuild is required.
The cache structure contains two important keys that may be used
ext... | [
"Execute",
"scssphp",
"on",
"a",
".",
"scss",
"file",
"or",
"a",
"scssphp",
"cache",
"structure"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/example/Server.php#L440-L482 | train |
leafo/scssphp | src/Parser.php | Parser.match | protected function match($regex, &$out, $eatWhitespace = null)
{
$r = '/' . $regex . '/' . $this->patternModifiers;
if (! preg_match($r, $this->buffer, $out, null, $this->count)) {
return false;
}
$this->count += strlen($out[0]);
if (! isset($eatWhitespace)) {
... | php | protected function match($regex, &$out, $eatWhitespace = null)
{
$r = '/' . $regex . '/' . $this->patternModifiers;
if (! preg_match($r, $this->buffer, $out, null, $this->count)) {
return false;
}
$this->count += strlen($out[0]);
if (! isset($eatWhitespace)) {
... | [
"protected",
"function",
"match",
"(",
"$",
"regex",
",",
"&",
"$",
"out",
",",
"$",
"eatWhitespace",
"=",
"null",
")",
"{",
"$",
"r",
"=",
"'/'",
".",
"$",
"regex",
".",
"'/'",
".",
"$",
"this",
"->",
"patternModifiers",
";",
"if",
"(",
"!",
"pr... | Try to match something on head of buffer
@param string $regex
@param array $out
@param boolean $eatWhitespace
@return boolean | [
"Try",
"to",
"match",
"something",
"on",
"head",
"of",
"buffer"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L867-L886 | train |
leafo/scssphp | src/Parser.php | Parser.matchChar | protected function matchChar($char, $eatWhitespace = null)
{
if (! isset($this->buffer[$this->count]) || $this->buffer[$this->count] !== $char) {
return false;
}
$this->count++;
if (! isset($eatWhitespace)) {
$eatWhitespace = $this->eatWhiteDefault;
... | php | protected function matchChar($char, $eatWhitespace = null)
{
if (! isset($this->buffer[$this->count]) || $this->buffer[$this->count] !== $char) {
return false;
}
$this->count++;
if (! isset($eatWhitespace)) {
$eatWhitespace = $this->eatWhiteDefault;
... | [
"protected",
"function",
"matchChar",
"(",
"$",
"char",
",",
"$",
"eatWhitespace",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"buffer",
"[",
"$",
"this",
"->",
"count",
"]",
")",
"||",
"$",
"this",
"->",
"buffer",
"[",
... | Match a single string
@param string $char
@param boolean $eatWhitespace
@return boolean | [
"Match",
"a",
"single",
"string"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L896-L912 | train |
leafo/scssphp | src/Parser.php | Parser.mediaQuery | protected function mediaQuery(&$out)
{
$expressions = null;
$parts = [];
if (($this->literal('only', 4) && ($only = true) || $this->literal('not', 3) && ($not = true) || true) &&
$this->mixedKeyword($mediaType)
) {
$prop = [Type::T_MEDIA_TYPE];
i... | php | protected function mediaQuery(&$out)
{
$expressions = null;
$parts = [];
if (($this->literal('only', 4) && ($only = true) || $this->literal('not', 3) && ($not = true) || true) &&
$this->mixedKeyword($mediaType)
) {
$prop = [Type::T_MEDIA_TYPE];
i... | [
"protected",
"function",
"mediaQuery",
"(",
"&",
"$",
"out",
")",
"{",
"$",
"expressions",
"=",
"null",
";",
"$",
"parts",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"$",
"this",
"->",
"literal",
"(",
"'only'",
",",
"4",
")",
"&&",
"(",
"$",
"only",
"... | Parse media query
@param array $out
@return boolean | [
"Parse",
"media",
"query"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L1036-L1079 | train |
leafo/scssphp | src/Parser.php | Parser.argValue | protected function argValue(&$out)
{
$s = $this->count;
$keyword = null;
if (! $this->variable($keyword) || ! $this->matchChar(':')) {
$this->seek($s);
$keyword = null;
}
if ($this->genericList($value, 'expression')) {
$out = [$keyword, ... | php | protected function argValue(&$out)
{
$s = $this->count;
$keyword = null;
if (! $this->variable($keyword) || ! $this->matchChar(':')) {
$this->seek($s);
$keyword = null;
}
if ($this->genericList($value, 'expression')) {
$out = [$keyword, ... | [
"protected",
"function",
"argValue",
"(",
"&",
"$",
"out",
")",
"{",
"$",
"s",
"=",
"$",
"this",
"->",
"count",
";",
"$",
"keyword",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"variable",
"(",
"$",
"keyword",
")",
"||",
"!",
"$",
"thi... | Parse argument value
@param array $out
@return boolean | [
"Parse",
"argument",
"value"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L1137-L1162 | train |
leafo/scssphp | src/Parser.php | Parser.func | protected function func($name, &$func)
{
$s = $this->count;
if ($this->matchChar('(')) {
if ($name === 'alpha' && $this->argumentList($args)) {
$func = [Type::T_FUNCTION, $name, [Type::T_STRING, '', $args]];
return true;
}
if ($n... | php | protected function func($name, &$func)
{
$s = $this->count;
if ($this->matchChar('(')) {
if ($name === 'alpha' && $this->argumentList($args)) {
$func = [Type::T_FUNCTION, $name, [Type::T_STRING, '', $args]];
return true;
}
if ($n... | [
"protected",
"function",
"func",
"(",
"$",
"name",
",",
"&",
"$",
"func",
")",
"{",
"$",
"s",
"=",
"$",
"this",
"->",
"count",
";",
"if",
"(",
"$",
"this",
"->",
"matchChar",
"(",
"'('",
")",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"'alpha'",
... | Parse function call
@param string $name
@param array $out
@return boolean | [
"Parse",
"function",
"call"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L1521-L1562 | train |
leafo/scssphp | src/Parser.php | Parser.argumentList | protected function argumentList(&$out)
{
$s = $this->count;
$this->matchChar('(');
$args = [];
while ($this->keyword($var)) {
if ($this->matchChar('=') && $this->expression($exp)) {
$args[] = [Type::T_STRING, '', [$var . '=']];
$arg = $ex... | php | protected function argumentList(&$out)
{
$s = $this->count;
$this->matchChar('(');
$args = [];
while ($this->keyword($var)) {
if ($this->matchChar('=') && $this->expression($exp)) {
$args[] = [Type::T_STRING, '', [$var . '=']];
$arg = $ex... | [
"protected",
"function",
"argumentList",
"(",
"&",
"$",
"out",
")",
"{",
"$",
"s",
"=",
"$",
"this",
"->",
"count",
";",
"$",
"this",
"->",
"matchChar",
"(",
"'('",
")",
";",
"$",
"args",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"this",
"->",
"ke... | Parse function call argument list
@param array $out
@return boolean | [
"Parse",
"function",
"call",
"argument",
"list"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L1571-L1604 | train |
leafo/scssphp | src/Parser.php | Parser.mixedKeyword | protected function mixedKeyword(&$out)
{
$parts = [];
$oldWhite = $this->eatWhiteDefault;
$this->eatWhiteDefault = false;
for (;;) {
if ($this->keyword($key)) {
$parts[] = $key;
continue;
}
if ($this->interpolatio... | php | protected function mixedKeyword(&$out)
{
$parts = [];
$oldWhite = $this->eatWhiteDefault;
$this->eatWhiteDefault = false;
for (;;) {
if ($this->keyword($key)) {
$parts[] = $key;
continue;
}
if ($this->interpolatio... | [
"protected",
"function",
"mixedKeyword",
"(",
"&",
"$",
"out",
")",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"$",
"oldWhite",
"=",
"$",
"this",
"->",
"eatWhiteDefault",
";",
"$",
"this",
"->",
"eatWhiteDefault",
"=",
"false",
";",
"for",
"(",
";",
";",... | Parse keyword or interpolation
@param array $out
@return boolean | [
"Parse",
"keyword",
"or",
"interpolation"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L1880-L1914 | train |
leafo/scssphp | src/Parser.php | Parser.variable | protected function variable(&$out)
{
$s = $this->count;
if ($this->matchChar('$', false) && $this->keyword($name)) {
$out = [Type::T_VARIABLE, $name];
return true;
}
$this->seek($s);
return false;
} | php | protected function variable(&$out)
{
$s = $this->count;
if ($this->matchChar('$', false) && $this->keyword($name)) {
$out = [Type::T_VARIABLE, $name];
return true;
}
$this->seek($s);
return false;
} | [
"protected",
"function",
"variable",
"(",
"&",
"$",
"out",
")",
"{",
"$",
"s",
"=",
"$",
"this",
"->",
"count",
";",
"if",
"(",
"$",
"this",
"->",
"matchChar",
"(",
"'$'",
",",
"false",
")",
"&&",
"$",
"this",
"->",
"keyword",
"(",
"$",
"name",
... | Parse a variable
@param array $out
@return boolean | [
"Parse",
"a",
"variable"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L2332-L2345 | train |
leafo/scssphp | src/Parser.php | Parser.end | protected function end()
{
if ($this->matchChar(';')) {
return true;
}
if ($this->count === strlen($this->buffer) || $this->buffer[$this->count] === '}') {
// if there is end of file or a closing block next then we don't need a ;
return true;
}
... | php | protected function end()
{
if ($this->matchChar(';')) {
return true;
}
if ($this->count === strlen($this->buffer) || $this->buffer[$this->count] === '}') {
// if there is end of file or a closing block next then we don't need a ;
return true;
}
... | [
"protected",
"function",
"end",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"matchChar",
"(",
"';'",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"count",
"===",
"strlen",
"(",
"$",
"this",
"->",
"buffer",
")",
"||",
... | Consume an end of statement delimiter
@return boolean | [
"Consume",
"an",
"end",
"of",
"statement",
"delimiter"
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/Parser.php#L2418-L2430 | train |
leafo/scssphp | src/SourceMap/Base64VLQ.php | Base64VLQ.encode | public static function encode($value)
{
$encoded = '';
$vlq = self::toVLQSigned($value);
do {
$digit = $vlq & self::VLQ_BASE_MASK;
$vlq >>= self::VLQ_BASE_SHIFT;
if ($vlq > 0) {
$digit |= self::VLQ_CONTINUATION_BIT;
}
... | php | public static function encode($value)
{
$encoded = '';
$vlq = self::toVLQSigned($value);
do {
$digit = $vlq & self::VLQ_BASE_MASK;
$vlq >>= self::VLQ_BASE_SHIFT;
if ($vlq > 0) {
$digit |= self::VLQ_CONTINUATION_BIT;
}
... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"value",
")",
"{",
"$",
"encoded",
"=",
"''",
";",
"$",
"vlq",
"=",
"self",
"::",
"toVLQSigned",
"(",
"$",
"value",
")",
";",
"do",
"{",
"$",
"digit",
"=",
"$",
"vlq",
"&",
"self",
"::",
"VLQ_BA... | Returns the VLQ encoded value.
@param integer $value
@return string | [
"Returns",
"the",
"VLQ",
"encoded",
"value",
"."
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/SourceMap/Base64VLQ.php#L57-L74 | train |
leafo/scssphp | src/SourceMap/Base64VLQ.php | Base64VLQ.decode | public static function decode($str, &$index)
{
$result = 0;
$shift = 0;
do {
$c = $str[$index++];
$digit = Base64::decode($c);
$continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
$digit &= self::VLQ_BASE_MASK;
$result = $re... | php | public static function decode($str, &$index)
{
$result = 0;
$shift = 0;
do {
$c = $str[$index++];
$digit = Base64::decode($c);
$continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
$digit &= self::VLQ_BASE_MASK;
$result = $re... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"str",
",",
"&",
"$",
"index",
")",
"{",
"$",
"result",
"=",
"0",
";",
"$",
"shift",
"=",
"0",
";",
"do",
"{",
"$",
"c",
"=",
"$",
"str",
"[",
"$",
"index",
"++",
"]",
";",
"$",
"digit",
"... | Decodes VLQValue.
@param string $str
@param integer $index
@return integer | [
"Decodes",
"VLQValue",
"."
] | 71720fac3374e61cdf3cf4acc724ec2a47031aff | https://github.com/leafo/scssphp/blob/71720fac3374e61cdf3cf4acc724ec2a47031aff/src/SourceMap/Base64VLQ.php#L84-L99 | train |
thekordy/ticketit | src/Models/Agent.php | Agent.scopeAdmins | public function scopeAdmins($query, $paginate = false)
{
if ($paginate) {
return $query->where('ticketit_admin', '1')->paginate($paginate, ['*'], 'admins_page');
} else {
return $query->where('ticketit_admin', '1')->get();
}
} | php | public function scopeAdmins($query, $paginate = false)
{
if ($paginate) {
return $query->where('ticketit_admin', '1')->paginate($paginate, ['*'], 'admins_page');
} else {
return $query->where('ticketit_admin', '1')->get();
}
} | [
"public",
"function",
"scopeAdmins",
"(",
"$",
"query",
",",
"$",
"paginate",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"paginate",
")",
"{",
"return",
"$",
"query",
"->",
"where",
"(",
"'ticketit_admin'",
",",
"'1'",
")",
"->",
"paginate",
"(",
"$",
"... | list of all admins and returning collection.
@param $query
@param bool $paginate
@return bool
@internal param int $cat_id | [
"list",
"of",
"all",
"admins",
"and",
"returning",
"collection",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Models/Agent.php#L41-L48 | train |
thekordy/ticketit | src/Models/Agent.php | Agent.scopeAgentsLists | public function scopeAgentsLists($query)
{
if (version_compare(app()->version(), '5.2.0', '>=')) {
return $query->where('ticketit_agent', '1')->pluck('name', 'id')->toArray();
} else { // if Laravel 5.1
return $query->where('ticketit_agent', '1')->lists('name', 'id')->toArray... | php | public function scopeAgentsLists($query)
{
if (version_compare(app()->version(), '5.2.0', '>=')) {
return $query->where('ticketit_agent', '1')->pluck('name', 'id')->toArray();
} else { // if Laravel 5.1
return $query->where('ticketit_agent', '1')->lists('name', 'id')->toArray... | [
"public",
"function",
"scopeAgentsLists",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"version_compare",
"(",
"app",
"(",
")",
"->",
"version",
"(",
")",
",",
"'5.2.0'",
",",
"'>='",
")",
")",
"{",
"return",
"$",
"query",
"->",
"where",
"(",
"'ticketit_age... | list of all agents and returning lists array of id and name.
@param $query
@return bool
@internal param int $cat_id | [
"list",
"of",
"all",
"agents",
"and",
"returning",
"lists",
"array",
"of",
"id",
"and",
"name",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Models/Agent.php#L78-L85 | train |
thekordy/ticketit | src/Models/Agent.php | Agent.isAgent | public static function isAgent($id = null)
{
if (isset($id)) {
$user = User::find($id);
if ($user->ticketit_agent) {
return true;
}
return false;
}
if (auth()->check()) {
if (auth()->user()->ticketit_agent) {
... | php | public static function isAgent($id = null)
{
if (isset($id)) {
$user = User::find($id);
if ($user->ticketit_agent) {
return true;
}
return false;
}
if (auth()->check()) {
if (auth()->user()->ticketit_agent) {
... | [
"public",
"static",
"function",
"isAgent",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"$",
"user",
"=",
"User",
"::",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"user",
"->",
"ticketit_agent... | Check if user is agent.
@return bool | [
"Check",
"if",
"user",
"is",
"agent",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Models/Agent.php#L92-L107 | train |
thekordy/ticketit | src/Models/Agent.php | Agent.isAssignedAgent | public static function isAssignedAgent($id)
{
if (auth()->check() && Auth::user()->ticketit_agent) {
if (Auth::user()->id == Ticket::find($id)->agent->id) {
return true;
}
}
} | php | public static function isAssignedAgent($id)
{
if (auth()->check() && Auth::user()->ticketit_agent) {
if (Auth::user()->id == Ticket::find($id)->agent->id) {
return true;
}
}
} | [
"public",
"static",
"function",
"isAssignedAgent",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"auth",
"(",
")",
"->",
"check",
"(",
")",
"&&",
"Auth",
"::",
"user",
"(",
")",
"->",
"ticketit_agent",
")",
"{",
"if",
"(",
"Auth",
"::",
"user",
"(",
")",
... | Check if user is the assigned agent for a ticket.
@param int $id ticket id
@return bool | [
"Check",
"if",
"user",
"is",
"the",
"assigned",
"agent",
"for",
"a",
"ticket",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Models/Agent.php#L126-L133 | train |
thekordy/ticketit | src/Models/Agent.php | Agent.isTicketOwner | public static function isTicketOwner($id)
{
if (auth()->check()) {
if (auth()->user()->id == Ticket::find($id)->user->id) {
return true;
}
}
} | php | public static function isTicketOwner($id)
{
if (auth()->check()) {
if (auth()->user()->id == Ticket::find($id)->user->id) {
return true;
}
}
} | [
"public",
"static",
"function",
"isTicketOwner",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"auth",
"(",
")",
"->",
"check",
"(",
")",
")",
"{",
"if",
"(",
"auth",
"(",
")",
"->",
"user",
"(",
")",
"->",
"id",
"==",
"Ticket",
"::",
"find",
"(",
"$",
... | Check if user is the owner for a ticket.
@param int $id ticket id
@return bool | [
"Check",
"if",
"user",
"is",
"the",
"owner",
"for",
"a",
"ticket",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Models/Agent.php#L142-L149 | train |
thekordy/ticketit | src/Controllers/AgentsController.php | AgentsController.addAgents | public function addAgents($user_ids)
{
$users = Agent::find($user_ids);
foreach ($users as $user) {
$user->ticketit_agent = true;
$user->save();
$users_list[] = $user->name;
}
return $users_list;
} | php | public function addAgents($user_ids)
{
$users = Agent::find($user_ids);
foreach ($users as $user) {
$user->ticketit_agent = true;
$user->save();
$users_list[] = $user->name;
}
return $users_list;
} | [
"public",
"function",
"addAgents",
"(",
"$",
"user_ids",
")",
"{",
"$",
"users",
"=",
"Agent",
"::",
"find",
"(",
"$",
"user_ids",
")",
";",
"foreach",
"(",
"$",
"users",
"as",
"$",
"user",
")",
"{",
"$",
"user",
"->",
"ticketit_agent",
"=",
"true",
... | Assign users as agents.
@param $user_ids
@return array | [
"Assign",
"users",
"as",
"agents",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Controllers/AgentsController.php#L73-L83 | train |
thekordy/ticketit | src/Controllers/AgentsController.php | AgentsController.removeAgent | public function removeAgent($id)
{
$agent = Agent::find($id);
$agent->ticketit_agent = false;
$agent->save();
// Remove him from tickets categories as well
if (version_compare(app()->version(), '5.2.0', '>=')) {
$agent_cats = $agent->categories->pluck('id')->toAr... | php | public function removeAgent($id)
{
$agent = Agent::find($id);
$agent->ticketit_agent = false;
$agent->save();
// Remove him from tickets categories as well
if (version_compare(app()->version(), '5.2.0', '>=')) {
$agent_cats = $agent->categories->pluck('id')->toAr... | [
"public",
"function",
"removeAgent",
"(",
"$",
"id",
")",
"{",
"$",
"agent",
"=",
"Agent",
"::",
"find",
"(",
"$",
"id",
")",
";",
"$",
"agent",
"->",
"ticketit_agent",
"=",
"false",
";",
"$",
"agent",
"->",
"save",
"(",
")",
";",
"// Remove him from... | Remove user from the agents.
@param $id
@return mixed | [
"Remove",
"user",
"from",
"the",
"agents",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Controllers/AgentsController.php#L92-L108 | train |
thekordy/ticketit | src/Controllers/AgentsController.php | AgentsController.syncAgentCategories | public function syncAgentCategories($id, Request $request)
{
$form_cats = ($request->input('agent_cats') == null) ? [] : $request->input('agent_cats');
$agent = Agent::find($id);
$agent->categories()->sync($form_cats);
} | php | public function syncAgentCategories($id, Request $request)
{
$form_cats = ($request->input('agent_cats') == null) ? [] : $request->input('agent_cats');
$agent = Agent::find($id);
$agent->categories()->sync($form_cats);
} | [
"public",
"function",
"syncAgentCategories",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"form_cats",
"=",
"(",
"$",
"request",
"->",
"input",
"(",
"'agent_cats'",
")",
"==",
"null",
")",
"?",
"[",
"]",
":",
"$",
"request",
"->",
"... | Sync Agent categories with the selected categories got from update form.
@param $id
@param Request $request | [
"Sync",
"Agent",
"categories",
"with",
"the",
"selected",
"categories",
"got",
"from",
"update",
"form",
"."
] | 55fc54152a2e9d941e114f8c242b7db209c2a47e | https://github.com/thekordy/ticketit/blob/55fc54152a2e9d941e114f8c242b7db209c2a47e/src/Controllers/AgentsController.php#L116-L121 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.