You are here

public function ConfigurationHandler::importFromJson in Configuration Management 7.3

1 call to ConfigurationHandler::importFromJson()
ConfigurationHandler::import in src/Handlers/ConfigurationHandler.php

File

src/Handlers/ConfigurationHandler.php, line 136

Class

ConfigurationHandler

Namespace

Configuration\Handlers

Code

public function importFromJson($file_content) {
  $object = new \stdClass();
  if ($this
    ->jsonAsArray()) {
    $object = $this
      ->importFromJsonAsArray($file_content);
  }
  else {
    $object = json_decode($file_content);
  }
  $configuration = new Configuration();
  $configuration
    ->fromObject($object);
  return $configuration;
}