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


PHP Spyc::dump方法代码示例

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


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

示例1: testDumpWithQuotes

 public function testDumpWithQuotes()
 {
     $Spyc = new Spyc();
     $Spyc->setting_dump_force_quotes = true;
     $yaml = $Spyc->load(file_get_contents('../spyc.yaml'));
     $dump = $Spyc->dump($yaml);
     $yaml_after_dump = Spyc::YAMLLoad($dump);
     $this->assertEquals($yaml, $yaml_after_dump);
 }
开发者ID:sofadesign,项目名称:vincent-helye.com,代码行数:9,代码来源:DumpTest.php

示例2: testDumpWithQuotes

 public function testDumpWithQuotes()
 {
     $Spyc = new Spyc();
     $Spyc->setting_dump_force_quotes = true;
     foreach ($this->files_to_test as $file) {
         $yaml = $Spyc->load(file_get_contents($file));
         $dump = $Spyc->dump($yaml);
         $yaml_after_dump = Spyc::YAMLLoad($dump);
         $this->assertEquals($yaml, $yaml_after_dump);
     }
 }
开发者ID:liaohui1080,项目名称:oneMail,代码行数:11,代码来源:DumpTest.php

示例3: write

 /**
  * Write the config array to a yaml file.
  *
  * @param   string The yaml file.
  *
  * @return bool True, if successfully written, else False.
  */
 public static function write($file, array $array)
 {
     // prefer yaml, then syck, else use Spyc - faster one first
     if (extension_loaded('yaml')) {
         return yaml_emit_file($file, $array);
     } elseif (extension_loaded('syck')) {
         $yaml = syck_dump($array);
     } elseif (class_exists('Spyc')) {
         $spyc = new Spyc();
         $yaml = $spyc->dump($array);
     } else {
         throw new \Koch\Exception\Exception('No YAML Parser available. Get Spyc or Syck!');
     }
     return (bool) file_put_contents($file, $yaml, LOCK_EX);
 }
开发者ID:ksst,项目名称:kf,代码行数:22,代码来源:YAML.php

示例4: YAMLDump

 /**
  * Dump YAML from PHP array statically
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.  Pretty simple.  Feel free to
  * save the returned string as nothing.yaml and pass it around.
  *
  * Oh, and you can decide how big the indent is and what the wordwrap
  * for folding is.  Pretty cool -- just pass in 'false' for either if
  * you want to use the default.
  *
  * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And
  * you can turn off wordwrap by passing in 0.
  *
  * @access public
  * @return string
  * @param array $array PHP array
  * @param int $indent Pass in false to use the default, which is 2
  * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
  * @param int $no_opening_dashes Do not start YAML file with "---\n"
  */
 public static function YAMLDump($array, $indent = false, $wordwrap = false, $no_opening_dashes = false)
 {
     $spyc = new Spyc();
     return $spyc->dump($array, $indent, $wordwrap, $no_opening_dashes);
 }
开发者ID:eroonkang,项目名称:typojanchi2015,代码行数:26,代码来源:Spyc.php

示例5: YAMLDump

 /**
  * Dump YAML from PHP array statically
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.  Pretty simple.  Feel free to
  * save the returned string as nothing.yaml and pass it around.
  *
  * Oh, and you can decide how big the indent is and what the wordwrap
  * for folding is.  Pretty cool -- just pass in 'false' for either if
  * you want to use the default.
  *
  * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And
  * you can turn off wordwrap by passing in 0.
  *
  * @access public
  * @return string
  * @param array $array PHP array
  * @param int $indent Pass in false to use the default, which is 2
  * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
  */
 function YAMLDump($array, $indent = false, $wordwrap = false)
 {
     $spyc = new Spyc();
     return $spyc->dump($array, $indent, $wordwrap);
 }
开发者ID:jmhobbs,项目名称:cakephp-yaml-migrations-and-fixtures,代码行数:25,代码来源:spyc.php

示例6: YAMLDump

 /**
  * Dump YAML from PHP array statically
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.  Pretty simple.  Feel free to
  * save the returned string as nothing.yml and pass it around.
  * @access public
  * @return string
  * @param array $array PHP array
  */
 function YAMLDump($array)
 {
     $spyc = new Spyc();
     return $spyc->dump($array);
 }
