Skip to content

Commit 0be3c8e

Browse files
authored
Apply fixes from StyleCI (#2)
1 parent c97781a commit 0be3c8e

File tree

13 files changed

+42
-35
lines changed

13 files changed

+42
-35
lines changed

database/migrations/2018_02_13_204645_create_urls_table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use Illuminate\Support\Facades\Schema;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
66

77
class CreateUrlsTable extends Migration
88
{

routes/web.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
Route::group(
44
[
5-
'middleware' => ['web']
5+
'middleware' => ['web'],
66
],
7-
function() {
7+
function () {
88
Route::get('/', 'Gallib\ShortUrl\Http\Controllers\UrlController@create')->name('shorturl.url.create');
99
Route::post('/', 'Gallib\ShortUrl\Http\Controllers\UrlController@store')->name('shorturl.url.store');
1010
Route::get('/{code}', 'Gallib\ShortUrl\Http\Controllers\RedirectController@redirect')->name('shorturl.redirect');
1111
}
1212
);
13-

src/Facades/Hasher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ protected static function getFacadeAccessor()
1515
{
1616
return 'hasher';
1717
}
18-
}
18+
}

src/Hasher.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
class Hasher
66
{
77
/**
8-
* @var integer
8+
* @var int
99
*/
1010
protected $length = 6;
1111

12-
public function setLength(int $length): Hasher
12+
public function setLength(int $length): self
1313
{
1414
$this->length = $length;
1515

1616
return $this;
1717
}
1818

1919
/**
20-
* Generate a random hash
20+
* Generate a random hash.
2121
*
2222
* @return string
2323
*/

src/Http/Controllers/RedirectController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class RedirectController extends Controller
1010
/**
1111
* Redirect to url by its code.
1212
*
13-
* @param string $code
13+
* @param string $code
14+
*
1415
* @return \Illuminate\Http\Response
1516
*/
1617
public function redirect($code)

src/Http/Controllers/UrlController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public function create()
2222
/**
2323
* Store a newly created resource in storage.
2424
*
25-
* @param \Gallib\ShortUrl\Http\Requests\UrlRequest $request
25+
* @param \Gallib\ShortUrl\Http\Requests\UrlRequest $request
26+
*
2627
* @return \Illuminate\Http\Response
2728
*/
2829
public function store(UrlRequest $request)

src/Http/Requests/UrlRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public function rules()
2626
$uniqueCode = '|unique:shorturl_urls';
2727

2828
if ($this->get('id')) {
29-
$uniqueCode .= ',id,' . $this->get('id');
29+
$uniqueCode .= ',id,'.$this->get('id');
3030
}
3131

3232
return [
33-
'url' => 'required|url',
34-
'code' => 'max:255' . $uniqueCode
33+
'url' => 'required|url',
34+
'code' => 'max:255'.$uniqueCode,
3535
];
3636
}
3737

src/Http/Responses/UrlResponse.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class UrlResponse implements Responsable
1414
/**
1515
* Create a new instance.
1616
*
17-
* @param \Gallib\ShortUrl\Url $url
17+
* @param \Gallib\ShortUrl\Url $url
18+
*
1819
* @return void
1920
*/
2021
public function __construct($url)
@@ -25,7 +26,8 @@ public function __construct($url)
2526
/**
2627
* Create an HTTP response that represents the object.
2728
*
28-
* @param \Illuminate\Http\Request $request
29+
* @param \Illuminate\Http\Request $request
30+
*
2931
* @return \Illuminate\Http\Response
3032
*/
3133
public function toResponse($request)
@@ -44,4 +46,4 @@ public function toResponse($request)
4446
return back()
4547
->with('short_url', $shortUrl);
4648
}
47-
}
49+
}

src/ShortUrlServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ class ShortUrlServiceProvider extends ServiceProvider
1313
*/
1414
public function boot()
1515
{
16-
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'shorturl');
16+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'shorturl');
1717

1818
if ($this->app->runningInConsole()) {
19-
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
19+
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
2020

2121
$this->publishes([
2222
__DIR__.'/../resources/views' => base_path('resources/views/vendor/shorturl'),

src/Url.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class Url extends Model
2626
/**
2727
* Set the code.
2828
*
29-
* @param string $code
29+
* @param string $code
30+
*
3031
* @return void
3132
*/
3233
public function setCodeAttribute($code)

0 commit comments

Comments
 (0)