Install
4 years ago
Update
4 years ago
Updater
4 years ago
Install.php
4 years ago
InstallCollection.php
4 years ago
PluginHeader.php
4 years ago
Update.php
4 years ago
Updater.php
4 years ago
Version.php
4 years ago
VersionStorage.php
4 years ago
VersionStorage.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Plugin; |
| 4 | |
| 5 | use AC\Storage\KeyValuePair; |
| 6 | use AC\Storage\OptionFactory; |
| 7 | |
| 8 | class VersionStorage { |
| 9 | |
| 10 | /** |
| 11 | * @var KeyValuePair |
| 12 | */ |
| 13 | private $storage; |
| 14 | |
| 15 | public function __construct( $key, $network_activated = false ) { |
| 16 | $this->storage = ( new OptionFactory() )->create( (string) $key, (bool) $network_activated ); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @param Version $version |
| 21 | * |
| 22 | * @return bool |
| 23 | */ |
| 24 | public function save( Version $version ) { |
| 25 | return $this->storage->save( $version->get_value() ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * @return Version |
| 30 | */ |
| 31 | public function get() { |
| 32 | return new Version( (string) $this->storage->get() ); |
| 33 | } |
| 34 | |
| 35 | } |