Initial SQLite development (#1)

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2024-06-08 23:58:45 +00:00
parent e91acee70f
commit f784f3e52c
66 changed files with 5509 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
<?php declare(strict_types=1);
namespace BitBadger\PDODocument\Mapper;
/**
* Map a string result from the
*
* @implements Mapper<string>
*/
class StringMapper implements Mapper
{
/**
* Constructor
*
* @param string $fieldName The name of the field to be retrieved as a string
*/
public function __construct(public string $fieldName) { }
/**
* @inheritDoc
*/
public function map(array $result): ?string
{
return match (false) {
key_exists($this->fieldName, $result) => null,
is_string($result[$this->fieldName]) => "{$result[$this->fieldName]}",
default => $result[$this->fieldName]
};
}
}