@@ -22,7 +22,8 @@ |
||
| 22 | 22 | use Fisharebest\Webtrees\GedcomRecord; |
| 23 | 23 | use Fisharebest\Webtrees\Tree; |
| 24 | 24 | |
| 25 | -interface GedcomRecordFactory { |
|
| 25 | +interface GedcomRecordFactory |
|
| 26 | +{ |
|
| 26 | 27 | |
| 27 | 28 | public function createRecord(string $xref, string $gedcom, ?string $pending, Tree $tree): GedcomRecord; |
| 28 | 29 | } |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | * @throws Exception |
| 184 | 184 | */ |
| 185 | 185 | public static function getInstance(string $xref, Tree $tree, string $gedcom = null) |
| 186 | - { |
|
| 186 | + { |
|
| 187 | 187 | if (!Application::getInstance()->bound(GedcomRecordFactories::class)) { |
| 188 | 188 | Application::getInstance()->singleton(GedcomRecordFactories::class); |
| 189 | 189 | } |
@@ -33,7 +33,8 @@ discard block |
||
| 33 | 33 | use Fisharebest\Webtrees\Source; |
| 34 | 34 | use stdClass; |
| 35 | 35 | |
| 36 | -class GedcomRecordFactories { |
|
| 36 | +class GedcomRecordFactories |
|
| 37 | +{ |
|
| 37 | 38 | |
| 38 | 39 | /** @var GedcomRecord[][] Allow getInstance() to return references to existing objects */ |
| 39 | 40 | protected $gedcom_record_cache; |
@@ -43,10 +44,12 @@ discard block |
||
| 43 | 44 | |
| 44 | 45 | protected $factories = []; |
| 45 | 46 | |
| 46 | - public function __construct() { |
|
| 47 | + public function __construct() |
|
| 48 | + { |
|
| 47 | 49 | } |
| 48 | 50 | |
| 49 | - public function addFactory(string $type, GedcomRecordFactory $factory) { |
|
| 51 | + public function addFactory(string $type, GedcomRecordFactory $factory) |
|
| 52 | + { |
|
| 50 | 53 | $this->factories[$type] = $factory; |
| 51 | 54 | } |
| 52 | 55 | |
@@ -62,7 +65,8 @@ discard block |
||
| 62 | 65 | * @throws Exception |
| 63 | 66 | * @return GedcomRecord|Individual|Family|Source|Repository|Media|Note|null |
| 64 | 67 | */ |
| 65 | - public function getInstance(string $xref, Tree $tree, string $gedcom = null) { |
|
| 68 | + public function getInstance(string $xref, Tree $tree, string $gedcom = null) |
|
| 69 | + { |
|
| 66 | 70 | $tree_id = $tree->id(); |
| 67 | 71 | |
| 68 | 72 | // Is this record already in the cache? |
@@ -162,7 +166,8 @@ discard block |
||
| 162 | 166 | return $record; |
| 163 | 167 | } |
| 164 | 168 | |
| 165 | - public function clearCache() { |
|
| 169 | + public function clearCache() |
|
| 170 | + { |
|
| 166 | 171 | // Clear the cache |
| 167 | 172 | $this->gedcom_record_cache = []; |
| 168 | 173 | $this->pending_record_cache = []; |