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


PHP core_kernel_classes_Resource::getRepository方法代码示例

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


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

示例1: exec

 /**
  * Short description of method exec
  *
  * @access public
  * @author Cédric Alfonsi, <cedric.alfonsi@tudor.lu>
  * @param  Resource resource
  * @param  string command
  * @return string
  */
 public static function exec(core_kernel_classes_Resource $resource, $command)
 {
     $returnValue = (string) '';
     $username = "";
     $password = "";
     $repository = null;
     try {
         if (empty($command)) {
             throw new Exception(__CLASS__ . ' -> ' . __FUNCTION__ . '() : $command_ must be specified');
         }
         //get context variables
         if ($resource instanceof core_kernel_versioning_File) {
             $repository = $resource->getRepository();
         } else {
             if ($resource instanceof core_kernel_versioning_Repository) {
                 $repository = $resource;
             } else {
                 throw new Exception('The first parameter (resource) should be a File or a Repository');
             }
         }
         if (is_null($repository)) {
             throw new Exception('Unable to find the repository to work with for the reference resource (' . $resource->getUri() . ')');
         }
         $username = $repository->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_GENERIS_VERSIONEDREPOSITORY_LOGIN));
         $password = $repository->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_GENERIS_VERSIONEDREPOSITORY_PASSWORD));
         $returnValue = shell_exec('svn --username ' . $username . ' --password ' . $password . ' ' . $command);
         //                var_dump('svn --username ' . $username . ' --password ' . $password . ' ' . $command);
         //                var_dump($returnValue);
     } catch (Exception $e) {
         die('Error code `svn_error_command` in ' . $e->getMessage());
     }
     return (string) $returnValue;
 }
开发者ID:nagyist,项目名称:generis,代码行数:42,代码来源:class.Utils.php

示例2: getImplementationToDelegateTo

 /**
  * Short description of method getImplementationToDelegateTo
  *
  * @access public
  * @author Cédric Alfonsi, <cedric.alfonsi@tudor.lu>
  * @param  Resource resource
  * @return core_kernel_versioning_FileInterface
  */
 public function getImplementationToDelegateTo(core_kernel_classes_Resource $resource)
 {
     $returnValue = null;
     $repository = $resource->getRepository();
     if (!is_null($repository)) {
         $VCStype = $repository->getVCSType();
         $implClass = '';
         // Function of the repository type, define the implementation to attack
         switch ($VCStype->getUri()) {
             case PROPERTY_GENERIS_VCS_TYPE_SUBVERSION:
                 $implClass = 'core_kernel_versioning_subversion_File';
                 break;
             case PROPERTY_GENERIS_VCS_TYPE_SUBVERSION_WIN:
                 $implClass = 'core_kernel_versioning_subversionWindows_File';
                 break;
             case INSTANCE_GENERIS_VCS_TYPE_LOCAL:
                 $implClass = 'core_kernel_versioning_local_File';
                 break;
             default:
                 throw new common_exception_Error('unknown Version Control System ' . $VCStype->getLabel() . '(' . $VCStype . ')');
         }
         // If an implementation has been found
         if (!empty($implClass)) {
             $reflectionMethod = new ReflectionMethod($implClass, 'singleton');
             $delegate = $reflectionMethod->invoke(null);
             $returnValue = $delegate;
         }
     } else {
         throw new core_kernel_versioning_exception_FileUnversionedException('no repository associated to the aledged versioned file');
     }
     return $returnValue;
 }
开发者ID:nagyist,项目名称:generis,代码行数:40,代码来源:class.FileProxy.php


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