You are here

public function Framework::implementor in Realistic Dummy Content 8.2

Same name and namespace in other branches
  1. 7.2 api/src/Framework/Framework.php \Drupal\realistic_dummy_content_api\Framework\Framework::implementor()
  2. 3.x api/src/Framework/Framework.php \Drupal\realistic_dummy_content_api\Framework\Framework::implementor()

Retrieves a framework-specific implementor.

1 call to Framework::implementor()
Framework::moduleInvokeAll in api/src/Framework/Framework.php

File

api/src/Framework/Framework.php, line 33

Class

Framework
The entry point for the framework.

Namespace

Drupal\realistic_dummy_content_api\Framework

Code

public function implementor() {
  if (!$this->implementor) {
    $framework = realistic_dummy_content_api_version();
    switch ($framework) {
      case 'Drupal7':
        module_load_include('php', 'realistic_dummy_content_api', 'src/Framework/Drupal7');
        $this->implementor = new Drupal7();
        break;
      case 'Drupal8':
        $this->implementor = new Drupal8();
        break;
      default:
        throw new \Exception('No framework implementation class available for the framework ' . $framework);
    }
  }
  return $this->implementor;
}