1 | <?php |
||
15 | class Scope { |
||
16 | |||
17 | /** |
||
18 | * Common Scope |
||
19 | * |
||
20 | * @var null|array |
||
21 | */ |
||
22 | protected static $common = null; |
||
23 | |||
24 | /** |
||
25 | * Folder with scopes. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | public static $folder = 'scope'; |
||
30 | |||
31 | /** |
||
32 | * Returns request scope. |
||
33 | * |
||
34 | * @param string|null $view_name View's name. |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | public static function get_scope( $view_name = null ) { |
||
51 | |||
52 | /** |
||
53 | * Extends Scope with scope that is defined in theme_name/scope folder. |
||
54 | * |
||
55 | * @param array $scope Data for view file. |
||
56 | * @param string $view_name View's name. |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public static function extend_scope( $scope, $view_name ) { |
||
63 | |||
64 | /** |
||
65 | * Returns Common Scope. |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | public static function get_common_scope() { |
||
76 | |||
77 | /** |
||
78 | * Requires file's scope. |
||
79 | * |
||
80 | * @param string $filename View's file name. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public static function require_scope( $filename ) { |
||
99 | } |
||
100 |
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
.