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


PHP ParserTools::parseLimitation方法代码示例

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


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

示例1: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $policyUpdate = $this->roleService->newPolicyUpdateStruct();
     // @todo XSD says that limitations field is mandatory, but
     // it needs to be possible to remove limitations from policy
     if (array_key_exists('limitations', $data)) {
         if (!is_array($data['limitations'])) {
             throw new Exceptions\Parser("Invalid format for 'limitations' in PolicyUpdate.");
         }
         if (!isset($data['limitations']['limitation']) || !is_array($data['limitations']['limitation'])) {
             throw new Exceptions\Parser("Invalid format for 'limitations' in PolicyUpdate.");
         }
         foreach ($data['limitations']['limitation'] as $limitationData) {
             $policyUpdate->addLimitation($this->parserTools->parseLimitation($limitationData));
         }
     }
     return $policyUpdate;
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:26,代码来源:PolicyUpdate.php

示例2: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\Core\REST\Server\Values\RoleAssignment
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('Role', $data)) {
         throw new Exceptions\Parser("Missing 'Role' element for RoleAssignInput.");
     }
     if (!is_array($data['Role']) || !array_key_exists('_href', $data['Role'])) {
         throw new Exceptions\Parser("Invalid 'Role' element for RoleAssignInput.");
     }
     try {
         $roleId = $this->requestParser->parseHref($data['Role']['_href'], 'roleId');
     } catch (Exceptions\InvalidArgumentException $e) {
         throw new Exceptions\Parser('Invalid format for <Role> reference in <RoleAssignInput>.');
     }
     // @todo XSD says that limitation is mandatory, but roles can be assigned without limitations
     $limitation = null;
     if (array_key_exists('limitation', $data) && is_array($data['limitation'])) {
         $limitation = $this->parserTools->parseLimitation($data['limitation']);
     }
     return new RoleAssignment($roleId, $limitation);
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:28,代码来源:RoleAssignInput.php

示例3: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('module', $data)) {
         throw new Exceptions\Parser("Missing 'module' attribute for PolicyCreate.");
     }
     if (!array_key_exists('function', $data)) {
         throw new Exceptions\Parser("Missing 'function' attribute for PolicyCreate.");
     }
     $policyCreate = $this->roleService->newPolicyCreateStruct($data['module'], $data['function']);
     // @todo XSD says that limitations is mandatory,
     // but polices can be created without limitations
     if (array_key_exists('limitations', $data)) {
         if (!is_array($data['limitations'])) {
             throw new Exceptions\Parser("Invalid format for 'limitations' in PolicyCreate.");
         }
         if (!isset($data['limitations']['limitation']) || !is_array($data['limitations']['limitation'])) {
             throw new Exceptions\Parser("Invalid format for 'limitations' in PolicyCreate.");
         }
         foreach ($data['limitations']['limitation'] as $limitationData) {
             $policyCreate->addLimitation($this->parserTools->parseLimitation($limitationData));
         }
     }
     return $policyCreate;
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:32,代码来源:PolicyCreate.php


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