Skip to content

Commit 8485dba

Browse files
lonnieezellpaulbalandan
authored andcommitted
cs-fix
1 parent 26c666c commit 8485dba

File tree

9 files changed

+27
-31
lines changed

9 files changed

+27
-31
lines changed

user_guide_src/source/guides/api/code/003.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class Ping extends BaseController
1313
public function getIndex()
1414
{
1515
return $this->respond([
16-
'status' => 'ok',
17-
'time' => date('c'),
18-
'version'=> CodeIgniter::CI_VERSION,
16+
'status' => 'ok',
17+
'time' => date('c'),
18+
'version' => CodeIgniter::CI_VERSION,
1919
]);
2020
}
2121
}

user_guide_src/source/guides/api/code/004.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public function up()
1515
'auto_increment' => true,
1616
],
1717
'name' => [
18-
'type' => 'VARCHAR',
18+
'type' => 'VARCHAR',
1919
'constraint' => '255',
20-
'null' => false,
20+
'null' => false,
2121
],
2222
'created_at' => [
2323
'type' => 'DATETIME',

user_guide_src/source/guides/api/code/005.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public function up()
1515
'auto_increment' => true,
1616
],
1717
'title' => [
18-
'type' => 'VARCHAR',
18+
'type' => 'VARCHAR',
1919
'constraint' => '255',
20-
'null' => false,
20+
'null' => false,
2121
],
2222
'author_id' => [
23-
'type' => 'INTEGER',
24-
'unsigned' => true,
25-
'null' => false,
23+
'type' => 'INTEGER',
24+
'unsigned' => true,
25+
'null' => false,
2626
],
2727
'year' => [
2828
'type' => 'INTEGER',

user_guide_src/source/guides/api/code/009.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace App\Controllers\Api;
44

5-
use CodeIgniter\Api\ResponseTrait;
65
use App\Controllers\BaseController;
6+
use CodeIgniter\Api\ResponseTrait;
77

88
class Books extends BaseController
99
{
@@ -19,7 +19,6 @@ class Books extends BaseController
1919
*/
2020
public function getIndex(?int $id = null)
2121
{
22-
//
2322
}
2423

2524
/**
@@ -29,7 +28,6 @@ public function getIndex(?int $id = null)
2928
*/
3029
public function putIndex(int $id)
3130
{
32-
//
3331
}
3432

3533
/**
@@ -39,7 +37,6 @@ public function putIndex(int $id)
3937
*/
4038
public function postIndex()
4139
{
42-
//
4340
}
4441

4542
/**
@@ -49,6 +46,5 @@ public function postIndex()
4946
*/
5047
public function deleteIndex(int $id)
5148
{
52-
//
5349
}
5450
}

user_guide_src/source/guides/api/code/010.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class AuthorTransformer extends BaseTransformer
99
public function toArray(mixed $resource): array
1010
{
1111
return [
12-
'id' => $resource['id'],
13-
'name' => $resource['name'],
12+
'id' => $resource['id'],
13+
'name' => $resource['name'],
1414
];
1515
}
1616
}

user_guide_src/source/guides/api/code/011.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class BookTransformer extends BaseTransformer
99
public function toArray(mixed $resource): array
1010
{
1111
return [
12-
'id' => $resource['id'],
13-
'title' => $resource['title'],
14-
'year' => $resource['year'],
12+
'id' => $resource['id'],
13+
'title' => $resource['title'],
14+
'year' => $resource['year'],
1515
];
1616
}
1717

user_guide_src/source/guides/api/code/012.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace App\Controllers\Api;
44

5-
use CodeIgniter\Api\ResponseTrait;
65
use App\Controllers\BaseController;
76
use App\Transformers\BookTransformer;
7+
use CodeIgniter\Api\ResponseTrait;
88

99
class Books extends BaseController
1010
{
@@ -20,14 +20,14 @@ class Books extends BaseController
2020
*/
2121
public function getIndex(?int $id = null)
2222
{
23-
$model = model('BookModel');
23+
$model = model('BookModel');
2424
$transformer = new BookTransformer();
2525

2626
// If an ID is provided, fetch a single record
2727
if ($id !== null) {
2828
$book = $model->withAuthorInfo()->find($id);
2929

30-
if (!$book) {
30+
if (! $book) {
3131
return $this->failNotFound('Book not found');
3232
}
3333

@@ -47,7 +47,7 @@ public function getIndex(?int $id = null)
4747
*/
4848
public function putIndex(int $id)
4949
{
50-
$data = $this->request->getRawInput();
50+
$data = $this->request->getRawInput();
5151
$model = model('BookModel');
5252

5353
$rules = [
@@ -56,13 +56,13 @@ public function putIndex(int $id)
5656
'year' => 'required|integer|greater_than_equal_to[2000]|less_than_equal_to[' . date('Y') . ']',
5757
];
5858

59-
if (!$this->validate($rules)) {
59+
if (! $this->validate($rules)) {
6060
return $this->failValidationErrors($this->validator->getErrors());
6161
}
6262

6363
$model = model('BookModel');
6464

65-
if (!$model->find($id)) {
65+
if (! $model->find($id)) {
6666
return $this->failNotFound('Book not found');
6767
}
6868

@@ -88,7 +88,7 @@ public function postIndex()
8888
'year' => 'required|integer|greater_than_equal_to[2000]|less_than_equal_to[' . date('Y') . ']',
8989
];
9090

91-
if (!$this->validate($rules)) {
91+
if (! $this->validate($rules)) {
9292
return $this->failValidationErrors($this->validator->getErrors());
9393
}
9494

@@ -109,7 +109,7 @@ public function deleteIndex(int $id)
109109
{
110110
$model = model('BookModel');
111111

112-
if (!$model->find($id)) {
112+
if (! $model->find($id)) {
113113
return $this->failNotFound('Book not found');
114114
}
115115

user_guide_src/source/guides/api/code/013.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class BookModel extends Model
88
{
9-
protected string $table = 'books';
9+
protected string $table = 'books';
1010
protected array $allowedFields = ['title', 'author_id', 'year'];
1111

1212
/**
@@ -16,6 +16,6 @@ class BookModel extends Model
1616
public function withAuthorInfo()
1717
{
1818
return $this->select('books.*, authors.id as author_id, authors.name as author_name')
19-
->join('authors', 'books.author_id = authors.id');
19+
->join('authors', 'books.author_id = authors.id');
2020
}
2121
}

user_guide_src/source/guides/api/code/014.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class BookModel extends Model
99
public function withAuthorInfo()
1010
{
1111
return $this->select('books.*, authors.name as author_name')
12-
->join('authors', 'books.author_id = authors.id');
12+
->join('authors', 'books.author_id = authors.id');
1313
}
1414
}

0 commit comments

Comments
 (0)