Puli\Manager\Api\Module\ModuleFile::setVersion PHP Method

setVersion() public method

Sets the version of the module file.
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;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * {@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;
 }