summaryrefslogtreecommitdiffstats
path: root/admin/survey/minify/lib/Minify/Controller/Base.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
commit19985dbb8c0aa66dc4bf7905abc1148de909097d (patch)
tree2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /admin/survey/minify/lib/Minify/Controller/Base.php
download1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip
Diffstat (limited to 'admin/survey/minify/lib/Minify/Controller/Base.php')
-rw-r--r--admin/survey/minify/lib/Minify/Controller/Base.php81
1 files changed, 81 insertions, 0 deletions
diff --git a/admin/survey/minify/lib/Minify/Controller/Base.php b/admin/survey/minify/lib/Minify/Controller/Base.php
new file mode 100644
index 0000000..557b514
--- /dev/null
+++ b/admin/survey/minify/lib/Minify/Controller/Base.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Class Minify_Controller_Base
+ * @package Minify
+ */
+
+use Psr\Log\LoggerInterface;
+use Monolog\Logger;
+
+/**
+ * Base class for Minify controller
+ *
+ * The controller class validates a request and uses it to create a configuration for Minify::serve().
+ *
+ * @package Minify
+ * @author Stephen Clay <steve@mrclay.org>
+ */
+abstract class Minify_Controller_Base implements Minify_ControllerInterface
+{
+
+ /**
+ * @var Minify_Env
+ */
+ protected $env;
+
+ /**
+ * @var Minify_Source_Factory
+ */
+ protected $sourceFactory;
+
+ /**
+ * @var LoggerInterface
+ */
+ protected $logger;
+
+ /**
+ * @param Minify_Env $env
+ * @param Minify_Source_Factory $sourceFactory
+ * @param LoggerInterface $logger
+ */
+ public function __construct(Minify_Env $env, Minify_Source_Factory $sourceFactory, LoggerInterface $logger = null)
+ {
+ $this->env = $env;
+ $this->sourceFactory = $sourceFactory;
+ if (!$logger) {
+ $logger = new Logger('minify');
+ }
+ $this->logger = $logger;
+ }
+
+ /**
+ * Create controller sources and options for Minify::serve()
+ *
+ * @param array $options controller and Minify options
+ *
+ * @return Minify_ServeConfiguration
+ */
+ abstract public function createConfiguration(array $options);
+
+ /**
+ * Send message to the Minify logger
+ *
+ * @param string $msg
+ *
+ * @return null
+ * @deprecated use $this->logger
+ */
+ public function log($msg)
+ {
+ trigger_error(__METHOD__ . ' is deprecated in Minify 3.0.', E_USER_DEPRECATED);
+ $this->logger->info($msg);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getEnv()
+ {
+ return $this->env;
+ }
+}