Ran phpcbf over code
This commit is contained in:
parent
205e77da0e
commit
27528c9cf7
@ -10,7 +10,6 @@ declare(strict_types = 1);
|
|||||||
* Abstract class to be inherited by classes for writing consolidated vocabulary names.
|
* Abstract class to be inherited by classes for writing consolidated vocabulary names.
|
||||||
*/
|
*/
|
||||||
abstract class NodaConsolidatedNamesAbstract {
|
abstract class NodaConsolidatedNamesAbstract {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function sanitizes a string.
|
* This function sanitizes a string.
|
||||||
*
|
*
|
||||||
|
@ -120,5 +120,4 @@ final class NodaConsolidatedNamesForPersinst extends NodaConsolidatedNamesAbstra
|
|||||||
return \trim($name, " ;.\t" . PHP_EOL);
|
return \trim($name, " ;.\t" . PHP_EOL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,7 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
|
|||||||
|
|
||||||
// Skip entries like "Vaci utca 12 Budapest, Vaci utca"
|
// Skip entries like "Vaci utca 12 Budapest, Vaci utca"
|
||||||
$indicatorTrimmed = trim($indicator);
|
$indicatorTrimmed = trim($indicator);
|
||||||
if (
|
if ((str_ends_with($parts[0], $indicatorTrimmed) && str_contains($parts[1], $indicatorTrimmed))
|
||||||
(str_ends_with($parts[0], $indicatorTrimmed) && str_contains($parts[1], $indicatorTrimmed))
|
|
||||||
|| (str_ends_with($parts[1], $indicatorTrimmed) && str_contains($parts[0], $indicatorTrimmed))
|
|| (str_ends_with($parts[1], $indicatorTrimmed) && str_contains($parts[0], $indicatorTrimmed))
|
||||||
) {
|
) {
|
||||||
return $name;
|
return $name;
|
||||||
@ -133,10 +132,8 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -334,7 +331,6 @@ final class NodaConsolidatedNamesForPlaces extends NodaConsolidatedNamesAbstract
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans and consolidates name parts appearing regularly in Ukrainian place names.
|
* 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 one of the parts is a blacklisted term or a cardinal directions, skip this
|
||||||
|
|
||||||
if (
|
if ((in_array($parts[0], self::_COUNTRY_REWRITE_BLACKLISTED_TERMS, true)
|
||||||
(in_array($parts[0], self::_COUNTRY_REWRITE_BLACKLISTED_TERMS, true)
|
|
||||||
|| in_array($parts[0], $cardinal_directions, 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], self::_COUNTRY_REWRITE_BLACKLISTED_TERMS, true)
|
||||||
|| in_array($parts[1], $cardinal_directions, 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;
|
return $name;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ declare(strict_types = 1);
|
|||||||
* contains a string.
|
* contains a string.
|
||||||
*/
|
*/
|
||||||
final class NodaDistinctlyTypedStrings {
|
final class NodaDistinctlyTypedStrings {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the vocabulary database whether it contains a given string.
|
* Checks the vocabulary database whether it contains a given string.
|
||||||
*
|
*
|
||||||
@ -40,5 +39,4 @@ final class NodaDistinctlyTypedStrings {
|
|||||||
return $cur[0];
|
return $cur[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ declare(strict_types = 1);
|
|||||||
*/
|
*/
|
||||||
final class NodaSplitTime {
|
final class NodaSplitTime {
|
||||||
|
|
||||||
const DEFAULT_DATE = '0001-01-01';
|
public const DEFAULT_DATE = '0001-01-01';
|
||||||
|
|
||||||
public readonly string $start_year;
|
public readonly string $start_year;
|
||||||
public readonly string $end_year;
|
public readonly string $end_year;
|
||||||
@ -40,11 +40,13 @@ final class NodaSplitTime {
|
|||||||
$start_date = $end_date = $year . '-' . $month . '-' . $day;
|
$start_date = $end_date = $year . '-' . $month . '-' . $day;
|
||||||
|
|
||||||
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::before
|
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::before
|
||||||
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::until) {
|
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::until
|
||||||
|
) {
|
||||||
$start_year = $start_date = '?';
|
$start_year = $start_date = '?';
|
||||||
}
|
}
|
||||||
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::after
|
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::after
|
||||||
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::since) {
|
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::since
|
||||||
|
) {
|
||||||
$end_year = $end_date = '?';
|
$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");
|
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 "";
|
return "";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,7 +330,6 @@ final class NodaSplitTime {
|
|||||||
$this->end_date = '9999-12-31';
|
$this->end_date = '9999-12-31';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!isset($this->start_date) && false !== $start_date) {
|
if (!isset($this->start_date) && false !== $start_date) {
|
||||||
$this->start_date = date("Y-m-d", MD_STD::strtotime($start_date));
|
$this->start_date = date("Y-m-d", MD_STD::strtotime($start_date));
|
||||||
}
|
}
|
||||||
@ -361,7 +360,5 @@ final class NodaSplitTime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -888,7 +888,6 @@ final class NodaTimeSplitter {
|
|||||||
|
|
||||||
$datum = self::clean_input($datum);
|
$datum = self::clean_input($datum);
|
||||||
|
|
||||||
|
|
||||||
// TODO: Check if this is duplicate
|
// TODO: Check if this is duplicate
|
||||||
|
|
||||||
// 17. Jahrhundert
|
// 17. Jahrhundert
|
||||||
|
@ -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, 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"));
|
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
|
// 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"));
|
||||||
self::assertEquals("Köln (Deutschland)", NodaConsolidatedNamesForPlaces::consolidate_name("de", "Deutschland, Köln"));
|
self::assertEquals("Köln (Deutschland)", NodaConsolidatedNamesForPlaces::consolidate_name("de", "Deutschland, Köln"));
|
||||||
|
@ -37,7 +37,6 @@ final class NodaTimeSplitterTest extends TestCase {
|
|||||||
self::assertEquals($output->toTimeName(), "02.01.2020");
|
self::assertEquals($output->toTimeName(), "02.01.2020");
|
||||||
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
|
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
|
||||||
|
|
||||||
|
|
||||||
$output = NodaTimeSplitter::attempt_splitting("02.1.25 v. Chr");
|
$output = NodaTimeSplitter::attempt_splitting("02.1.25 v. Chr");
|
||||||
self::assertNotEmpty($output);
|
self::assertNotEmpty($output);
|
||||||
self::assertEquals($output->toOldFormat(), [
|
self::assertEquals($output->toOldFormat(), [
|
||||||
|
@ -12,8 +12,6 @@ use PHPUnit\Framework\Attributes\Small;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This script contains tests for the validation of single field contents.
|
* This script contains tests for the validation of single field contents.
|
||||||
*
|
|
||||||
* @covers \NodaValidationHelper
|
|
||||||
*/
|
*/
|
||||||
#[small]
|
#[small]
|
||||||
#[CoversClass(\NodaValidationHelper::class)]
|
#[CoversClass(\NodaValidationHelper::class)]
|
||||||
|
@ -20,6 +20,5 @@ declare(strict_types = 1);
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user