projects
/
pharext
/
pharext
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
sourcedir: guess basic package info
[pharext/pharext]
/
src
/
pharext
/
SourceDir
/
Basic.php
diff --git
a/src/pharext/SourceDir/Basic.php
b/src/pharext/SourceDir/Basic.php
index 414c2015765a884f7c993316aca569f97645692c..13891d02a9b65eeb452a065e7453f4f9d6362086 100644
(file)
--- a/
src/pharext/SourceDir/Basic.php
+++ b/
src/pharext/SourceDir/Basic.php
@@
-3,6
+3,8
@@
namespace pharext\SourceDir;
use pharext\Cli\Args;
namespace pharext\SourceDir;
use pharext\Cli\Args;
+use pharext\License;
+use pharext\PackageInfo;
use pharext\SourceDir;
use FilesystemIterator;
use pharext\SourceDir;
use FilesystemIterator;
@@
-14,6
+16,9
@@
use RecursiveIteratorIterator;
class Basic implements IteratorAggregate, SourceDir
{
class Basic implements IteratorAggregate, SourceDir
{
+ use License;
+ use PackageInfo;
+
private $path;
public function __construct($path) {
private $path;
public function __construct($path) {
@@
-23,11
+28,22
@@
class Basic implements IteratorAggregate, SourceDir
public function getBaseDir() {
return $this->path;
}
public function getBaseDir() {
return $this->path;
}
-
+
+ /**
+ * @inheritdoc
+ * @return array
+ */
public function getPackageInfo() {
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 getArgs() {
return [];
}
@@
-52,7
+68,7
@@
class Basic implements IteratorAggregate, SourceDir
$rii = new RecursiveIteratorIterator($rci);
foreach ($rii as $path => $child) {
if (!$child->isDir()) {
$rii = new RecursiveIteratorIterator($rci);
foreach ($rii as $path => $child) {
if (!$child->isDir()) {
- yield
$path
;
+ yield
realpath($path)
;
}
}
}
}
}
}