Skip to content

Commit a4dfef8

Browse files
committed
Reformat code
1 parent 1f056c6 commit a4dfef8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+895
-815
lines changed

cli/Valet/CommandLine.php

+14-13
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ class CommandLine
99
/**
1010
* Simple global function to run commands.
1111
*
12-
* @param string $command
12+
* @param string $command
1313
* @return void
1414
*/
1515
public function quietly($command)
1616
{
17-
$this->runCommand($command.' > /dev/null 2>&1');
17+
$this->runCommand($command . ' > /dev/null 2>&1');
1818
}
1919

2020
/**
2121
* Simple global function to run commands.
2222
*
23-
* @param string $command
23+
* @param string $command
2424
* @return void
2525
*/
2626
public function quietlyAsUser($command)
2727
{
28-
$this->quietly('sudo -u '.user().' '.$command.' > /dev/null 2>&1');
28+
$this->quietly('sudo -u ' . user() . ' ' . $command . ' > /dev/null 2>&1');
2929
}
3030

3131
/**
3232
* Pass the command to the command line and display the output.
3333
*
34-
* @param string $command
34+
* @param string $command
3535
* @return void
3636
*/
3737
public function passthru($command)
@@ -42,8 +42,8 @@ public function passthru($command)
4242
/**
4343
* Run the given command as the non-root user.
4444
*
45-
* @param string $command
46-
* @param callable $onError
45+
* @param string $command
46+
* @param callable $onError
4747
* @return string
4848
*/
4949
public function run($command, callable $onError = null)
@@ -54,25 +54,26 @@ public function run($command, callable $onError = null)
5454
/**
5555
* Run the given command.
5656
*
57-
* @param string $command
58-
* @param callable $onError
57+
* @param string $command
58+
* @param callable $onError
5959
* @return string
6060
*/
6161
public function runAsUser($command, callable $onError = null)
6262
{
63-
return $this->runCommand('sudo -u '.user().' '.$command, $onError);
63+
return $this->runCommand('sudo -u ' . user() . ' ' . $command, $onError);
6464
}
6565

