Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / src / Annotations / DrupalCommandAnnotationReader.php
1 <?php
2
3 namespace Drupal\Console\Annotations;
4
5 use Doctrine\Common\Annotations\AnnotationReader;
6
7 /**
8  * Class DrupalCommandReader
9  *
10  * @package Drupal\Console\Annotations
11  */
12 class DrupalCommandAnnotationReader
13 {
14     /**
15      * @param $class
16      * @return array
17      */
18     public function readAnnotation($class)
19     {
20         $annotation = [];
21         $reader = new AnnotationReader();
22         $drupalCommandAnnotation = $reader->getClassAnnotation(
23             new \ReflectionClass($class),
24             'Drupal\\Console\\Annotations\\DrupalCommand'
25         );
26         if ($drupalCommandAnnotation) {
27             $annotation['extension'] = $drupalCommandAnnotation->extension?:'';
28             $annotation['extensionType'] = $drupalCommandAnnotation->extensionType?:'';
29             $annotation['dependencies'] = $drupalCommandAnnotation->dependencies?:[];
30         }
31
32         return $annotation;
33     }
34 }