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


PHP midgardmvc_core::read_yaml方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $path = midgardmvc_core::get_component_path('midgardmvc_core') . '/configuration/defaults.yml';
     $yaml = file_get_contents($path);
     $this->testConfiguration = midgardmvc_core::read_yaml($yaml);
     parent::setUp();
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:configurationTest.php

示例2: get_configuration

 public function get_configuration()
 {
     if (is_null($this->configuration)) {
         $configuration_param = $this->node->get_parameter('midgardmvc_core', 'configuration');
         $this->configuration = array();
         if ($configuration_param) {
             $this->configuration = midgardmvc_core::read_yaml($configuration_param);
         }
     }
     return $this->configuration;
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:11,代码来源:midgard2.php

示例3: load_manifest_file

 /**
  * Load a component manifest file
  *
  * @param string $manifest_file Path of the manifest file
  */
 private function load_manifest_file($component, $manifest_file)
 {
     if (!file_exists($manifest_file)) {
         throw new OutOfRangeException("Component manifest {$manifest_file} is not installed");
     }
     $manifest_yaml = file_get_contents($manifest_file);
     $manifest = midgardmvc_core::read_yaml($manifest_yaml);
     // Normalize manifest
     if (!isset($manifest['version'])) {
         $manifest['version'] = '0.0.1devel';
     }
     if (!isset($manifest['extends'])) {
         $manifest['extends'] = null;
     } elseif (!isset($this->components_enabled[$manifest['extends']])) {
         // Ensure the parent component is always enabled
         $this->components_enabled[$manifest['extends']] = array();
     }
     if (!isset($manifest['requires']) || !is_array($manifest['requires'])) {
         $manifest['requires'] = array();
     }
     // Ensure the required components are always enabled
     foreach ($manifest['requires'] as $component_required => $component_info) {
         $this->components_enabled[$component_required] = array();
     }
     if (isset($manifest['process_injector'])) {
         // This component has an injector for the process() phase
         $this->injectors['process'][$component] = $manifest['process_injector'];
     }
     if (isset($manifest['template_injector'])) {
         // This component has an injector for the template() phase
         $this->injectors['template'][$component] = $manifest['template_injector'];
     }
     if (!isset($manifest['observations'])) {
         $manifest['observations'] = array();
     }
     foreach ($manifest['observations'] as $index => $observation) {
         if (!is_array($observation['type'])) {
             $observation['type'] = array($observation['type']);
         }
         if (!is_array($observation['event'])) {
             $observation['event'] = array($observation['event']);
         }
         $manifest['observations'][$index] = $observation;
     }
     return $manifest;
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:51,代码来源:midgardmvc.php

示例4: read_configuration

 private static function read_configuration($local_configuration = null)
 {
     if (is_array($local_configuration)) {
         // Configuration passed as a PHP array
         return $local_configuration;
     } elseif (is_string($local_configuration) && substr($local_configuration, 0, 1) == '/') {
         // Application YAML file provided, load configuration from it
         if (!file_exists($local_configuration)) {
             throw new Exception("Application configuration file {$local_configuration} not found");
         }
         $configuration_yaml = file_get_contents($local_configuration);
         return midgardmvc_core::read_yaml($configuration_yaml);
     }
     throw new Exception('Unrecognized configuration given for Midgard MVC initialization');
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:15,代码来源:interface.php

示例5: get_configuration

 public function get_configuration()
 {
     if (is_null($this->configuration)) {
         // Called for first time, load from YAML file
         $this->configuration = midgardmvc_core::read_yaml($this->get_configuration_contents());
     }
     return $this->configuration;
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:8,代码来源:midgardmvc.php

示例6: test_read_yaml_empty

 public function test_read_yaml_empty()
 {
     $yaml = '';
     $parsed = midgardmvc_core::read_yaml($yaml);
     $this->assertTrue(is_array($parsed));
     $this->assertTrue(empty($parsed));
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:coreTest.php


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