Version 1
[yaffs-website] / web / modules / contrib / devel / webprofiler / src / Profiler / ProfilerStorageFactory.php
diff --git a/web/modules/contrib/devel/webprofiler/src/Profiler/ProfilerStorageFactory.php b/web/modules/contrib/devel/webprofiler/src/Profiler/ProfilerStorageFactory.php
new file mode 100644 (file)
index 0000000..5ba1545
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\webprofiler\Profiler;
+
+use Drupal\Core\Config\ConfigFactoryInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Class ProfilerStorageFactory
+ */
+class ProfilerStorageFactory {
+
+  /**
+   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
+   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
+   *
+   * @return \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface
+   */
+  final public static function getProfilerStorage(ConfigFactoryInterface $config, ContainerInterface $container) {
+    $storage = $config->get('webprofiler.config')
+      ->get('storage') ?: 'profiler.database_storage';
+
+    return $container->get($storage);
+  }
+
+}