license helper
[pharext/pharext] / src / pharext / SourceDir / Git.php
index e17a3055c15d1b5fd534e73f3bdbb3f529afbc67..62dc24f9e5162cfde0cf7ff3d6380c4e5a7a2875 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace pharext\SourceDir;
 
-use pharext\Command;
 use pharext\Cli\Args;
+use pharext\License;
 use pharext\SourceDir;
 
 /**
@@ -11,6 +11,8 @@ use pharext\SourceDir;
  */
 class Git implements \IteratorAggregate, SourceDir
 {
+       use License;
+       
        /**
         * Base directory
         * @var string
@@ -41,6 +43,17 @@ class Git implements \IteratorAggregate, SourceDir
                return [];
        }
 
+       /**
+        * @inheritdoc
+        * @return string
+        */
+       public function getLicense() {
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               return "UNKNOWN";
+       }
+
        /**
         * @inheritdoc
         * @return array