+
+ /**
+ * Retrieve gathered package info
+ * @return Generator
+ */
+ public function getPackageInfo() {
+ if (($name = $this->sxe->xpath("/pecl:package/pecl:name"))) {
+ yield "name" => (string) $name[0];
+ }
+ if (($release = $this->sxe->xpath("/pecl:package/pecl:version/pecl:release"))) {
+ yield "release" => (string) $release[0];
+ }
+ if ($this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease")) {
+ yield "zend" => true;
+ }
+ }
+
+ /**
+ * @inheritdoc
+ * @return string
+ */
+ public function getLicense() {
+ if (($license = $this->sxe->xpath("/pecl:package/pecl:license"))) {
+ if (($file = $this->findLicense($this->getBaseDir(), $license[0]["filesource"]))) {
+ return $this->readLicense($file);
+ }
+ }
+ if (($file = $this->findLicense($this->getBaseDir()))) {
+ return $this->readLicense($file);
+ }
+ if ($license) {
+ return $license[0] ." ". $license[0]["uri"];
+ }
+ return "UNKNOWN";
+ }
+
+ /**
+ * @inheritdoc
+ * @see \pharext\SourceDir::getArgs()
+ */
+ public function getArgs() {
+ $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
+ foreach ($configure as $cfg) {
+ yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
+ strlen($cfg["default"]) ? $cfg["default"] : null];
+ }
+ $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
+ foreach ($configure as $cfg) {
+ yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
+ strlen($cfg["default"]) ? $cfg["default"] : null];
+ }
+ }
+
+ /**
+ * @inheritdoc
+ * @see \pharext\SourceDir::setArgs()
+ */
+ public function setArgs(Args $args) {
+ $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
+ foreach ($configure as $cfg) {
+ if (isset($args[$cfg["name"]])) {
+ $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
+ }
+ }
+ $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
+ foreach ($configure as $cfg) {
+ if (isset($args[$cfg["name"]])) {
+ $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
+ }
+ }
+ }