X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FSourceDir%2FBasic.php;h=e5b2d230c36ea071dc4e28133a09895df2abd7f1;hb=d5207a43143f6c41520d024ba682cd5d69517416;hp=414c2015765a884f7c993316aca569f97645692c;hpb=1865a2712e004efb244cdbb241a8b7694bcdbfd7;p=pharext%2Fpharext diff --git a/src/pharext/SourceDir/Basic.php b/src/pharext/SourceDir/Basic.php index 414c201..e5b2d23 100644 --- a/src/pharext/SourceDir/Basic.php +++ b/src/pharext/SourceDir/Basic.php @@ -3,6 +3,8 @@ namespace pharext\SourceDir; use pharext\Cli\Args; +use pharext\License; +use pharext\PackageInfo; use pharext\SourceDir; use FilesystemIterator; @@ -14,24 +16,38 @@ use RecursiveIteratorIterator; class Basic implements IteratorAggregate, SourceDir { + use License; + use PackageInfo; + private $path; - + public function __construct($path) { - $this->path = $path; + $this->path = realpath($path); } - + public function getBaseDir() { return $this->path; } - + + /** + * @inheritdoc + * @return array + */ public function getPackageInfo() { - return []; + return $this->findPackageInfo($this->getBaseDir()); } - + + public function getLicense() { + if (($file = $this->findLicense($this->getBaseDir()))) { + return $this->readLicense($file); + } + return "UNKNOWN"; + } + public function getArgs() { return []; } - + public function setArgs(Args $args) { } @@ -52,7 +68,7 @@ class Basic implements IteratorAggregate, SourceDir $rii = new RecursiveIteratorIterator($rci); foreach ($rii as $path => $child) { if (!$child->isDir()) { - yield $path; + yield realpath($path); } } }