2021-04-17 00:26:33 +02:00
|
|
|
<?php
|
2021-04-17 21:20:54 +02:00
|
|
|
namespace WapplerSystems\Meilisearch\System\Meilisearch\Document;
|
2021-04-17 00:26:33 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the TYPO3 CMS project.
|
|
|
|
*
|
|
|
|
* It is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License, either version 2
|
|
|
|
* of the License, or any later version.
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please read the
|
|
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* The TYPO3 project - inspiring people to share!
|
|
|
|
*/
|
|
|
|
|
|
|
|
use RuntimeException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Document representing the update query document
|
|
|
|
*
|
|
|
|
* @author Timo Hund <timo.hund@dkd.de>
|
|
|
|
*/
|
2021-04-24 04:44:44 +02:00
|
|
|
class Document
|
2021-04-17 00:26:33 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Magic call method used to emulate getters as used by the template engine.
|
|
|
|
*
|
|
|
|
* @param string $name method name
|
|
|
|
* @param array $arguments method arguments
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function __call($name, $arguments)
|
|
|
|
{
|
2021-04-24 04:44:44 +02:00
|
|
|
if (substr($name, 0, 3) === 'get') {
|
2021-04-17 00:26:33 +02:00
|
|
|
$field = substr($name, 3);
|
|
|
|
$field = strtolower($field[0]) . substr($field, 1);
|
|
|
|
return $this->fields[$field] ?? null;
|
|
|
|
}
|
2021-04-24 04:44:44 +02:00
|
|
|
throw new RuntimeException('Call to undefined method. Supports magic getters only.', 1311006605);
|
2021-04-17 00:26:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getFieldNames()
|
|
|
|
{
|
|
|
|
return array_keys($this->fields);
|
|
|
|
}
|
|
|
|
}
|