public function toPackageFile($package, $channel, $onlyMain = false) { if ($this->exists($package, $channel, true)) { foreach ($this->registries as $reg) { if ($reg instanceof Registry\Xml) { // prefer xml for retrieving packagefile object try { return $reg->toPackageFile($package, $channel); } catch (\Exception $e) { // failed, cascade to using default registry instead break; } } } return $this->registries[0]->toPackageFile($package, $channel); } elseif ($onlyMain || !$this->exists($package, $channel, false)) { throw new Registry\Exception('Cannot retrieve package file object ' . 'for package ' . $channel . '/' . $package . ', it is not installed'); } // installed in parent registry return $this->parent->toPackageFile($package, $channel); }