toYaml() публичный статический Метод

Populate yaml from data model.
public static toYaml ( array $data ) : Data
$data array
Результат Data
Пример #1
0
 /**
  * Export to Yaml file.
  *
  * @param string $file
  * @param bool   $autoCreate
  *
  * @return Result
  */
 public function exportToYaml($file, $autoCreate = true)
 {
     Craft::app()->config->maxPowerCaptain();
     $result = new Result();
     $dataModel = $this->exportDataModel();
     $yaml = Data::toYaml($dataModel);
     if (!IOHelper::writeToFile($file, $yaml, $autoCreate)) {
         // Do not auto create
         $result->addError('errors', "Failed to write contents to \"{$file}\"");
     }
     return $result;
 }
Пример #2
0
 /**
  * @covers ::toYaml
  */
 public function testToYamlContainsCorrectText()
 {
     $dataModel = $this->generateDataModel();
     $yaml = Data::toYaml($dataModel->attributes);
     $this->assertContains('override_bucket_name', $yaml);
 }