1 | <?php |
||
39 | class AppView extends View |
||
40 | { |
||
41 | |||
42 | const VIEW_FORM = 'form'; |
||
43 | |||
44 | /** |
||
45 | * Controller form actions. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $_formActions = ['edit', 'add']; |
||
50 | |||
51 | /** |
||
52 | * Get view file path. |
||
53 | * |
||
54 | * @param string $name |
||
55 | * @return null|string |
||
56 | */ |
||
57 | public function getViewFile($name) |
||
71 | |||
72 | /** |
||
73 | * Initialization hook method. |
||
74 | * |
||
75 | * Properties like $helpers etc. cannot be initialized statically in your custom |
||
76 | * view class as they are overwritten by values from controller in constructor. |
||
77 | * So this method allows you to manipulate them as required after view instance |
||
78 | * is constructed. |
||
79 | * |
||
80 | * @return void |
||
81 | * |
||
82 | * @throws \JBZoo\Utils\Exception |
||
83 | */ |
||
84 | public function initialize() |
||
93 | |||
94 | /** |
||
95 | * Render layout partial. |
||
96 | * |
||
97 | * @param string $name |
||
98 | * @param array $data |
||
99 | * @return null|string |
||
100 | */ |
||
101 | public function partial($name, array $data = []) |
||
111 | |||
112 | /** |
||
113 | * Renders view for given template file and layout. |
||
114 | * |
||
115 | * @param null|string $view |
||
116 | * @param null|string $layout |
||
117 | * @return null|string |
||
118 | */ |
||
119 | public function render($view = null, $layout = null) |
||
124 | |||
125 | /** |
||
126 | * Find form view by request. |
||
127 | * |
||
128 | * @return string|null |
||
129 | */ |
||
130 | protected function _findViewByRequest() |
||
155 | |||
156 | /** |
||
157 | * Get current form view. |
||
158 | * |
||
159 | * @param null|string $view |
||
160 | * @return null |
||
161 | */ |
||
162 | protected function _getFormView($view = null) |
||
170 | |||
171 | /** |
||
172 | * Finds an partial filename, returns false on failure. |
||
173 | * |
||
174 | * @param string $name |
||
175 | * @return bool|string |
||
176 | */ |
||
177 | protected function _getLayoutPartialPath($name) |
||
195 | } |
||
196 |
This check looks for type mismatches where the missing type is
false
. This is usually indicative of an error condtion.Consider the follow example
This function either returns a new
DateTime
object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returnedfalse
before passing on the value to another function or method that may not be able to handle afalse
.