Skip to content

Commit 20dbce7

Browse files
committed
style fixes and PSR-2
1 parent eee45e8 commit 20dbce7

16 files changed

+39
-37
lines changed

Diff for: blade.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ The following example creates a `@datetime($var)` directive which formats a give
359359
*/
360360
public function boot()
361361
{
362-
Blade::directive('datetime', function($expression) {
362+
Blade::directive('datetime', function ($expression) {
363363
return "<?php echo $expression->format('m/d/Y H:i'); ?>";
364364
});
365365
}

Diff for: cache.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The cache configuration file also contains various other options, which are docu
3131

3232
When using the `database` cache driver, you will need to setup a table to contain the cache items. You'll find an example `Schema` declaration for the table below:
3333

34-
Schema::create('cache', function($table) {
34+
Schema::create('cache', function ($table) {
3535
$table->string('key')->unique();
3636
$table->text('value');
3737
$table->integer('expiration');
@@ -118,7 +118,7 @@ The `get` method on the `Cache` facade is used to retrieve items from the cache.
118118

119119
You may even pass a `Closure` as the default value. The result of the `Closure` will be returned if the specified item does not exist in the cache. Passing a Closure allows you to defer the retrieval of default values from a database or other external service:
120120

121-
$value = Cache::get('key', function() {
121+
$value = Cache::get('key', function () {
122122
return DB::table(...)->get();
123123
});
124124

@@ -143,7 +143,7 @@ The `increment` and `decrement` methods may be used to adjust the value of integ
143143

144144
Sometimes you may wish to retrieve an item from the cache, but also store a default value if the requested item doesn't exist. For example, you may wish to retrieve all users from the cache or, if they don't exist, retrieve them from the database and add them to the cache. You may do this using the `Cache::remember` method:
145145

146-
$value = Cache::remember('users', $minutes, function() {
146+
$value = Cache::remember('users', $minutes, function () {
147147
return DB::table('users')->get();
148148
});
149149

@@ -220,16 +220,16 @@ If you provide an array of key / value pairs and an expiration time to the funct
220220

221221
Cache tags allow you to tag related items in the cache and then flush all cached values that have been assigned a given tag. You may access a tagged cache by passing in an ordered array of tag names. For example, let's access a tagged cache and `put` value in the cache:
222222

223-
Cache::tags(['people', 'artists'])->put('John', $john, $minutes);
223+
Cache::tags(['people', 'artists'])->put('John', $john, $minutes);
224224

225-
Cache::tags(['people', 'authors'])->put('Anne', $anne, $minutes);
225+
Cache::tags(['people', 'authors'])->put('Anne', $anne, $minutes);
226226

227227
<a name="accessing-tagged-cache-items"></a>
228228
### Accessing Tagged Cache Items
229229

230230
To retrieve a tagged cache item, pass the same ordered list of tags to the `tags` method and then call the `get` method with the key you wish to retrieve:
231231

232-
$john = Cache::tags(['people', 'artists'])->get('John');
232+
$john = Cache::tags(['people', 'artists'])->get('John');
233233

234234
$anne = Cache::tags(['people', 'authors'])->get('Anne');
235235

@@ -238,11 +238,11 @@ To retrieve a tagged cache item, pass the same ordered list of tags to the `tags
238238

239239
You may flush all items that are assigned a tag or list of tags. For example, this statement would remove all caches tagged with either `people`, `authors`, or both. So, both `Anne` and `John` would be removed from the cache:
240240

241-
Cache::tags(['people', 'authors'])->flush();
241+
Cache::tags(['people', 'authors'])->flush();
242242

243243
In contrast, this statement would remove only caches tagged with `authors`, so `Anne` would be removed, but not `John`:
244244

245-
Cache::tags('authors')->flush();
245+
Cache::tags('authors')->flush();
246246

247247
<a name="adding-custom-cache-drivers"></a>
248248
## Adding Custom Cache Drivers
@@ -274,7 +274,7 @@ To create our custom cache driver, we first need to implement the `Illuminate\Co
274274

275275
We just need to implement each of these methods using a MongoDB connection. For an example of how to implement each of these methods, take a look at the `Illuminate\Cache\MemcachedStore` in the framework source code. Once our implementation is complete, we can finish our custom driver registration.
276276

277-
Cache::extend('mongo', function($app) {
277+
Cache::extend('mongo', function ($app) {
278278
return Cache::repository(new MongoStore);
279279
});
280280

@@ -302,7 +302,7 @@ To register the custom cache driver with Laravel, we will use the `extend` metho
302302
*/
303303
public function boot()
304304
{
305-
Cache::extend('mongo', function($app) {
305+
Cache::extend('mongo', function ($app) {
306306
return Cache::repository(new MongoStore);
307307
});
308308
}

Diff for: elixir.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ The `copy` method may be used to copy files and directories to new locations. Al
300300

301301
```javascript
302302
elixir(function(mix) {
303-
mix.copy('vendor/foo/bar.css', 'public/css/bar.css');
303+
mix.copy('vendor/foo/bar.css', 'public/css/bar.css');
304304
});
305305
```
306306

Diff for: eloquent-relationships.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ If you need to update an existing row in your pivot table, you may use `updateEx
856856

857857
$user = App\User::find(1);
858858

859-
$user->roles()->updateExistingPivot($roleId, $attributes);
859+
$user->roles()->updateExistingPivot($roleId, $attributes);
860860

861861
<a name="touching-parent-timestamps"></a>
862862
## Touching Parent Timestamps

Diff for: eloquent.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ Eloquent also allows you to define global scopes using Closures, which is partic
603603
{
604604
parent::boot();
605605

606-
static::addGlobalScope('age', function(Builder $builder) {
606+
static::addGlobalScope('age', function (Builder $builder) {
607607
$builder->where('age', '>', 200);
608608
});
609609
}

Diff for: errors.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Once this option has been configured, Laravel will log all levels greater than o
5959

6060
If you would like to have complete control over how Monolog is configured for your application, you may use the application's `configureMonologUsing` method. You should place a call to this method in your `bootstrap/app.php` file right before the `$app` variable is returned by the file:
6161

62-
$app->configureMonologUsing(function($monolog) {
62+
$app->configureMonologUsing(function ($monolog) {
6363
$monolog->pushHandler(...);
6464
});
6565

Diff for: filesystem.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ In order to set up the custom filesystem you will need to create a [service prov
333333
*/
334334
public function boot()
335335
{
336-
Storage::extend('dropbox', function($app, $config) {
336+
Storage::extend('dropbox', function ($app, $config) {
337337
$client = new DropboxClient(
338338
$config['accessToken'], $config['clientIdentifier']
339339
);

Diff for: helpers.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -708,14 +708,14 @@ If the method accepts route parameters, you may pass them as the second argument
708708

709709
Generate a URL for an asset using the current scheme of the request (HTTP or HTTPS):
710710

711-
$url = asset('img/photo.jpg');
711+
$url = asset('img/photo.jpg');
712712

713713
<a name="method-secure-asset"></a>
714714
#### `secure_asset()` {#collection-method}
715715

716716
Generate a URL for an asset using HTTPS:
717717

718-
echo secure_asset('foo/bar.zip', $title, $attributes = []);
718+
echo secure_asset('foo/bar.zip', $title, $attributes = []);
719719

720720
<a name="method-route"></a>
721721
#### `route()` {#collection-method}
@@ -987,7 +987,9 @@ The session store will be returned if no value is passed to the function:
987987

988988
The `value` function's behavior will simply return the value it is given. However, if you pass a `Closure` to the function, the `Closure` will be executed then its result will be returned:
989989

990-
$value = value(function() { return 'bar'; });
990+
$value = value(function () {
991+
return 'bar';
992+
});
991993

992994
<a name="method-view"></a>
993995
#### `view()` {#collection-method}

Diff for: homestead.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Mac / Linux:
153153

154154
Windows:
155155

156-
vendor\\bin\\homestead make
156+
vendor\\bin\\homestead make
157157

158158
Next, run the `vagrant up` command in your terminal and access your project at `http://homestead.app` in your browser. Remember, you will still need to add an `/etc/hosts` file entry for `homestead.app` or the domain of your choice.
159159

Diff for: queries.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ If you would like to retrieve an array containing the values of a single column,
9898

9999
If you need to work with thousands of database records, consider using the `chunk` method. This method retrieves a small chunk of the results at a time and feeds each chunk into a `Closure` for processing. This method is very useful for writing [Artisan commands](/docs/{{version}}/artisan) that process thousands of records. For example, let's work with the entire `users` table in chunks of 100 records at a time:
100100

101-
DB::table('users')->orderBy('id')->chunk(100, function($users) {
101+
DB::table('users')->orderBy('id')->chunk(100, function ($users) {
102102
foreach ($users as $user) {
103103
//
104104
}
105105
});
106106

107107
You may stop further chunks from being processed by returning `false` from the `Closure`:
108108

109-
DB::table('users')->orderBy('id')->chunk(100, function($users) {
109+
DB::table('users')->orderBy('id')->chunk(100, function ($users) {
110110
// Process the records...
111111

112112
return false;

Diff for: redis.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ First, let's setup a channel listener using the `subscribe` method. We'll place
176176
*/
177177
public function handle()
178178
{
179-
Redis::subscribe(['test-channel'], function($message) {
179+
Redis::subscribe(['test-channel'], function ($message) {
180180
echo $message;
181181
});
182182
}
@@ -194,10 +194,10 @@ Now we may publish messages to the channel using the `publish` method:
194194

195195
Using the `psubscribe` method, you may subscribe to a wildcard channel, which may be useful for catching all messages on all channels. The `$channel` name will be passed as the second argument to the provided callback `Closure`:
196196

197-
Redis::psubscribe(['*'], function($message, $channel) {
197+
Redis::psubscribe(['*'], function ($message, $channel) {
198198
echo $message;
199199
});
200200

201-
Redis::psubscribe(['users.*'], function($message, $channel) {
201+
Redis::psubscribe(['users.*'], function ($message, $channel) {
202202
echo $message;
203203
});

Diff for: routing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ To assign middleware to all routes within a group, you may use the `middleware`
150150

151151
Another common use-case for route groups is assigning the same PHP namespace to a group of controllers using the `namespace` parameter in the group array:
152152

153-
Route::group(['namespace' => 'Admin'], function() {
153+
Route::group(['namespace' => 'Admin'], function () {
154154
// Controllers Within The "App\Http\Controllers\Admin" Namespace
155155
});
156156

@@ -222,7 +222,7 @@ To register an explicit binding, use the router's `model` method to specify the
222222

223223
Next, define a route that contains a `{user}` parameter:
224224

225-
$router->get('profile/{user}', function(App\User $user) {
225+
$router->get('profile/{user}', function (App\User $user) {
226226
//
227227
});
228228

Diff for: seeding.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ For example, let's create 50 users and attach a relationship to each user:
5858
*/
5959
public function run()
6060
{
61-
factory(App\User::class, 50)->create()->each(function($u) {
61+
factory(App\User::class, 50)->create()->each(function ($u) {
6262
$u->posts()->save(factory(App\Post::class)->make());
6363
});
6464
}

Diff for: session.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ When you retrieve a value from the session, you may also pass a default value as
9797

9898
$value = $request->session()->get('key', 'default');
9999

100-
$value = $request->session()->get('key', function() {
100+
$value = $request->session()->get('key', function () {
101101
return 'default';
102102
});
103103

@@ -249,7 +249,7 @@ Once your driver has been implemented, you are ready to register it with the fra
249249
*/
250250
public function boot()
251251
{
252-
Session::extend('mongo', function($app) {
252+
Session::extend('mongo', function ($app) {
253253
// Return implementation of SessionHandlerInterface...
254254
return new MongoSessionStore;
255255
});

Diff for: upgrade.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ The `sortBy` method now returns a fresh collection instance instead of modifying
950950

951951
The `groupBy` method now returns `Collection` instances for each item in the parent `Collection`. If you would like to convert all of the items back to plain arrays, you may `map` over them:
952952

953-
$collection->groupBy('type')->map(function($item)
953+
$collection->groupBy('type')->map(function ($item)
954954
{
955955
return $item->all();
956956
});

Diff for: validation.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ The validator also allows you to attach callbacks to be run after validation is
363363

364364
$validator = Validator::make(...);
365365

366-
$validator->after(function($validator) {
366+
$validator->after(function ($validator) {
367367
if ($this->somethingElseIsInvalid()) {
368368
$validator->errors()->add('field', 'Something is wrong with this field!');
369369
}
@@ -909,13 +909,13 @@ Sometimes you may wish to add validation rules based on more complex conditional
909909

910910
Let's assume our web application is for game collectors. If a game collector registers with our application and they own more than 100 games, we want them to explain why they own so many games. For example, perhaps they run a game resale shop, or maybe they just enjoy collecting. To conditionally add this requirement, we can use the `sometimes` method on the `Validator` instance.
911911

912-
$v->sometimes('reason', 'required|max:500', function($input) {
912+
$v->sometimes('reason', 'required|max:500', function ($input) {
913913
return $input->games >= 100;
914914
});
915915

916916
The first argument passed to the `sometimes` method is the name of the field we are conditionally validating. The second argument is the rules we want to add. If the `Closure` passed as the third argument returns `true`, the rules will be added. This method makes it a breeze to build complex conditional validations. You may even add conditional validations for several fields at once:
917917

918-
$v->sometimes(['reason', 'cost'], 'required', function($input) {
918+
$v->sometimes(['reason', 'cost'], 'required', function ($input) {
919919
return $input->games >= 100;
920920
});
921921

@@ -960,7 +960,7 @@ Laravel provides a variety of helpful validation rules; however, you may wish to
960960
*/
961961
public function boot()
962962
{
963-
Validator::extend('foo', function($attribute, $value, $parameters, $validator) {
963+
Validator::extend('foo', function ($attribute, $value, $parameters, $validator) {
964964
return $value == 'foo';
965965
});
966966
}
@@ -1003,7 +1003,7 @@ When creating a custom validation rule, you may sometimes need to define custom
10031003
{
10041004
Validator::extend(...);
10051005

1006-
Validator::replacer('foo', function($message, $attribute, $rule, $parameters) {
1006+
Validator::replacer('foo', function ($message, $attribute, $rule, $parameters) {
10071007
return str_replace(...);
10081008
});
10091009
}
@@ -1020,7 +1020,7 @@ By default, when an attribute being validated is not present or contains an empt
10201020

10211021
For a rule to run even when an attribute is empty, the rule must imply that the attribute is required. To create such an "implicit" extension, use the `Validator::extendImplicit()` method:
10221022

1023-
Validator::extendImplicit('foo', function($attribute, $value, $parameters, $validator) {
1023+
Validator::extendImplicit('foo', function ($attribute, $value, $parameters, $validator) {
10241024
return $value == 'foo';
10251025
});
10261026

0 commit comments

Comments
 (0)