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


PHP MetadataDescription::getStatements方法代码示例

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


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

示例1: serializeCitationDescription

 private function serializeCitationDescription(MetadataDescription &$citationDescription)
 {
     // Prepare transformation tables for the output serialization:
     // - the following lines will be deleted from our output file
     static $linesToDelete = array('    [0-9]+ => ', '    array \\(', '      \'_data\' => ', '    \\),');
     // Transform person descriptions to arrays
     $citationDescriptionArray = $citationDescription->getStatements();
     $personDescriptionProperties = array('person-group[@person-group-type="author"]', 'person-group[@person-group-type="editor"]');
     foreach ($personDescriptionProperties as $personDescriptionProperty) {
         if (isset($citationDescriptionArray[$personDescriptionProperty])) {
             foreach ($citationDescriptionArray[$personDescriptionProperty] as &$person) {
                 $person = $person->getStatements();
             }
         }
     }
     // Transform the result into an array that we can serialize
     // in a human-readable form and also re-import as PHP-parsable code.
     $citationDescriptionOutput = var_export($citationDescriptionArray, true);
     $citationDescriptionOutputArray = explode("\n", $citationDescriptionOutput);
     foreach ($citationDescriptionOutputArray as $key => &$citationDescriptionOutputLine) {
         // Remove redundant lines
         foreach ($linesToDelete as $lineToDelete) {
             if (preg_match('/^' . $lineToDelete . '$/', $citationDescriptionOutputLine)) {
                 unset($citationDescriptionOutputArray[$key]);
             }
         }
         // Correctly indent the output line
         $citationDescriptionOutputLine = "\t\t\t" . preg_replace('/^\\t\\t\\t/', "\t\t", str_replace('  ', "\t", $citationDescriptionOutputLine));
     }
     // Create the final serialized format
     return implode("\n", $citationDescriptionOutputArray);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:32,代码来源:Nlm30CitationSchemaParserFilterTestCase.inc.php


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