You are here

public function TransformerFactory::getTransformer in Facebook Instant Articles 3.x

Create a new instance of Transformer.

Return value

\Facebook\InstantArticles\Transformer\Transformer A new Transformer instance loaded with the rules from the transformer rules manager.

Throws

\ReflectionException

File

src/TransformerFactory.php, line 66

Class

TransformerFactory
Factory class for creating Transformer objects.

Namespace

Drupal\fb_instant_articles

Code

public function getTransformer() : Transformer {
  $transformer = new Transformer();

  // Override the default timezone according to the site wide timezone.
  $config_data_default_timezone = $this->configFactory
    ->get('system.date')
    ->get('timezone.default');
  $default_time_zone = !empty($config_data_default_timezone) ? $config_data_default_timezone : @date_default_timezone_get();
  $transformer
    ->setDefaultDateTimeZone(new \DateTimeZone($default_time_zone));
  $this
    ->addRules($transformer);
  return $transformer;
}