/** * {@inheritdoc} */ public static function fromString($string, Translations $translations, array $options = []) { $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath']; $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath); $string = $bladeCompiler->compileString($string); PhpCode::fromString($string, $translations, $options); }
/** * {@inheritDoc} */ public static function fromString($string, Translations $translations = null, $file = '') { self::addExtension('Twig_Extensions_Extension_I18n'); $string = self::$twig->compileSource($string); // add default global php gettext functions PhpCode::$functions['gettext'] = '__'; PhpCode::$functions['ngettext'] = '__'; PhpCode::$functions['_'] = '__'; return PhpCode::fromString($string, $translations, $file); }
/** * {@inheritdoc} */ public static function fromString($string, Translations $translations = null, $file = '') { $bladeCompiler = new BladeCompiler(new Filesystem(), null); $string = $bladeCompiler->compileString($string); return PhpCode::fromString($string, $translations, $file); }
/** * {@inheritdoc} */ public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $twig = $options['twig'] ?: self::createTwig(); PhpCode::fromString($twig->compileSource($string), $translations, $options); }