for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace AmaTeam\ElasticSearch\Mapping;
use AmaTeam\ElasticSearch\API\Mapping\DocumentMappingInterface;
use AmaTeam\ElasticSearch\API\Mapping\DocumentMappingProviderInterface;
use AmaTeam\ElasticSearch\Mapping\Annotation\Reader;
class MappingProvider implements DocumentMappingProviderInterface
{
/**
* @var Reader
*/
private $reader;
* @var DocumentMappingInterface[]
private $registry;
* @param Reader $reader
public function __construct(Reader $reader = null)
$this->reader = $reader ?? new Reader();
}
public function getMapping(string $className): DocumentMappingInterface
if (isset($this->registry[$className])) {
return $this->registry[$className];
$mapping = $this->reader->read($className);
$this->registry[$className] = $mapping;
return $mapping;