mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-26 11:13:50 +02:00
25 lines
369 B
PHP
25 lines
369 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Structural\DataMapper;
|
|
|
|
class StorageAdapter
|
|
{
|
|
public function __construct(private array $data)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @return array|null
|
|
*/
|
|
public function find(int $id)
|
|
{
|
|
if (isset($this->data[$id])) {
|
|
return $this->data[$id];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|