Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
syna
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Flori
syna
Commits
93693762
Unverified
Commit
93693762
authored
6 years ago
by
Thomas Flori
Browse files
Options
Downloads
Patches
Plain Diff
add provide method to provide a section without output buffering
parent
60561704
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/View.php
+11
-6
11 additions, 6 deletions
src/View.php
with
11 additions
and
6 deletions
src/View.php
+
11
−
6
View file @
93693762
...
...
@@ -117,17 +117,22 @@ class View
throw
new
\LogicException
(
'You must start a section before you can end it.'
);
}
$content
=
trim
(
ob_get_clean
());
if
(
$this
->
appendSection
&&
isset
(
$this
->
sections
[
$this
->
sectionName
]))
{
$this
->
sections
[
$this
->
sectionName
]
.
=
$content
;
}
else
{
$this
->
sections
[
$this
->
sectionName
]
=
$content
;
}
$this
->
provide
(
$this
->
sectionName
,
ob_get_clean
(),
$this
->
appendSection
);
$this
->
sectionName
=
null
;
$this
->
appendSection
=
false
;
}
public
function
provide
(
string
$name
,
string
$content
,
bool
$append
=
false
)
{
$content
=
trim
(
$content
,
"
\t\n\r\0\x0b
"
);
if
(
$append
&&
isset
(
$this
->
sections
[
$name
]))
{
$this
->
sections
[
$name
]
.
=
$content
;
}
else
{
$this
->
sections
[
$name
]
=
$content
;
}
}
public
function
section
(
string
$name
,
string
$default
=
null
):
string
{
if
(
!
isset
(
$this
->
sections
[
$name
]))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment