mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 00:40:06 +01:00
Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3a5d12e24d
commit
101abeae0e
@@ -4,14 +4,14 @@
|
||||
|
||||
class Configuration
|
||||
{
|
||||
var $files;
|
||||
public $files;
|
||||
|
||||
/**
|
||||
* Create a new Valet configuration class instance.
|
||||
*
|
||||
* @param Filesystem $files
|
||||
* @param Filesystem $files
|
||||
*/
|
||||
function __construct(Filesystem $files)
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
$this->files = $files;
|
||||
}
|
||||
@@ -21,7 +21,7 @@ function __construct(Filesystem $files)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install()
|
||||
public function install()
|
||||
{
|
||||
$this->createConfigurationDirectory();
|
||||
$this->createDriversDirectory();
|
||||
@@ -39,7 +39,7 @@ function install()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function uninstall()
|
||||
public function uninstall()
|
||||
{
|
||||
$this->files->unlink(VALET_HOME_PATH);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ function uninstall()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createConfigurationDirectory()
|
||||
public function createConfigurationDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(preg_replace('~/valet$~', '', VALET_HOME_PATH), user());
|
||||
|
||||
@@ -68,7 +68,7 @@ function createConfigurationDirectory()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createDriversDirectory()
|
||||
public function createDriversDirectory()
|
||||
{
|
||||
if ($this->files->isDir($driversDirectory = VALET_HOME_PATH.'/Drivers')) {
|
||||
return;
|
||||
@@ -87,7 +87,7 @@ function createDriversDirectory()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createSitesDirectory()
|
||||
public function createSitesDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Sites', user());
|
||||
}
|
||||
@@ -97,7 +97,7 @@ function createSitesDirectory()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createExtensionsDirectory()
|
||||
public function createExtensionsDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Extensions', user());
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function createExtensionsDirectory()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createLogDirectory()
|
||||
public function createLogDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Log', user());
|
||||
|
||||
@@ -119,7 +119,7 @@ function createLogDirectory()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createCertificatesDirectory()
|
||||
public function createCertificatesDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Certificates', user());
|
||||
}
|
||||
@@ -127,19 +127,19 @@ function createCertificatesDirectory()
|
||||
/**
|
||||
* Write the base, initial configuration for Valet.
|
||||
*/
|
||||
function writeBaseConfiguration()
|
||||
public function writeBaseConfiguration()
|
||||
{
|
||||
if (! $this->files->exists($this->path())) {
|
||||
$this->write(['tld' => 'test', 'loopback' => VALET_LOOPBACK, 'paths' => []]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate old configurations from 'domain' to 'tld'
|
||||
* Migrate old configurations from 'domain' to 'tld'.
|
||||
*/
|
||||
$config = $this->read();
|
||||
|
||||
if (! isset($config['tld'])) {
|
||||
$this->updateKey('tld', !empty($config['domain']) ? $config['domain'] : 'test');
|
||||
$this->updateKey('tld', ! empty($config['domain']) ? $config['domain'] : 'test');
|
||||
}
|
||||
|
||||
if (! isset($config['loopback'])) {
|
||||
@@ -154,7 +154,7 @@ function writeBaseConfiguration()
|
||||
* @param bool $prepend
|
||||
* @return void
|
||||
*/
|
||||
function addPath($path, $prepend = false)
|
||||
public function addPath($path, $prepend = false)
|
||||
{
|
||||
$this->write(tap($this->read(), function (&$config) use ($path, $prepend) {
|
||||
$method = $prepend ? 'prepend' : 'push';
|
||||
@@ -169,7 +169,7 @@ function addPath($path, $prepend = false)
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
function prependPath($path)
|
||||
public function prependPath($path)
|
||||
{
|
||||
$this->addPath($path, true);
|
||||
}
|
||||
@@ -180,11 +180,11 @@ function prependPath($path)
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
function removePath($path)
|
||||
public function removePath($path)
|
||||
{
|
||||
if ($path == VALET_HOME_PATH.'/Sites') {
|
||||
info("Cannot remove this directory because this is where Valet stores its site definitions.\nRun [valet paths] for a list of parked paths.");
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
$this->write(tap($this->read(), function (&$config) use ($path) {
|
||||
@@ -199,7 +199,7 @@ function removePath($path)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function prune()
|
||||
public function prune()
|
||||
{
|
||||
if (! $this->files->exists($this->path())) {
|
||||
return;
|
||||
@@ -217,7 +217,7 @@ function prune()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function read()
|
||||
public function read()
|
||||
{
|
||||
return json_decode($this->files->get($this->path()), true);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ function read()
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
function updateKey($key, $value)
|
||||
public function updateKey($key, $value)
|
||||
{
|
||||
return tap($this->read(), function (&$config) use ($key, $value) {
|
||||
$config[$key] = $value;
|
||||
@@ -244,7 +244,7 @@ function updateKey($key, $value)
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
function write($config)
|
||||
public function write($config)
|
||||
{
|
||||
$this->files->putAsUser($this->path(), json_encode(
|
||||
$config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
|
||||
@@ -256,7 +256,7 @@ function write($config)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function path()
|
||||
public function path()
|
||||
{
|
||||
return VALET_HOME_PATH.'/config.json';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user