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
120d6a5d
Commit
120d6a5d
authored
Aug 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the view class.
parent
3bf85e03
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
36 deletions
+2
-36
view.php
system/view.php
+2
-36
No files found.
system/view.php
View file @
120d6a5d
...
...
@@ -134,11 +134,9 @@ class View {
if
(
isset
(
static
::
$composers
[
$this
->
module
][
$this
->
view
]))
{
$composer
=
static
::
$composers
[
$this
->
module
][
$this
->
view
];
if
(
!
is_null
(
$composer
=
$this
->
find_composer_function
(
$composer
)))
foreach
((
array
)
static
::
$composers
[
$this
->
module
][
$this
->
view
]
as
$key
=>
$value
)
{
call_user_func
(
$composer
,
$this
);
if
(
is_callable
(
$value
))
return
call_user_func
(
$value
,
$this
);
}
}
}
...
...
@@ -158,28 +156,6 @@ class View {
static
::
$composers
[
$module
]
=
(
file_exists
(
$composers
))
?
require
$composers
:
array
();
}
/**
* Find the composer function in a composer definition.
*
* If the composer value itself is callable, it will be returned, otherwise the
* first callable value in the composer array will be returned. If the composer
* value is a string, it is simply a view name being defined.
*
* @param mixed $composer
* @return Closure
*/
private
function
find_composer_function
(
$composer
)
{
if
(
is_string
(
$composer
))
return
;
if
(
is_callable
(
$composer
))
return
$composer
;
foreach
(
$composer
as
$key
=>
$value
)
{
if
(
is_callable
(
$value
))
return
$value
;
}
}
/**
* Get the parsed content of the view.
*
...
...
@@ -194,16 +170,6 @@ class View {
throw
new
\Exception
(
"View [
$view
] does not exist."
);
}
// Before rendering the view, we need to spin through all of the bound data and
// evaluate any sub-views or responses that are present.
foreach
(
$this
->
data
as
&
$data
)
{
if
(
$data
instanceof
View
or
$data
instanceof
Response
)
{
$data
=
(
string
)
$data
;
}
}
ob_start
()
and
extract
(
$this
->
data
,
EXTR_SKIP
);
try
{
include
$this
->
path
.
$view
.
EXT
;
}
catch
(
\Exception
$e
)
{
Error
::
handle
(
$e
);
}
...
...
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