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


PHP Phing::__import方法代码示例

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


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

示例1: getDefinedClasses

 /**
  * @param string the filename
  * @param Path optional classpath
  * @return array list of classes defined in the file
  */
 static function getDefinedClasses($filename, $classpath = NULL)
 {
     $filename = realpath($filename);
     if (!file_exists($filename)) {
         throw new Exception("File '" . $filename . "' does not exist");
     }
     if (isset(self::$definedClasses[$filename])) {
         return self::$definedClasses[$filename];
     }
     Phing::__import($filename, $classpath);
     $declaredClasses = get_declared_classes();
     foreach ($declaredClasses as $classname) {
         $reflect = new ReflectionClass($classname);
         self::$definedClasses[$reflect->getFilename()][] = $classname;
         if (is_array(self::$definedClasses[$reflect->getFilename()])) {
             self::$definedClasses[$reflect->getFilename()] = array_unique(self::$definedClasses[$reflect->getFilename()]);
         }
     }
     if (isset(self::$definedClasses[$filename])) {
         return self::$definedClasses[$filename];
     } else {
         return array();
     }
 }
开发者ID:umesecke,项目名称:phing,代码行数:29,代码来源:PHPUnitUtil.php

示例2: import

 /**
  * Import a path, supporting the following conventions:
  * - PEAR style (@link http://pear.php.net/manual/en/standards.naming.php)
  * - PSR-0 (@link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
  * - dot-path
  *
  * @param string $dotPath   Path
  * @param mixed  $classpath String or object supporting __toString()
  *
  * @return string         The unqualified classname (which can be instantiated).
  *
  * @throws BuildException - if cannot find the specified file
  */
 public static function import($dotPath, $classpath = null)
 {
     if (strpos($dotPath, '.') !== false) {
         $classname = StringHelper::unqualify($dotPath);
     } else {
         $classname = $dotPath;
         $dotPath = '';
         $shortClassName = $classname;
         if ($lastNsPos = strripos($shortClassName, '\\')) {
             $namespace = substr($shortClassName, 0, $lastNsPos);
             $shortClassName = substr($shortClassName, $lastNsPos + 1);
             $dotPath = str_replace('\\', '.', $namespace) . '.';
         }
         $dotPath .= str_replace('_', '.', $shortClassName);
     }
     // first check to see that the class specified hasn't already been included.
     // (this also handles case where this method is called w/ a classname rather than dotpath)
     if (class_exists($classname)) {
         return $classname;
     }
     $dotClassname = basename($dotPath);
     $dotClassnamePos = strlen($dotPath) - strlen($dotClassname);
     // 1- temporarily replace escaped '.' with another illegal char (#)
     $tmp = str_replace('\\.', '##', $dotClassname);
     // 2- swap out the remaining '.' with DIR_SEP
     $tmp = strtr($tmp, '.', DIRECTORY_SEPARATOR);
     // 3- swap back the escaped '.'
     $tmp = str_replace('##', '.', $tmp);
     $classFile = $tmp . ".php";
     $path = substr_replace($dotPath, $classFile, $dotClassnamePos);
     Phing::__import($path, $classpath);
     return $classname;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:46,代码来源:Phing.php

示例3: import

 /**
  * Import a dot-path notation class path.
  * @param string $dotPath
  * @param mixed $classpath String or object supporting __toString()
  * @return string The unqualified classname (which can be instantiated).
  * @throws BuildException - if cannot find the specified file
  */
 public static function import($dotPath, $classpath = null)
 {
     /// check if this is a PEAR-style path (@link http://pear.php.net/manual/en/standards.naming.php)
     if (strpos($dotPath, '.') === false && strpos($dotPath, '_') !== false) {
         $classname = $dotPath;
         $dotPath = str_replace('_', '.', $dotPath);
     } else {
         $classname = StringHelper::unqualify($dotPath);
     }
     // first check to see that the class specified hasn't already been included.
     // (this also handles case where this method is called w/ a classname rather than dotpath)
     if (class_exists($classname)) {
         return $classname;
     }
     $dotClassname = basename($dotPath);
     $dotClassnamePos = strlen($dotPath) - strlen($dotClassname);
     // 1- temporarily replace escaped '.' with another illegal char (#)
     $tmp = str_replace('\\.', '##', $dotClassname);
     // 2- swap out the remaining '.' with DIR_SEP
     $tmp = strtr($tmp, '.', DIRECTORY_SEPARATOR);
     // 3- swap back the escaped '.'
     $tmp = str_replace('##', '.', $tmp);
     $classFile = $tmp . ".php";
     $path = substr_replace($dotPath, $classFile, $dotClassnamePos);
     Phing::__import($path, $classpath);
     return $classname;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:34,代码来源:Phing.php

示例4: main

 function main()
 {
     $files = $this->getFilenames();
     $this->log("Setting up coverage database for " . count($files) . " files");
     $props = new Properties();
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         $filename = $file['key'];
         $props->setProperty($filename, serialize(array('fullname' => $fullname, 'coverage' => array())));
     }
     $dbfile = new PhingFile($this->database);
     $props->store($dbfile);
     $this->project->setProperty('coverage.database', $dbfile->getAbsolutePath());
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
         Phing::__import($fullname, $this->classpath);
         $coverage = xdebug_get_code_coverage();
         xdebug_stop_code_coverage();
         CoverageMerger::merge($this->project, array($coverage));
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:22,代码来源:CoverageSetupTask.php

示例5: import

 /**
  * Import a dot-path notation class path.
  * @param string $dotPath
  * @param mixed $classpath String or object supporting __toString()
  * @return string The unqualified classname (which can be instantiated).
  * @throws BuildException - if cannot find the specified file
  */
 public static function import($dotPath, $classpath = null)
 {
     // first check to see that the class specified hasn't already been included.
     // (this also handles case where this method is called w/ a classname rather than dotpath)
     $classname = StringHelper::unqualify($dotPath);
     if (class_exists($classname, false)) {
         return $classname;
     }
     $dotClassname = basename($dotPath);
     $dotClassnamePos = strlen($dotPath) - strlen($dotClassname);
     $classFile = strtr($dotClassname, '.', DIRECTORY_SEPARATOR) . ".php";
     $path = substr_replace($dotPath, $classFile, $dotClassnamePos);
     Phing::__import($path, $classpath);
     return $classname;
 }
开发者ID:domenypl,项目名称:symfony1-legacy,代码行数:22,代码来源:Phing.php


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