1 | <?php |
||
23 | class CFSTemplateManager implements TemplateManager |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $cache_dir; |
||
29 | |||
30 | /** |
||
31 | * @var CFSWrapper |
||
32 | */ |
||
33 | protected $cascading_files; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $compiled_paths = []; |
||
39 | |||
40 | /** |
||
41 | * @var TemplateCompiler |
||
42 | */ |
||
43 | protected $compiler; |
||
44 | |||
45 | /** |
||
46 | * @var boolean |
||
47 | */ |
||
48 | protected $recompile_always; |
||
49 | |||
50 | /** |
||
51 | * Valid options: |
||
52 | * * cache_dir => the path where compiled templates will be cached |
||
53 | * * recompile_always => whether to recompile each template on every execution, |
||
54 | * |
||
55 | * @param CFSWrapper $cascading_files |
||
56 | * @param TemplateCompiler $compiler |
||
57 | * @param array $options |
||
58 | */ |
||
59 | public function __construct(CFSWrapper $cascading_files, TemplateCompiler $compiler, array $options) |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function getPath($template_name) |
||
83 | |||
84 | /** |
||
85 | * @param string $compiled_path |
||
86 | * |
||
87 | * @return bool |
||
88 | */ |
||
89 | protected function isCompileRequired($compiled_path) |
||
97 | |||
98 | /** |
||
99 | * @param string $template_name |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | protected function requireSourceFileContent($template_name) |
||
111 | |||
112 | /** |
||
113 | * @param string $compiled_path |
||
114 | * @param string $compiled |
||
115 | */ |
||
116 | protected function writeFile($compiled_path, $compiled) |
||
121 | |||
122 | /** |
||
123 | * @param string $path |
||
124 | */ |
||
125 | protected function ensureWriteableDirectory($path) |
||
137 | |||
138 | } |
||
139 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and
&&
or
||
The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&
, or||
.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
die
introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.