feat: parser now writes, added missing fields

updated docs, example, extensive use of Traits with better handling.
valid level 9 phpstan codebase.
This commit is contained in:
2024-08-18 18:23:05 +03:00
parent 8771b14d2a
commit aa6786981a
24 changed files with 406 additions and 296 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace Ivuorinen\BusinessDataFetcher\Traits;
trait HasLanguage
{
/**
* @see getLanguageString()
* @var string|null $language Two letter language code
* (e.g. 'fi', 'sv', 'en')
*/
public ?string $language;
/**
* Get the language code as a string.
*/
public function getLanguageString(): string
{
return match ($this->language) {
'fi' => 'finnish',
'en' => 'english',
'sv' => 'swedish',
default => 'unknown:' . $this->language,
};
}
}