📄 v2.php
字号:
} function getArchiveFile() { return $this->_archiveFile; } /** * Directly set the array that defines this packagefile * * WARNING: no validation. This should only be performed by internal methods * inside PEAR or by inputting an array saved from an existing PEAR_PackageFile_v2 * @param array */ function fromArray($pinfo) { unset($pinfo['old']); unset($pinfo['xsdversion']); $this->_incomplete = false; $this->_packageInfo = $pinfo; } function isIncomplete() { return $this->_incomplete; } /** * @return array */ function toArray($forreg = false) { if (!$this->validate(PEAR_VALIDATE_NORMAL)) { return false; } return $this->getArray($forreg); } function getArray($forReg = false) { if ($forReg) { $arr = $this->_packageInfo; $arr['old'] = array(); $arr['old']['version'] = $this->getVersion(); $arr['old']['release_date'] = $this->getDate(); $arr['old']['release_state'] = $this->getState(); $arr['old']['release_license'] = $this->getLicense(); $arr['old']['release_notes'] = $this->getNotes(); $arr['old']['release_deps'] = $this->getDeps(); $arr['old']['maintainers'] = $this->getMaintainers(); $arr['xsdversion'] = '2.0'; return $arr; } else { $info = $this->_packageInfo; unset($info['dirtree']); if (isset($info['_lastversion'])) { unset($info['_lastversion']); } if (isset($info['#binarypackage'])) { unset($info['#binarypackage']); } return $info; } } function packageInfo($field) { $arr = $this->getArray(true); if ($field == 'state') { return $arr['stability']['release']; } if ($field == 'api-version') { return $arr['version']['api']; } if ($field == 'api-state') { return $arr['stability']['api']; } if (isset($arr['old'][$field])) { if (!is_string($arr['old'][$field])) { return null; } return $arr['old'][$field]; } if (isset($arr[$field])) { if (!is_string($arr[$field])) { return null; } return $arr[$field]; } return null; } function getName() { return $this->getPackage(); } function getPackage() { if (isset($this->_packageInfo['name'])) { return $this->_packageInfo['name']; } return false; } function getChannel() { if (isset($this->_packageInfo['uri'])) { return '__uri'; } if (isset($this->_packageInfo['channel'])) { return strtolower($this->_packageInfo['channel']); } return false; } function getUri() { if (isset($this->_packageInfo['uri'])) { return $this->_packageInfo['uri']; } return false; } function getExtends() { if (isset($this->_packageInfo['extends'])) { return $this->_packageInfo['extends']; } return false; } function getSummary() { if (isset($this->_packageInfo['summary'])) { return $this->_packageInfo['summary']; } return false; } function getDescription() { if (isset($this->_packageInfo['description'])) { return $this->_packageInfo['description']; } return false; } function getMaintainers($raw = false) { if (!isset($this->_packageInfo['lead'])) { return false; } if ($raw) { $ret = array('lead' => $this->_packageInfo['lead']); (isset($this->_packageInfo['developer'])) ? $ret['developer'] = $this->_packageInfo['developer'] :null; (isset($this->_packageInfo['contributor'])) ? $ret['contributor'] = $this->_packageInfo['contributor'] :null; (isset($this->_packageInfo['helper'])) ? $ret['helper'] = $this->_packageInfo['helper'] :null; return $ret; } else { $ret = array(); $leads = isset($this->_packageInfo['lead'][0]) ? $this->_packageInfo['lead'] : array($this->_packageInfo['lead']); foreach ($leads as $lead) { $s = $lead; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'lead'; $ret[] = $s; } if (isset($this->_packageInfo['developer'])) { $leads = isset($this->_packageInfo['developer'][0]) ? $this->_packageInfo['developer'] : array($this->_packageInfo['developer']); foreach ($leads as $maintainer) { $s = $maintainer; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'developer'; $ret[] = $s; } } if (isset($this->_packageInfo['contributor'])) { $leads = isset($this->_packageInfo['contributor'][0]) ? $this->_packageInfo['contributor'] : array($this->_packageInfo['contributor']); foreach ($leads as $maintainer) { $s = $maintainer; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'contributor'; $ret[] = $s; } } if (isset($this->_packageInfo['helper'])) { $leads = isset($this->_packageInfo['helper'][0]) ? $this->_packageInfo['helper'] : array($this->_packageInfo['helper']); foreach ($leads as $maintainer) { $s = $maintainer; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'helper'; $ret[] = $s; } } return $ret; } return false; } function getLeads() { if (isset($this->_packageInfo['lead'])) { return $this->_packageInfo['lead']; } return false; } function getDevelopers() { if (isset($this->_packageInfo['developer'])) { return $this->_packageInfo['developer']; } return false; } function getContributors() { if (isset($this->_packageInfo['contributor'])) { return $this->_packageInfo['contributor']; } return false; } function getHelpers() { if (isset($this->_packageInfo['helper'])) { return $this->_packageInfo['helper']; } return false; } function setDate($date) { if (!isset($this->_packageInfo['date'])) { // ensure that the extends tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'bundle', 'changelog'), array(), 'date'); } $this->_packageInfo['date'] = $date; $this->_isValid = 0; } function setTime($time) { $this->_isValid = 0; if (!isset($this->_packageInfo['time'])) { // ensure that the time tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'bundle', 'changelog'), $time, 'time'); } $this->_packageInfo['time'] = $time; } function getDate() { if (isset($this->_packageInfo['date'])) { return $this->_packageInfo['date']; } return false; } function getTime() { if (isset($this->_packageInfo['time'])) { return $this->_packageInfo['time']; } return false; } /** * @param package|api version category to return */ function getVersion($key = 'release') { if (isset($this->_packageInfo['version'][$key])) { return $this->_packageInfo['version'][$key]; } return false; } function getStability() { if (isset($this->_packageInfo['stability'])) { return $this->_packageInfo['stability']; } return false; } function getState($key = 'release') { if (isset($this->_packageInfo['stability'][$key])) { return $this->_packageInfo['stability'][$key]; } return false; } function getLicense($raw = false) { if (isset($this->_packageInfo['license'])) { if ($raw) { return $this->_packageInfo['license']; } if (is_array($this->_packageInfo['license'])) { return $this->_packageInfo['license']['_content']; } else { return $this->_packageInfo['license']; } } return false; } function getLicenseLocation() { if (!isset($this->_packageInfo['license']) || !is_array($this->_packageInfo['license'])) { return false; } return $this->_packageInfo['license']['attribs']; } function getNotes() { if (isset($this->_packageInfo['notes'])) { return $this->_packageInfo['notes']; } return false; } /** * Return the <usesrole> tag contents, if any * @return array|false */ function getUsesrole() { if (isset($this->_packageInfo['usesrole'])) { return $this->_packageInfo['usesrole']; } return false; } /** * Return the <usestask> tag contents, if any * @return array|false */ function getUsestask() { if (isset($this->_packageInfo['usestask'])) { return $this->_packageInfo['usestask']; } return false; } /** * This should only be used to retrieve filenames and install attributes */ function getFilelist($preserve = false) { if (isset($this->_packageInfo['filelist']) && !$preserve) { return $this->_packageInfo['filelist']; } $this->flattenFilelist(); if ($contents = $this->getContents()) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -