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


PHP PathHelper::assertValidLocalName方法代码示例

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


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

示例1: isValidNodename

 /**
  * Check if this node name is valid. Returns null if valid, an exception otherwise.
  *
  * @param string $nodeName The node local name
  *
  * @return RepositoryException|null
  */
 public function isValidNodename($nodeName)
 {
     try {
         $parts = explode(':', $nodeName);
         if (1 > count($parts) || 2 < count($parts)) {
             return new RepositoryException("Name contains illegal characters: {$nodeName}");
         }
         if (0 === strlen($parts[0])) {
             return new RepositoryException("Name may not be empty: {$nodeName}");
         }
         PathHelper::assertValidLocalName($parts[0]);
         if (2 == count($parts)) {
             // [0] was the namespace prefix, also check the name
             PathHelper::assertValidLocalName($parts[1]);
             if (0 === strlen($parts[1])) {
                 return new RepositoryException("Local name may not be empty: {$nodeName}");
             }
         }
     } catch (RepositoryException $e) {
         return $e;
     }
     return null;
 }
开发者ID:steffenbrem,项目名称:phpcr-odm,代码行数:30,代码来源:ClassMetadata.php

示例2: testAssertInvalidLocalName

 /**
  * @dataProvider dataproviderInvalidLocalNames
  * @expectedException \PHPCR\RepositoryException
  */
 public function testAssertInvalidLocalName($name)
 {
     PathHelper::assertValidLocalName($name);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:8,代码来源:PathHelperTest.php

示例3: validateWorkspaceName

 private function validateWorkspaceName($name)
 {
     $res = PathHelper::assertValidLocalName($name);
     if (!$res) {
         throw new RepositoryException(sprintf('Invalid workspace name "%s"', $name));
     }
 }
开发者ID:jackalope,项目名称:jackalope-fs,代码行数:7,代码来源:Client.php

示例4: assertValidName

 /**
  * Minimal check according to the jcr spec to see if this node name
  * conforms to the specification
  *
  * If it can't be avoided, extending transports may overwrite this method to add
  * additional checks. But this will reduce interchangeability, thus it is better to
  * properly encode and decode characters that are not natively allowed by the storage.
  *
  * @param string $name The name to check
  *
  * @return boolean always true, if the name is not valid a RepositoryException is thrown
  *
  * @see http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.2.2%20Local%20Names
  *
  * @throws RepositoryException if the name contains invalid characters
  */
 public function assertValidName($name)
 {
     return PathHelper::assertValidLocalName($name);
 }
开发者ID:frogriotcom,项目名称:jackalope,代码行数:20,代码来源:BaseTransport.php


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