1 | <?php |
||
25 | class CFSTemplateManager implements TemplateManager |
||
26 | { |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $cache_dir; |
||
31 | |||
32 | /** |
||
33 | * @var CFSWrapper |
||
34 | */ |
||
35 | protected $cascading_files; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $compiled_paths = []; |
||
41 | |||
42 | /** |
||
43 | * @var TemplateCompiler |
||
44 | */ |
||
45 | protected $compiler; |
||
46 | |||
47 | /** |
||
48 | * @var boolean |
||
49 | */ |
||
50 | protected $recompile_always; |
||
51 | |||
52 | /** |
||
53 | * Valid options: |
||
54 | * * cache_dir => the path where compiled templates will be cached |
||
55 | * * recompile_always => whether to recompile each template on every execution, |
||
56 | * |
||
57 | * @param TemplateCompiler $compiler |
||
58 | * @param array $options |
||
59 | * @param CFSWrapper $cascading_files |
||
60 | */ |
||
61 | public function __construct(TemplateCompiler $compiler, array $options, CFSWrapper $cascading_files = NULL) |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | public function getPath($template_name) |
||
85 | |||
86 | /** |
||
87 | * @param string $compiled_path |
||
88 | * |
||
89 | * @return bool |
||
90 | */ |
||
91 | protected function isCompileRequired($compiled_path) |
||
99 | |||
100 | /** |
||
101 | * @param string $template_name |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | protected function requireSourceFileContent($template_name) |
||
113 | |||
114 | /** |
||
115 | * @param string $compiled_path |
||
116 | * @param string $compiled |
||
117 | */ |
||
118 | protected function writeFile($compiled_path, $compiled) |
||
123 | |||
124 | /** |
||
125 | * @param string $path |
||
126 | */ |
||
127 | protected function ensureWriteableDirectory($path) |
||
139 | |||
140 | } |
||
141 |
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.