Skip to content

Commit 71d78fc

Browse files
committed
docs: fix concepts indentation
1 parent 9f5c4ab commit 71d78fc

File tree

5 files changed

+92
-92
lines changed

5 files changed

+92
-92
lines changed

user_guide_src/source/concepts/factories.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ by using the magic static method of the Factories class, ``Factories::models()``
2424
the common path structure for namespaces and folders, Factories know that the model files
2525
and classes are found within **Models**, so you can request a model by its shorthand base name::
2626

27-
use CodeIgniter\Config\Factories;
27+
use CodeIgniter\Config\Factories;
2828

29-
$users = Factories::models('UserModel');
29+
$users = Factories::models('UserModel');
3030

3131
Or you could also request a specific class::
3232

33-
$widgets = Factories::models('Some\Namespace\Models\WidgetModel');
33+
$widgets = Factories::models('Some\Namespace\Models\WidgetModel');
3434

3535
Next time you ask for the same class anywhere in your code, ``Factories`` will be sure
3636
you get back the instance as before::
3737

38-
class SomeOtherClass
39-
{
40-
$widgets = Factories::models('WidgetModel');
41-
...
42-
}
38+
class SomeOtherClass
39+
{
40+
$widgets = Factories::models('WidgetModel');
41+
...
42+
}
4343

4444
Factory Parameters
4545
==================
@@ -52,8 +52,8 @@ constructor, making it easy to configure your class instance on-the-fly. For exa
5252
your app uses a separate database for authentication and you want to be sure that any attempts
5353
to access user records always go through that connection::
5454

55-
$conn = db_connect('AuthDatabase');
56-
$users = Factories::models('UserModel', [], $conn);
55+
$conn = db_connect('AuthDatabase');
56+
$users = Factories::models('UserModel', [], $conn);
5757

5858
Now any time the ``UserModel`` is loaded from ``Factories`` it will in fact be returning a
5959
class instance that uses the alternate database connection.
@@ -92,17 +92,17 @@ that supplies options as an array property that matches the name of the componen
9292
if you wanted to ensure that all Filters used by your app were valid framework instances,
9393
your **Factories.php** file might look like this::
9494

95-
<?php namespace Config;
95+
<?php namespace Config;
9696

97-
use CodeIgniter\Config\Factory as BaseFactory;
98-
use CodeIgniter\Filters\FilterInterface;
97+
use CodeIgniter\Config\Factory as BaseFactory;
98+
use CodeIgniter\Filters\FilterInterface;
9999

100-
class Factories extends BaseFactory
101-
{
102-
public $filters = [
103-
'instanceOf' => FilterInterface::class,
104-
];
105-
}
100+
class Factories extends BaseFactory
101+
{
102+
public $filters = [
103+
'instanceOf' => FilterInterface::class,
104+
];
105+
}
106106

107107
This would prevent conflict of an unrelated third-party module which happened to have an
108108
unrelated "Filters" path in its namespace.
@@ -114,10 +114,10 @@ The ``Factories`` class has a static method to allow runtime option configuratio
114114
supply the desired array of options using the ``setOptions()`` method and they will be
115115
merged with the default values and stored for the next call::
116116

117-
Factories::setOptions('filters', [
118-
'instanceOf' => FilterInterface::class,
119-
'prefersApp' => false,
120-
]);
117+
Factories::setOptions('filters', [
118+
'instanceOf' => FilterInterface::class,
119+
'prefersApp' => false,
120+
]);
121121

122122
Parameter Options
123123
-----------------
@@ -131,5 +131,5 @@ For example, by default ``Factories`` assumes that you want to locate a shared i
131131
a component. By adding a second parameter to the magic static call, you can control whether
132132
that single call will return a new or shared instance::
133133

134-
$users = Factories::models('UserModel', ['getShared' => true]); // Default; will always be the same instance
135-
$other = Factories::models('UserModel', ['getShared' => false]); // Will always create a new instance
134+
$users = Factories::models('UserModel', ['getShared' => true]); // Default; will always be the same instance
135+
$other = Factories::models('UserModel', ['getShared' => false]); // Will always create a new instance

user_guide_src/source/concepts/http.rst

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ to the server and waits for a response.
2828

2929
The request would look something like this::
3030

31-
GET / HTTP/1.1
32-
Host codeigniter.com
33-
Accept: text/html
34-
User-Agent: Chrome/46.0.2490.80
31+
GET / HTTP/1.1
32+
Host codeigniter.com
33+
Accept: text/html
34+
User-Agent: Chrome/46.0.2490.80
3535

