當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。