Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
5f97030c
Commit
5f97030c
authored
May 30, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored set_format to foromat.
parent
c2ad6a81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
messages.php
laravel/messages.php
+8
-5
No files found.
laravel/messages.php
View file @
5f97030c
...
...
@@ -80,12 +80,12 @@ class Messages {
*
* <code>
* // Apply a new default format.
* $messages->
set_
format('email', '<p>this is my :message</p>');
* $messages->format('email', '<p>this is my :message</p>');
* </code>
*
* @param string $format
*/
public
function
set_
format
(
$format
=
':message'
)
public
function
format
(
$format
=
':message'
)
{
$this
->
format
=
$format
;
}
...
...
@@ -111,6 +111,7 @@ class Messages {
public
function
first
(
$key
=
null
,
$format
=
null
)
{
$format
=
(
$format
===
null
)
?
$this
->
format
:
$format
;
$messages
=
is_null
(
$key
)
?
$this
->
all
(
$format
)
:
$this
->
get
(
$key
,
$format
);
return
(
count
(
$messages
)
>
0
)
?
$messages
[
0
]
:
''
;
...
...
@@ -134,9 +135,10 @@ class Messages {
public
function
get
(
$key
,
$format
=
null
)
{
$format
=
(
$format
===
null
)
?
$this
->
format
:
$format
;
if
(
array_key_exists
(
$key
,
$this
->
messages
))
{
return
$this
->
format
(
$this
->
messages
[
$key
],
$format
);
return
$this
->
transform
(
$this
->
messages
[
$key
],
$format
);
}
return
array
();
...
...
@@ -159,11 +161,12 @@ class Messages {
public
function
all
(
$format
=
null
)
{
$format
=
(
$format
===
null
)
?
$this
->
format
:
$format
;
$all
=
array
();
foreach
(
$this
->
messages
as
$messages
)
{
$all
=
array_merge
(
$all
,
$this
->
format
(
$messages
,
$format
));
$all
=
array_merge
(
$all
,
$this
->
transform
(
$messages
,
$format
));
}
return
$all
;
...
...
@@ -176,7 +179,7 @@ class Messages {
* @param string $format
* @return array
*/
protected
function
format
(
$messages
,
$format
)
protected
function
transform
(
$messages
,
$format
)
{
$messages
=
(
array
)
$messages
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment