コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function fromJson($jsonData, array $options = array())
 {
     Assert::isInstanceOf($jsonData, 'stdClass');
     $moduleFile = new ModuleFile(null, isset($options['path']) ? $options['path'] : null);
     $this->addJsonToModuleFile($jsonData, $moduleFile);
     return $moduleFile;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function fromJson($jsonData, array $options = array())
 {
     $path = isset($options['path']) ? $options['path'] : null;
     $baseConfig = isset($options['baseConfig']) ? $options['baseConfig'] : null;
     Assert::isInstanceOf($jsonData, 'stdClass');
     Assert::nullOrString($path, 'The "path" option should be null or a string. Got: %s');
     Assert::nullOrIsInstanceOf($baseConfig, 'Puli\\Manager\\Api\\Config\\Config', 'The "baseConfig" option should be null or an instance of %2$s. Got: %s');
     $moduleFile = new RootModuleFile(null, $path, $baseConfig);
     $this->addJsonToModuleFile($jsonData, $moduleFile);
     $this->addJsonToRootModuleFile($jsonData, $moduleFile);
     return $moduleFile;
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function fromJson($jsonData, array $options = array())
 {
     $path = isset($options['path']) ? $options['path'] : null;
     $baseConfig = isset($options['baseConfig']) ? $options['baseConfig'] : null;
     Assert::isInstanceOf($jsonData, 'stdClass');
     Assert::nullOrString($path, 'The "path" option should be null or a string. Got: %s');
     Assert::nullOrIsInstanceOf($baseConfig, 'Puli\\Manager\\Api\\Config\\Config', 'The "baseConfig" option should be null or an instance of %2$s. Got: %s');
     $configFile = new ConfigFile($path, $baseConfig);
     $config = $configFile->getConfig();
     $jsonData = $this->objectsToArrays($jsonData);
     foreach ($jsonData as $key => $value) {
         $config->set($key, $value);
     }
     return $configFile;
 }