• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Output\Generator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中eZ\Publish\Core\REST\Common\Output\Generator的典型用法代码示例。如果您正苦于以下问题:PHP Generator类的具体用法?PHP Generator怎么用?PHP Generator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: visit

 /**
  * @param Visitor $visitor
  * @param Generator $generator
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $contentTypeIdentifiers = is_array($data->value) ? $data->value : [$data->value];
     $generator->startList('ContentTypeIdentifierCriterion');
     foreach ($contentTypeIdentifiers as $contentTypeIdentifier) {
         $generator->startValueElement('ContentTypeIdentifierCriterion', $contentTypeIdentifier);
         $generator->endValueElement('ContentTypeIdentifierCriterion');
     }
     $generator->endList('ContentTypeIdentifierCriterion');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:15,代码来源:ContentTypeIdentifier.php


示例2: visit

 /**
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  * @return mixed
  * @throws \EzSystems\RecommendationBundle\Rest\Exception\ResponseClassNotImplementedException
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentList'));
     if (empty($data->contents)) {
         $visitor->setStatus(204);
         return;
     }
     if (!isset($this->responseRenderers[$data->options['responseType']])) {
         throw new ResponseClassNotImplementedException(sprintf('Renderer for %s response not implemented.', $data->options['responseType']));
     }
     return $this->responseRenderers[$data->options['responseType']]->render($generator, $data);
 }
开发者ID:kamilmusial,项目名称:EzSystemsRecommendationBundle,代码行数:19,代码来源:ContentData.php


示例3: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentObjectStates');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentObjectStates'));
     $generator->startList('ObjectState');
     foreach ($data->states as $state) {
         $generator->startObjectElement('ObjectState');
         $generator->startAttribute('href', $this->requestParser->generate('objectstate', array('objectstategroup' => $state->groupId, 'objectstate' => $state->objectState->id)));
         $generator->endAttribute('href');
         $generator->endObjectElement('ObjectState');
     }
     $generator->endList('ObjectState');
     $generator->endObjectElement('ContentObjectStates');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:21,代码来源:ContentObjectStates.php


示例4: visit

 /**
  * @param Visitor $visitor
  * @param Generator $generator
  * @param \eZ\Publish\Core\REST\Client\Values\ViewInput $data
  * @throws Exceptions\InvalidArgumentException
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ViewInput');
     $generator->startValueElement('identifier', $data->identifier);
     $generator->endValueElement('identifier');
     if ($data->locationQuery !== null) {
         $queryElementName = 'locationQuery';
     } elseif ($data->contentQuery !== null) {
         $queryElementName = 'contentQuery';
     } else {
         throw new Exceptions\InvalidArgumentException("ViewInput Query", "No content nor location query found in ViewInput");
     }
     $visitor->visitValueObject($data->{$queryElementName});
     $generator->endObjectElement('ViewInput');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:21,代码来源:ViewInput.php


示例5: visitField

 /**
  * Visits a single content field and generates its content
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
  * @param \eZ\Publish\API\Repository\Values\Content\Field $field
  */
 public function visitField(Generator $generator, ContentType $contentType, Field $field)
 {
     $generator->startHashElement('field');
     $generator->startValueElement('id', $field->id);
     $generator->endValueElement('id');
     $generator->startValueElement('fieldDefinitionIdentifier', $field->fieldDefIdentifier);
     $generator->endValueElement('fieldDefinitionIdentifier');
     $generator->startValueElement('languageCode', $field->languageCode);
     $generator->endValueElement('languageCode');
     $this->fieldTypeSerializer->serializeFieldValue($generator, $contentType, $field);
     $generator->endHashElement('field');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:19,代码来源:Version.php


示例6: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('SectionInput');
     $visitor->setHeader('Content-Type', $generator->getMediaType('SectionInput'));
     $generator->startValueElement('identifier', $data->identifier);
     $generator->endValueElement('identifier');
     $generator->startValueElement('name', $data->name);
     $generator->endValueElement('name');
     $generator->endObjectElement('SectionInput');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:17,代码来源:SectionCreateStruct.php


示例7: visit

 /**
  * Visit struct returned by controllers.
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('SessionInput');
     $visitor->setHeader('Content-Type', $generator->getMediaType('SessionInput'));
     $generator->startValueElement('login', $data->login);
     $generator->endValueElement('login');
     $generator->startValueElement('password', $data->password);
     $generator->endValueElement('password');
     $generator->endObjectElement('SessionInput');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:17,代码来源:SessionInput.php


示例8: visit

 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     if ($data instanceof LocationQueryValue) {
         $rootObjectElement = 'LocationQuery';
     } else {
         if ($data instanceof ContentQueryValue) {
             $rootObjectElement = 'ContentQuery';
         } else {
             throw new Exceptions\InvalidArgumentException("ViewInput Query", "No content nor location query found in ViewInput");
         }
     }
     $generator->startObjectElement($rootObjectElement, 'Query');
     if (isset($data->filter)) {
         $generator->startHashElement('Filter');
         $visitor->visitValueObject($data->filter);
         $generator->endHashElement('Filter');
     }
     if (isset($data->query)) {
         $generator->startHashElement('Query');
         $visitor->visitValueObject($data->query);
         $generator->endhashElement('Query');
     }
     // $generator->startObjectElement('SortClauses');
     // foreach ($data->sortClauses as $sortClause) {
     //     $visitor->visitValueObject($sortClause);
     // }
     // $generator->endObjectElement('SortClauses');
     $generator->endObjectElement($rootObjectElement);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:29,代码来源:Query.php


示例9: visit

 /**
  * Visit struct returned by controllers.
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\RoleAssignmentList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('RoleAssignmentList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignmentList'));
     $generator->startAttribute('href', $data->isGroupAssignment ? $this->router->generate('ezpublish_rest_loadRoleAssignmentsForUserGroup', array('groupPath' => $data->id)) : $this->router->generate('ezpublish_rest_loadRoleAssignmentsForUser', array('userId' => $data->id)));
     $generator->endAttribute('href');
     $generator->startList('RoleAssignment');
     foreach ($data->roleAssignments as $roleAssignment) {
         $visitor->visitValueObject($data->isGroupAssignment ? new Values\RestUserGroupRoleAssignment($roleAssignment, $data->id) : new Values\RestUserRoleAssignment($roleAssignment, $data->id));
     }
     $generator->endList('RoleAssignment');
     $generator->endObjectElement('RoleAssignmentList');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:RoleAssignmentList.php


示例10: visit

 /**
  * Visit struct returned by controllers.
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\URLWildcardList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('UrlWildcardList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('UrlWildcardList'));
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_listURLWildcards'));
     $generator->endAttribute('href');
     $generator->startList('UrlWildcard');
     foreach ($data->urlWildcards as $urlWildcard) {
         $visitor->visitValueObject($urlWildcard);
     }
     $generator->endList('UrlWildcard');
     $generator->endObjectElement('UrlWildcardList');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:URLWildcardList.php


示例11: visit

 /**
  * Visit struct returned by controllers.
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\URLAliasList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('UrlAliasList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAliasList'));
     $generator->startAttribute('href', $data->path);
     $generator->endAttribute('href');
     $generator->startList('UrlAlias');
     foreach ($data->urlAliases as $urlAlias) {
         $visitor->visitValueObject($urlAlias);
     }
     $generator->endList('UrlAlias');
     $generator->endObjectElement('UrlAliasList');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:URLAliasList.php


示例12: visit

 /**
  * Visit struct returned by controllers.
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\Trash $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('Trash');
     $visitor->setHeader('Content-Type', $generator->getMediaType('Trash'));
     $generator->startAttribute('href', $data->path);
     $generator->endAttribute('href');
     $generator->startList('TrashItem');
     foreach ($data->trashItems as $trashItem) {
         $visitor->visitValueObject($trashItem);
     }
     $generator->endList('TrashItem');
     $generator->endObjectElement('Trash');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:20,代码来源:Trash.php


示例13: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('RoleAssignInput');
     $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignInput'));
     $generator->startObjectElement('Role');
     $generator->startAttribute('href', $this->requestParser->generate('role', array('role' => $data->getRole()->id)));
     $generator->endAttribute('href');
     $generator->endObjectElement('Role');
     $roleLimitation = $data->getRoleLimitation();
     if ($roleLimitation !== null) {
         $visitor->visitValueObject($roleLimitation);
     }
     $generator->endObjectElement('RoleAssignInput');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:21,代码来源:RoleAssignment.php


示例14: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\ContentTypeInfoList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentTypeInfoList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeInfoList'));
     //@todo Needs refactoring, disabling certain headers should not be done this way
     $visitor->setHeader('Accept-Patch', false);
     $generator->startAttribute('href', $data->path);
     $generator->endAttribute('href');
     $generator->startList('ContentType');
     foreach ($data->contentTypes as $contentType) {
         $visitor->visitValueObject(new Values\RestContentType($contentType));
     }
     $generator->endList('ContentType');
     $generator->endObjectElement('ContentTypeInfoList');
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:22,代码来源:ContentTypeInfoList.php


示例15: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\ContentList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentList'));
     //@todo Needs refactoring, disabling certain headers should not be done this way
     $visitor->setHeader('Accept-Patch', false);
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_redirectContent'));
     $generator->endAttribute('href');
     $generator->startList('ContentInfo');
     foreach ($data->contents as $content) {
         $visitor->visitValueObject($content);
     }
     $generator->endList('ContentInfo');
     $generator->endObjectElement('ContentList');
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:22,代码来源:ContentList.php


示例16: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\ObjectStateList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ObjectStateList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateList'));
     //@todo Needs refactoring, disabling certain headers should not be done this way
     $visitor->setHeader('Accept-Patch', false);
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadObjectStates', array('objectStateGroupId' => $data->groupId)));
     $generator->endAttribute('href');
     $generator->startList('ObjectState');
     foreach ($data->states as $state) {
         $visitor->visitValueObject(new RestObjectStateValue($state, $data->groupId));
     }
     $generator->endList('ObjectState');
     $generator->endObjectElement('ObjectStateList');
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:22,代码来源:ObjectStateList.php


示例17: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('PolicyUpdate');
     $visitor->setHeader('Content-Type', $generator->getMediaType('PolicyUpdate'));
     $limitations = $data->getLimitations();
     if (!empty($limitations)) {
         $generator->startObjectElement('limitations');
         $generator->startList('limitations');
         foreach ($limitations as $limitation) {
             $visitor->visitValueObject($limitation);
         }
         $generator->endList('limitations');
         $generator->endObjectElement('limitations');
     }
     $generator->endObjectElement('PolicyUpdate');
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:23,代码来源:PolicyUpdateStruct.php


示例18: render

 public function render(Generator $generator, $data)
 {
     ini_set('max_execution_time', 0);
     if (file_exists($data->options['documentRoot'] . '/var/export/.lock')) {
         throw new ExportInProgressException('Export is running');
     }
     $chunkDir = $this->createChunkDir($data->options['documentRoot']);
     $chunkDirPath = $data->options['documentRoot'] . '/var/export' . $chunkDir;
     $chunks = array_chunk($data->contents, $data->options['chunkSize']);
     $urls = [];
     touch($data->options['documentRoot'] . '/var/export/.lock');
     foreach ($chunks as $id => $chunk) {
         $chunkPath = $chunkDirPath . $id;
         $generator->reset();
         $generator->startDocument($chunk);
         $this->contentListElementGenerator->generateElement($generator, $chunk);
         file_put_contents($chunkPath, $generator->endDocument($chunk));
         $urls[] = sprintf('%s/api/ezp/v2/ez_recommendation/v1/exportDownload%s%s', $data->options['host'], $chunkDir, $id);
     }
     unlink($data->options['documentRoot'] . '/var/export/.lock');
     echo $this->sendYCResponse($urls, $data->options, $chunkDirPath);
     $generator->reset();
     return $generator;
 }
开发者ID:kamilmusial,项目名称:EzSystemsRecommendationBundle,代码行数:24,代码来源:ExportResponse.php


示例19: visit

 /**
  * Visit struct returned by controllers.
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\RelationList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('Relations', 'RelationList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('RelationList'));
     $path = $data->path;
     if ($path === null) {
         $path = $this->router->generate('ezpublish_rest_loadVersionRelations', array('contentId' => $data->contentId, 'versionNumber' => $data->versionNo));
     }
     $generator->startAttribute('href', $path);
     $generator->endAttribute('href');
     $generator->startList('Relation');
     foreach ($data->relations as $relation) {
         $visitor->visitValueObject(new ValuesRestRelation($relation, $data->contentId, $data->versionNo));
     }
     $generator->endList('Relation');
     $generator->endObjectElement('Relations');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:24,代码来源:RelationList.php


示例20: visit

 /**
  * Visit struct returned by controllers
  *
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\FieldDefinitionList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $fieldDefinitionList = $data;
     $contentType = $fieldDefinitionList->contentType;
     $urlTypeSuffix = $this->getUrlTypeSuffix($contentType->status);
     $generator->startObjectElement('FieldDefinitions', 'FieldDefinitionList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('FieldDefinitionList'));
     //@todo Needs refactoring, disabling certain headers should not be done this way
     $visitor->setHeader('Accept-Patch', false);
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContentType' . $urlTypeSuffix . 'FieldDefinitionList', array('contentTypeId' => $contentType->id)));
     $generator->endAttribute('href');
     $generator->startList('FieldDefinition');
     foreach ($fieldDefinitionList->fieldDefinitions as $fieldDefinition) {
         $visitor->visitValueObject(new ValuesRestFieldDefinition($contentType, $fieldDefinition));
     }
     $generator->endList('FieldDefinition');
     $generator->endObjectElement('FieldDefinitions');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:25,代码来源:FieldDefinitionList.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Output\Visitor类代码示例发布时间:2022-05-23
下一篇:
PHP Input\ParserTools类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap