Version 1
[yaffs-website] / vendor / drupal / console / src / Annotations / DrupalCommandAnnotationReader.php
diff --git a/vendor/drupal/console/src/Annotations/DrupalCommandAnnotationReader.php b/vendor/drupal/console/src/Annotations/DrupalCommandAnnotationReader.php
new file mode 100644 (file)
index 0000000..476acb3
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Drupal\Console\Annotations;
+
+use Doctrine\Common\Annotations\AnnotationReader;
+
+/**
+ * Class DrupalCommandReader
+ *
+ * @package Drupal\Console\Annotations
+ */
+class DrupalCommandAnnotationReader
+{
+    /**
+     * @param $class
+     * @return array
+     */
+    public function readAnnotation($class)
+    {
+        $annotation = [];
+        $reader = new AnnotationReader();
+        $drupalCommandAnnotation = $reader->getClassAnnotation(
+            new \ReflectionClass($class),
+            'Drupal\\Console\\Annotations\\DrupalCommand'
+        );
+        if ($drupalCommandAnnotation) {
+            $annotation['extension'] = $drupalCommandAnnotation->extension?:'';
+            $annotation['extensionType'] = $drupalCommandAnnotation->extensionType?:'';
+            $annotation['dependencies'] = $drupalCommandAnnotation->dependencies?:[];
+        }
+
+        return $annotation;
+    }
+}