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


PHP PEAR_Installer_Role::getPhpRoles方法代码示例

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


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

示例1: _analyzePhpFiles

 function _analyzePhpFiles()
 {
     if (!$this->_isValid) {
         return false;
     }
     if (!isset($this->_pf->_packageFile)) {
         $this->_cannotValidateNoPathSet();
         return false;
     }
     $dir_prefix = dirname($this->_pf->_packageFile);
     $common = new PEAR_Common();
     $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') : array(&$common, 'log');
     $info = $this->_pf->getContents();
     if (!$info || !isset($info['dir']['file'])) {
         $this->_tagCannotBeEmpty('contents><dir');
         return false;
     }
     $info = $info['dir']['file'];
     if (isset($info['attribs'])) {
         $info = array($info);
     }
     $provides = array();
     foreach ($info as $fa) {
         $fa = $fa['attribs'];
         $file = $fa['name'];
         if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
             $this->_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $file);
             $this->_isValid = 0;
             continue;
         }
         if (in_array($fa['role'], PEAR_Installer_Role::getPhpRoles()) && $dir_prefix) {
             call_user_func_array($log, array(1, "Analyzing {$file}"));
             $srcinfo = $this->analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
             if ($srcinfo) {
                 $provides = array_merge($provides, $this->_buildProvidesArray($srcinfo));
             }
         }
     }
     $this->_packageName = $pn = $this->_pf->getPackage();
     $pnl = strlen($pn);
     foreach ($provides as $key => $what) {
         if (isset($what['explicit']) || !$what) {
             // skip conformance checks if the provides entry is
             // specified in the package.xml file
             continue;
         }
         extract($what);
         if ($type == 'class') {
             if (!strncasecmp($name, $pn, $pnl)) {
                 continue;
             }
             $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn), 'in %file%: %type% "%name%" not prefixed with package name "%package%"');
         } elseif ($type == 'function') {
             if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
                 continue;
             }
             $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn), 'in %file%: %type% "%name%" not prefixed with package name "%package%"');
         }
     }
     return $this->_isValid;
 }
开发者ID:racontemoi,项目名称:mamp,代码行数:61,代码来源:Validator.php

示例2: registerRoles

 /**
  * Scan through the Command directory looking for classes
  * and see what commands they implement.
  * @param string which directory to look for classes, defaults to
  *               the Installer/Roles subdirectory of
  *               the directory from where this file (__FILE__) is
  *               included.
  *
  * @return bool TRUE on success, a PEAR error on failure
  * @access public
  * @static
  */
 function registerRoles($dir = null)
 {
     $GLOBALS['_PEAR_INSTALLER_ROLES'] = array();
     $parser = new PEAR_XMLParser();
     if ($dir === null) {
         $dir = dirname(__FILE__) . '/Role';
     }
     if (!file_exists($dir) || !is_dir($dir)) {
         return PEAR::raiseError("registerRoles: opendir({$dir}) failed");
     }
     $dp = @opendir($dir);
     if (empty($dp)) {
         return PEAR::raiseError("registerRoles: opendir({$dir}) failed");
     }
     while ($entry = readdir($dp)) {
         if ($entry[0] == '.' || substr($entry, -4) != '.xml') {
             continue;
         }
         $class = "PEAR_Installer_Role_" . substr($entry, 0, -4);
         // List of roles
         if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) {
             $file = "{$dir}/{$entry}";
             $parser->parse(file_get_contents($file));
             $data = $parser->getData();
             if (!is_array($data['releasetypes'])) {
                 $data['releasetypes'] = array($data['releasetypes']);
             }
             $GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = $data;
         }
     }
     closedir($dp);
     ksort($GLOBALS['_PEAR_INSTALLER_ROLES']);
     PEAR_Installer_Role::getBaseinstallRoles(true);
     PEAR_Installer_Role::getInstallableRoles(true);
     PEAR_Installer_Role::getPhpRoles(true);
     PEAR_Installer_Role::getValidRoles('****', true);
     return true;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:50,代码来源:Role.php

示例3: registerRoles

 /**
  * Scan through the Command directory looking for classes
  * and see what commands they implement.
  * @param string which directory to look for classes, defaults to
  *               the Installer/Roles subdirectory of
  *               the directory from where this file (__FILE__) is
  *               included.
  *
  * @return bool TRUE on success, a PEAR error on failure
  * @access public
  * @static
  */
 function registerRoles($dir = null)
 {
     if ($dir === null) {
         $dir = dirname(__FILE__) . '/Role';
     }
     $dp = @opendir($dir);
     if (empty($dp)) {
         return PEAR::raiseError("registerRoles: opendir({$dir}) failed");
     }
     while ($entry = readdir($dp)) {
         if ($entry[0] == '.' || substr($entry, -4) != '.php' || $entry == 'Common.php') {
             continue;
         }
         $class = "PEAR_Installer_Role_" . substr($entry, 0, -4);
         $file = "{$dir}/{$entry}";
         include_once $file;
         // List of roles
         if (empty($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) {
             $GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = call_user_func(array($class, 'getInfo'));
         }
     }
     @closedir($dp);
     ksort($GLOBALS['_PEAR_INSTALLER_ROLES']);
     PEAR_Installer_Role::getBaseinstallRoles(true);
     PEAR_Installer_Role::getInstallableRoles(true);
     PEAR_Installer_Role::getPhpRoles(true);
     PEAR_Installer_Role::getValidRoles('****', true);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:dilps,代码行数:41,代码来源:Role.php


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