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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
jeremykenedy/laravel-roles | src/RolesServiceProvider.php | RolesServiceProvider.loadSeedsFrom | private function loadSeedsFrom()
{
if (config('roles.defaultSeeds.PermissionsTableSeeder')) {
$this->app['seed.handler']->register(
DefaultPermissionsTableSeeder::class
);
}
if (config('roles.defaultSeeds.RolesTableSeeder')) {
$this->app['... | php | private function loadSeedsFrom()
{
if (config('roles.defaultSeeds.PermissionsTableSeeder')) {
$this->app['seed.handler']->register(
DefaultPermissionsTableSeeder::class
);
}
if (config('roles.defaultSeeds.RolesTableSeeder')) {
$this->app['... | [
"private",
"function",
"loadSeedsFrom",
"(",
")",
"{",
"if",
"(",
"config",
"(",
"'roles.defaultSeeds.PermissionsTableSeeder'",
")",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'seed.handler'",
"]",
"->",
"register",
"(",
"DefaultPermissionsTableSeeder",
"::",
"clas... | Loads a seeds.
@return void | [
"Loads",
"a",
"seeds",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/RolesServiceProvider.php#L58-L83 | train |
jeremykenedy/laravel-roles | src/Traits/HasRoleAndPermission.php | HasRoleAndPermission.hasOneRole | public function hasOneRole($role)
{
foreach ($this->getArrayFrom($role) as $role) {
if ($this->checkRole($role)) {
return true;
}
}
return false;
} | php | public function hasOneRole($role)
{
foreach ($this->getArrayFrom($role) as $role) {
if ($this->checkRole($role)) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasOneRole",
"(",
"$",
"role",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getArrayFrom",
"(",
"$",
"role",
")",
"as",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkRole",
"(",
"$",
"role",
")",
")",
"{",
"re... | Check if the user has at least one of the given roles.
@param int|string|array $role
@return bool | [
"Check",
"if",
"the",
"user",
"has",
"at",
"least",
"one",
"of",
"the",
"given",
"roles",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/Traits/HasRoleAndPermission.php#L78-L87 | train |
jeremykenedy/laravel-roles | src/Traits/HasRoleAndPermission.php | HasRoleAndPermission.checkRole | public function checkRole($role)
{
return $this->getRoles()->contains(function ($value) use ($role) {
return $role == $value->id || Str::is($role, $value->slug);
});
} | php | public function checkRole($role)
{
return $this->getRoles()->contains(function ($value) use ($role) {
return $role == $value->id || Str::is($role, $value->slug);
});
} | [
"public",
"function",
"checkRole",
"(",
"$",
"role",
")",
"{",
"return",
"$",
"this",
"->",
"getRoles",
"(",
")",
"->",
"contains",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"role",
")",
"{",
"return",
"$",
"role",
"==",
"$",
"value... | Check if the user has role.
@param int|string $role
@return bool | [
"Check",
"if",
"the",
"user",
"has",
"role",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/Traits/HasRoleAndPermission.php#L114-L119 | train |
jeremykenedy/laravel-roles | src/Traits/HasRoleAndPermission.php | HasRoleAndPermission.hasOnePermission | public function hasOnePermission($permission)
{
foreach ($this->getArrayFrom($permission) as $permission) {
if ($this->checkPermission($permission)) {
return true;
}
}
return false;
} | php | public function hasOnePermission($permission)
{
foreach ($this->getArrayFrom($permission) as $permission) {
if ($this->checkPermission($permission)) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasOnePermission",
"(",
"$",
"permission",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getArrayFrom",
"(",
"$",
"permission",
")",
"as",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkPermission",
"(",
"$",
"per... | Check if the user has at least one of the given permissions.
@param int|string|array $permission
@return bool | [
"Check",
"if",
"the",
"user",
"has",
"at",
"least",
"one",
"of",
"the",
"given",
"permissions",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/Traits/HasRoleAndPermission.php#L258-L267 | train |
jeremykenedy/laravel-roles | src/Traits/HasRoleAndPermission.php | HasRoleAndPermission.allowed | public function allowed($providedPermission, Model $entity, $owner = true, $ownerColumn = 'user_id')
{
if ($this->isPretendEnabled()) {
return $this->pretend('allowed');
}
if ($owner === true && $entity->{$ownerColumn} == $this->id) {
return true;
}
... | php | public function allowed($providedPermission, Model $entity, $owner = true, $ownerColumn = 'user_id')
{
if ($this->isPretendEnabled()) {
return $this->pretend('allowed');
}
if ($owner === true && $entity->{$ownerColumn} == $this->id) {
return true;
}
... | [
"public",
"function",
"allowed",
"(",
"$",
"providedPermission",
",",
"Model",
"$",
"entity",
",",
"$",
"owner",
"=",
"true",
",",
"$",
"ownerColumn",
"=",
"'user_id'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPretendEnabled",
"(",
")",
")",
"{",
"re... | Check if the user is allowed to manipulate with entity.
@param string $providedPermission
@param Model $entity
@param bool $owner
@param string $ownerColumn
@return bool | [
"Check",
"if",
"the",
"user",
"is",
"allowed",
"to",
"manipulate",
"with",
"entity",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/Traits/HasRoleAndPermission.php#L311-L322 | train |
jeremykenedy/laravel-roles | src/Traits/HasRoleAndPermission.php | HasRoleAndPermission.isAllowed | protected function isAllowed($providedPermission, Model $entity)
{
foreach ($this->getPermissions() as $permission) {
if ($permission->model != '' && get_class($entity) == $permission->model
&& ($permission->id == $providedPermission || $permission->slug === $providedPermission)
... | php | protected function isAllowed($providedPermission, Model $entity)
{
foreach ($this->getPermissions() as $permission) {
if ($permission->model != '' && get_class($entity) == $permission->model
&& ($permission->id == $providedPermission || $permission->slug === $providedPermission)
... | [
"protected",
"function",
"isAllowed",
"(",
"$",
"providedPermission",
",",
"Model",
"$",
"entity",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getPermissions",
"(",
")",
"as",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"permission",
"->",
"model",
"!... | Check if the user is allowed to manipulate with provided entity.
@param string $providedPermission
@param Model $entity
@return bool | [
"Check",
"if",
"the",
"user",
"is",
"allowed",
"to",
"manipulate",
"with",
"provided",
"entity",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/Traits/HasRoleAndPermission.php#L332-L343 | train |
jeremykenedy/laravel-roles | src/Traits/RoleHasRelations.php | RoleHasRelations.attachPermission | public function attachPermission($permission)
{
return (!$this->permissions()->get()->contains($permission)) ? $this->permissions()->attach($permission) : true;
} | php | public function attachPermission($permission)
{
return (!$this->permissions()->get()->contains($permission)) ? $this->permissions()->attach($permission) : true;
} | [
"public",
"function",
"attachPermission",
"(",
"$",
"permission",
")",
"{",
"return",
"(",
"!",
"$",
"this",
"->",
"permissions",
"(",
")",
"->",
"get",
"(",
")",
"->",
"contains",
"(",
"$",
"permission",
")",
")",
"?",
"$",
"this",
"->",
"permissions"... | Attach permission to a role.
@param int|Permission $permission
@return int|bool | [
"Attach",
"permission",
"to",
"a",
"role",
"."
] | c531167d84f353db77a5709e9d3c106a5e9cf5c3 | https://github.com/jeremykenedy/laravel-roles/blob/c531167d84f353db77a5709e9d3c106a5e9cf5c3/src/Traits/RoleHasRelations.php#L37-L40 | train |
J7mbo/twitter-api-php | TwitterAPIExchange.php | TwitterAPIExchange.buildBaseString | private function buildBaseString($baseURI, $method, $params)
{
$return = array();
ksort($params);
foreach($params as $key => $value)
{
$return[] = rawurlencode($key) . '=' . rawurlencode($value);
}
return $method . "&" . rawurlencode($baseURI) . '&' . ra... | php | private function buildBaseString($baseURI, $method, $params)
{
$return = array();
ksort($params);
foreach($params as $key => $value)
{
$return[] = rawurlencode($key) . '=' . rawurlencode($value);
}
return $method . "&" . rawurlencode($baseURI) . '&' . ra... | [
"private",
"function",
"buildBaseString",
"(",
"$",
"baseURI",
",",
"$",
"method",
",",
"$",
"params",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"ksort",
"(",
"$",
"params",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>... | Private method to generate the base string used by cURL
@param string $baseURI
@param string $method
@param array $params
@return string Built base string | [
"Private",
"method",
"to",
"generate",
"the",
"base",
"string",
"used",
"by",
"cURL"
] | f1a84c8c39a854ac7a8bc87e59c997b526c7bbc7 | https://github.com/J7mbo/twitter-api-php/blob/f1a84c8c39a854ac7a8bc87e59c997b526c7bbc7/TwitterAPIExchange.php#L338-L349 | train |
J7mbo/twitter-api-php | TwitterAPIExchange.php | TwitterAPIExchange.request | public function request($url, $method = 'get', $data = null, $curlOptions = array())
{
if (strtolower($method) === 'get')
{
$this->setGetfield($data);
}
else
{
$this->setPostfields($data);
}
return $this->buildOauth($url, $method)->per... | php | public function request($url, $method = 'get', $data = null, $curlOptions = array())
{
if (strtolower($method) === 'get')
{
$this->setGetfield($data);
}
else
{
$this->setPostfields($data);
}
return $this->buildOauth($url, $method)->per... | [
"public",
"function",
"request",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"'get'",
",",
"$",
"data",
"=",
"null",
",",
"$",
"curlOptions",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"strtolower",
"(",
"$",
"method",
")",
"===",
"'get'",
")",
"... | Helper method to perform our request
@param string $url
@param string $method
@param string $data
@param array $curlOptions
@throws \Exception
@return string The json response from the server | [
"Helper",
"method",
"to",
"perform",
"our",
"request"
] | f1a84c8c39a854ac7a8bc87e59c997b526c7bbc7 | https://github.com/J7mbo/twitter-api-php/blob/f1a84c8c39a854ac7a8bc87e59c997b526c7bbc7/TwitterAPIExchange.php#L387-L399 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/WiFi.php | WiFi.buildWifiString | protected function buildWifiString()
{
$wifi = $this->prefix;
if (isset($this->encryption)) {
$wifi .= 'T:'.$this->encryption.$this->separator;
}
if (isset($this->ssid)) {
$wifi .= 'S:'.$this->ssid.$this->separator;
}
if (isset($this->password... | php | protected function buildWifiString()
{
$wifi = $this->prefix;
if (isset($this->encryption)) {
$wifi .= 'T:'.$this->encryption.$this->separator;
}
if (isset($this->ssid)) {
$wifi .= 'S:'.$this->ssid.$this->separator;
}
if (isset($this->password... | [
"protected",
"function",
"buildWifiString",
"(",
")",
"{",
"$",
"wifi",
"=",
"$",
"this",
"->",
"prefix",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"encryption",
")",
")",
"{",
"$",
"wifi",
".=",
"'T:'",
".",
"$",
"this",
"->",
"encryption",
... | Builds the WiFi string.
@return string | [
"Builds",
"the",
"WiFi",
"string",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/WiFi.php#L74-L92 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/WiFi.php | WiFi.setProperties | protected function setProperties(array $arguments)
{
$arguments = $arguments[0];
if (isset($arguments['encryption'])) {
$this->encryption = $arguments['encryption'];
}
if (isset($arguments['ssid'])) {
$this->ssid = $arguments['ssid'];
}
if (iss... | php | protected function setProperties(array $arguments)
{
$arguments = $arguments[0];
if (isset($arguments['encryption'])) {
$this->encryption = $arguments['encryption'];
}
if (isset($arguments['ssid'])) {
$this->ssid = $arguments['ssid'];
}
if (iss... | [
"protected",
"function",
"setProperties",
"(",
"array",
"$",
"arguments",
")",
"{",
"$",
"arguments",
"=",
"$",
"arguments",
"[",
"0",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"arguments",
"[",
"'encryption'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"e... | Sets the WiFi properties.
@param $arguments | [
"Sets",
"the",
"WiFi",
"properties",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/WiFi.php#L99-L114 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/SMS.php | SMS.setProperties | protected function setProperties(array $arguments)
{
if (isset($arguments[0])) {
$this->phoneNumber = $arguments[0];
}
if (isset($arguments[1])) {
$this->message = $arguments[1];
}
} | php | protected function setProperties(array $arguments)
{
if (isset($arguments[0])) {
$this->phoneNumber = $arguments[0];
}
if (isset($arguments[1])) {
$this->message = $arguments[1];
}
} | [
"protected",
"function",
"setProperties",
"(",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"arguments",
"[",
"0",
"]",
")",
")",
"{",
"$",
"this",
"->",
"phoneNumber",
"=",
"$",
"arguments",
"[",
"0",
"]",
";",
"}",
"if",
"("... | Sets the phone number and message for a sms message.
@param array $arguments | [
"Sets",
"the",
"phone",
"number",
"and",
"message",
"for",
"a",
"sms",
"message",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/SMS.php#L60-L68 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/SMS.php | SMS.buildSMSString | protected function buildSMSString()
{
$sms = $this->prefix.$this->phoneNumber;
if (isset($this->message)) {
$sms .= $this->separator.$this->message;
}
return $sms;
} | php | protected function buildSMSString()
{
$sms = $this->prefix.$this->phoneNumber;
if (isset($this->message)) {
$sms .= $this->separator.$this->message;
}
return $sms;
} | [
"protected",
"function",
"buildSMSString",
"(",
")",
"{",
"$",
"sms",
"=",
"$",
"this",
"->",
"prefix",
".",
"$",
"this",
"->",
"phoneNumber",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"message",
")",
")",
"{",
"$",
"sms",
".=",
"$",
"this",... | Builds a SMS string.
@return string | [
"Builds",
"a",
"SMS",
"string",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/SMS.php#L75-L84 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/BTC.php | BTC.setProperties | protected function setProperties(array $arguments)
{
if (isset($arguments[0])) {
$this->address = $arguments[0];
}
if (isset($arguments[1])) {
$this->amount = $arguments[1];
}
if (isset($arguments[2])) {
$this->setOptions($arguments[2]);
... | php | protected function setProperties(array $arguments)
{
if (isset($arguments[0])) {
$this->address = $arguments[0];
}
if (isset($arguments[1])) {
$this->amount = $arguments[1];
}
if (isset($arguments[2])) {
$this->setOptions($arguments[2]);
... | [
"protected",
"function",
"setProperties",
"(",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"arguments",
"[",
"0",
"]",
")",
")",
"{",
"$",
"this",
"->",
"address",
"=",
"$",
"arguments",
"[",
"0",
"]",
";",
"}",
"if",
"(",
... | Sets the BitCoin arguments.
@param array $arguments | [
"Sets",
"the",
"BitCoin",
"arguments",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/BTC.php#L81-L94 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/BTC.php | BTC.setOptions | protected function setOptions(array $options)
{
if (isset($options['label'])) {
$this->label = $options['label'];
}
if (isset($options['message'])) {
$this->message = $options['message'];
}
if (isset($options['returnAddress'])) {
$this->r... | php | protected function setOptions(array $options)
{
if (isset($options['label'])) {
$this->label = $options['label'];
}
if (isset($options['message'])) {
$this->message = $options['message'];
}
if (isset($options['returnAddress'])) {
$this->r... | [
"protected",
"function",
"setOptions",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'label'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"label",
"=",
"$",
"options",
"[",
"'label'",
"]",
";",
"}",
"if",
"(",
... | Sets the optional BitCoin options.
@param array $options | [
"Sets",
"the",
"optional",
"BitCoin",
"options",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/BTC.php#L101-L114 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/DataTypes/BTC.php | BTC.buildBitCoinString | protected function buildBitCoinString()
{
$query = http_build_query([
'amount' => $this->amount,
'label' => $this->label,
'$message' => $this->message,
'r' => $this->returnAddress,
]);
$btc = $this->prefix.$this->address.'?'.$q... | php | protected function buildBitCoinString()
{
$query = http_build_query([
'amount' => $this->amount,
'label' => $this->label,
'$message' => $this->message,
'r' => $this->returnAddress,
]);
$btc = $this->prefix.$this->address.'?'.$q... | [
"protected",
"function",
"buildBitCoinString",
"(",
")",
"{",
"$",
"query",
"=",
"http_build_query",
"(",
"[",
"'amount'",
"=>",
"$",
"this",
"->",
"amount",
",",
"'label'",
"=>",
"$",
"this",
"->",
"label",
",",
"'$message'",
"=>",
"$",
"this",
"->",
"m... | Builds a BitCoin string.
@return string | [
"Builds",
"a",
"BitCoin",
"string",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/DataTypes/BTC.php#L121-L133 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/ImageMerge.php | ImageMerge.merge | public function merge($percentage)
{
$this->setProperties($percentage);
imagecopyresampled(
$this->sourceImage->getImageResource(),
$this->mergeImage->getImageResource(),
$this->centerX,
$this->centerY,
0,
0,
$this-... | php | public function merge($percentage)
{
$this->setProperties($percentage);
imagecopyresampled(
$this->sourceImage->getImageResource(),
$this->mergeImage->getImageResource(),
$this->centerX,
$this->centerY,
0,
0,
$this-... | [
"public",
"function",
"merge",
"(",
"$",
"percentage",
")",
"{",
"$",
"this",
"->",
"setProperties",
"(",
"$",
"percentage",
")",
";",
"imagecopyresampled",
"(",
"$",
"this",
"->",
"sourceImage",
"->",
"getImageResource",
"(",
")",
",",
"$",
"this",
"->",
... | Returns an QrCode that has been merge with another image.
This is usually used with logos to imprint a logo into a QrCode.
@param $percentage float The percentage of size relative to the entire QR of the merged image
@return string | [
"Returns",
"an",
"QrCode",
"that",
"has",
"been",
"merge",
"with",
"another",
"image",
".",
"This",
"is",
"usually",
"used",
"with",
"logos",
"to",
"imprint",
"a",
"logo",
"into",
"a",
"QrCode",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/ImageMerge.php#L97-L115 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/ImageMerge.php | ImageMerge.calculateCenter | private function calculateCenter()
{
$this->centerY = ($this->sourceImageHeight / 2) - ($this->postMergeImageHeight / 2);
$this->centerX = ($this->sourceImageWidth / 2) - ($this->postMergeImageHeight / 2);
} | php | private function calculateCenter()
{
$this->centerY = ($this->sourceImageHeight / 2) - ($this->postMergeImageHeight / 2);
$this->centerX = ($this->sourceImageWidth / 2) - ($this->postMergeImageHeight / 2);
} | [
"private",
"function",
"calculateCenter",
"(",
")",
"{",
"$",
"this",
"->",
"centerY",
"=",
"(",
"$",
"this",
"->",
"sourceImageHeight",
"/",
"2",
")",
"-",
"(",
"$",
"this",
"->",
"postMergeImageHeight",
"/",
"2",
")",
";",
"$",
"this",
"->",
"centerX... | Calculates the center of the source Image using the Merge image. | [
"Calculates",
"the",
"center",
"of",
"the",
"source",
"Image",
"using",
"the",
"Merge",
"image",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/ImageMerge.php#L154-L158 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/ImageMerge.php | ImageMerge.calculateOverlap | private function calculateOverlap($percentage)
{
$this->postMergeImageHeight = $this->sourceImageHeight * $percentage;
$this->postMergeImageWidth = $this->sourceImageWidth * $percentage;
} | php | private function calculateOverlap($percentage)
{
$this->postMergeImageHeight = $this->sourceImageHeight * $percentage;
$this->postMergeImageWidth = $this->sourceImageWidth * $percentage;
} | [
"private",
"function",
"calculateOverlap",
"(",
"$",
"percentage",
")",
"{",
"$",
"this",
"->",
"postMergeImageHeight",
"=",
"$",
"this",
"->",
"sourceImageHeight",
"*",
"$",
"percentage",
";",
"$",
"this",
"->",
"postMergeImageWidth",
"=",
"$",
"this",
"->",
... | Calculates the width of the merge image being placed on the source image.
@param float $percentage | [
"Calculates",
"the",
"width",
"of",
"the",
"merge",
"image",
"being",
"placed",
"on",
"the",
"source",
"image",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/ImageMerge.php#L165-L169 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.generate | public function generate($text, $filename = null)
{
$qrCode = $this->writer->writeString($text, $this->encoding, $this->errorCorrection);
if ($this->imageMerge !== null) {
$merger = new ImageMerge(new Image($qrCode), new Image($this->imageMerge));
$qrCode = $merger->merge($t... | php | public function generate($text, $filename = null)
{
$qrCode = $this->writer->writeString($text, $this->encoding, $this->errorCorrection);
if ($this->imageMerge !== null) {
$merger = new ImageMerge(new Image($qrCode), new Image($this->imageMerge));
$qrCode = $merger->merge($t... | [
"public",
"function",
"generate",
"(",
"$",
"text",
",",
"$",
"filename",
"=",
"null",
")",
"{",
"$",
"qrCode",
"=",
"$",
"this",
"->",
"writer",
"->",
"writeString",
"(",
"$",
"text",
",",
"$",
"this",
"->",
"encoding",
",",
"$",
"this",
"->",
"er... | Generates a QrCode.
@param string $text The text to be converted into a QrCode
@param null|string $filename The filename and path to save the QrCode file
@return string|void Returns a QrCode string depending on the format, or saves to a file. | [
"Generates",
"a",
"QrCode",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L72-L86 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.merge | public function merge($filepath, $percentage = .2, $absolute = false)
{
if (function_exists('base_path') && !$absolute) {
$filepath = base_path().$filepath;
}
$this->imageMerge = file_get_contents($filepath);
$this->imagePercentage = $percentage;
return $this;
... | php | public function merge($filepath, $percentage = .2, $absolute = false)
{
if (function_exists('base_path') && !$absolute) {
$filepath = base_path().$filepath;
}
$this->imageMerge = file_get_contents($filepath);
$this->imagePercentage = $percentage;
return $this;
... | [
"public",
"function",
"merge",
"(",
"$",
"filepath",
",",
"$",
"percentage",
"=",
".2",
",",
"$",
"absolute",
"=",
"false",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'base_path'",
")",
"&&",
"!",
"$",
"absolute",
")",
"{",
"$",
"filepath",
"=",
"... | Merges an image with the center of the QrCode.
@param $filepath string The filepath to an image
@param $percentage float The amount that the merged image should be placed over the qrcode.
@param $absolute boolean Whether to use an absolute filepath or not.
@return $this | [
"Merges",
"an",
"image",
"with",
"the",
"center",
"of",
"the",
"QrCode",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L97-L107 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.mergeString | public function mergeString($content, $percentage = .2)
{
$this->imageMerge = $content;
$this->imagePercentage = $percentage;
return $this;
} | php | public function mergeString($content, $percentage = .2)
{
$this->imageMerge = $content;
$this->imagePercentage = $percentage;
return $this;
} | [
"public",
"function",
"mergeString",
"(",
"$",
"content",
",",
"$",
"percentage",
"=",
".2",
")",
"{",
"$",
"this",
"->",
"imageMerge",
"=",
"$",
"content",
";",
"$",
"this",
"->",
"imagePercentage",
"=",
"$",
"percentage",
";",
"return",
"$",
"this",
... | Merges an image string with the center of the QrCode, does not check for correct format.
@param $content string The string contents of an image.
@param $percentage float The amount that the merged image should be placed over the qrcode.
@return $this | [
"Merges",
"an",
"image",
"string",
"with",
"the",
"center",
"of",
"the",
"QrCode",
"does",
"not",
"check",
"for",
"correct",
"format",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L117-L123 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.format | public function format($format)
{
switch ($format) {
case 'png':
$this->writer->setRenderer(new Png());
break;
case 'eps':
$this->writer->setRenderer(new Eps());
break;
case 'svg':
$this->writ... | php | public function format($format)
{
switch ($format) {
case 'png':
$this->writer->setRenderer(new Png());
break;
case 'eps':
$this->writer->setRenderer(new Eps());
break;
case 'svg':
$this->writ... | [
"public",
"function",
"format",
"(",
"$",
"format",
")",
"{",
"switch",
"(",
"$",
"format",
")",
"{",
"case",
"'png'",
":",
"$",
"this",
"->",
"writer",
"->",
"setRenderer",
"(",
"new",
"Png",
"(",
")",
")",
";",
"break",
";",
"case",
"'eps'",
":",... | Switches the format of the outputted QrCode or defaults to SVG.
@param string $format The desired format.
@throws \InvalidArgumentException
@return $this | [
"Switches",
"the",
"format",
"of",
"the",
"outputted",
"QrCode",
"or",
"defaults",
"to",
"SVG",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L134-L151 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.size | public function size($pixels)
{
$this->writer->getRenderer()->setHeight($pixels);
$this->writer->getRenderer()->setWidth($pixels);
return $this;
} | php | public function size($pixels)
{
$this->writer->getRenderer()->setHeight($pixels);
$this->writer->getRenderer()->setWidth($pixels);
return $this;
} | [
"public",
"function",
"size",
"(",
"$",
"pixels",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"getRenderer",
"(",
")",
"->",
"setHeight",
"(",
"$",
"pixels",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"getRenderer",
"(",
")",
"->",
"setWidth",
"("... | Changes the size of the QrCode.
@param int $pixels The size of the QrCode in pixels
@return $this | [
"Changes",
"the",
"size",
"of",
"the",
"QrCode",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L160-L166 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.color | public function color($red, $green, $blue)
{
$this->writer->getRenderer()->setForegroundColor(new Rgb($red, $green, $blue));
return $this;
} | php | public function color($red, $green, $blue)
{
$this->writer->getRenderer()->setForegroundColor(new Rgb($red, $green, $blue));
return $this;
} | [
"public",
"function",
"color",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"getRenderer",
"(",
")",
"->",
"setForegroundColor",
"(",
"new",
"Rgb",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
... | Changes the foreground color of a QrCode.
@param int $red
@param int $green
@param int $blue
@return $this | [
"Changes",
"the",
"foreground",
"color",
"of",
"a",
"QrCode",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L177-L182 | train |
SimpleSoftwareIO/simple-qrcode | src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php | BaconQrCodeGenerator.backgroundColor | public function backgroundColor($red, $green, $blue)
{
$this->writer->getRenderer()->setBackgroundColor(new Rgb($red, $green, $blue));
return $this;
} | php | public function backgroundColor($red, $green, $blue)
{
$this->writer->getRenderer()->setBackgroundColor(new Rgb($red, $green, $blue));
return $this;
} | [
"public",
"function",
"backgroundColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"getRenderer",
"(",
")",
"->",
"setBackgroundColor",
"(",
"new",
"Rgb",
"(",
"$",
"red",
",",
"$",
"green",
",... | Changes the background color of a QrCode.
@param int $red
@param int $green
@param int $blue
@return $this | [
"Changes",
"the",
"background",
"color",
"of",
"a",
"QrCode",
"."
] | 4968df591efa38f91cbce801a7e63a990e28feea | https://github.com/SimpleSoftwareIO/simple-qrcode/blob/4968df591efa38f91cbce801a7e63a990e28feea/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php#L193-L198 | train |
fisharebest/webtrees | app/Auth.php | Auth.login | public static function login(UserInterface $user): void
{
Session::regenerate(false);
Session::put('wt_user', $user->id());
} | php | public static function login(UserInterface $user): void
{
Session::regenerate(false);
Session::put('wt_user', $user->id());
} | [
"public",
"static",
"function",
"login",
"(",
"UserInterface",
"$",
"user",
")",
":",
"void",
"{",
"Session",
"::",
"regenerate",
"(",
"false",
")",
";",
"Session",
"::",
"put",
"(",
"'wt_user'",
",",
"$",
"user",
"->",
"id",
"(",
")",
")",
";",
"}"
... | Login directly as an explicit user - for masquerading.
@param UserInterface $user
@return void | [
"Login",
"directly",
"as",
"an",
"explicit",
"user",
"-",
"for",
"masquerading",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Auth.php#L184-L188 | train |
fisharebest/webtrees | app/Report/ReportHtmlLine.php | ReportHtmlLine.render | public function render($renderer)
{
if ($this->x1 === ReportBaseElement::CURRENT_POSITION) {
$this->x1 = $renderer->getX();
}
if ($this->y1 === ReportBaseElement::CURRENT_POSITION) {
$this->y1 = $renderer->getY();
}
if ($this->x2 === ReportBaseElement:... | php | public function render($renderer)
{
if ($this->x1 === ReportBaseElement::CURRENT_POSITION) {
$this->x1 = $renderer->getX();
}
if ($this->y1 === ReportBaseElement::CURRENT_POSITION) {
$this->y1 = $renderer->getY();
}
if ($this->x2 === ReportBaseElement:... | [
"public",
"function",
"render",
"(",
"$",
"renderer",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"x1",
"===",
"ReportBaseElement",
"::",
"CURRENT_POSITION",
")",
"{",
"$",
"this",
"->",
"x1",
"=",
"$",
"renderer",
"->",
"getX",
"(",
")",
";",
"}",
"if",... | HTML line renderer
@param ReportHtml $renderer
@return void | [
"HTML",
"line",
"renderer"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtmlLine.php#L32-L58 | train |
fisharebest/webtrees | app/GedcomCode/GedcomCodeQuay.php | GedcomCodeQuay.getValues | public static function getValues(): array
{
$values = [];
foreach (self::TYPES as $type) {
$values[$type] = self::getValue($type);
}
return $values;
} | php | public static function getValues(): array
{
$values = [];
foreach (self::TYPES as $type) {
$values[$type] = self::getValue($type);
}
return $values;
} | [
"public",
"static",
"function",
"getValues",
"(",
")",
":",
"array",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"TYPES",
"as",
"$",
"type",
")",
"{",
"$",
"values",
"[",
"$",
"type",
"]",
"=",
"self",
"::",
"getValue",
... | A list of all possible values for QUAY
@return string[] | [
"A",
"list",
"of",
"all",
"possible",
"values",
"for",
"QUAY"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomCode/GedcomCodeQuay.php#L67-L75 | train |
fisharebest/webtrees | app/Module/CustomCssJsModule.php | CustomCssJsModule.getAdminAction | public function getAdminAction(): ResponseInterface
{
$this->layout = 'layouts/administration';
return $this->viewResponse('modules/custom-css-js/edit', [
'title' => $this->title(),
'head' => $this->getPreference('head'),
'body' => $this->getPreference('body'),... | php | public function getAdminAction(): ResponseInterface
{
$this->layout = 'layouts/administration';
return $this->viewResponse('modules/custom-css-js/edit', [
'title' => $this->title(),
'head' => $this->getPreference('head'),
'body' => $this->getPreference('body'),... | [
"public",
"function",
"getAdminAction",
"(",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"layout",
"=",
"'layouts/administration'",
";",
"return",
"$",
"this",
"->",
"viewResponse",
"(",
"'modules/custom-css-js/edit'",
",",
"[",
"'title'",
"=>",
"$",
... | Show a form to edit the user CSS and JS.
@return ResponseInterface | [
"Show",
"a",
"form",
"to",
"edit",
"the",
"user",
"CSS",
"and",
"JS",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/CustomCssJsModule.php#L59-L68 | train |
fisharebest/webtrees | app/Statistics/Repository/EventRepository.php | EventRepository.getCommonFacts | private function getCommonFacts(): array
{
// The list of facts used to limit the query result
return array_merge(
Gedcom::BIRTH_EVENTS,
Gedcom::MARRIAGE_EVENTS,
Gedcom::DIVORCE_EVENTS,
Gedcom::DEATH_EVENTS
);
} | php | private function getCommonFacts(): array
{
// The list of facts used to limit the query result
return array_merge(
Gedcom::BIRTH_EVENTS,
Gedcom::MARRIAGE_EVENTS,
Gedcom::DIVORCE_EVENTS,
Gedcom::DEATH_EVENTS
);
} | [
"private",
"function",
"getCommonFacts",
"(",
")",
":",
"array",
"{",
"// The list of facts used to limit the query result",
"return",
"array_merge",
"(",
"Gedcom",
"::",
"BIRTH_EVENTS",
",",
"Gedcom",
"::",
"MARRIAGE_EVENTS",
",",
"Gedcom",
"::",
"DIVORCE_EVENTS",
",",... | Retursn the list of common facts used query the data.
@return array | [
"Retursn",
"the",
"list",
"of",
"common",
"facts",
"used",
"query",
"the",
"data",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Repository/EventRepository.php#L186-L195 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.startElement | protected function startElement($parser, string $name, array $attrs): void
{
$newattrs = [];
foreach ($attrs as $key => $value) {
if (preg_match("/^\\$(\w+)$/", $value, $match)) {
if (isset($this->vars[$match[1]]['id']) && !isset($this->vars[$match[1]]['gedcom'])) {
... | php | protected function startElement($parser, string $name, array $attrs): void
{
$newattrs = [];
foreach ($attrs as $key => $value) {
if (preg_match("/^\\$(\w+)$/", $value, $match)) {
if (isset($this->vars[$match[1]]['id']) && !isset($this->vars[$match[1]]['gedcom'])) {
... | [
"protected",
"function",
"startElement",
"(",
"$",
"parser",
",",
"string",
"$",
"name",
",",
"array",
"$",
"attrs",
")",
":",
"void",
"{",
"$",
"newattrs",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"attrs",
"as",
"$",
"key",
"=>",
"$",
"value",
")"... | XML start element handler
This function is called whenever a starting element is reached
The element handler will be called if found, otherwise it must be HTML
@param resource $parser the resource handler for the XML parser
@param string $name the name of the XML element parsed
@param string[] $attrs an array of ... | [
"XML",
"start",
"element",
"handler",
"This",
"function",
"is",
"called",
"whenever",
"a",
"starting",
"element",
"is",
"reached",
"The",
"element",
"handler",
"will",
"be",
"called",
"if",
"found",
"otherwise",
"it",
"must",
"be",
"HTML"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L165-L188 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.endElement | protected function endElement($parser, string $name): void
{
if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name =... | php | protected function endElement($parser, string $name): void
{
if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name =... | [
"protected",
"function",
"endElement",
"(",
"$",
"parser",
",",
"string",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"process_footnote",
"||",
"$",
"name",
"===",
"'Footnote'",
")",
"&&",
"(",
"$",
"this",
"->",
"process_ifs... | XML end element handler
This function is called whenever an ending element is reached
The element handler will be called if found, otherwise it must be HTML
@param resource $parser the resource handler for the XML parser
@param string $name the name of the XML element parsed
@return void | [
"XML",
"end",
"element",
"handler",
"This",
"function",
"is",
"called",
"whenever",
"an",
"ending",
"element",
"is",
"reached",
"The",
"element",
"handler",
"will",
"be",
"called",
"if",
"found",
"otherwise",
"it",
"must",
"be",
"HTML"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L200-L211 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.characterData | protected function characterData($parser, $data): void
{
if ($this->print_data && $this->process_gedcoms === 0 && $this->process_ifs === 0 && $this->process_repeats === 0) {
$this->current_element->addText($data);
}
} | php | protected function characterData($parser, $data): void
{
if ($this->print_data && $this->process_gedcoms === 0 && $this->process_ifs === 0 && $this->process_repeats === 0) {
$this->current_element->addText($data);
}
} | [
"protected",
"function",
"characterData",
"(",
"$",
"parser",
",",
"$",
"data",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"print_data",
"&&",
"$",
"this",
"->",
"process_gedcoms",
"===",
"0",
"&&",
"$",
"this",
"->",
"process_ifs",
"===",
"0... | XML character data handler
@param resource $parser the resource handler for the XML parser
@param string $data the name of the XML element parsed
@return void | [
"XML",
"character",
"data",
"handler"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L221-L226 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.gedcomStartHandler | private function gedcomStartHandler(array $attrs): void
{
if ($this->process_gedcoms > 0) {
$this->process_gedcoms++;
return;
}
$tag = $attrs['id'];
$tag = str_replace('@fact', $this->fact, $tag);
$tags = explode(':', $tag);
... | php | private function gedcomStartHandler(array $attrs): void
{
if ($this->process_gedcoms > 0) {
$this->process_gedcoms++;
return;
}
$tag = $attrs['id'];
$tag = str_replace('@fact', $this->fact, $tag);
$tags = explode(':', $tag);
... | [
"private",
"function",
"gedcomStartHandler",
"(",
"array",
"$",
"attrs",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"process_gedcoms",
">",
"0",
")",
"{",
"$",
"this",
"->",
"process_gedcoms",
"++",
";",
"return",
";",
"}",
"$",
"tag",
"=",
... | Called at the start of an element.
@param string[] $attrs an array of key value pairs for the attributes
@return void | [
"Called",
"at",
"the",
"start",
"of",
"an",
"element",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L638-L695 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.gedcomEndHandler | private function gedcomEndHandler(): void
{
if ($this->process_gedcoms > 0) {
$this->process_gedcoms--;
} else {
[$this->gedrec, $this->fact, $this->desc] = array_pop($this->gedrec_stack);
}
} | php | private function gedcomEndHandler(): void
{
if ($this->process_gedcoms > 0) {
$this->process_gedcoms--;
} else {
[$this->gedrec, $this->fact, $this->desc] = array_pop($this->gedrec_stack);
}
} | [
"private",
"function",
"gedcomEndHandler",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"process_gedcoms",
">",
"0",
")",
"{",
"$",
"this",
"->",
"process_gedcoms",
"--",
";",
"}",
"else",
"{",
"[",
"$",
"this",
"->",
"gedrec",
",",
"$",... | Called at the end of an element.
@return void | [
"Called",
"at",
"the",
"end",
"of",
"an",
"element",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L702-L709 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.addDescendancy | private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
{
$person = Individual::getInstance($pid, $this->tree);
if ($person === null) {
return;
}
if (!isset($list[$pid])) {
$list[$pid] = $person;
}
if (!isset($l... | php | private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
{
$person = Individual::getInstance($pid, $this->tree);
if ($person === null) {
return;
}
if (!isset($list[$pid])) {
$list[$pid] = $person;
}
if (!isset($l... | [
"private",
"function",
"addDescendancy",
"(",
"&",
"$",
"list",
",",
"$",
"pid",
",",
"$",
"parents",
"=",
"false",
",",
"$",
"generations",
"=",
"-",
"1",
")",
":",
"void",
"{",
"$",
"person",
"=",
"Individual",
"::",
"getInstance",
"(",
"$",
"pid",... | Create a list of all descendants.
@param string[] $list
@param string $pid
@param bool $parents
@param int $generations
@return void | [
"Create",
"a",
"list",
"of",
"all",
"descendants",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L2696-L2749 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.addAncestors | private function addAncestors(array &$list, string $pid, bool $children = false, int $generations = -1): void
{
$genlist = [$pid];
$list[$pid]->generation = 1;
while (count($genlist) > 0) {
$id = array_shift($genlist);
if (strpos($id, 'empty') === 0) {
... | php | private function addAncestors(array &$list, string $pid, bool $children = false, int $generations = -1): void
{
$genlist = [$pid];
$list[$pid]->generation = 1;
while (count($genlist) > 0) {
$id = array_shift($genlist);
if (strpos($id, 'empty') === 0) {
... | [
"private",
"function",
"addAncestors",
"(",
"array",
"&",
"$",
"list",
",",
"string",
"$",
"pid",
",",
"bool",
"$",
"children",
"=",
"false",
",",
"int",
"$",
"generations",
"=",
"-",
"1",
")",
":",
"void",
"{",
"$",
"genlist",
"=",
"[",
"$",
"pid"... | Create a list of all ancestors.
@param string[] $list
@param string $pid
@param bool $children
@param int $generations
@return void | [
"Create",
"a",
"list",
"of",
"all",
"ancestors",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L2761-L2798 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.getGedcomValue | private function getGedcomValue($tag, $level, $gedrec): string
{
if (empty($gedrec)) {
return '';
}
$tags = explode(':', $tag);
$origlevel = $level;
if ($level == 0) {
$level = $gedrec[0] + 1;
}
$subrec = $gedrec;
foreach ... | php | private function getGedcomValue($tag, $level, $gedrec): string
{
if (empty($gedrec)) {
return '';
}
$tags = explode(':', $tag);
$origlevel = $level;
if ($level == 0) {
$level = $gedrec[0] + 1;
}
$subrec = $gedrec;
foreach ... | [
"private",
"function",
"getGedcomValue",
"(",
"$",
"tag",
",",
"$",
"level",
",",
"$",
"gedrec",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"gedrec",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"tags",
"=",
"explode",
"(",
"':'",
",... | get gedcom tag value
@param string $tag The tag to find, use : to delineate subtags
@param int $level The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record
@param string $gedrec The gedcom record to get the value from
@return string the valu... | [
"get",
"gedcom",
"tag",
"value"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L2809-L2874 | train |
fisharebest/webtrees | app/Report/ReportParserGenerate.php | ReportParserGenerate.substituteVars | private function substituteVars($expression, $quote): string
{
return preg_replace_callback(
'/\$(\w+)/',
function (array $matches) use ($quote): string {
if (isset($this->vars[$matches[1]]['id'])) {
if ($quote) {
return "'"... | php | private function substituteVars($expression, $quote): string
{
return preg_replace_callback(
'/\$(\w+)/',
function (array $matches) use ($quote): string {
if (isset($this->vars[$matches[1]]['id'])) {
if ($quote) {
return "'"... | [
"private",
"function",
"substituteVars",
"(",
"$",
"expression",
",",
"$",
"quote",
")",
":",
"string",
"{",
"return",
"preg_replace_callback",
"(",
"'/\\$(\\w+)/'",
",",
"function",
"(",
"array",
"$",
"matches",
")",
"use",
"(",
"$",
"quote",
")",
":",
"s... | Replace variable identifiers with their values.
@param string $expression An expression such as "$foo == 123"
@param bool $quote Whether to add quotation marks
@return string | [
"Replace",
"variable",
"identifiers",
"with",
"their",
"values",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportParserGenerate.php#L2884-L2903 | train |
fisharebest/webtrees | app/File.php | File.mkdir | public static function mkdir($path): bool
{
if (is_dir($path)) {
return true;
}
if (dirname($path) && !is_dir(dirname($path))) {
self::mkdir(dirname($path));
}
try {
mkdir($path);
return true;
} catch (Throwable $ex) ... | php | public static function mkdir($path): bool
{
if (is_dir($path)) {
return true;
}
if (dirname($path) && !is_dir(dirname($path))) {
self::mkdir(dirname($path));
}
try {
mkdir($path);
return true;
} catch (Throwable $ex) ... | [
"public",
"static",
"function",
"mkdir",
"(",
"$",
"path",
")",
":",
"bool",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"dirname",
"(",
"$",
"path",
")",
"&&",
"!",
"is_dir",
"(",
"dirname",
... | Create a folder, and sub-folders, if it does not already exist
@param string $path
@return bool Does the folder now exist | [
"Create",
"a",
"folder",
"and",
"sub",
"-",
"folders",
"if",
"it",
"does",
"not",
"already",
"exist"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/File.php#L34-L51 | train |
fisharebest/webtrees | app/Functions/FunctionsPrintLists.php | FunctionsPrintLists.surnameTagCloud | public static function surnameTagCloud(array $surnames, ?ModuleListInterface $module, bool $totals, Tree $tree): string
{
$minimum = PHP_INT_MAX;
$maximum = 1;
foreach ($surnames as $surn => $surns) {
foreach ($surns as $spfxsurn => $count) {
$maximum = max($maxim... | php | public static function surnameTagCloud(array $surnames, ?ModuleListInterface $module, bool $totals, Tree $tree): string
{
$minimum = PHP_INT_MAX;
$maximum = 1;
foreach ($surnames as $surn => $surns) {
foreach ($surns as $spfxsurn => $count) {
$maximum = max($maxim... | [
"public",
"static",
"function",
"surnameTagCloud",
"(",
"array",
"$",
"surnames",
",",
"?",
"ModuleListInterface",
"$",
"module",
",",
"bool",
"$",
"totals",
",",
"Tree",
"$",
"tree",
")",
":",
"string",
"{",
"$",
"minimum",
"=",
"PHP_INT_MAX",
";",
"$",
... | Print a tagcloud of surnames.
@param int[][] $surnames array (of SURN, of array of SPFX_SURN, of counts)
@param ModuleListInterface|null $module
@param bool $totals show totals after each name
@param Tree $tree generate links to this tree
@return string | [
"Print",
"a",
"tagcloud",
"of",
"surnames",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsPrintLists.php#L39-L77 | train |
fisharebest/webtrees | app/Functions/FunctionsPrintLists.php | FunctionsPrintLists.surnameList | public static function surnameList($surnames, $style, $totals, ?ModuleListInterface $module, Tree $tree): string
{
$html = [];
foreach ($surnames as $surn => $surns) {
// Each surname links back to the indilist
if ($module instanceof ModuleListInterface) {
if ... | php | public static function surnameList($surnames, $style, $totals, ?ModuleListInterface $module, Tree $tree): string
{
$html = [];
foreach ($surnames as $surn => $surns) {
// Each surname links back to the indilist
if ($module instanceof ModuleListInterface) {
if ... | [
"public",
"static",
"function",
"surnameList",
"(",
"$",
"surnames",
",",
"$",
"style",
",",
"$",
"totals",
",",
"?",
"ModuleListInterface",
"$",
"module",
",",
"Tree",
"$",
"tree",
")",
":",
"string",
"{",
"$",
"html",
"=",
"[",
"]",
";",
"foreach",
... | Print a list of surnames.
@param int[][] $surnames counts of surname by variant
@param int $style 1=bullet list, 2=semicolon-separated list, 3=tabulated list with up to 4 columns
@param bool $totals show totals after each name
@param ModuleListInterface|nu... | [
"Print",
"a",
"list",
"of",
"surnames",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsPrintLists.php#L90-L157 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/ModuleController.php | ModuleController.list | public function list(): ResponseInterface
{
return $this->viewResponse('admin/modules', [
'title' => I18N::translate('All modules'),
'modules' => $this->module_service->all(true),
'deleted_modules' => $this->module_service->deletedModules(),
]);
... | php | public function list(): ResponseInterface
{
return $this->viewResponse('admin/modules', [
'title' => I18N::translate('All modules'),
'modules' => $this->module_service->all(true),
'deleted_modules' => $this->module_service->deletedModules(),
]);
... | [
"public",
"function",
"list",
"(",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"viewResponse",
"(",
"'admin/modules'",
",",
"[",
"'title'",
"=>",
"I18N",
"::",
"translate",
"(",
"'All modules'",
")",
",",
"'modules'",
"=>",
"$",
"this",
... | Show the administrator a list of modules.
@return ResponseInterface | [
"Show",
"the",
"administrator",
"a",
"list",
"of",
"modules",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/ModuleController.php#L83-L90 | train |
fisharebest/webtrees | app/Module/ColorsTheme.php | ColorsTheme.menuPalette | public function menuPalette(): Menu
{
$request = app(ServerRequestInterface::class);
/* I18N: A colour scheme */
$menu = new Menu(I18N::translate('Palette'), '#', 'menu-color');
foreach ($this->palettes() as $palette_id => $palette_name) {
$url = (string) $request->getU... | php | public function menuPalette(): Menu
{
$request = app(ServerRequestInterface::class);
/* I18N: A colour scheme */
$menu = new Menu(I18N::translate('Palette'), '#', 'menu-color');
foreach ($this->palettes() as $palette_id => $palette_name) {
$url = (string) $request->getU... | [
"public",
"function",
"menuPalette",
"(",
")",
":",
"Menu",
"{",
"$",
"request",
"=",
"app",
"(",
"ServerRequestInterface",
"::",
"class",
")",
";",
"/* I18N: A colour scheme */",
"$",
"menu",
"=",
"new",
"Menu",
"(",
"I18N",
"::",
"translate",
"(",
"'Palett... | Create a menu of palette options
@return Menu | [
"Create",
"a",
"menu",
"of",
"palette",
"options"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/ColorsTheme.php#L71-L94 | train |
fisharebest/webtrees | app/Carbon.php | Carbon.local | public function local(): Carbon
{
$locale = app(LocaleInterface::class)->code();
$timezone = Auth::user()->getPreference('TIMEZONE', Site::getPreference('TIMEZONE', 'UTC'));
return $this->locale($locale)->setTimezone($timezone);
} | php | public function local(): Carbon
{
$locale = app(LocaleInterface::class)->code();
$timezone = Auth::user()->getPreference('TIMEZONE', Site::getPreference('TIMEZONE', 'UTC'));
return $this->locale($locale)->setTimezone($timezone);
} | [
"public",
"function",
"local",
"(",
")",
":",
"Carbon",
"{",
"$",
"locale",
"=",
"app",
"(",
"LocaleInterface",
"::",
"class",
")",
"->",
"code",
"(",
")",
";",
"$",
"timezone",
"=",
"Auth",
"::",
"user",
"(",
")",
"->",
"getPreference",
"(",
"'TIMEZ... | Create a local timestamp for the current user.
@return Carbon | [
"Create",
"a",
"local",
"timestamp",
"for",
"the",
"current",
"user",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Carbon.php#L46-L52 | train |
fisharebest/webtrees | app/Module/IndividualFactsTabModule.php | IndividualFactsTabModule.historicalFacts | private function historicalFacts(Individual $individual): array
{
return $this->module_service->findByInterface(ModuleHistoricEventsInterface::class)
->map(static function (ModuleHistoricEventsInterface $module) use ($individual): Collection {
return $module->historicEventsForInd... | php | private function historicalFacts(Individual $individual): array
{
return $this->module_service->findByInterface(ModuleHistoricEventsInterface::class)
->map(static function (ModuleHistoricEventsInterface $module) use ($individual): Collection {
return $module->historicEventsForInd... | [
"private",
"function",
"historicalFacts",
"(",
"Individual",
"$",
"individual",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"module_service",
"->",
"findByInterface",
"(",
"ModuleHistoricEventsInterface",
"::",
"class",
")",
"->",
"map",
"(",
"static",
... | Get any historical events.
@param Individual $individual
@return Fact[] | [
"Get",
"any",
"historical",
"events",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/IndividualFactsTabModule.php#L453-L461 | train |
fisharebest/webtrees | app/Module/IndividualFactsTabModule.php | IndividualFactsTabModule.associateFacts | private function associateFacts(Individual $person): array
{
$facts = [];
/** @var Individual[] $associates */
$associates = array_merge(
$person->linkedIndividuals('ASSO'),
$person->linkedIndividuals('_ASSO'),
$person->linkedFamilies('ASSO'),
... | php | private function associateFacts(Individual $person): array
{
$facts = [];
/** @var Individual[] $associates */
$associates = array_merge(
$person->linkedIndividuals('ASSO'),
$person->linkedIndividuals('_ASSO'),
$person->linkedFamilies('ASSO'),
... | [
"private",
"function",
"associateFacts",
"(",
"Individual",
"$",
"person",
")",
":",
"array",
"{",
"$",
"facts",
"=",
"[",
"]",
";",
"/** @var Individual[] $associates */",
"$",
"associates",
"=",
"array_merge",
"(",
"$",
"person",
"->",
"linkedIndividuals",
"("... | Get the events of associates.
@param Individual $person
@return Fact[] | [
"Get",
"the",
"events",
"of",
"associates",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/IndividualFactsTabModule.php#L470-L509 | train |
fisharebest/webtrees | app/Http/Controllers/SearchController.php | SearchController.quick | public function quick(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$query = $request->get('query', '');
// Was the search query an XREF in the current tree?
// If so, go straight to it.
$record = GedcomRecord::getInstance($query, $tree);
if ($record !==... | php | public function quick(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$query = $request->get('query', '');
// Was the search query an XREF in the current tree?
// If so, go straight to it.
$record = GedcomRecord::getInstance($query, $tree);
if ($record !==... | [
"public",
"function",
"quick",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"query",
"=",
"$",
"request",
"->",
"get",
"(",
"'query'",
",",
"''",
")",
";",
"// Was the search query an XREF in... | The "omni-search" box in the header.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"The",
"omni",
"-",
"search",
"box",
"in",
"the",
"header",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/SearchController.php#L144-L157 | train |
fisharebest/webtrees | app/Http/Controllers/SearchController.php | SearchController.extractSearchTerms | private function extractSearchTerms(string $query): array
{
$search_terms = [];
// Words in double quotes stay together
while (preg_match('/"([^"]+)"/', $query, $match)) {
$search_terms[] = trim($match[1]);
$query = str_replace($match[0], '', $query);
... | php | private function extractSearchTerms(string $query): array
{
$search_terms = [];
// Words in double quotes stay together
while (preg_match('/"([^"]+)"/', $query, $match)) {
$search_terms[] = trim($match[1]);
$query = str_replace($match[0], '', $query);
... | [
"private",
"function",
"extractSearchTerms",
"(",
"string",
"$",
"query",
")",
":",
"array",
"{",
"$",
"search_terms",
"=",
"[",
"]",
";",
"// Words in double quotes stay together",
"while",
"(",
"preg_match",
"(",
"'/\"([^\"]+)\"/'",
",",
"$",
"query",
",",
"$"... | Convert the query into an array of search terms
@param string $query
@return string[] | [
"Convert",
"the",
"query",
"into",
"an",
"array",
"of",
"search",
"terms"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/SearchController.php#L281-L298 | train |
fisharebest/webtrees | app/Http/Controllers/SearchController.php | SearchController.phonetic | public function phonetic(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$firstname = $request->get('firstname', '');
$lastname = $request->get('lastname', '');
$place = $request->get('place', '');
$soundex = $request->get('soundex', 'Russell');
// W... | php | public function phonetic(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$firstname = $request->get('firstname', '');
$lastname = $request->get('lastname', '');
$place = $request->get('place', '');
$soundex = $request->get('soundex', 'Russell');
// W... | [
"public",
"function",
"phonetic",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"firstname",
"=",
"$",
"request",
"->",
"get",
"(",
"'firstname'",
",",
"''",
")",
";",
"$",
"lastname",
"="... | The phonetic search.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"The",
"phonetic",
"search",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/SearchController.php#L308-L346 | train |
fisharebest/webtrees | app/Http/Controllers/SearchController.php | SearchController.advanced | public function advanced(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$default_fields = array_fill_keys(self::DEFAULT_ADVANCED_FIELDS, '');
$fields = $request->get('fields', $default_fields);
$modifiers = $request->get('modifiers', []);
$other_field = $re... | php | public function advanced(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$default_fields = array_fill_keys(self::DEFAULT_ADVANCED_FIELDS, '');
$fields = $request->get('fields', $default_fields);
$modifiers = $request->get('modifiers', []);
$other_field = $re... | [
"public",
"function",
"advanced",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"default_fields",
"=",
"array_fill_keys",
"(",
"self",
"::",
"DEFAULT_ADVANCED_FIELDS",
",",
"''",
")",
";",
"$",
... | A structured search.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"A",
"structured",
"search",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/SearchController.php#L537-L571 | train |
fisharebest/webtrees | app/Http/Controllers/SearchController.php | SearchController.otherFields | private function otherFields(array $fields): array
{
$unused = array_diff(self::OTHER_ADVANCED_FIELDS, array_keys($fields));
$other_fileds = [];
foreach ($unused as $tag) {
$other_fileds[$tag] = GedcomTag::getLabel($tag);
}
return $other_fileds;
} | php | private function otherFields(array $fields): array
{
$unused = array_diff(self::OTHER_ADVANCED_FIELDS, array_keys($fields));
$other_fileds = [];
foreach ($unused as $tag) {
$other_fileds[$tag] = GedcomTag::getLabel($tag);
}
return $other_fileds;
} | [
"private",
"function",
"otherFields",
"(",
"array",
"$",
"fields",
")",
":",
"array",
"{",
"$",
"unused",
"=",
"array_diff",
"(",
"self",
"::",
"OTHER_ADVANCED_FIELDS",
",",
"array_keys",
"(",
"$",
"fields",
")",
")",
";",
"$",
"other_fileds",
"=",
"[",
... | Extra search fields to add to the advanced search
@param string[] $fields
@return string[] | [
"Extra",
"search",
"fields",
"to",
"add",
"to",
"the",
"advanced",
"search"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/SearchController.php#L580-L591 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.getIso3166Countries | private function getIso3166Countries(): array
{
$countries = $this->country_service->getAllCountries();
// Get the country names for each language
$country_to_iso3166 = [];
foreach (I18N::activeLocales() as $locale) {
I18N::init($locale->languageTag());
for... | php | private function getIso3166Countries(): array
{
$countries = $this->country_service->getAllCountries();
// Get the country names for each language
$country_to_iso3166 = [];
foreach (I18N::activeLocales() as $locale) {
I18N::init($locale->languageTag());
for... | [
"private",
"function",
"getIso3166Countries",
"(",
")",
":",
"array",
"{",
"$",
"countries",
"=",
"$",
"this",
"->",
"country_service",
"->",
"getAllCountries",
"(",
")",
";",
"// Get the country names for each language",
"$",
"country_to_iso3166",
"=",
"[",
"]",
... | Returns the country names for each language.
@return string[] | [
"Returns",
"the",
"country",
"names",
"for",
"each",
"language",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L88-L105 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.createChartData | private function createChartData(array $places): array
{
$data = [
[
I18N::translate('Country'),
I18N::translate('Total'),
],
];
// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
... | php | private function createChartData(array $places): array
{
$data = [
[
I18N::translate('Country'),
I18N::translate('Total'),
],
];
// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes.
... | [
"private",
"function",
"createChartData",
"(",
"array",
"$",
"places",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"[",
"I18N",
"::",
"translate",
"(",
"'Country'",
")",
",",
"I18N",
"::",
"translate",
"(",
"'Total'",
")",
",",
"]",
",",
"]",
";",... | Returns the data structure required by google geochart.
@param array $places
@return array | [
"Returns",
"the",
"data",
"structure",
"required",
"by",
"google",
"geochart",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L114-L135 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.getBirthChartData | private function getBirthChartData(): array
{
// Count how many people were born in each country
$surn_countries = [];
$b_countries = $this->placeRepository->statsPlaces('INDI', 'BIRT', 0, true);
foreach ($b_countries as $country => $count) {
// Consolidate places (Ge... | php | private function getBirthChartData(): array
{
// Count how many people were born in each country
$surn_countries = [];
$b_countries = $this->placeRepository->statsPlaces('INDI', 'BIRT', 0, true);
foreach ($b_countries as $country => $count) {
// Consolidate places (Ge... | [
"private",
"function",
"getBirthChartData",
"(",
")",
":",
"array",
"{",
"// Count how many people were born in each country",
"$",
"surn_countries",
"=",
"[",
"]",
";",
"$",
"b_countries",
"=",
"$",
"this",
"->",
"placeRepository",
"->",
"statsPlaces",
"(",
"'INDI'... | Returns the google geochart data for birth fact.
@return array | [
"Returns",
"the",
"google",
"geochart",
"data",
"for",
"birth",
"fact",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L142-L162 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.getDeathChartData | private function getDeathChartData(): array
{
// Count how many people were death in each country
$surn_countries = [];
$d_countries = $this->placeRepository->statsPlaces('INDI', 'DEAT', 0, true);
foreach ($d_countries as $country => $count) {
// Consolidate places (G... | php | private function getDeathChartData(): array
{
// Count how many people were death in each country
$surn_countries = [];
$d_countries = $this->placeRepository->statsPlaces('INDI', 'DEAT', 0, true);
foreach ($d_countries as $country => $count) {
// Consolidate places (G... | [
"private",
"function",
"getDeathChartData",
"(",
")",
":",
"array",
"{",
"// Count how many people were death in each country",
"$",
"surn_countries",
"=",
"[",
"]",
";",
"$",
"d_countries",
"=",
"$",
"this",
"->",
"placeRepository",
"->",
"statsPlaces",
"(",
"'INDI... | Returns the google geochart data for death fact.
@return array | [
"Returns",
"the",
"google",
"geochart",
"data",
"for",
"death",
"fact",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L169-L189 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.getMarriageChartData | private function getMarriageChartData(): array
{
// Count how many families got marriage in each country
$surn_countries = [];
$m_countries = $this->placeRepository->statsPlaces('FAM');
// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter ... | php | private function getMarriageChartData(): array
{
// Count how many families got marriage in each country
$surn_countries = [];
$m_countries = $this->placeRepository->statsPlaces('FAM');
// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter ... | [
"private",
"function",
"getMarriageChartData",
"(",
")",
":",
"array",
"{",
"// Count how many families got marriage in each country",
"$",
"surn_countries",
"=",
"[",
"]",
";",
"$",
"m_countries",
"=",
"$",
"this",
"->",
"placeRepository",
"->",
"statsPlaces",
"(",
... | Returns the google geochart data for marriages.
@return array | [
"Returns",
"the",
"google",
"geochart",
"data",
"for",
"marriages",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L196-L217 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.getSurnameChartData | private function getSurnameChartData(string $surname): array
{
if ($surname === '') {
$surname = $this->individualRepository->getCommonSurname();
}
// Count how many people are events in each country
$surn_countries = [];
$records = $this->queryRecords($su... | php | private function getSurnameChartData(string $surname): array
{
if ($surname === '') {
$surname = $this->individualRepository->getCommonSurname();
}
// Count how many people are events in each country
$surn_countries = [];
$records = $this->queryRecords($su... | [
"private",
"function",
"getSurnameChartData",
"(",
"string",
"$",
"surname",
")",
":",
"array",
"{",
"if",
"(",
"$",
"surname",
"===",
"''",
")",
"{",
"$",
"surname",
"=",
"$",
"this",
"->",
"individualRepository",
"->",
"getCommonSurname",
"(",
")",
";",
... | Returns the google geochart data for surnames.
@param string $surname The surname used to create the chart
@return array | [
"Returns",
"the",
"google",
"geochart",
"data",
"for",
"surnames",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L247-L278 | train |
fisharebest/webtrees | app/Statistics/Google/ChartDistribution.php | ChartDistribution.getIndivdualChartData | private function getIndivdualChartData(): array
{
// Count how many people have events in each country
$surn_countries = [];
$a_countries = $this->placeRepository->statsPlaces('INDI');
// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter c... | php | private function getIndivdualChartData(): array
{
// Count how many people have events in each country
$surn_countries = [];
$a_countries = $this->placeRepository->statsPlaces('INDI');
// webtrees uses 3 letter country codes and localised country names, but google uses 2 letter c... | [
"private",
"function",
"getIndivdualChartData",
"(",
")",
":",
"array",
"{",
"// Count how many people have events in each country",
"$",
"surn_countries",
"=",
"[",
"]",
";",
"$",
"a_countries",
"=",
"$",
"this",
"->",
"placeRepository",
"->",
"statsPlaces",
"(",
"... | Returns the google geochart data for individuals.
@return array | [
"Returns",
"the",
"google",
"geochart",
"data",
"for",
"individuals",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartDistribution.php#L285-L306 | train |
fisharebest/webtrees | app/Module/DescendancyModule.php | DescendancyModule.getPersonLi | public function getPersonLi(Individual $person, $generations = 0): string
{
$icon = $generations > 0 ? 'icon-minus' : 'icon-plus';
$lifespan = $person->canShow() ? '(' . $person->getLifeSpan() . ')' : '';
$spouses = $generations > 0 ? $this->loadSpouses($person, 0) : '';
return... | php | public function getPersonLi(Individual $person, $generations = 0): string
{
$icon = $generations > 0 ? 'icon-minus' : 'icon-plus';
$lifespan = $person->canShow() ? '(' . $person->getLifeSpan() . ')' : '';
$spouses = $generations > 0 ? $this->loadSpouses($person, 0) : '';
return... | [
"public",
"function",
"getPersonLi",
"(",
"Individual",
"$",
"person",
",",
"$",
"generations",
"=",
"0",
")",
":",
"string",
"{",
"$",
"icon",
"=",
"$",
"generations",
">",
"0",
"?",
"'icon-minus'",
":",
"'icon-plus'",
";",
"$",
"lifespan",
"=",
"$",
... | Format an individual in a list.
@param Individual $person
@param int $generations
@return string | [
"Format",
"an",
"individual",
"in",
"a",
"list",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/DescendancyModule.php#L145-L165 | train |
fisharebest/webtrees | app/Module/DescendancyModule.php | DescendancyModule.getFamilyLi | public function getFamilyLi(Family $family, Individual $person, $generations = 0): string
{
$spouse = $family->spouse($person);
if ($spouse) {
$spouse_name = $spouse->getSexImage() . $spouse->fullName();
$spouse_link = '<a href="' . e($person->url()) . '" title="' . strip_tag... | php | public function getFamilyLi(Family $family, Individual $person, $generations = 0): string
{
$spouse = $family->spouse($person);
if ($spouse) {
$spouse_name = $spouse->getSexImage() . $spouse->fullName();
$spouse_link = '<a href="' . e($person->url()) . '" title="' . strip_tag... | [
"public",
"function",
"getFamilyLi",
"(",
"Family",
"$",
"family",
",",
"Individual",
"$",
"person",
",",
"$",
"generations",
"=",
"0",
")",
":",
"string",
"{",
"$",
"spouse",
"=",
"$",
"family",
"->",
"spouse",
"(",
"$",
"person",
")",
";",
"if",
"(... | Format a family in a list.
@param Family $family
@param Individual $person
@param int $generations
@return string | [
"Format",
"a",
"family",
"in",
"a",
"list",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/DescendancyModule.php#L176-L202 | train |
fisharebest/webtrees | app/Module/DescendancyModule.php | DescendancyModule.loadSpouses | public function loadSpouses(Individual $individual, $generations): string
{
$out = '';
if ($individual->canShow()) {
foreach ($individual->spouseFamilies() as $family) {
$out .= $this->getFamilyLi($family, $individual, $generations - 1);
}
}
if... | php | public function loadSpouses(Individual $individual, $generations): string
{
$out = '';
if ($individual->canShow()) {
foreach ($individual->spouseFamilies() as $family) {
$out .= $this->getFamilyLi($family, $individual, $generations - 1);
}
}
if... | [
"public",
"function",
"loadSpouses",
"(",
"Individual",
"$",
"individual",
",",
"$",
"generations",
")",
":",
"string",
"{",
"$",
"out",
"=",
"''",
";",
"if",
"(",
"$",
"individual",
"->",
"canShow",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"individual... | Display spouses.
@param Individual $individual
@param int $generations
@return string | [
"Display",
"spouses",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/DescendancyModule.php#L212-L225 | train |
fisharebest/webtrees | app/Module/DescendancyModule.php | DescendancyModule.loadChildren | public function loadChildren(Family $family, $generations): string
{
$out = '';
if ($family->canShow()) {
$children = $family->children();
if ($children->isNotEmpty()) {
foreach ($children as $child) {
$out .= $this->getPersonLi($child, $g... | php | public function loadChildren(Family $family, $generations): string
{
$out = '';
if ($family->canShow()) {
$children = $family->children();
if ($children->isNotEmpty()) {
foreach ($children as $child) {
$out .= $this->getPersonLi($child, $g... | [
"public",
"function",
"loadChildren",
"(",
"Family",
"$",
"family",
",",
"$",
"generations",
")",
":",
"string",
"{",
"$",
"out",
"=",
"''",
";",
"if",
"(",
"$",
"family",
"->",
"canShow",
"(",
")",
")",
"{",
"$",
"children",
"=",
"$",
"family",
"-... | Display descendants.
@param Family $family
@param int $generations
@return string | [
"Display",
"descendants",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/DescendancyModule.php#L235-L254 | train |
fisharebest/webtrees | app/Http/Controllers/PendingChangesController.php | PendingChangesController.acceptAllChanges | public function acceptAllChanges(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$url = $request->get('url', '');
$changes = DB::table('change')
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'pending')
->orderBy('change_id')
... | php | public function acceptAllChanges(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$url = $request->get('url', '');
$changes = DB::table('change')
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'pending')
->orderBy('change_id')
... | [
"public",
"function",
"acceptAllChanges",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"url",
"=",
"$",
"request",
"->",
"get",
"(",
"'url'",
",",
"''",
")",
";",
"$",
"changes",
"=",
"... | Accept all changes to a tree.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Accept",
"all",
"changes",
"to",
"a",
"tree",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/PendingChangesController.php#L52-L82 | train |
fisharebest/webtrees | app/Http/Controllers/PendingChangesController.php | PendingChangesController.rejectAllChanges | public function rejectAllChanges(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$url = $request->get('url', '');
DB::table('change')
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'pending')
->update(['status' => 'rejected']);
... | php | public function rejectAllChanges(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$url = $request->get('url', '');
DB::table('change')
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'pending')
->update(['status' => 'rejected']);
... | [
"public",
"function",
"rejectAllChanges",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"url",
"=",
"$",
"request",
"->",
"get",
"(",
"'url'",
",",
"''",
")",
";",
"DB",
"::",
"table",
"... | Reject all changes to a tree.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Reject",
"all",
"changes",
"to",
"a",
"tree",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/PendingChangesController.php#L166-L179 | train |
fisharebest/webtrees | app/Functions/FunctionsDate.php | FunctionsDate.getAgeAtEvent | public static function getAgeAtEvent(string $age_string): string
{
switch (strtoupper($age_string)) {
case 'CHILD':
return I18N::translate('Child');
case 'INFANT':
return I18N::translate('Infant');
case 'STILLBORN':
return I... | php | public static function getAgeAtEvent(string $age_string): string
{
switch (strtoupper($age_string)) {
case 'CHILD':
return I18N::translate('Child');
case 'INFANT':
return I18N::translate('Infant');
case 'STILLBORN':
return I... | [
"public",
"static",
"function",
"getAgeAtEvent",
"(",
"string",
"$",
"age_string",
")",
":",
"string",
"{",
"switch",
"(",
"strtoupper",
"(",
"$",
"age_string",
")",
")",
"{",
"case",
"'CHILD'",
":",
"return",
"I18N",
"::",
"translate",
"(",
"'Child'",
")"... | Convert a GEDCOM age string to localized text.
@param string $age_string
@return string | [
"Convert",
"a",
"GEDCOM",
"age",
"string",
"to",
"localized",
"text",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsDate.php#L35-L68 | train |
fisharebest/webtrees | app/Module/BatchUpdate/BatchUpdateBasePlugin.php | BatchUpdateBasePlugin.getActionPreview | public function getActionPreview(GedcomRecord $record): string
{
$old_lines = explode("\n", $record->gedcom());
$new_lines = explode("\n", $this->updateRecord($record));
$algorithm = new MyersDiff();
$differences = $algorithm->calculate($old_lines, $new_lines);
$diff_li... | php | public function getActionPreview(GedcomRecord $record): string
{
$old_lines = explode("\n", $record->gedcom());
$new_lines = explode("\n", $this->updateRecord($record));
$algorithm = new MyersDiff();
$differences = $algorithm->calculate($old_lines, $new_lines);
$diff_li... | [
"public",
"function",
"getActionPreview",
"(",
"GedcomRecord",
"$",
"record",
")",
":",
"string",
"{",
"$",
"old_lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"record",
"->",
"gedcom",
"(",
")",
")",
";",
"$",
"new_lines",
"=",
"explode",
"(",
"\"\\n... | Default previewer for plugins with no custom preview.
@param GedcomRecord $record
@return string | [
"Default",
"previewer",
"for",
"plugins",
"with",
"no",
"custom",
"preview",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/BatchUpdate/BatchUpdateBasePlugin.php#L81-L103 | train |
fisharebest/webtrees | app/Module/BatchUpdate/BatchUpdateBasePlugin.php | BatchUpdateBasePlugin.createEditLinks | public static function createEditLinks($gedrec, GedcomRecord $record): string
{
return preg_replace(
"/@([^#@\n]+)@/m",
'<a href="' . e(route('edit-raw-record', [
'ged' => $record->tree()->name(),
'xref' => $record->xref(),
])) . '">@\\1@<... | php | public static function createEditLinks($gedrec, GedcomRecord $record): string
{
return preg_replace(
"/@([^#@\n]+)@/m",
'<a href="' . e(route('edit-raw-record', [
'ged' => $record->tree()->name(),
'xref' => $record->xref(),
])) . '">@\\1@<... | [
"public",
"static",
"function",
"createEditLinks",
"(",
"$",
"gedrec",
",",
"GedcomRecord",
"$",
"record",
")",
":",
"string",
"{",
"return",
"preg_replace",
"(",
"\"/@([^#@\\n]+)@/m\"",
",",
"'<a href=\"'",
".",
"e",
"(",
"route",
"(",
"'edit-raw-record'",
",",... | Converted gedcom links into editable links
@param string $gedrec
@param GedcomRecord $record
@return string | [
"Converted",
"gedcom",
"links",
"into",
"editable",
"links"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/BatchUpdate/BatchUpdateBasePlugin.php#L137-L147 | train |
fisharebest/webtrees | app/Report/ReportPdfFootnote.php | ReportPdfFootnote.render | public function render($renderer)
{
$renderer->setCurrentStyle('footnotenum');
$renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name
} | php | public function render($renderer)
{
$renderer->setCurrentStyle('footnotenum');
$renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name
} | [
"public",
"function",
"render",
"(",
"$",
"renderer",
")",
"{",
"$",
"renderer",
"->",
"setCurrentStyle",
"(",
"'footnotenum'",
")",
";",
"$",
"renderer",
"->",
"Write",
"(",
"$",
"renderer",
"->",
"getCurrentStyleHeight",
"(",
")",
",",
"$",
"this",
"->",... | PDF Footnotes number renderer
@param ReportTcpdf $renderer
@return void | [
"PDF",
"Footnotes",
"number",
"renderer"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportPdfFootnote.php#L32-L36 | train |
fisharebest/webtrees | app/Report/ReportPdfFootnote.php | ReportPdfFootnote.getWidth | public function getWidth($renderer)
{
// Setup the style name, a font must be selected to calculate the width
$renderer->setCurrentStyle('footnotenum');
// Check for the largest font size in the box
$fsize = $renderer->getCurrentStyleHeight();
if ($fsize > $renderer->largest... | php | public function getWidth($renderer)
{
// Setup the style name, a font must be selected to calculate the width
$renderer->setCurrentStyle('footnotenum');
// Check for the largest font size in the box
$fsize = $renderer->getCurrentStyleHeight();
if ($fsize > $renderer->largest... | [
"public",
"function",
"getWidth",
"(",
"$",
"renderer",
")",
"{",
"// Setup the style name, a font must be selected to calculate the width",
"$",
"renderer",
"->",
"setCurrentStyle",
"(",
"'footnotenum'",
")",
";",
"// Check for the largest font size in the box",
"$",
"fsize",
... | Splits the text into lines to fit into a giving cell
and returns the last lines width
@param ReportTcpdf $renderer
@return float|array | [
"Splits",
"the",
"text",
"into",
"lines",
"to",
"fit",
"into",
"a",
"giving",
"cell",
"and",
"returns",
"the",
"last",
"lines",
"width"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportPdfFootnote.php#L92-L181 | train |
fisharebest/webtrees | app/Media.php | Media.mediaFiles | public function mediaFiles(): Collection
{
return $this->facts(['FILE'])
->map(function (Fact $fact): MediaFile {
return new MediaFile($fact->gedcom(), $this);
});
} | php | public function mediaFiles(): Collection
{
return $this->facts(['FILE'])
->map(function (Fact $fact): MediaFile {
return new MediaFile($fact->gedcom(), $this);
});
} | [
"public",
"function",
"mediaFiles",
"(",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"facts",
"(",
"[",
"'FILE'",
"]",
")",
"->",
"map",
"(",
"function",
"(",
"Fact",
"$",
"fact",
")",
":",
"MediaFile",
"{",
"return",
"new",
"MediaFile",
... | Get the media files for this media object
@return Collection
@return MediaFile[] | [
"Get",
"the",
"media",
"files",
"for",
"this",
"media",
"object"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Media.php#L120-L126 | train |
fisharebest/webtrees | app/Media.php | Media.firstImageFile | public function firstImageFile(): ?MediaFile
{
foreach ($this->mediaFiles() as $media_file) {
if ($media_file->isImage()) {
return $media_file;
}
}
return null;
} | php | public function firstImageFile(): ?MediaFile
{
foreach ($this->mediaFiles() as $media_file) {
if ($media_file->isImage()) {
return $media_file;
}
}
return null;
} | [
"public",
"function",
"firstImageFile",
"(",
")",
":",
"?",
"MediaFile",
"{",
"foreach",
"(",
"$",
"this",
"->",
"mediaFiles",
"(",
")",
"as",
"$",
"media_file",
")",
"{",
"if",
"(",
"$",
"media_file",
"->",
"isImage",
"(",
")",
")",
"{",
"return",
"... | Get the first media file that contains an image.
@return MediaFile|null | [
"Get",
"the",
"first",
"media",
"file",
"that",
"contains",
"an",
"image",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Media.php#L133-L142 | train |
fisharebest/webtrees | app/Media.php | Media.getNote | public function getNote(): string
{
$fact = $this->facts(['NOTE'])->first();
if ($fact instanceof Fact) {
// Link to note object
$note = $fact->target();
if ($note instanceof Note) {
return $note->getNote();
}
// Inline no... | php | public function getNote(): string
{
$fact = $this->facts(['NOTE'])->first();
if ($fact instanceof Fact) {
// Link to note object
$note = $fact->target();
if ($note instanceof Note) {
return $note->getNote();
}
// Inline no... | [
"public",
"function",
"getNote",
"(",
")",
":",
"string",
"{",
"$",
"fact",
"=",
"$",
"this",
"->",
"facts",
"(",
"[",
"'NOTE'",
"]",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"fact",
"instanceof",
"Fact",
")",
"{",
"// Link to note object",... | Get the first note attached to this media object
@return string | [
"Get",
"the",
"first",
"note",
"attached",
"to",
"this",
"media",
"object"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Media.php#L149-L165 | train |
fisharebest/webtrees | app/Module/HitCountFooterModule.php | HitCountFooterModule.countHit | protected function countHit(Tree $tree, string $page, string $parameter): int
{
// Don't increment the counter while we stay on the same page.
if (
Session::get('last_gedcom_id') === $tree->id() &&
Session::get('last_page_name') === $page &&
Session::get('last_pag... | php | protected function countHit(Tree $tree, string $page, string $parameter): int
{
// Don't increment the counter while we stay on the same page.
if (
Session::get('last_gedcom_id') === $tree->id() &&
Session::get('last_page_name') === $page &&
Session::get('last_pag... | [
"protected",
"function",
"countHit",
"(",
"Tree",
"$",
"tree",
",",
"string",
"$",
"page",
",",
"string",
"$",
"parameter",
")",
":",
"int",
"{",
"// Don't increment the counter while we stay on the same page.",
"if",
"(",
"Session",
"::",
"get",
"(",
"'last_gedco... | Increment the page count.
@param Tree $tree
@param string $page
@param string $parameter
@return int | [
"Increment",
"the",
"page",
"count",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/HitCountFooterModule.php#L153-L186 | train |
fisharebest/webtrees | app/Http/Controllers/ReportEngineController.php | ReportEngineController.reportList | public function reportList(Tree $tree, UserInterface $user): ResponseInterface
{
$title = I18N::translate('Choose a report to run');
return $this->viewResponse('report-select-page', [
'reports' => $this->module_service->findByComponent(ModuleReportInterface::class, $tree, $user),
... | php | public function reportList(Tree $tree, UserInterface $user): ResponseInterface
{
$title = I18N::translate('Choose a report to run');
return $this->viewResponse('report-select-page', [
'reports' => $this->module_service->findByComponent(ModuleReportInterface::class, $tree, $user),
... | [
"public",
"function",
"reportList",
"(",
"Tree",
"$",
"tree",
",",
"UserInterface",
"$",
"user",
")",
":",
"ResponseInterface",
"{",
"$",
"title",
"=",
"I18N",
"::",
"translate",
"(",
"'Choose a report to run'",
")",
";",
"return",
"$",
"this",
"->",
"viewRe... | A list of available reports.
@param Tree $tree
@param UserInterface $user
@return ResponseInterface | [
"A",
"list",
"of",
"available",
"reports",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/ReportEngineController.php#L69-L77 | train |
fisharebest/webtrees | app/Http/Middleware/DoHousekeeping.php | DoHousekeeping.runHousekeeping | private function runHousekeeping(): void
{
$data_filesystem = app(FilesystemInterface::class);
$root_filesystem = new Filesystem(new Local(Webtrees::ROOT_DIR));
// Clear files in the (user-specified) data folder - which might not be local files
$this->housekeeping_service->deleteOld... | php | private function runHousekeeping(): void
{
$data_filesystem = app(FilesystemInterface::class);
$root_filesystem = new Filesystem(new Local(Webtrees::ROOT_DIR));
// Clear files in the (user-specified) data folder - which might not be local files
$this->housekeeping_service->deleteOld... | [
"private",
"function",
"runHousekeeping",
"(",
")",
":",
"void",
"{",
"$",
"data_filesystem",
"=",
"app",
"(",
"FilesystemInterface",
"::",
"class",
")",
";",
"$",
"root_filesystem",
"=",
"new",
"Filesystem",
"(",
"new",
"Local",
"(",
"Webtrees",
"::",
"ROOT... | Run the various housekeeping services.
@return void | [
"Run",
"the",
"various",
"housekeeping",
"services",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Middleware/DoHousekeeping.php#L91-L108 | train |
fisharebest/webtrees | app/Functions/FunctionsExport.php | FunctionsExport.convertMediaPath | private static function convertMediaPath($rec, $path): string
{
if ($path && preg_match('/\n1 FILE (.+)/', $rec, $match)) {
$old_file_name = $match[1];
// Don’t modify external links
if (strpos($old_file_name, '://') === false) {
// Adding a windows path? ... | php | private static function convertMediaPath($rec, $path): string
{
if ($path && preg_match('/\n1 FILE (.+)/', $rec, $match)) {
$old_file_name = $match[1];
// Don’t modify external links
if (strpos($old_file_name, '://') === false) {
// Adding a windows path? ... | [
"private",
"static",
"function",
"convertMediaPath",
"(",
"$",
"rec",
",",
"$",
"path",
")",
":",
"string",
"{",
"if",
"(",
"$",
"path",
"&&",
"preg_match",
"(",
"'/\\n1 FILE (.+)/'",
",",
"$",
"rec",
",",
"$",
"match",
")",
")",
"{",
"$",
"old_file_na... | Prepend the GEDCOM_MEDIA_PATH to media filenames.
@param string $rec
@param string $path
@return string | [
"Prepend",
"the",
"GEDCOM_MEDIA_PATH",
"to",
"media",
"filenames",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/FunctionsExport.php#L138-L159 | train |
fisharebest/webtrees | app/Services/CalendarService.php | CalendarService.calendarMonthsInYear | public function calendarMonthsInYear(string $calendar, int $year): array
{
$date = new Date($calendar . ' ' . $year);
$calendar_date = $date->minimumDate();
$month_numbers = range(1, $calendar_date->monthsInYear());
$month_names = [];
foreach ($month_numbers as $m... | php | public function calendarMonthsInYear(string $calendar, int $year): array
{
$date = new Date($calendar . ' ' . $year);
$calendar_date = $date->minimumDate();
$month_numbers = range(1, $calendar_date->monthsInYear());
$month_names = [];
foreach ($month_numbers as $m... | [
"public",
"function",
"calendarMonthsInYear",
"(",
"string",
"$",
"calendar",
",",
"int",
"$",
"year",
")",
":",
"array",
"{",
"$",
"date",
"=",
"new",
"Date",
"(",
"$",
"calendar",
".",
"' '",
".",
"$",
"year",
")",
";",
"$",
"calendar_date",
"=",
"... | List all the months in a given year.
@param string $calendar
@param int $year
@return string[] | [
"List",
"all",
"the",
"months",
"in",
"a",
"given",
"year",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/CalendarService.php#L51-L79 | train |
fisharebest/webtrees | app/Services/CalendarService.php | CalendarService.getEventsList | public function getEventsList(int $jd1, int $jd2, string $events, bool $only_living, string $sort_by, Tree $tree): array
{
$found_facts = [];
$facts = [];
foreach (range($jd1, $jd2) as $jd) {
$found_facts = array_merge($found_facts, $this->getAnniversaryEvents($jd, $events... | php | public function getEventsList(int $jd1, int $jd2, string $events, bool $only_living, string $sort_by, Tree $tree): array
{
$found_facts = [];
$facts = [];
foreach (range($jd1, $jd2) as $jd) {
$found_facts = array_merge($found_facts, $this->getAnniversaryEvents($jd, $events... | [
"public",
"function",
"getEventsList",
"(",
"int",
"$",
"jd1",
",",
"int",
"$",
"jd2",
",",
"string",
"$",
"events",
",",
"bool",
"$",
"only_living",
",",
"string",
"$",
"sort_by",
",",
"Tree",
"$",
"tree",
")",
":",
"array",
"{",
"$",
"found_facts",
... | Get the list of current and upcoming events, sorted by anniversary date
@param int $jd1
@param int $jd2
@param string $events
@param bool $only_living
@param string $sort_by
@param Tree $tree
@return Fact[] | [
"Get",
"the",
"list",
"of",
"current",
"and",
"upcoming",
"events",
"sorted",
"by",
"anniversary",
"date"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/CalendarService.php#L168-L211 | train |
fisharebest/webtrees | app/Services/CalendarService.php | CalendarService.defaultAnniversaries | private function defaultAnniversaries(Builder $query, AbstractCalendarDate $anniv): void
{
if ($anniv->day() === 1) {
$query->where('d_day', '<=', 1);
} elseif ($anniv->day() === $anniv->daysInMonth()) {
$query->where('d_day', '>=', $anniv->daysInMonth());
} else {
... | php | private function defaultAnniversaries(Builder $query, AbstractCalendarDate $anniv): void
{
if ($anniv->day() === 1) {
$query->where('d_day', '<=', 1);
} elseif ($anniv->day() === $anniv->daysInMonth()) {
$query->where('d_day', '>=', $anniv->daysInMonth());
} else {
... | [
"private",
"function",
"defaultAnniversaries",
"(",
"Builder",
"$",
"query",
",",
"AbstractCalendarDate",
"$",
"anniv",
")",
":",
"void",
"{",
"if",
"(",
"$",
"anniv",
"->",
"day",
"(",
")",
"===",
"1",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"'d_d... | By default, missing days have anniversaries on the first of the month,
and invalid days have anniversaries on the last day of the month.
@param Builder $query
@param AbstractCalendarDate $anniv | [
"By",
"default",
"missing",
"days",
"have",
"anniversaries",
"on",
"the",
"first",
"of",
"the",
"month",
"and",
"invalid",
"days",
"have",
"anniversaries",
"on",
"the",
"last",
"day",
"of",
"the",
"month",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/CalendarService.php#L329-L340 | train |
fisharebest/webtrees | app/Services/CalendarService.php | CalendarService.adarIIAnniversaries | private function adarIIAnniversaries(Builder $query, JewishDate $anniv): void
{
if ($anniv->day() === 1) {
$query->where('d_day', '<=', 1);
} elseif ($anniv->day() === $anniv->daysInMonth()) {
$query->where('d_day', '>=', $anniv->daysInMonth());
} else {
$... | php | private function adarIIAnniversaries(Builder $query, JewishDate $anniv): void
{
if ($anniv->day() === 1) {
$query->where('d_day', '<=', 1);
} elseif ($anniv->day() === $anniv->daysInMonth()) {
$query->where('d_day', '>=', $anniv->daysInMonth());
} else {
$... | [
"private",
"function",
"adarIIAnniversaries",
"(",
"Builder",
"$",
"query",
",",
"JewishDate",
"$",
"anniv",
")",
":",
"void",
"{",
"if",
"(",
"$",
"anniv",
"->",
"day",
"(",
")",
"===",
"1",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"'d_day'",
","... | ADS includes non-leap ADR.
@param Builder $query
@param JewishDate $anniv | [
"ADS",
"includes",
"non",
"-",
"leap",
"ADR",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/CalendarService.php#L418-L437 | train |
fisharebest/webtrees | app/Services/CalendarService.php | CalendarService.nisanAnniversaries | private function nisanAnniversaries(Builder $query, JewishDate $anniv): void
{
if ($anniv->day === 1 && !$anniv->isLeapYear()) {
$query->where(static function (Builder $query): void {
$query->where(static function (Builder $query): void {
$query->where('d_day'... | php | private function nisanAnniversaries(Builder $query, JewishDate $anniv): void
{
if ($anniv->day === 1 && !$anniv->isLeapYear()) {
$query->where(static function (Builder $query): void {
$query->where(static function (Builder $query): void {
$query->where('d_day'... | [
"private",
"function",
"nisanAnniversaries",
"(",
"Builder",
"$",
"query",
",",
"JewishDate",
"$",
"anniv",
")",
":",
"void",
"{",
"if",
"(",
"$",
"anniv",
"->",
"day",
"===",
"1",
"&&",
"!",
"$",
"anniv",
"->",
"isLeapYear",
"(",
")",
")",
"{",
"$",... | 1 NSN includes 30 ADR, if this year is non-leap.
@param Builder $query
@param JewishDate $anniv | [
"1",
"NSN",
"includes",
"30",
"ADR",
"if",
"this",
"year",
"is",
"non",
"-",
"leap",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/CalendarService.php#L445-L458 | train |
fisharebest/webtrees | app/Statistics/Google/ChartChildren.php | ChartChildren.chartChildren | public function chartChildren(): string
{
$data = [
[
I18N::translate('Century'),
I18N::translate('Average number')
]
];
foreach ($this->queryRecords() as $record) {
$data[] = [
$this->century_service->centu... | php | public function chartChildren(): string
{
$data = [
[
I18N::translate('Century'),
I18N::translate('Average number')
]
];
foreach ($this->queryRecords() as $record) {
$data[] = [
$this->century_service->centu... | [
"public",
"function",
"chartChildren",
"(",
")",
":",
"string",
"{",
"$",
"data",
"=",
"[",
"[",
"I18N",
"::",
"translate",
"(",
"'Century'",
")",
",",
"I18N",
"::",
"translate",
"(",
"'Average number'",
")",
"]",
"]",
";",
"foreach",
"(",
"$",
"this",... | Creates a children per family chart.
@return string | [
"Creates",
"a",
"children",
"per",
"family",
"chart",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartChildren.php#L82-L124 | train |
fisharebest/webtrees | app/Census/AbstractCensusColumnCondition.php | AbstractCensusColumnCondition.isChild | private function isChild(Individual $individual): bool
{
$age = Date::getAgeYears($individual->getEstimatedBirthDate(), $this->date());
return $age < $this->age_adult;
} | php | private function isChild(Individual $individual): bool
{
$age = Date::getAgeYears($individual->getEstimatedBirthDate(), $this->date());
return $age < $this->age_adult;
} | [
"private",
"function",
"isChild",
"(",
"Individual",
"$",
"individual",
")",
":",
"bool",
"{",
"$",
"age",
"=",
"Date",
"::",
"getAgeYears",
"(",
"$",
"individual",
"->",
"getEstimatedBirthDate",
"(",
")",
",",
"$",
"this",
"->",
"date",
"(",
")",
")",
... | Is the individual a child.
@param Individual $individual
@return bool | [
"Is",
"the",
"individual",
"a",
"child",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/AbstractCensusColumnCondition.php#L101-L106 | train |
fisharebest/webtrees | app/Census/AbstractCensusColumnCondition.php | AbstractCensusColumnCondition.isDead | private function isDead(Individual $individual): bool
{
return $individual->getDeathDate()->isOK() && Date::compare($individual->getDeathDate(), $this->date()) < 0;
} | php | private function isDead(Individual $individual): bool
{
return $individual->getDeathDate()->isOK() && Date::compare($individual->getDeathDate(), $this->date()) < 0;
} | [
"private",
"function",
"isDead",
"(",
"Individual",
"$",
"individual",
")",
":",
"bool",
"{",
"return",
"$",
"individual",
"->",
"getDeathDate",
"(",
")",
"->",
"isOK",
"(",
")",
"&&",
"Date",
"::",
"compare",
"(",
"$",
"individual",
"->",
"getDeathDate",
... | Is the individual dead.
@param Individual $individual
@return bool | [
"Is",
"the",
"individual",
"dead",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/AbstractCensusColumnCondition.php#L163-L166 | train |
fisharebest/webtrees | app/Date.php | Date.calendarNames | public static function calendarNames(): array
{
return [
/* I18N: The gregorian calendar */
'gregorian' => I18N::translate('Gregorian'),
/* I18N: The julian calendar */
'julian' => I18N::translate('Julian'),
/* I18N: The French calendar */
... | php | public static function calendarNames(): array
{
return [
/* I18N: The gregorian calendar */
'gregorian' => I18N::translate('Gregorian'),
/* I18N: The julian calendar */
'julian' => I18N::translate('Julian'),
/* I18N: The French calendar */
... | [
"public",
"static",
"function",
"calendarNames",
"(",
")",
":",
"array",
"{",
"return",
"[",
"/* I18N: The gregorian calendar */",
"'gregorian'",
"=>",
"I18N",
"::",
"translate",
"(",
"'Gregorian'",
")",
",",
"/* I18N: The julian calendar */",
"'julian'",
"=>",
"I18N"... | A list of supported calendars and their names.
@return string[] | [
"A",
"list",
"of",
"supported",
"calendars",
"and",
"their",
"names",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Date.php#L221-L237 | train |
fisharebest/webtrees | app/Date.php | Date.addYears | public function addYears(int $years, string $qualifier = ''): Date
{
$tmp = clone $this;
$tmp->date1->year += $years;
$tmp->date1->month = 0;
$tmp->date1->day = 0;
$tmp->date1->setJdFromYmd();
$tmp->qual1 = $qualifier;
$tmp->qual2 = '';
... | php | public function addYears(int $years, string $qualifier = ''): Date
{
$tmp = clone $this;
$tmp->date1->year += $years;
$tmp->date1->month = 0;
$tmp->date1->day = 0;
$tmp->date1->setJdFromYmd();
$tmp->qual1 = $qualifier;
$tmp->qual2 = '';
... | [
"public",
"function",
"addYears",
"(",
"int",
"$",
"years",
",",
"string",
"$",
"qualifier",
"=",
"''",
")",
":",
"Date",
"{",
"$",
"tmp",
"=",
"clone",
"$",
"this",
";",
"$",
"tmp",
"->",
"date1",
"->",
"year",
"+=",
"$",
"years",
";",
"$",
"tmp... | Offset this date by N years, and round to the whole year.
This is typically used to create an estimated death date,
which is before a certain number of years after the birth date.
@param int $years a number of years, positive or negative
@param string $qualifier typically “BEF” or “AFT”
@return Date | [
"Offset",
"this",
"date",
"by",
"N",
"years",
"and",
"round",
"to",
"the",
"whole",
"year",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Date.php#L451-L463 | train |
fisharebest/webtrees | app/Date.php | Date.getAge | public static function getAge(Date $d1, Date $d2 = null): string
{
if ($d2 instanceof self) {
if ($d2->maximumJulianDay() >= $d1->minimumJulianDay() && $d2->minimumJulianDay() <= $d1->maximumJulianDay()) {
// Overlapping dates
$jd = $d1->minimumJulianDay();
... | php | public static function getAge(Date $d1, Date $d2 = null): string
{
if ($d2 instanceof self) {
if ($d2->maximumJulianDay() >= $d1->minimumJulianDay() && $d2->minimumJulianDay() <= $d1->maximumJulianDay()) {
// Overlapping dates
$jd = $d1->minimumJulianDay();
... | [
"public",
"static",
"function",
"getAge",
"(",
"Date",
"$",
"d1",
",",
"Date",
"$",
"d2",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"$",
"d2",
"instanceof",
"self",
")",
"{",
"if",
"(",
"$",
"d2",
"->",
"maximumJulianDay",
"(",
")",
">=",
... | Calculate the the age of a person, on a date.
@param Date $d1
@param Date|null $d2
@return string | [
"Calculate",
"the",
"the",
"age",
"of",
"a",
"person",
"on",
"a",
"date",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Date.php#L524-L551 | train |
fisharebest/webtrees | app/Date.php | Date.compare | public static function compare(Date $a, Date $b): int
{
// Get min/max JD for each date.
switch ($a->qual1) {
case 'BEF':
$amin = $a->minimumJulianDay() - 1;
$amax = $amin;
break;
case 'AFT':
$amax = $a->maximumJ... | php | public static function compare(Date $a, Date $b): int
{
// Get min/max JD for each date.
switch ($a->qual1) {
case 'BEF':
$amin = $a->minimumJulianDay() - 1;
$amax = $amin;
break;
case 'AFT':
$amax = $a->maximumJ... | [
"public",
"static",
"function",
"compare",
"(",
"Date",
"$",
"a",
",",
"Date",
"$",
"b",
")",
":",
"int",
"{",
"// Get min/max JD for each date.",
"switch",
"(",
"$",
"a",
"->",
"qual1",
")",
"{",
"case",
"'BEF'",
":",
"$",
"amin",
"=",
"$",
"a",
"->... | Compare two dates, so they can be sorted.
return <0 if $a<$b
return >0 if $b>$a
return 0 if dates same/overlap
BEF/AFT sort as the day before/after
@param Date $a
@param Date $b
@return int | [
"Compare",
"two",
"dates",
"so",
"they",
"can",
"be",
"sorted",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Date.php#L592-L640 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/UsersController.php | UsersController.monthOptions | private function monthOptions(): array
{
return [
3 => I18N::number(3),
6 => I18N::number(6),
9 => I18N::number(9),
12 => I18N::number(12),
18 => I18N::number(18),
24 => I18N::number(24),
];
} | php | private function monthOptions(): array
{
return [
3 => I18N::number(3),
6 => I18N::number(6),
9 => I18N::number(9),
12 => I18N::number(12),
18 => I18N::number(18),
24 => I18N::number(24),
];
} | [
"private",
"function",
"monthOptions",
"(",
")",
":",
"array",
"{",
"return",
"[",
"3",
"=>",
"I18N",
"::",
"number",
"(",
"3",
")",
",",
"6",
"=>",
"I18N",
"::",
"number",
"(",
"6",
")",
",",
"9",
"=>",
"I18N",
"::",
"number",
"(",
"9",
")",
"... | Delete users older than this.
@return string[] | [
"Delete",
"users",
"older",
"than",
"this",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/UsersController.php#L484-L494 | train |
fisharebest/webtrees | app/Module/ModuleListTrait.php | ModuleListTrait.listMenu | public function listMenu(Tree $tree): ?Menu
{
if ($this->listIsEmpty($tree)) {
return null;
}
return new Menu(
$this->listTitle(),
$this->listUrl($tree),
$this->listMenuClass(),
$this->listUrlAttributes()
);
} | php | public function listMenu(Tree $tree): ?Menu
{
if ($this->listIsEmpty($tree)) {
return null;
}
return new Menu(
$this->listTitle(),
$this->listUrl($tree),
$this->listMenuClass(),
$this->listUrlAttributes()
);
} | [
"public",
"function",
"listMenu",
"(",
"Tree",
"$",
"tree",
")",
":",
"?",
"Menu",
"{",
"if",
"(",
"$",
"this",
"->",
"listIsEmpty",
"(",
"$",
"tree",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Menu",
"(",
"$",
"this",
"->",
"li... | A main menu item for this list, or null if the list is empty.
@param Tree $tree
@return Menu|null | [
"A",
"main",
"menu",
"item",
"for",
"this",
"list",
"or",
"null",
"if",
"the",
"list",
"is",
"empty",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/ModuleListTrait.php#L45-L57 | train |
fisharebest/webtrees | app/Module/ModuleListTrait.php | ModuleListTrait.listUrl | public function listUrl(Tree $tree, array $parameters = []): string
{
return route('module', [
'module' => $this->name(),
'action' => 'List',
'ged' => $tree->name(),
] + $parameters);
} | php | public function listUrl(Tree $tree, array $parameters = []): string
{
return route('module', [
'module' => $this->name(),
'action' => 'List',
'ged' => $tree->name(),
] + $parameters);
} | [
"public",
"function",
"listUrl",
"(",
"Tree",
"$",
"tree",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
":",
"string",
"{",
"return",
"route",
"(",
"'module'",
",",
"[",
"'module'",
"=>",
"$",
"this",
"->",
"name",
"(",
")",
",",
"'action'",
... | The URL for a page showing list options.
@param Tree $tree
@param string[] $parameters
@return string | [
"The",
"URL",
"for",
"a",
"page",
"showing",
"list",
"options",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/ModuleListTrait.php#L87-L94 | train |
fisharebest/webtrees | app/Individual.php | Individual.birthDateComparator | public static function birthDateComparator(): Closure
{
return static function (Individual $x, Individual $y): int {
return Date::compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate());
};
} | php | public static function birthDateComparator(): Closure
{
return static function (Individual $x, Individual $y): int {
return Date::compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate());
};
} | [
"public",
"static",
"function",
"birthDateComparator",
"(",
")",
":",
"Closure",
"{",
"return",
"static",
"function",
"(",
"Individual",
"$",
"x",
",",
"Individual",
"$",
"y",
")",
":",
"int",
"{",
"return",
"Date",
"::",
"compare",
"(",
"$",
"x",
"->",
... | A closure which will compare individuals by birth date.
@return Closure | [
"A",
"closure",
"which",
"will",
"compare",
"individuals",
"by",
"birth",
"date",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L72-L77 | train |
fisharebest/webtrees | app/Individual.php | Individual.load | public static function load(Tree $tree, array $xrefs): void
{
$rows = DB::table('individuals')
->where('i_file', '=', $tree->id())
->whereIn('i_id', array_unique($xrefs))
->select(['i_id AS xref', 'i_gedcom AS gedcom'])
->get();
foreach ($rows as $row... | php | public static function load(Tree $tree, array $xrefs): void
{
$rows = DB::table('individuals')
->where('i_file', '=', $tree->id())
->whereIn('i_id', array_unique($xrefs))
->select(['i_id AS xref', 'i_gedcom AS gedcom'])
->get();
foreach ($rows as $row... | [
"public",
"static",
"function",
"load",
"(",
"Tree",
"$",
"tree",
",",
"array",
"$",
"xrefs",
")",
":",
"void",
"{",
"$",
"rows",
"=",
"DB",
"::",
"table",
"(",
"'individuals'",
")",
"->",
"where",
"(",
"'i_file'",
",",
"'='",
",",
"$",
"tree",
"->... | Sometimes, we'll know in advance that we need to load a set of records.
Typically when we load families and their members.
@param Tree $tree
@param string[] $xrefs
@return void | [
"Sometimes",
"we",
"ll",
"know",
"in",
"advance",
"that",
"we",
"need",
"to",
"load",
"a",
"set",
"of",
"records",
".",
"Typically",
"when",
"we",
"load",
"families",
"and",
"their",
"members",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L123-L134 | train |
fisharebest/webtrees | app/Individual.php | Individual.canShowName | public function canShowName(int $access_level = null): bool
{
if ($access_level === null) {
$access_level = Auth::accessLevel($this->tree);
}
return $this->tree->getPreference('SHOW_LIVING_NAMES') >= $access_level || $this->canShow($access_level);
} | php | public function canShowName(int $access_level = null): bool
{
if ($access_level === null) {
$access_level = Auth::accessLevel($this->tree);
}
return $this->tree->getPreference('SHOW_LIVING_NAMES') >= $access_level || $this->canShow($access_level);
} | [
"public",
"function",
"canShowName",
"(",
"int",
"$",
"access_level",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"access_level",
"===",
"null",
")",
"{",
"$",
"access_level",
"=",
"Auth",
"::",
"accessLevel",
"(",
"$",
"this",
"->",
"tree",
")... | Can the name of this record be shown?
@param int|null $access_level
@return bool | [
"Can",
"the",
"name",
"of",
"this",
"record",
"be",
"shown?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L143-L150 | train |
fisharebest/webtrees | app/Individual.php | Individual.canShowByType | protected function canShowByType(int $access_level): bool
{
// Dead people...
if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
$keep_alive = false;
$KEEP_ALIVE_YEARS_BIRTH = (int) $this->tree->getPreference('KEEP_ALIVE_YEAR... | php | protected function canShowByType(int $access_level): bool
{
// Dead people...
if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
$keep_alive = false;
$KEEP_ALIVE_YEARS_BIRTH = (int) $this->tree->getPreference('KEEP_ALIVE_YEAR... | [
"protected",
"function",
"canShowByType",
"(",
"int",
"$",
"access_level",
")",
":",
"bool",
"{",
"// Dead people...",
"if",
"(",
"$",
"this",
"->",
"tree",
"->",
"getPreference",
"(",
"'SHOW_DEAD_PEOPLE'",
")",
">=",
"$",
"access_level",
"&&",
"$",
"this",
... | Can this individual be shown?
@param int $access_level
@return bool | [
"Can",
"this",
"individual",
"be",
"shown?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L159-L199 | train |
fisharebest/webtrees | app/Individual.php | Individual.isRelated | private static function isRelated(Individual $target, $distance): bool
{
static $cache = null;
$user_individual = self::getInstance($target->tree->getUserPreference(Auth::user(), 'gedcomid'), $target->tree);
if ($user_individual) {
if (!$cache) {
$cache = [
... | php | private static function isRelated(Individual $target, $distance): bool
{
static $cache = null;
$user_individual = self::getInstance($target->tree->getUserPreference(Auth::user(), 'gedcomid'), $target->tree);
if ($user_individual) {
if (!$cache) {
$cache = [
... | [
"private",
"static",
"function",
"isRelated",
"(",
"Individual",
"$",
"target",
",",
"$",
"distance",
")",
":",
"bool",
"{",
"static",
"$",
"cache",
"=",
"null",
";",
"$",
"user_individual",
"=",
"self",
"::",
"getInstance",
"(",
"$",
"target",
"->",
"tr... | For relationship privacy calculations - is this individual a close relative?
@param Individual $target
@param int $distance
@return bool | [
"For",
"relationship",
"privacy",
"calculations",
"-",
"is",
"this",
"individual",
"a",
"close",
"relative?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L209-L275 | train |
fisharebest/webtrees | app/Individual.php | Individual.findHighlightedMediaFile | public function findHighlightedMediaFile(): ?MediaFile
{
foreach ($this->facts(['OBJE']) as $fact) {
$media = $fact->target();
if ($media instanceof Media) {
foreach ($media->mediaFiles() as $media_file) {
if ($media_file->isImage() && !$media_file... | php | public function findHighlightedMediaFile(): ?MediaFile
{
foreach ($this->facts(['OBJE']) as $fact) {
$media = $fact->target();
if ($media instanceof Media) {
foreach ($media->mediaFiles() as $media_file) {
if ($media_file->isImage() && !$media_file... | [
"public",
"function",
"findHighlightedMediaFile",
"(",
")",
":",
"?",
"MediaFile",
"{",
"foreach",
"(",
"$",
"this",
"->",
"facts",
"(",
"[",
"'OBJE'",
"]",
")",
"as",
"$",
"fact",
")",
"{",
"$",
"media",
"=",
"$",
"fact",
"->",
"target",
"(",
")",
... | Find the highlighted media object for an individual
@return MediaFile|null | [
"Find",
"the",
"highlighted",
"media",
"object",
"for",
"an",
"individual"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L430-L444 | train |
fisharebest/webtrees | app/Individual.php | Individual.displayImage | public function displayImage($width, $height, $fit, $attributes): string
{
$media_file = $this->findHighlightedMediaFile();
if ($media_file !== null) {
return $media_file->displayImage($width, $height, $fit, $attributes);
}
if ($this->tree->getPreference('USE_SILHOUETTE... | php | public function displayImage($width, $height, $fit, $attributes): string
{
$media_file = $this->findHighlightedMediaFile();
if ($media_file !== null) {
return $media_file->displayImage($width, $height, $fit, $attributes);
}
if ($this->tree->getPreference('USE_SILHOUETTE... | [
"public",
"function",
"displayImage",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"fit",
",",
"$",
"attributes",
")",
":",
"string",
"{",
"$",
"media_file",
"=",
"$",
"this",
"->",
"findHighlightedMediaFile",
"(",
")",
";",
"if",
"(",
"$",
"media_... | Display the prefered image for this individual.
Use an icon if no image is available.
@param int $width Pixels
@param int $height Pixels
@param string $fit "crop" or "contain"
@param string[] $attributes Additional HTML attributes
@return string | [
"Display",
"the",
"prefered",
"image",
"for",
"this",
"individual",
".",
"Use",
"an",
"icon",
"if",
"no",
"image",
"is",
"available",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Individual.php#L457-L470 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.