Skip to content

Commit

Permalink
Fixed code style (Pint)
Browse files Browse the repository at this point in the history
  • Loading branch information
voidgraphics committed Oct 3, 2022
1 parent 18b0838 commit 7a5f927
Show file tree
Hide file tree
Showing 24 changed files with 440 additions and 408 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"laravel/pint": "^1.2"
},
"scripts": {
"test": "phpunit --colors=always tests"
"test": "phpunit --colors=always tests",
"fix-style": "./vendor/bin/pint"
}
}
21 changes: 10 additions & 11 deletions src/Commands/CreateCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle()

$this->files->put($path, $this->buildClass());

$this->info('Created ' . $path);
$this->info('Created '.$path);
}

/**
Expand All @@ -69,7 +69,7 @@ public function handle()
*/
public function getClassnameArgument()
{
if(!$this->argument('classname')) {
if (! $this->argument('classname')) {
return $this->ask('Please provide a class name for your layout');
}

Expand All @@ -84,21 +84,21 @@ public function getClassnameArgument()
protected function getPath()
{
return $this->makeDirectory(
app_path('Casts/' . $this->classname . '.php')
app_path('Casts/'.$this->classname.'.php')
);
}

/**
* Create the directories if they do not exist yet
*
* @param string $path
* @param string $path
* @return string
*/
protected function makeDirectory($path)
{
$directory = dirname($path);

if(!$this->files->isDirectory($directory)) {
if (! $this->files->isDirectory($directory)) {
$this->files->makeDirectory($directory, 0755, true, true);
}

Expand All @@ -113,12 +113,11 @@ protected function makeDirectory($path)
protected function buildClass()
{
return str_replace([
':classname',
], [
$this->classname,
],
$this->files->get(__DIR__ . '/../Stubs/Cast.php')
':classname',
], [
$this->classname,
],
$this->files->get(__DIR__.'/../Stubs/Cast.php')
);
}

}
27 changes: 13 additions & 14 deletions src/Commands/CreateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function handle()

$this->files->put($path, $this->buildClass());

$this->info('Created ' . $path);
$this->info('Created '.$path);
}

/**
Expand All @@ -77,7 +77,7 @@ public function handle()
*/
public function getClassnameArgument()
{
if(!$this->argument('classname')) {
if (! $this->argument('classname')) {
return $this->ask('Please provide a class name for your layout');
}

Expand All @@ -91,7 +91,7 @@ public function getClassnameArgument()
*/
public function getNameArgument()
{
if(!$this->argument('name')) {
if (! $this->argument('name')) {
return strtolower($this->classname);
}

Expand All @@ -106,21 +106,21 @@ public function getNameArgument()
protected function getPath()
{
return $this->makeDirectory(
app_path('Nova/Flexible/Layouts/' . $this->classname . '.php')
app_path('Nova/Flexible/Layouts/'.$this->classname.'.php')
);
}

/**
* Create the directories if they do not exist yet
*
* @param string $path
* @param string $path
* @return string
*/
protected function makeDirectory($path)
{
$directory = dirname($path);

if(!$this->files->isDirectory($directory)) {
if (! $this->files->isDirectory($directory)) {
$this->files->makeDirectory($directory, 0755, true, true);
}

Expand All @@ -135,14 +135,13 @@ protected function makeDirectory($path)
protected function buildClass()
{
return str_replace([
':classname',
':name'
], [
$this->classname,
$this->name
],
$this->files->get(__DIR__ . '/../Stubs/Layout.php')
':classname',
':name',
], [
$this->classname,
$this->name,
],
$this->files->get(__DIR__.'/../Stubs/Layout.php')
);
}

}
13 changes: 6 additions & 7 deletions src/Commands/CreatePreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle()

$this->files->put($path, $this->buildClass());

$this->info('Created ' . $path);
$this->info('Created '.$path);
}

/**
Expand All @@ -69,7 +69,7 @@ public function handle()
*/
public function getClassnameArgument()
{
if(!$this->argument('classname')) {
if (! $this->argument('classname')) {
return $this->ask('Please provide a class name for your preset');
}

Expand All @@ -84,21 +84,21 @@ public function getClassnameArgument()
protected function getPath()
{
return $this->makeDirectory(
app_path('Nova/Flexible/Presets/' . $this->classname . '.php')
app_path('Nova/Flexible/Presets/'.$this->classname.'.php')
);
}

/**
* Create the directories if they do not exist yet
*
* @param string $path
* @param string $path
* @return string
*/
protected function makeDirectory($path)
{
$directory = dirname($path);

if(!$this->files->isDirectory($directory)) {
if (! $this->files->isDirectory($directory)) {
$this->files->makeDirectory($directory, 0755, true, true);
}

Expand All @@ -115,8 +115,7 @@ protected function buildClass()
return str_replace(
':classname',
$this->classname,
$this->files->get(__DIR__ . '/../Stubs/Preset.php')
$this->files->get(__DIR__.'/../Stubs/Preset.php')
);
}

}
13 changes: 6 additions & 7 deletions src/Commands/CreateResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle()

$this->files->put($path, $this->buildClass());

$this->info('Created ' . $path);
$this->info('Created '.$path);
}

/**
Expand All @@ -69,7 +69,7 @@ public function handle()
*/
public function getClassnameArgument()
{
if(!$this->argument('classname')) {
if (! $this->argument('classname')) {
return $this->ask('Please provide a class name for your resolver');
}

Expand All @@ -84,21 +84,21 @@ public function getClassnameArgument()
protected function getPath()
{
return $this->makeDirectory(
app_path('Nova/Flexible/Resolvers/' . $this->classname . '.php')
app_path('Nova/Flexible/Resolvers/'.$this->classname.'.php')
);
}

/**
* Create the directories if they do not exist yet
*
* @param string $path
* @param string $path
* @return string
*/
protected function makeDirectory($path)
{
$directory = dirname($path);

if(!$this->files->isDirectory($directory)) {
if (! $this->files->isDirectory($directory)) {
$this->files->makeDirectory($directory, 0755, true, true);
}

Expand All @@ -115,8 +115,7 @@ protected function buildClass()
return str_replace(
':classname',
$this->classname,
$this->files->get(__DIR__ . '/../Stubs/Resolver.php')
$this->files->get(__DIR__.'/../Stubs/Resolver.php')
);
}

}
Loading

0 comments on commit 7a5f927

Please sign in to comment.