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