3636
This message displays all of the information necessary to know what the client is requesting. It tells the
3737
method for the request (GET, POST, DELETE, etc), and the version of HTTP it supports.
@@ -48,14 +48,14 @@ Once the server receives the request, your application will take that informatio
4848
The server will bundle your output as part of its response to the client. This is also represented as
4949
a simple text message that looks something like this::
5050

51-
HTTP/1.1 200 OK
52-
Server: nginx/1.8.0
53-
Date: Thu, 05 Nov 2015 05:33:22 GMT
54-
Content-Type: text/html; charset=UTF-8
51+
HTTP/1.1 200 OK
52+
Server: nginx/1.8.0
53+
Date: Thu, 05 Nov 2015 05:33:22 GMT
54+
Content-Type: text/html; charset=UTF-8
5555

56-
<html>
57-
. . .
58-
</html>
56+
<html>
57+
. . .
58+
</html>
5959

6060
The response tells the client what version of the HTTP specification that it's using and, probably most
6161
importantly, the status code (200). The status code is one of a number of codes that have been standardized
@@ -70,32 +70,32 @@ While PHP provides ways to interact with the request and response headers, CodeI
7070
abstracts them so that you have a consistent, simple interface to them. The :doc:`IncomingRequest class </incoming/incomingrequest>`
7171
is an object-oriented representation of the HTTP request. It provides everything you need::
7272

73-
use CodeIgniter\HTTP\IncomingRequest;
73+
use CodeIgniter\HTTP\IncomingRequest;
7474

75-
$request = service('request');
75+
$request = service('request');
7676

77-
// the URI being requested (i.e. /about)
78-
$request->uri->getPath();
77+
// the URI being requested (i.e. /about)
78+
$request->uri->getPath();
7979

80-
// Retrieve $_GET and $_POST variables
81-
$request->getGet('foo');
82-
$request->getPost('foo');
80+
// Retrieve $_GET and $_POST variables
81+
$request->getGet('foo');
82+
$request->getPost('foo');
8383

84-
// Retrieve from $_REQUEST which should include
85-
// both $_GET and $_POST contents
86-
$request->getVar('foo');
84+
// Retrieve from $_REQUEST which should include
85+
// both $_GET and $_POST contents
86+
$request->getVar('foo');
8787

88-
// Retrieve JSON from AJAX calls
89-
$request->getJSON();
88+
// Retrieve JSON from AJAX calls
89+
$request->getJSON();
9090

91-
// Retrieve server variables
92-
$request->getServer('Host');
91+
// Retrieve server variables
92+
$request->getServer('Host');
9393

94-
// Retrieve an HTTP Request header, with case-insensitive names
95-
$request->getHeader('host');
96-
$request->getHeader('Content-Type');
94+
// Retrieve an HTTP Request header, with case-insensitive names
95+
$request->getHeader('host');
96+
$request->getHeader('Content-Type');
9797

98-
$request->getMethod(); // GET, POST, PUT, etc
98+
$request->getMethod(); // GET, POST, PUT, etc
9999

100100
The request class does a lot of work in the background for you, that you never need to worry about.
101101
The `isAJAX()` and `isSecure()` methods check several different methods to determine the correct answer.

user_guide_src/source/concepts/index.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ CodeIgniter4 Overview
55
The following pages describe the architectural concepts behind CodeIgniter4:
66

77
.. toctree::
8-
:titlesonly:
8+
:titlesonly:
99

10-
structure
11-
mvc
12-
autoloader
13-
services
14-
factories
15-
http
16-
security
10+
structure
11+
mvc
12+
autoloader
13+
services
14+
factories
15+
http
16+
security

user_guide_src/source/concepts/services.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ configuration file. This file acts as a type of factory to create new instances
1616
A quick example will probably make things clearer, so imagine that you need to pull in an instance
1717
of the Timer class. The simplest method would simply be to create a new instance of that class::
1818

19-
$timer = new \CodeIgniter\Debug\Timer();
19+
$timer = new \CodeIgniter\Debug\Timer();
2020

2121
And this works great. Until you decide that you want to use a different timer class in its place.
2222
Maybe this one has some advanced reporting the default timer does not provide. In order to do this,
@@ -30,7 +30,7 @@ class for us. This class is kept very simple. It only contains a method for each
3030
to use as a service. The method typically returns a shared instance of that class, passing any dependencies
3131
it might have into it. Then, we would replace our timer creation code with code that calls this new class::
3232

33-
$timer = \Config\Services::timer();
33+
$timer = \Config\Services::timer();
3434

