Issue/327 versioning (#345)
* Switch to semver format * Rewrite new version check to use Github Releases and cron * Styling * Remove v from in front of version * New version check test fix * Uncomment test case
This commit is contained in:
69
app/Repositories/KvpRepository.php
Normal file
69
app/Repositories/KvpRepository.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use Spatie\Valuestore\Valuestore;
|
||||
|
||||
class KvpRepository
|
||||
{
|
||||
private $valueStore;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->valueStore = Valuestore::make(config('phpvms.kvp_storage_path'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param null $default
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function retrieve($key, $default = null)
|
||||
{
|
||||
return $this->get($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from the KVP store
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default default value to return
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if (!$this->valueStore->has($key)) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
return $this->valueStore->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @alias store($key,$value)
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function save($key, $value)
|
||||
{
|
||||
return $this->store($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a value to the KVP store
|
||||
*
|
||||
* @param $key
|
||||
* @param $value
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function store($key, $value)
|
||||
{
|
||||
return $this->valueStore->put($key, $value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user