aboutsummaryrefslogtreecommitdiff
path: root/cli/Commands/AbstractPluginCommand.php
diff options
context:
space:
mode:
authorMarcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de>2021-12-17 16:20:12 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2021-12-17 16:20:12 +0000
commitb0a1a7adf5203efa32661b96ecb023fef74c5d2d (patch)
treec4641b27164f1e8d4feb2274164bed26578721af /cli/Commands/AbstractPluginCommand.php
parentcb0a67594116a17c78182637908c4723f37e7263 (diff)
CLI-Skript `studip` einführen und alte Skripte entsprechend umstellen
Diffstat (limited to 'cli/Commands/AbstractPluginCommand.php')
-rw-r--r--cli/Commands/AbstractPluginCommand.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/Commands/AbstractPluginCommand.php b/cli/Commands/AbstractPluginCommand.php
new file mode 100644
index 0000000..149f54c
--- /dev/null
+++ b/cli/Commands/AbstractPluginCommand.php
@@ -0,0 +1,21 @@
+<?php
+namespace Studip\Cli\Commands;
+
+abstract class AbstractPluginCommand extends AbstractCommand
+{
+ protected function findPluginByName(\PluginManager $pluginManager, string $pluginname): ?array
+ {
+ $plugins = $pluginManager->getPluginInfos();
+ $found = array_filter($plugins, function ($plugin) use ($pluginname) {
+ return mb_strtolower($pluginname) === mb_strtolower($plugin['name']);
+ });
+
+ return count($found) ? reset($found) : null;
+ }
+
+ protected function findPluginNameByFolder(string $folder)
+ {
+ var_dump('foo');die;
+ return 'foo';
+ }
+}