SensioLabs\Insight\Cli\Configuration::save PHP Method

save() public method

public save ( )
    public function save()
    {
        file_put_contents($this->storagePath, json_encode($this->toArray()));
    }

Usage Example

Ejemplo n.º 1
0
 private function saveConfiguration(InputInterface $input, OutputInterface $output, Configuration $configuration)
 {
     if (!$input->isInteractive()) {
         $configuration->save();
         return;
     }
     $question = 'Do you want to save this new configuration? [Y/n] ';
     if (PHP_VERSION_ID > 50400) {
         $question = json_encode($configuration->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n\n" . $question;
     }
     $dialog = $this->getHelperSet()->get('dialog');
     if ($dialog->askConfirmation($output, $question)) {
         $configuration->save();
     }
 }