Skip to content

Commit 8633491

Browse files
committed
json decoded automatically (JIT)
1 parent 1223436 commit 8633491

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

view/overview/index.phtml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -450,23 +450,26 @@ $this->without(['foo', 'baz']);
450450
<h2 id="json-api">JSON API</h2>
451451
<p>Web services and APIs can be built using JSON requests and responses. A request with the <code
452452
class="highlighter-rouge">application/json</code> content type header is <a
453-
href="https://github.com/mvc5/http-message/blob/master/src/Plugin/Data.php#L64">automatically decoded</a>
454-
into an associative array and <a href="https://github.com/mvc5/http-message/blob/master/config/request.php#L33">assigned</a>
455-
to the request as the <code class="highlighter-rouge">data</code> attribute. If the <a
453+
href="https://github.com/mvc5/http-message/blob/master/src/Plugin/Data.php#L64">decoded</a> automatically
454+
(JIT) into an associative array and <a
455+
href="https://github.com/mvc5/http-message/blob/master/config/request.php#L33">assigned</a> to the request
456+
as the <code class="highlighter-rouge">data</code> attribute. If the <a
456457
href="https://github.com/mvc5/mvc5/blob/master/config/middleware.php#L7">route match</a> middleware function
457-
returns a HTTP <a href="https://github.com/mvc5/mvc5/blob/master/src/Http/Error.php">error</a>, e.g <a
458+
returns a HTTP <a href="https://github.com/mvc5/mvc5/blob/master/src/Http/Error.php">Error</a>, e.g <a
458459
href="https://github.com/mvc5/mvc5/blob/master/src/Http/Error/NotFound.php">404 Not Found</a>, it is <a
459460
href="https://github.com/mvc5/mvc5/blob/master/src/Route/Dispatch/Router.php#L108">assigned</a> to the
460461
request by the router. The <a href="https://github.com/mvc5/mvc5/blob/master/src/Request/Error/Controller.php#L43">error
461-
controller</a> will then return the HTTP <a href="https://github.com/mvc5/mvc5/blob/master/src/Http/Error.php">error</a>
462+
controller</a> will then return the HTTP <a href="https://github.com/mvc5/mvc5/blob/master/src/Http/Error.php">Error</a>
462463
as a <a href="https://github.com/mvc5/mvc5/blob/master/src/Response/JsonErrorResponse.php">JSON response</a> when
463-
the client’s request accept header is <code class="highlighter-rouge">application/json</code>. Similarly, when an
464-
exception is thrown, the <a href="https://github.com/mvc5/mvc5/blob/master/config/event.php#L7"><code
464+
the request accept header is <code class="highlighter-rouge">application/json</code>. Similarly, when an exception
465+
is thrown, the <a href="https://github.com/mvc5/mvc5/blob/master/config/event.php#L7"><code
465466
class="highlighter-rouge">response\exception</code></a> function will return a <a
466467
href="https://github.com/mvc5/mvc5/blob/master/src/Response/JsonExceptionResponse.php">JSON response</a>
467468
containing an empty exception message. Alternatively, in development, the <a
468469
href="https://github.com/mvc5/mvc5-application/blob/master/config/config.php#L9">debug</a> configuration
469-
parameter can be set to true to include the details of the exception.</p>
470+
parameter can be set to true to <a
471+
href="https://github.com/mvc5/mvc5/blob/master/src/Response/JsonExceptionResponse.php#L20">include</a> the
472+
details of the exception.</p>
470473

471474
<h2 id="rest-api-methods">REST API Methods</h2>
472475
<p>Routes can be configured with <a
@@ -497,7 +500,8 @@ $this-&gt;without(['foo', 'baz']);
497500
</code></pre>
498501
</div>
499502
<p>A controller is a function, it can also be <a href="#middleware">middleware</a>, or an <a
500-
href="https://github.com/mvc5/mvc5/blob/master/src/Event/Event.php">event</a>, or a <a href="https://mvc5.github.io/plugins">plugin</a>
503+
href="https://github.com/mvc5/mvc5/blob/master/src/Event/Event.php">event</a>, or a <a
504+
href="https://mvc5.github.io/plugins">plugin</a>
501505
that <a href="https://github.com/mvc5/mvc5/blob/master/src/Resolver/Resolver.php#L477">resolves</a> to a <a
502506
href="http://php.net/manual/en/language.types.callable.php">callable</a> function. If the value returned
503507
from the controller is not null and is not a <a
@@ -843,7 +847,8 @@ class Controller
843847
</div>
844848

