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