Ran phpcbf over code

This commit is contained in:
Joshua Ramon Enslin 2024-07-08 00:48:50 +02:00
parent 205e77da0e
commit 27528c9cf7
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
12 changed files with 190 additions and 210 deletions

View File

@ -10,7 +10,6 @@ declare(strict_types = 1);
* Abstract class to be inherited by classes for writing consolidated vocabulary names.
*/
abstract class NodaConsolidatedNamesAbstract {
/**
* This function sanitizes a string.
*

View File

@ -120,5 +120,4 @@ final class NodaConsolidatedNamesForPersinst extends NodaConsolidatedNamesAbstra
return \trim($name, " ;.\t" . PHP_EOL);
}
}

View File

@ -105,8 +105,7 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
// Skip entries like "Vaci utca 12 Budapest, Vaci utca"
$indicatorTrimmed = trim($indicator);
if (
(str_ends_with($parts[0], $indicatorTrimmed) && str_contains($parts[1], $indicatorTrimmed))
if ((str_ends_with($parts[0], $indicatorTrimmed) && str_contains($parts[1], $indicatorTrimmed))
|| (str_ends_with($parts[1], $indicatorTrimmed) && str_contains($parts[0], $indicatorTrimmed))
) {
return $name;
@ -133,10 +132,8 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
}
}
return $name;
}
@ -334,7 +331,6 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
}
/**
* Cleans and consolidates name parts appearing regularly in Ukrainian place names.
*
@ -427,15 +423,12 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
// If one of the parts is a blacklisted term or a cardinal directions, skip this
if (
(in_array($parts[0], self::_COUNTRY_REWRITE_BLACKLISTED_TERMS, true)
if ((in_array($parts[0], self::_COUNTRY_REWRITE_BLACKLISTED_TERMS, true)
|| in_array($parts[0], $cardinal_directions, true)
|| in_array(strtolower($parts[0]), $cardinal_directions, true)
)
|| in_array(strtolower($parts[0]), $cardinal_directions, true))
|| (in_array($parts[1], self::_COUNTRY_REWRITE_BLACKLISTED_TERMS, true)
|| in_array($parts[1], $cardinal_directions, true)
|| in_array(strtolower($parts[1]), $cardinal_directions, true)
)
|| in_array(strtolower($parts[1]), $cardinal_directions, true))
) {
return $name;
}

View File

@ -10,7 +10,6 @@ declare(strict_types = 1);
* contains a string.
*/
final class NodaDistinctlyTypedStrings {
/**
* Checks the vocabulary database whether it contains a given string.
*
@ -40,5 +39,4 @@ final class NodaDistinctlyTypedStrings {
return $cur[0];
}
}

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class NodaSplitTime {
const DEFAULT_DATE = '0001-01-01';
public const DEFAULT_DATE = '0001-01-01';
public readonly string $start_year;
public readonly string $end_year;
@ -40,11 +40,13 @@ final class NodaSplitTime {
$start_date = $end_date = $year . '-' . $month . '-' . $day;
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::before
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::until) {
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::until
) {
$start_year = $start_date = '?';
}
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::after
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::since) {
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::since
) {
$end_year = $end_date = '?';
}
@ -94,7 +96,6 @@ final class NodaSplitTime {
throw new MDgenericInvalidInputsException("Times with no certain end need to have a question mark (?) entered as a end date");
}
}
/**
@ -272,7 +273,6 @@ final class NodaSplitTime {
return "";
}
/**
@ -330,7 +330,6 @@ final class NodaSplitTime {
$this->end_date = '9999-12-31';
}
if (!isset($this->start_date) && false !== $start_date) {
$this->start_date = date("Y-m-d", MD_STD::strtotime($start_date));
}
@ -361,7 +360,5 @@ final class NodaSplitTime {
}
}
}
}

View File

@ -888,11 +888,10 @@ final class NodaTimeSplitter {
$datum = self::clean_input($datum);
// TODO: Check if this is duplicate
// 17. Jahrhundert
if (\preg_match("/^[0-9]{2}(\.|)" . self::REGEX_CENTURIES ."$/", $datum)) {
if (\preg_match("/^[0-9]{2}(\.|)" . self::REGEX_CENTURIES . "$/", $datum)) {
if ($centuryNo = \intval(\substr($datum, 0, 2))) {
$centuryNo--;
return new NodaSplitTime((string)$centuryNo . "01", \strval($centuryNo + 1) . "00");

View File

@ -56,7 +56,6 @@ final class NodaConsolidatedNamesForPlacesTest extends TestCase {
self::assertEquals("Deák Ferenc utca 16-18. (Budapest, 5. kerület)", NodaConsolidatedNamesForPlaces::consolidate_name("hu", "Deák Ferenc utca 16-18. Budapest, V."));
self::assertEquals("Deák Ferenc utca 16-18. Budapest, V. abc", NodaConsolidatedNamesForPlaces::consolidate_name("hu", "Deák Ferenc utca 16-18. Budapest, V. abc"));
// Rewriting country names in brackets
self::assertEquals("Köln (Deutschland)", NodaConsolidatedNamesForPlaces::consolidate_name("de", "Deutschland-Köln"));
self::assertEquals("Köln (Deutschland)", NodaConsolidatedNamesForPlaces::consolidate_name("de", "Deutschland, Köln"));

View File

@ -37,7 +37,6 @@ final class NodaTimeSplitterTest extends TestCase {
self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("02.1.25 v. Chr");
self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [

View File

@ -12,8 +12,6 @@ use PHPUnit\Framework\Attributes\Small;
/**
* This script contains tests for the validation of single field contents.
*
* @covers \NodaValidationHelper
*/
#[small]
#[CoversClass(\NodaValidationHelper::class)]

View File

@ -20,6 +20,5 @@ declare(strict_types = 1);
}
}
});