mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge pull request #1062 from jim-parry/cleanup-docs
Fix sphinx errors in user guide
This commit is contained in:
commit
7c8ac3cc28
@ -141,7 +141,7 @@ A small example should clarify this.
|
||||
|
||||
Imagine that you've created a new directory, ``Blog`` in your root directory. This will hold a blog module with controllers,
|
||||
models, etc, and you'd like to make some of the classes available as a service. The first step is to create a new file:
|
||||
``Blog\Config\Services.php``. The skeleton of the file should be:
|
||||
``Blog\Config\Services.php``. The skeleton of the file should be::
|
||||
|
||||
<?php namespace Blog\Config;
|
||||
|
||||
@ -156,7 +156,7 @@ models, etc, and you'd like to make some of the classes available as a service.
|
||||
}
|
||||
|
||||
Now you can use this file as described above. When you want to grab the posts service from any controller, you
|
||||
would simply use the framework's ``Config\Services`` class to grab your service:
|
||||
would simply use the framework's ``Config\Services`` class to grab your service::
|
||||
|
||||
$postManager = Config\Services::postManager();
|
||||
|
||||
|
@ -280,7 +280,7 @@ a tag, as specified by type, class, or id::
|
||||
The **dontSee()** method is the exact opposite::
|
||||
|
||||
// Checks that "Hello World" does NOT exist on the page
|
||||
$results->dontSee('Hello World");
|
||||
$results->dontSee('Hello World');
|
||||
// Checks that "Hellow World" does NOT exist within any h1 tag
|
||||
$results->dontSee('Hello World', 'h1');
|
||||
|
||||
@ -325,25 +325,25 @@ CITestStreamFilter
|
||||
|
||||
This filter captures output and makes it available to you.
|
||||
|
||||
An example demonstrating this inside one of your test cases:
|
||||
An example demonstrating this inside one of your test cases::
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
CITestStreamFilter::$buffer = '';
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter');
|
||||
}
|
||||
public function setUp()
|
||||
{
|
||||
CITestStreamFilter::$buffer = '';
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
stream_filter_remove($this->stream_filter);
|
||||
}
|
||||
public function tearDown()
|
||||
{
|
||||
stream_filter_remove($this->stream_filter);
|
||||
}
|
||||
|
||||
public function testSomeOutput()
|
||||
{
|
||||
CLI::write('first.');
|
||||
$expected = "first.\n";
|
||||
$this->assertEquals($expected, CITestStreamFilter::$buffer);
|
||||
}
|
||||
public function testSomeOutput()
|
||||
{
|
||||
CLI::write('first.');
|
||||
$expected = "first.\n";
|
||||
$this->assertEquals($expected, CITestStreamFilter::$buffer);
|
||||
}
|
||||
|
||||
|
||||
Additional Assertions
|
||||
@ -353,7 +353,7 @@ Additional Assertions
|
||||
|
||||
**assertLogged($level, $expectedMessage)**
|
||||
|
||||
Ensure that something you expected to be logged actually was.
|
||||
Ensure that something you expected to be logged actually was::
|
||||
|
||||
$config = new LoggerConfig();
|
||||
$logger = new Logger($config);
|
||||
@ -365,15 +365,15 @@ Ensure that something you expected to be logged actually was.
|
||||
|
||||
**assertEventTriggered($eventName)**
|
||||
|
||||
Ensure that an event you excpected to be triggered actually was:
|
||||
Ensure that an event you excpected to be triggered actually was::
|
||||
|
||||
Events::on('foo', function($arg) use(&$result) {
|
||||
$result = $arg;
|
||||
});
|
||||
Events::on('foo', function($arg) use(&$result) {
|
||||
$result = $arg;
|
||||
});
|
||||
|
||||
Events::trigger('foo', 'bar');
|
||||
Events::trigger('foo', 'bar');
|
||||
|
||||
$this->assertEventTriggered('foo');
|
||||
$this->assertEventTriggered('foo');
|
||||
|
||||
|
||||
=====================
|
||||
|
@ -385,9 +385,9 @@ Provided Filters
|
||||
|
||||
The following filters are available when using the parser:
|
||||
|
||||
==================== ========================== =================================================================== =================================
|
||||
Filter Arguments Description Example
|
||||
==================== ========================== =================================================================== =================================
|
||||
==================== ========================== ==================================================================== =================================
|
||||
Filter Arguments Description Example
|
||||
==================== ========================== ==================================================================== =================================
|
||||
abs Displays the absolute value of a number. { v|abs }
|
||||
capitalize Displays the string in sentence case: all lowercase with first { v|capitalize}
|
||||
letter capitalized.
|
||||
@ -399,7 +399,7 @@ esc html, attr, css, js Specifies the context to escape
|
||||
excerpt phrase, radius Returns the text within a radius of words from a given phrase. { v|excerpt(green giant, 20) }
|
||||
Same as **excerpt** helper function.
|
||||
highlight phrase Highlights a given phrase within the text using '<mark></mark>'
|
||||
tags. { v|highlight(view parser) }
|
||||
tags. { v|highlight(view parser) }
|
||||
highlight_code Highlights code samples with HTML/CSS. { v|highlight_code }
|
||||
limit_chars limit Limits the number of chracters to $limit. { v|limit_chars(100) }
|
||||
limit_words limit Limits the number of words to $limit. { v|limit_words(20) }
|
||||
@ -407,7 +407,6 @@ local_currency currency, locale Displays a localized version of
|
||||
3-letter ISO 4217 currency code.
|
||||
local_number type, precision, locale Displays a localized version of a number. "type" can be one of: { v|local_number(decimal,2,en_US) }
|
||||
decimal, currency, percent, scientific, spellout, ordinal, duration.
|
||||
See `PHP's NumberFormatter <http://php.net/manual/en/numberformatter.create.php>`_ for details.
|
||||
lower Converts a string to lowercase. { v|lower }
|
||||
nl2br Replaces all newline characters (\n) to an HTML <br/> tag. { v|nl2br }
|
||||
number_format places Wraps PHP **number_format** function for use within the parser. { v|number_format(3) }
|
||||
@ -419,7 +418,10 @@ strip_tags allowed chars Wraps PHP **strip_tags**. Can ac
|
||||
title Displays a "title case" version of the string, with all lowercase, { v|title }
|
||||
and each word capitalized.
|
||||
upper Displays the string in all uppercase. { v|upper }
|
||||
==================== ========================== =================================================================== =================================
|
||||
==================== ========================== ==================================================================== =================================
|
||||
|
||||
See `PHP's NumberFormatter <http://php.net/manual/en/numberformatter.create.php>`_ for details relevant to the
|
||||
"local_number" filter.
|
||||
|
||||
Custom Filters
|
||||
--------------
|
||||
|
@ -8,8 +8,6 @@ about the browser, mobile device, or robot visiting your site.
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
**************************
|
||||
Using the User Agent Class
|
||||
**************************
|
||||
|
@ -267,7 +267,7 @@ easily validate your data::
|
||||
|
||||
// Joe Smith
|
||||
$validation->setRules([
|
||||
'contacts.name' => 'required
|
||||
'contacts.name' => 'required'
|
||||
]);
|
||||
|
||||
// Fred Flintsone & Wilma
|
||||
|
Loading…
x
Reference in New Issue
Block a user