/** * Convert the PEAR server response into an array that we would get when * accessing the dependencies of a local package.xml via PEAR. * * @param string $type The dependency type. * @param array $input The input array. * @param string $optional Indicates if it is an optional dependency. * @param array &$result The result array. * * @return NULL */ private function _convert($type, $input, $optional, &$result) { if (in_array($type, array('package', 'extension')) && !isset($input['name'])) { foreach ($input as $element) { $this->_convert($type, $element, $optional, $result); } } else { Horde_Pear_Package_Dependencies::addDependency($input, $type, $optional, $result); } }
/** * Complete the dependency information. * * @param DOMNode $parent The parent node ("required" or "optional"). * @param array &$result The result array. * @param string $optional Optional dependency or not? * * @return NULL */ private function _completeDependencies($parent, &$result, $optional) { if ($parent === false) { return; } foreach ($parent->childNodes as $dep) { if ($dep->nodeType == XML_TEXT_NODE) { continue; } $input = array(); $this->_dependencyInputValue($input, 'min', $dep); $this->_dependencyInputValue($input, 'max', $dep); $this->_dependencyInputValue($input, 'name', $dep); $this->_dependencyInputValue($input, 'channel', $dep); $this->_dependencyInputValue($input, 'conflicts', $dep); Horde_Pear_Package_Dependencies::addDependency($input, $dep->nodeName, $optional, $result); } }
/** * @expectedException Horde_Pear_Exception */ public function testUnsupported() { $result = array(); Horde_Pear_Package_Dependencies::addDependency(array('name' => 'Z'), 'unsupported', 'yes', $result); }