Skip to content

Commit 4e0f965

Browse files
authored
Merge pull request #6967 from kenjis/fix-docs-services.rst
docs: fix services.rst
2 parents e47eb98 + 9f71f23 commit 4e0f965

5 files changed

Lines changed: 16 additions & 16 deletions

File tree

user_guide_src/source/concepts/services.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ CodeIgniter's classes provide an interface that they adhere to. When you want to
106106
core classes, you only need to ensure you meet the requirements of the interface and you know that
107107
the classes are compatible.
108108

109-
For example, the ``RouterCollection`` class implements the ``RouterCollectionInterface``. When you
109+
For example, the ``RouteCollection`` class implements the ``RouteCollectionInterface``. When you
110110
want to create a replacement that provides a different way to create routes, you just need to
111-
create a new class that implements the ``RouterCollectionInterface``:
111+
create a new class that implements the ``RouteCollectionInterface``:
112112

113113
.. literalinclude:: services/006.php
114114

115-
Finally, modify **app/Config/Services.php** to create a new instance of ``MyRouter``
116-
instead of ``CodeIgniter\Router\RouterCollection``:
115+
Finally, add the ``routes()`` method to **app/Config/Services.php** to create a new instance of ``MyRouteCollection``
116+
instead of ``CodeIgniter\Router\RouteCollection``:
117117

118118
.. literalinclude:: services/007.php
119119

user_guide_src/source/concepts/services/006.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use CodeIgniter\Router\RouteCollectionInterface;
66

7-
class MyRouter implements RouteCollectionInterface
7+
class MyRouteCollection implements RouteCollectionInterface
88
{
99
// Implement required methods here.
1010
}

user_guide_src/source/concepts/services/007.php

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

77
class Services extends BaseService
88
{
9+
// ...
10+
911
public static function routes()
1012
{
11-
return new \App\Router\MyRouter();
13+
return new \App\Router\MyRouteCollection(static::locator(), config('Modules'));
1214
}
13-
14-
// ...
1515
}

user_guide_src/source/concepts/services/008.php

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

77
class Services extends BaseService
88
{
9+
// ...
10+
911
public static function renderer($viewPath = APPPATH . 'views/')
1012
{
1113
return new \CodeIgniter\View\View($viewPath);
1214
}
13-
14-
// ...
1515
}

user_guide_src/source/concepts/services/010.php

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

77
class Services extends BaseService
88
{
9-
public static function routes($getShared = false)
9+
// ...
10+
11+
public static function routes($getShared = true)
1012
{
11-
if (! $getShared) {
12-
return new \CodeIgniter\Router\RouteCollection();
13+
if ($getShared) {
14+
return static::getSharedInstance('routes');
1315
}
1416

15-
return static::getSharedInstance('routes');
17+
return new \App\Router\MyRouteCollection(static::locator(), config('Modules'));
1618
}
17-
18-
// ...
1919
}

0 commit comments

Comments
 (0)