public setVersion ( string $version ) | ||
$version | string | The module file version. |
public function setVersion($version)
{
Assert::string($version, 'The module file version must be a string. Got: %s');
Assert::regex($version, '~^\\d\\.\\d$~', 'The module file version must have the format "<digit>.<digit>". Got: %s</digit>');
$this->version = $version;
}
/** * {@inheritdoc} */ public function fromJson($jsonData, array $options = array()) { Assert::isInstanceOf($jsonData, 'stdClass'); $moduleFile = new ModuleFile(null, isset($options['path']) ? $options['path'] : null); $moduleFile->setVersion($this->versioner->parseVersion($jsonData)); $this->addJsonToModuleFile($jsonData, $moduleFile); return $moduleFile; }