1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* KNUT7 K7F (https://marciozebedeu.com/) |
4
|
|
|
* KNUT7 K7F (tm) : Rapid Development Framework (https://marciozebedeu.com/). |
5
|
|
|
* |
6
|
|
|
* Licensed under The MIT License |
7
|
|
|
* For full copyright and license information, please see the LICENSE.txt |
8
|
|
|
* Redistributions of files must retain the above copyright notice. |
9
|
|
|
* |
10
|
|
|
* @see https://github.com/knut7/framework/ for the canonical source repository |
11
|
|
|
* |
12
|
|
|
* @copyright (c) 2015. KNUT7 Software Technologies AO Inc. (https://marciozebedeu.com/) |
13
|
|
|
* @license https://marciozebedeu.com/license/new-bsd New BSD License |
14
|
|
|
* @author Marcio Zebedeu - [email protected] |
15
|
|
|
* |
16
|
|
|
* @version 1.0.2 |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Ballybran\Helpers\Security; |
20
|
|
|
|
21
|
|
|
use Closure; |
22
|
|
|
use Ballybran\Exception\KException; |
23
|
|
|
|
24
|
|
|
class RenderFiles |
25
|
|
|
{ |
26
|
|
|
protected $index = 'index'; |
27
|
|
|
protected $header = 'header'; |
28
|
|
|
protected $footer = 'footer'; |
29
|
|
|
protected $ex = '.phtml'; |
30
|
|
|
|
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
$this->ex; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
protected function isViewPath($controller) |
37
|
|
|
{ |
38
|
|
|
if (!file_exists(VIEW) || !is_readable(VIEW)) { |
39
|
|
|
return KException::noPathView(); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
if (!is_readable(VIEW . $controller) || !file_exists(VIEW . $controller)) { |
43
|
|
|
return KException::noPathinView($controller); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
protected function isHeader() |
48
|
|
|
{ |
49
|
|
|
if (!file_exists(VIEW . $this->header . $this->ex) || !is_readable(VIEW . $this->header . $this->ex)) { |
50
|
|
|
return KException::notHeader(); |
|
|
|
|
51
|
|
|
} |
52
|
|
|
require_once VIEW . $this->header . $this->ex; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
protected function isFooter() |
56
|
|
|
{ |
57
|
|
|
if (!is_readable(VIEW . $this->footer . $this->ex) || !file_exists(VIEW . $this->footer . $this->ex)) { |
58
|
|
|
return KException::notFooter(); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
require_once VIEW . $this->footer . $this->ex; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function isIndex($controller, $view, $data = null) |
|
|
|
|
65
|
|
|
{ |
66
|
|
|
require_once VIEW . $controller . DS . $view . $this->ex; |
67
|
|
|
|
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.