2675a7899836d70d07b9e36b4b0d1ee637ad2150
3 namespace pharext\SourceDir
;
9 * A source directory containing pharext_package.php and eventually pharext_install.php
11 class Pharext
implements \IteratorAggregate
, SourceDir
14 * @var pharext\Command
30 * @see \pharext\SourceDir::__construct()
32 public function __construct(Command
$cmd, $path) {
36 $callable = include "$path/pharext_package.php";
37 if (!is_callable($callable)) {
38 throw new \
Exception("Package hook did not return a callable");
40 $this->iter
= $callable($cmd, $path);
45 * @see \pharext\SourceDir::getBaseDir()
47 public function getBaseDir() {
52 * Implements IteratorAggregate
53 * @see IteratorAggregate::getIterator()
55 public function getIterator() {
56 if (!is_callable($this->iter
)) {
57 return new Git($this->cmd
, $this->path
);
59 return call_user_func($this->iter
, $this->cmd
, $this->path
);