From 89af62d083aadaa0b606c0b7f885ebba7fb37197 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sun, 10 Jul 2016 16:17:50 +0200 Subject: [PATCH] Add custom prefix for definition files to class. --- lib/Frs/FieldDefinition.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Frs/FieldDefinition.php b/lib/Frs/FieldDefinition.php index 3cb7c0f..ab26845 100644 --- a/lib/Frs/FieldDefinition.php +++ b/lib/Frs/FieldDefinition.php @@ -4,15 +4,18 @@ namespace Frs; class FieldDefinition { + private $definitionsPrefix; private $fieldData = array(); /** * @param string $type Type of FieldDefinition (hotel, car, etc.) + * @param string $definitionsPrefix Prefix for definition files. If it's a directory, has to end with slash! * @throws \Exception if no definition file for this $type is found */ - public function __construct($type) + public function __construct($type, $definitionsPrefix = 'definitions/') { - $definitionFile = 'definitions/' . $type . '.json'; + $this->definitionsPrefix = $definitionsPrefix; + $definitionFile = $this->definitionsPrefix . $type . '.json'; if (!file_exists($definitionFile)) { throw new \Exception('File ' . $definitionFile . ' not found!'); }