Skip to content

Commit d5af999

Browse files
authored
Fix code block indentation in docs. (#8207)
1 parent b318b57 commit d5af999

5 files changed

Lines changed: 49 additions & 50 deletions

File tree

docs/en/controllers.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,9 @@ the controller's default one:
495495
``` php
496496
// In a controller method.
497497
$recentArticles = $this->fetchTable('Articles')->find('all',
498-
limit: 5,
499-
order: 'Articles.created DESC',
500-
)
501-
->all();
498+
limit: 5,
499+
order: 'Articles.created DESC',
500+
)->all();
502501
```
503502

504503
### fetchModel()

docs/en/core-libraries/collections.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,40 +1245,40 @@ imagine a lengthy closure like this one:
12451245

12461246
``` php
12471247
$collection
1248-
->map(function ($row, $key) {
1249-
if (!empty($row['items'])) {
1250-
$row['total'] = collection($row['items'])->sumOf('price');
1251-
}
1248+
->map(function ($row, $key) {
1249+
if (!empty($row['items'])) {
1250+
$row['total'] = collection($row['items'])->sumOf('price');
1251+
}
12521252

1253-
if (!empty($row['total'])) {
1254-
$row['tax_amount'] = $row['total'] * 0.25;
1255-
}
1253+
if (!empty($row['total'])) {
1254+
$row['tax_amount'] = $row['total'] * 0.25;
1255+
}
12561256

1257-
// More code here...
1257+
// More code here...
12581258

1259-
return $modifiedRow;
1260-
});
1259+
return $modifiedRow;
1260+
});
12611261
```
12621262

12631263
This can be refactored by creating another class:
12641264

12651265
``` php
12661266
class TotalOrderCalculator
12671267
{
1268-
public function __invoke($row, $key)
1269-
{
1270-
if (!empty($row['items'])) {
1271-
$row['total'] = collection($row['items'])->sumOf('price');
1272-
}
1268+
public function __invoke($row, $key)
1269+
{
1270+
if (!empty($row['items'])) {
1271+
$row['total'] = collection($row['items'])->sumOf('price');
1272+
}
12731273

1274-
if (!empty($row['total'])) {
1275-
$row['tax_amount'] = $row['total'] * 0.25;
1276-
}
1274+
if (!empty($row['total'])) {
1275+
$row['tax_amount'] = $row['total'] * 0.25;
1276+
}
12771277

1278-
// More code here...
1278+
// More code here...
12791279

1280-
return $modifiedRow;
1281-
}
1280+
return $modifiedRow;
1281+
}
12821282
}
12831283

12841284
// Use the logic in your map() call

docs/en/core-libraries/email.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ application. Mailer views can also use layouts and elements just like normal vie
158158
``` php
159159
$mailer = new Mailer();
160160
$mailer
161-
->setEmailFormat('html')
162-
->setTo('bob@example.com')
163-
->setFrom('app@domain.com')
164-
->viewBuilder()
165-
->setTemplate('welcome')
166-
->setLayout('fancy');
161+
->setEmailFormat('html')
162+
->setTo('bob@example.com')
163+
->setFrom('app@domain.com')
164+
->viewBuilder()
165+
->setTemplate('welcome')
166+
->setLayout('fancy');
167167

168168
$mailer->deliver();
169169
```
@@ -175,12 +175,12 @@ send multipart templated email messages as well:
175175
``` php
176176
$mailer = new Mailer();
177177
$mailer
178-
->setEmailFormat('both')
179-
->setTo('bob@example.com')
180-
->setFrom('app@domain.com')
181-
->viewBuilder()
182-
->setTemplate('welcome')
183-
->setLayout('fancy');
178+
->setEmailFormat('both')
179+
->setTo('bob@example.com')
180+
->setFrom('app@domain.com')
181+
->viewBuilder()
182+
->setTemplate('welcome')
183+
->setLayout('fancy');
184184

185185
$mailer->deliver();
186186
```

docs/en/orm/associations.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class ArticlesTable extends Table
4242
public function initialize(array $config): void
4343
{
4444
$this->belongsTo('Authors', [
45-
'className' => 'Publishing.Authors',
46-
])
45+
'className' => 'Publishing.Authors',
46+
])
4747
->setForeignKey('author_id')
4848
->setProperty('author');
4949
}
@@ -81,8 +81,8 @@ class ArticlesTable extends Table
8181
->setFinder('approved');
8282

8383
$this->hasMany('UnapprovedComments', [
84-
'className' => 'Comments',
85-
])
84+
'className' => 'Comments',
85+
])
8686
->setFinder('unapproved')
8787
->setProperty('unapproved_comments');
8888
}
@@ -195,15 +195,15 @@ class UsersTable extends Table
195195
public function initialize(array $config): void
196196
{
197197
$this->hasOne('HomeAddresses', [
198-
'className' => 'Addresses',
199-
])
198+
'className' => 'Addresses',
199+
])
200200
->setProperty('home_address')
201201
->setConditions(['HomeAddresses.label' => 'Home'])
202202
->setDependent(true);
203203

204204
$this->hasOne('WorkAddresses', [
205-
'className' => 'Addresses',
206-
])
205+
'className' => 'Addresses',
206+
])
207207
->setProperty('work_address')
208208
->setConditions(['WorkAddresses.label' => 'Work'])
209209
->setDependent(true);

docs/en/orm/retrieving-data-and-resultsets.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ the Author entity.
319319
``` php
320320
// In your finders/controller:
321321
$query = $articles->find('list',
322-
keyField: 'id',
323-
valueField: function ($article) {
324-
return $article->author->get('label');
325-
}
326-
)
322+
keyField: 'id',
323+
valueField: function ($article) {
324+
return $article->author->get('label');
325+
},
326+
)
327327
->contain('Authors');
328328
```
329329

0 commit comments

Comments
 (0)