3535
When you need to change the implementation used, you can modify the services configuration file, and
3636
the change happens automatically throughout your application without you having to do anything. Now
@@ -50,16 +50,16 @@ required parameter is the service name. This is the same as the method name with
5050
file always returns a SHARED instance of the class, so calling the function multiple times should
5151
always return the same instance::
5252

53-
$logger = service('logger');
53+
$logger = service('logger');
5454

5555
If the creation method requires additional parameters, they can be passed after the service name::
5656

57-
$renderer = service('renderer', APPPATH.'views/');
57+
$renderer = service('renderer', APPPATH.'views/');
5858

5959
The second function, ``single_service()`` works just like ``service()`` but returns a new instance of
6060
the class::
6161

62-
$logger = single_service('logger');
62+
$logger = single_service('logger');
6363

6464
Defining Services
6565
=================
@@ -74,18 +74,18 @@ For example, the ``RouterCollection`` class implements the ``RouterCollectionInt
7474
want to create a replacement that provides a different way to create routes, you just need to
7575
create a new class that implements the ``RouterCollectionInterface``::
7676

77-
class MyRouter implements \CodeIgniter\Router\RouteCollectionInterface
78-
{
79-
// Implement required methods here.
80-
}
77+
class MyRouter implements \CodeIgniter\Router\RouteCollectionInterface
78+
{
79+
// Implement required methods here.
80+
}
8181

8282
Finally, modify **/app/Config/Services.php** to create a new instance of ``MyRouter``
8383
instead of ``CodeIgniter\Router\RouterCollection``::
8484

85-
public static function routes()
86-
{
87-
return new \App\Router\MyRouter();
88-
}
85+
public static function routes()
86+
{
87+
return new \App\Router\MyRouter();
88+
}
8989

9090
Allowing Parameters
9191
-------------------
@@ -98,15 +98,15 @@ to find the views at ``APPPATH.views/``. We want the developer to have the optio
9898
changing that path, though, if their needs require it. So the class accepts the ``$viewPath``
9999
as a constructor parameter. The service method looks like this::
100100

101-
public static function renderer($viewPath=APPPATH.'views/')
102-
{
103-
return new \CodeIgniter\View\View($viewPath);
104-
}
101+
public static function renderer($viewPath=APPPATH.'views/')
102+
{
103+
return new \CodeIgniter\View\View($viewPath);
104+
}
105105

106106
This sets the default path in the constructor method, but allows for easily changing
107107
the path it uses::
108108

109-
$renderer = \Config\Services::renderer('/shared/views');
109+
$renderer = \Config\Services::renderer('/shared/views');
110110

111111
Shared Classes
112112
-----------------

user_guide_src/source/concepts/structure.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ structure that works well for many applications. The following folders make up t
1919

2020
.. code-block:: none
2121
22-
/app
23-
/Config Stores the configuration files
24-
/Controllers Controllers determine the program flow
25-
/Database Stores the database migrations and seeds files
26-
/Filters Stores filter classes that can run before and after controller
27-
/Helpers Helpers store collections of standalone functions
28-
/Language Multiple language support reads the language strings from here
29-
/Libraries Useful classes that don't fit in another category
30-
/Models Models work with the database to represent the business entities.
31-
/ThirdParty ThirdParty libraries that can be used in application
32-
/Views Views make up the HTML that is displayed to the client.
22+
/app
23+
/Config Stores the configuration files
24+
/Controllers Controllers determine the program flow
25+
/Database Stores the database migrations and seeds files
26+
/Filters Stores filter classes that can run before and after controller
27+
/Helpers Helpers store collections of standalone functions
28+
/Language Multiple language support reads the language strings from here
29+
/Libraries Useful classes that don't fit in another category
30+
/Models Models work with the database to represent the business entities.
31+
/ThirdParty ThirdParty libraries that can be used in application
32+
/Views Views make up the HTML that is displayed to the client.
3333
3434
Because the ``app`` directory is already namespaced, you should feel free to modify the structure
3535
of this directory to suit your application's needs. For example, you might decide to start using the Repository
3636
pattern and Entity Models to work with your data. In this case, you could rename the ``Models`` directory to
3737
``Repositories``, and add a new ``Entities`` directory.
3838

3939
.. note:: If you rename the ``Controllers`` directory, though, you will not be able to use the automatic method of
40-
routing to controllers, and will need to define all of your routes in the routes file.
40+
routing to controllers, and will need to define all of your routes in the routes file.
4141

4242
All files in this directory live under the ``App`` namespace, though you are free to change that in
4343
**app/Config/Constants.php**.

0 commit comments

Comments
 (0)