6666
/**
6767
* Run the given command.
6868
*
69-
* @param string $command
70-
* @param callable $onError
69+
* @param string $command
70+
* @param callable $onError
7171
* @return string
7272
*/
7373
protected function runCommand($command, callable $onError = null)
7474
{
75-
$onError = $onError ?: function () {};
75+
$onError = $onError ?: function () {
76+
};
7677

7778
$process = new Process($command);
7879

cli/Valet/Configuration.php

+22-22
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ public function createConfigurationDirectory()
6363
*/
6464
public function createDriversDirectory()
6565
{
66-
if ($this->files->isDir($driversDirectory = VALET_HOME_PATH.'/Drivers')) {
66+
if ($this->files->isDir($driversDirectory = VALET_HOME_PATH . '/Drivers')) {
6767
return;
6868
}
6969

7070
$this->files->mkdirAsUser($driversDirectory);
7171

7272
$this->files->putAsUser(
73-
$driversDirectory.'/SampleValetDriver.php',
74-
$this->files->get(__DIR__.'/../stubs/SampleValetDriver.php')
73+
$driversDirectory . '/SampleValetDriver.php',
74+
$this->files->get(__DIR__ . '/../stubs/SampleValetDriver.php')
7575
);
7676
}
7777

@@ -82,7 +82,7 @@ public function createDriversDirectory()
8282
*/
8383
public function createSitesDirectory()
8484
{
85-
$this->files->ensureDirExists(VALET_HOME_PATH.'/Sites', user());
85+
$this->files->ensureDirExists(VALET_HOME_PATH . '/Sites', user());
8686
}
8787

8888
/**
@@ -92,7 +92,7 @@ public function createSitesDirectory()
9292
*/
9393
public function createExtensionsDirectory()
9494
{
95-
$this->files->ensureDirExists(VALET_HOME_PATH.'/Extensions', user());
95+
$this->files->ensureDirExists(VALET_HOME_PATH . '/Extensions', user());
9696
}
9797

9898
/**
@@ -102,9 +102,9 @@ public function createExtensionsDirectory()
102102
*/
103103
public function createLogDirectory()
104104
{
105-
$this->files->ensureDirExists(VALET_HOME_PATH.'/Log', user());
105+
$this->files->ensureDirExists(VALET_HOME_PATH . '/Log', user());
106106

107-
$this->files->touch(VALET_HOME_PATH.'/Log/nginx-error.log');
107+
$this->files->touch(VALET_HOME_PATH . '/Log/nginx-error.log');
108108
}
109109

110110
/**
@@ -114,24 +114,24 @@ public function createLogDirectory()
114114
*/
115115
public function createCertificatesDirectory()
116116
{
117-
$this->files->ensureDirExists(VALET_HOME_PATH.'/Certificates', user());
117+
$this->files->ensureDirExists(VALET_HOME_PATH . '/Certificates', user());
118118
}
119119

120120
/**
121121
* Write the base, initial configuration for Valet.
122122
*/
123123
public function writeBaseConfiguration()
124124
{
125-
if (! $this->files->exists($this->path())) {
125+
if (!$this->files->exists($this->path())) {
126126
$this->write(['domain' => 'test', 'paths' => [], 'port' => '80']);
127127
}
128128
}
129129

130130
/**
131131
* Add the given path to the configuration.
132132
*
133-
* @param string $path
134-
* @param bool $prepend
133+
* @param string $path
134+
* @param bool $prepend
135135
* @return void
136136
*/
137137
public function addPath($path, $prepend = false)
@@ -146,7 +146,7 @@ public function addPath($path, $prepend = false)
146146
/**
147147
* Prepend the given path to the configuration.
148148
*
149-
* @param string $path
149+
* @param string $path
150150
* @return void
151151
*/
152152
public function prependPath($path)
@@ -157,7 +157,7 @@ public function prependPath($path)
157157
/**
158158
* Add the given path to the configuration.
159159
*
160-
* @param string $path
160+
* @param string $path
161161
* @return void
162162
*/
163163
public function removePath($path)
@@ -176,7 +176,7 @@ public function removePath($path)
176176
*/
177177
public function prune()
178178
{
179-
if (! $this->files->exists($this->path())) {
179+
if (!$this->files->exists($this->path())) {
180180
return;
181181
}
182182

@@ -201,7 +201,7 @@ public function read()
201201
* Get a configuration value.
202202
*
203203
* @param string $key
204-
* @param mixed $default
204+
* @param mixed $default
205205
* @return mixed
206206
*/
207207
public function get($key, $default = null)
@@ -214,8 +214,8 @@ public function get($key, $default = null)
214214
/**
215215
* Update a specific key in the configuration file.
216216
*
217-
* @param string $key
218-
* @param mixed $value
217+
* @param string $key
218+
* @param mixed $value
219219
* @return array
220220
*/
221221
public function updateKey($key, $value)
@@ -229,15 +229,15 @@ public function updateKey($key, $value)
229229
/**
230230
* Write the given configuration to disk.
231231
*
232-
* @param array $config
232+
* @param array $config
233233
* @return void
234234
*/
235235
public function write(array $config)
236236
{
237237
$this->files->putAsUser($this->path(), json_encode(
238-
$config,
239-
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
240-
).PHP_EOL);
238+
$config,
239+
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
240+
) . PHP_EOL);
241241
}
242242

243243
/**
@@ -247,6 +247,6 @@ public function write(array $config)
247247
*/
248248
public function path()
249249
{
250-
return VALET_HOME_PATH.'/config.json';
250+
return VALET_HOME_PATH . '/config.json';
251251
}
252252
}

cli/Valet/Contracts/PackageManager.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ interface PackageManager
77
/**
88
* Determine if the given package is installed.
99
*
10-
* @param string $package
10+
* @param string $package
1111
* @return bool
1212
*/
1313
public function installed($package);
1414

1515
/**
1616
* Ensure that the given package is installed.
1717
*
18-
* @param string $package
18+
* @param string $package
1919
* @return void
2020
*/
2121
public function ensureInstalled($package);
2222

2323
/**
2424
* Install the given package and throw an exception on failure.
2525
*
26-
* @param string $package
26+
* @param string $package
2727
* @return void
2828
*/
2929
public function installOrFail($package);

cli/Valet/DnsMasq.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ class DnsMasq
1919
/**
2020
* Create a new DnsMasq instance.
2121
*
22-
* @param PackageManager $pm PackageManager object
23-
* @param ServiceManager $sm ServiceManager object
22+
* @param PackageManager $pm PackageManager object
23+
* @param ServiceManager $sm ServiceManager object
2424
* @param Filesystem $files Filesystem object
25-
* @param CommandLine $cli CommandLine object
25+
* @param CommandLine $cli CommandLine object
2626
*
2727
* @return void
2828
*/
2929
public function __construct(PackageManager $pm, ServiceManager $sm, Filesystem $files, CommandLine $cli)
3030
{
31-
$this->pm = $pm;
32-
$this->sm = $sm;
33-
$this->cli = $cli;
31+
$this->pm = $pm;
32+
$this->sm = $sm;
33+
$this->cli = $cli;
3434
$this->files = $files;
3535
$this->rclocal = '/etc/rc.local';
36-
$this->resolvconf = '/etc/resolv.conf';
37-
$this->dnsmasqconf = '/etc/dnsmasq.conf';
38-
$this->configPath = '/etc/dnsmasq.d/valet';
39-
$this->dnsmasqOpts = '/etc/dnsmasq.d/options';
36+
$this->resolvconf = '/etc/resolv.conf';
37+
$this->dnsmasqconf = '/etc/dnsmasq.conf';
38+
$this->configPath = '/etc/dnsmasq.d/valet';
39+
$this->dnsmasqOpts = '/etc/dnsmasq.d/options';
4040
$this->nmConfigPath = '/etc/NetworkManager/conf.d/valet.conf';
4141
$this->resolvedConfigPath = '/etc/systemd/resolved.conf';
4242
}
@@ -52,7 +52,7 @@ private function _lockResolvConf($lock = true)
5252
{
5353
$arg = $lock ? '+i' : '-i';
5454

55-
if (! $this->files->isLink($this->resolvconf)) {
55+
if (!$this->files->isLink($this->resolvconf)) {
5656
$this->cli->run(
5757
"chattr {$arg} {$this->resolvconf}",
5858
function ($code, $msg) {
@@ -69,20 +69,20 @@ function ($code, $msg) {
6969
*/
7070
private function _mergeDns()
7171
{
72-
$optDir = '/opt/valet-linux';
73-
$script = $optDir.'/valet-dns';
72+
$optDir = '/opt/valet-linux';
73+
$script = $optDir . '/valet-dns';
7474

7575
$this->pm->ensureInstalled('inotify-tools');
7676
$this->files->remove($optDir);
7777
$this->files->ensureDirExists($optDir);
78-
$this->files->put($script, $this->files->get(__DIR__.'/../stubs/valet-dns'));
78+
$this->files->put($script, $this->files->get(__DIR__ . '/../stubs/valet-dns'));
7979
$this->cli->run("chmod +x $script");
8080
$this->sm->installValetDns($this->files);
81-
81+
8282
if ($this->files->exists($this->rclocal)) {
8383
$this->files->restore($this->rclocal);
8484
}
85-
85+
8686
$this->files->backup($this->resolvconf);
8787
$this->files->unlink($this->resolvconf);
8888
$this->files->symlink($script, $this->resolvconf);
@@ -116,7 +116,7 @@ public function install($domain = 'test')
116116
*/
117117
public function createCustomConfigFile($domain)
118118
{
119-
$this->files->putAsUser($this->configPath, 'address=/.'.$domain.'/127.0.0.1'.PHP_EOL);
119+
$this->files->putAsUser($this->configPath, 'address=/.' . $domain . '/127.0.0.1' . PHP_EOL);
120120
}
121121

122122
/**
@@ -156,9 +156,9 @@ public function dnsmasqSetup()
156156
$this->files->unlink('/etc/dnsmasq.d/network-manager');
157157
$this->files->backup($this->dnsmasqconf);
158158

159-
$this->files->putAsUser($this->dnsmasqconf, $this->files->get(__DIR__.'/../stubs/dnsmasq.conf'));
160-
$this->files->putAsUser($this->dnsmasqOpts, $this->files->get(__DIR__.'/../stubs/dnsmasq_options'));
161-
$this->files->putAsUser($this->nmConfigPath, $this->files->get(__DIR__.'/../stubs/networkmanager.conf'));
159+
$this->files->putAsUser($this->dnsmasqconf, $this->files->get(__DIR__ . '/../stubs/dnsmasq.conf'));
160+
$this->files->putAsUser($this->dnsmasqOpts, $this->files->get(__DIR__ . '/../stubs/dnsmasq_options'));
161+
$this->files->putAsUser($this->nmConfigPath, $this->files->get(__DIR__ . '/../stubs/networkmanager.conf'));
162162
}
163163

164164
/**
@@ -190,7 +190,7 @@ public function uninstall()
190190
$this->files->unlink($this->dnsmasqOpts);
191191
$this->files->unlink($this->nmConfigPath);
192192
$this->files->restore($this->resolvedConfigPath);
193-
193+
194194
$this->_lockResolvConf(false);
195195
$this->files->restore($this->rclocal);
196196
$this->files->restore($this->resolvconf);

0 commit comments

Comments
 (0)