845849
<h2 id="dependency-injection">Dependency Injection</h2>
846-
<p>A service configuration can either be a string, an array, an anonymous function, a <a href="https://mvc5.github.io/plugins">plugin</a> or a
850+
<p>A service configuration can either be a string, an array, an anonymous function, a <a
851+
href="https://mvc5.github.io/plugins">plugin</a> or a
847852
real value.
848853
The service name can either be a short name or a class or interface name. If a service name does not have a service
849854
configuration and it is a fully qualified class name, the class will be <a
@@ -867,11 +872,14 @@ class Controller
867872
there are required dependencies. The first value of the array is the name of the class (or another configuration)
868873
and the remaining values are the arguments that cannot be <a href="#autowiring">autowired</a> and can override a
869874
parent configuration value by name. An anonymous function can be used when the class instantiation requires custom
870-
logic. However, anonymous functions cannot be serialized and a <a href="https://mvc5.github.io/plugins">plugin</a> can be used instead. <a
871-
href="https://mvc5.github.io/plugins">Plugins</a> provide inversion of control and are a domain-specific language. Each <a
875+
logic. However, anonymous functions cannot be serialized and a <a href="https://mvc5.github.io/plugins">plugin</a>
876+
can be used instead. <a
877+
href="https://mvc5.github.io/plugins">Plugins</a> provide inversion of control and are a domain-specific
878+
language. Each <a
872879
href="https://mvc5.github.io/plugins">plugin</a> must implement a <a
873880
href="https://github.com/mvc5/mvc5/blob/master/src/Resolvable.php">resolvable</a> interface so the system
874-
can distinguish them from other objects and invoke their associated function. <a href="https://mvc5.github.io/plugins">Plugins</a> are
881+
can distinguish them from other objects and invoke their associated function. <a
882+
href="https://mvc5.github.io/plugins">Plugins</a> are
875883
only required when an explicit configuration is necessary.</p>
876884

877885
<h3 id="autowiring">Autowiring</h3>
@@ -883,7 +891,8 @@ class Controller
883891
injection</a>.</p>
884892

885893
<h3 id="service-container">Service Container</h3>
886-
<p>Service configurations and <a href="https://mvc5.github.io/plugins">plugins</a> can be combined and accessed using the <a
894+
<p>Service configurations and <a href="https://mvc5.github.io/plugins">plugins</a> can be combined and accessed using
895+
the <a
887896
href="http://php.net/manual/en/class.arrayaccess.php">ArrayAccess</a> interface or the <a
888897
href="https://github.com/mvc5/mvc5/blob/master/src/Arg.php#L106">arrow</a> notation, e.g. <code>dashboard-&gt;home</code>.
889898
</p>
@@ -921,7 +930,8 @@ $app-&gt;call('dashboard-&gt;home', ['form' =&gt; []]);
921930
</div>
922931
<p>A <a href="https://github.com/mvc5/mvc5/blob/master/src/Resolver/Container.php">container</a> can contain any type of
923932
value, except for <a href="http://php.net/manual/en/language.types.null.php">null</a>; in which case the <a
924-
href="https://mvc5.github.io/plugins/#nullvalue">null value</a> plugin can be used. A parent container can also pass itself to a
933+
href="https://mvc5.github.io/plugins/#nullvalue">null value</a> plugin can be used. A parent container can
934+
also pass itself to a
925935
child container as the service <a href="https://github.com/mvc5/mvc5/blob/master/src/Resolver/Resolver.php#L73">provider</a>
926936
to use when the child container cannot retrieve or resolve a particular value. The parent container can also
927937
configure the <a href="https://github.com/mvc5/mvc5/blob/master/src/Resolver/Resolver.php#L75">scope</a> of an

0 commit comments

Comments
 (0)