当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_Common::infoFromAny方法代码示例

本文整理汇总了PHP中PEAR_Common::infoFromAny方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Common::infoFromAny方法的具体用法?PHP PEAR_Common::infoFromAny怎么用?PHP PEAR_Common::infoFromAny使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_Common的用法示例。


在下文中一共展示了PEAR_Common::infoFromAny方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doPackageDependencies

 function doPackageDependencies($command, $options, $params)
 {
     // $params[0] -> the PEAR package to list its information
     if (sizeof($params) != 1) {
         return $this->raiseError("bad parameter(s), try \"help {$command}\"");
     }
     $obj = new PEAR_Common();
     if (PEAR::isError($info = $obj->infoFromAny($params[0]))) {
         return $this->raiseError($info);
     }
     if (is_array($info['release_deps'])) {
         $data = array('caption' => 'Dependencies for ' . $info['package'], 'border' => true, 'headline' => array("Type", "Name", "Relation", "Version"));
         foreach ($info['release_deps'] as $d) {
             if (isset($this->_deps_rel_trans[$d['rel']])) {
                 $rel = $this->_deps_rel_trans[$d['rel']];
             } else {
                 $rel = $d['rel'];
             }
             if (isset($this->_deps_type_trans[$d['type']])) {
                 $type = ucfirst($this->_deps_type_trans[$d['type']]);
             } else {
                 $type = $d['type'];
             }
             if (isset($d['name'])) {
                 $name = $d['name'];
             } else {
                 $name = '';
             }
             if (isset($d['version'])) {
                 $version = $d['version'];
             } else {
                 $version = '';
             }
             $data['data'][] = array($type, $name, $rel, $version);
         }
         $this->ui->outputData($data, $command);
         return true;
     }
     // Fallback
     $this->ui->outputData("This package does not have any dependencies.", $command);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:41,代码来源:Package.php

示例2: doInfo

 function doInfo($command, $options, $params)
 {
     // $params[0] The package for showing info
     if (sizeof($params) != 1) {
         return $this->raiseError("This command only accepts one param: " . "the package you want information");
     }
     if (@is_file($params[0])) {
         $obj = new PEAR_Common();
         $info = $obj->infoFromAny($params[0]);
     } else {
         $reg = new PEAR_Registry($this->config->get('php_dir'));
         $info = $reg->packageInfo($params[0]);
     }
     if (PEAR::isError($info)) {
         return $info;
     }
     if (empty($info)) {
         $this->raiseError("Nothing found for `{$params['0']}'");
         return;
     }
     unset($info['filelist']);
     unset($info['changelog']);
     $keys = array_keys($info);
     $longtext = array('description', 'summary');
     foreach ($keys as $key) {
         if (is_array($info[$key])) {
             switch ($key) {
                 case 'maintainers':
                     $i = 0;
                     $mstr = '';
                     foreach ($info[$key] as $m) {
                         if ($i++ > 0) {
                             $mstr .= "\n";
                         }
                         $mstr .= $m['name'] . " <";
                         if (isset($m['email'])) {
                             $mstr .= $m['email'];
                         } else {
                             $mstr .= $m['handle'] . '@php.net';
                         }
                         $mstr .= "> ({$m['role']})";
                     }
                     $info[$key] = $mstr;
                     break;
                 case 'release_deps':
                     $i = 0;
                     $dstr = '';
                     foreach ($info[$key] as $d) {
                         if (isset($this->_deps_rel_trans[$d['rel']])) {
                             $rel = $this->_deps_rel_trans[$d['rel']];
                         } else {
                             $rel = $d['rel'];
                         }
                         if (isset($this->_deps_type_trans[$d['type']])) {
                             $type = ucfirst($this->_deps_type_trans[$d['type']]);
                         } else {
                             $type = $d['type'];
                         }
                         if (isset($d['name'])) {
                             $name = $d['name'] . ' ';
                         } else {
                             $name = '';
                         }
                         if (isset($d['version'])) {
                             $version = $d['version'] . ' ';
                         } else {
                             $version = '';
                         }
                         $dstr .= "{$type} {$name}{$rel} {$version}\n";
                     }
                     $info[$key] = $dstr;
                     break;
                 case 'provides':
                     $debug = $this->config->get('verbose');
                     if ($debug < 2) {
                         $pstr = 'Classes: ';
                     } else {
                         $pstr = '';
                     }
                     $i = 0;
                     foreach ($info[$key] as $p) {
                         if ($debug < 2 && $p['type'] != "class") {
                             continue;
                         }
                         // Only print classes when verbosity mode is < 2
                         if ($debug < 2) {
                             if ($i++ > 0) {
                                 $pstr .= ", ";
                             }
                             $pstr .= $p['name'];
                         } else {
                             if ($i++ > 0) {
                                 $pstr .= "\n";
                             }
                             $pstr .= ucfirst($p['type']) . " " . $p['name'];
                             if (isset($p['explicit']) && $p['explicit'] == 1) {
                                 $pstr .= " (explicit)";
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:radicaldesigns,项目名称:amp,代码行数:101,代码来源:Registry.php


注:本文中的PEAR_Common::infoFromAny方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。