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


PHP GitRepository::isNameValid方法代码示例

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


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

示例1: cloneRepository

 public function cloneRepository($projectId, $forkName, $parentId)
 {
     $c = $this->getController();
     $projectId = intval($projectId);
     $parentId = intval($parentId);
     if (empty($projectId) || empty($forkName) || empty($parentId)) {
         $c->addError($this->getText('actions_params_error'));
         return false;
     }
     $parentRepo = new GitRepository();
     $parentRepo->setId($parentId);
     try {
         $parentRepo->load();
         // Disable possibility to delete gitolite repositories
         if ($parentRepo->getBackend() instanceof Git_Backend_Gitolite) {
             $c->addError($this->getText('disable_fork_gitolite'));
             $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $parentId . '/');
         }
         if ($parentRepo->isNameValid($forkName) === false) {
             $c->addError($this->getText('actions_input_format_error', array($parentRepo->getBackend()->getAllowedCharsInNamePattern(), GitDao::REPO_NAME_MAX_LENGTH)));
             $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $parentId . '/');
             return false;
         }
         if (!$parentRepo->isInitialized()) {
             $c->addError($this->getText('repo_not_initialized'));
             $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $parentId . '/');
             return false;
         }
     } catch (GitDaoException $e) {
         $c->addError($e->getMessage());
         $c->redirect('/plugins/git/?action=index&group_id=' . $projectId);
         return false;
     }
     $this->systemEventManager->createEvent('GIT_REPO_CLONE', $projectId . SystemEvent::PARAMETER_SEPARATOR . $forkName . SystemEvent::PARAMETER_SEPARATOR . $parentId . SystemEvent::PARAMETER_SEPARATOR . $this->user->getId(), SystemEvent::PRIORITY_MEDIUM);
     $c->addInfo($this->getText('actions_create_repo_process'));
     $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $parentId . '/');
     return;
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:38,代码来源:GitActions.class.php

示例2: checkNameValidation

 private function checkNameValidation(GitRepository $repo)
 {
     $this->assertFalse($repo->isNameValid(''));
     $this->assertFalse($repo->isNameValid('/'));
     $this->assertFalse($repo->isNameValid('/jambon'));
     $this->assertFalse($repo->isNameValid('jambon/'));
     $this->assertTrue($repo->isNameValid('jambon'));
     $this->assertTrue($repo->isNameValid('jambon.beurre'));
     $this->assertTrue($repo->isNameValid('jambon-beurre'));
     $this->assertTrue($repo->isNameValid('jambon_beurre'));
     $this->assertFalse($repo->isNameValid('jambon/.beurre'));
     $this->assertFalse($repo->isNameValid('jambon..beurre'));
     $this->assertFalse($repo->isNameValid('jambon...beurre'));
     $this->assertFalse($repo->isNameValid(str_pad('name_with_more_than_255_chars_', 256, '_')));
     $this->assertFalse($repo->isNameValid('repo.git'));
     $this->assertFalse($repo->isNameValid('u/toto'));
 }
开发者ID:nterray,项目名称:tuleap,代码行数:17,代码来源:GitRepositoryTest.php

示例3: isNamespaceValid

 private function isNamespaceValid(GitRepository $repository, $namespace)
 {
     if ($namespace) {
         $ns_chunk = explode('/', $namespace);
         foreach ($ns_chunk as $chunk) {
             if (!$repository->isNameValid($chunk)) {
                 throw new Exception($GLOBALS['Language']->getText('plugin_git', 'fork_repository_invalid_namespace'));
             }
         }
     }
     return true;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:12,代码来源:GitRepositoryManager.class.php


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