开发者ID:nonfiction,项目名称:nterchange,代码行数:15,代码来源:spyc.php

示例7: dump

 /**
  * Dump YAML from PHP array statically
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.
  *
  * @return string
  * @param array $array PHP array
  */
 public static function dump($array)
 {
     require_once dirname(__FILE__) . '/Spyc.class.php';
     $spyc = new Spyc();
     return $spyc->dump($array, false, 0);
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:15,代码来源:sfYaml.class.php

示例8: YAMLDump

 /**
  * Dump YAML from PHP array statically
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.  Pretty simple.  Feel free to
  * save the returned string as nothing.yaml and pass it around.
  *
  * Oh, and you can decide how big the indent is and what the wordwrap
  * for folding is.  Pretty cool -- just pass in 'false' for either if
  * you want to use the default.
  *
  * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And
  * you can turn off wordwrap by passing in 0.
  *
  * @access public
  * @return string
  * @param array $array PHP array
  * @param int $indent Pass in false to use the default, which is 2
  * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
  */
 function YAMLDump($array, $indent = false, $wordwrap = false, $ignore_private = false)
 {
     $spyc = new Spyc();
     return $spyc->dump($array, $indent, $wordwrap, $ignore_private);
 }
开发者ID:ntemple,项目名称:com_updater,代码行数:25,代码来源:spyc.php

示例9: write_state_file

 /**
  * Write a state object to a file
  * 
  * @param object $state_obj
  * @param string $file
  */
 private function write_state_file($state_data, $file)
 {
     $spyc = new Spyc();
     $file_data = $spyc->dump($state_data, 2, 0);
     // $spyc->dump() prepends "---\n" :(
     $file_data = substr($file_data, 4);
     file_put_contents($file, $file_data);
 }
开发者ID:2012summerain,项目名称:dictator,代码行数:14,代码来源:class-dictator-cli-command.php

示例10: dump

 /**
  * write yaml from an array using the Spyc class
  * @param array $array array to YAMLize
  * @return string
  */
 public function dump($array)
 {
     return Spyc::dump($array);
 }
开发者ID:slact,项目名称:webylene-php,代码行数:9,代码来源:YAML.php

示例11: yamlDump

 /**
  * Dump YAML from PHP array statically
  *
  * The dump method, when supplied with an array, will do its best
  * to convert the array into friendly YAML.  Pretty simple.  Feel free to
  * save the returned string as nothing.yaml and pass it around.
  *
  * Oh, and you can decide how big the indent is and what the wordwrap
  * for folding is.  Pretty cool -- just pass in 'false' for either if
  * you want to use the default.
  *
  * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And
  * you can turn off wordwrap by passing in 0.
  *
  * @param [array]   $array    PHP array
  * @param [integer] $indent   Pass in false to use the default, which is 2
  * @param [integer] $wordwrap 0 for no wordwrap, false for default (40)
  * @return [string] $string
  */
 public static function yamlDump($array, $indent = false, $wordwrap = false)
 {
     $spyc = new Spyc();
     $string = $spyc->dump($array, $indent, $wordwrap);
     return $string;
 }
开发者ID:blueprintmrk,项目名称:cli,代码行数:25,代码来源:Spyc.php

示例12: writeConfig

 /**
  * Write the config array to a yaml file
  *
  * @param   string  The filename
  * @return array | boolean false
  * @todo fix this return true/false thingy
  */
 public static function writeConfig($file, array $array)
 {
     /**
      * transform PHP Array into YAML Format
      */
     // take syck, as the faster one first
     if (extension_loaded('syck')) {
         // convert to YAML via SYCK
         $yaml = syck_dump($data);
     } elseif (is_file(ROOT_LIBRARIES . '/spyc/Spyc.class.php') === true) {
         // ok, load spyc
         if (false === class_exists('Spyc', false)) {
             include ROOT_LIBRARIES . '/spyc/Spyc.class.php';
         }
         $spyc = new Spyc();
         // convert to YAML via SPYC
         $yaml = $spyc->dump($array);
     } else {
         // we have no YAML Parser - too bad :(
         throw new Koch_Exception('No YAML Parser available. Get Spyc or Syck!');
     }
     /**
      * write array
      */
     // write YAML content to file
     file_put_contents($file, $yaml);
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:34,代码来源:Yaml.php


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