Skip to content

Commit c7712a8

Browse files
committed
#101 - Add support for #final configuration. Added getSetting()
1 parent 0ae021a commit c7712a8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/FileConverter.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ public function getConvertedString($source, $convert_path = 'null->null') {
168168
return $destination;
169169
}
170170

171+
public function getSetting($key) {
172+
return $this->settings[$key];
173+
}
174+
171175
public function getSettings() {
172176
return $this->settings;
173177
}
@@ -251,7 +255,7 @@ public function getEngines($convert_path, $configuration_overrides = NULL, $conf
251255
}
252256
if (isset($configuration_overrides)
253257
&& is_array($configuration_overrides)) {
254-
$configuration = array_merge($configuration, $configuration_overrides);
258+
$configuration = array_replace($configuration, $configuration_overrides);
255259
}
256260
$engine = $this->getEngine($convert_path, $configuration);
257261
if (!$confirm_available || $engine->isAvailable()) {
@@ -260,6 +264,13 @@ public function getEngines($convert_path, $configuration_overrides = NULL, $conf
260264
else {
261265
$this->missing_engines[$conf_id] = $engine;
262266
}
267+
268+
// Stop if the engine is marked as #final
269+
// This is similar to setConverter('a->b', 'force_id'),
270+
// except that it might not be the first engine tried.
271+
if (isset($configuration['#final'])) {
272+
break(2);
273+
}
263274
}
264275
}
265276

0 commit comments

Comments
 (0)