/** * Get translated filename if provided in the configuration `FormatterInterface::CFG_FILENAME`. * By default, the translated filename will be checked against the variables provided by the object * to ensure no variables tag ('%var%') left. * * @param \MwbExporter\Model\Base $object The object to translate * @param bool $check True to check the translated filename * @throws \Exception * @return string */ public function translateFilename(Base $object, $check = true) { if ($object && ($filename = $object->translateVars($this->getConfig()->get(FormatterInterface::CFG_FILENAME)))) { if ($check && false !== strpos($filename, '%')) { throw new \Exception(sprintf('All filename variable where not converted. Perhaps a misstyped name (%s) ?', substr($filename, strpos($filename, '%'), strrpos($filename, '%')))); } return $filename; } }
/** * Constructor. * * @param \MwbExporter\Model\Base $parent * @param \SimpleXMLElement $node */ public function __construct(Base $parent = null, $node = null) { $this->links = new RegistryHolder(); parent::__construct($parent, $node); }