Completed
Push — master ( b0df54...0c9057 )
by Ben
10s
created

Tales.php ➔ phptal_tale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHPTAL templating engine
4
 *
5
 * PHP Version 5
6
 *
7
 * @category HTML
8
 * @package  PHPTAL
9
 * @author   Laurent Bedubourg <[email protected]>
10
 * @author   Kornel Lesiński <[email protected]>
11
 * @license  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
12
 * @version  SVN: $Id$
13
 * @link     http://phptal.org/
14
 */
15
16
17
/**
18
 * You can implement this interface to create custom tales modifiers
19
 *
20
 * Methods suitable for modifiers must be static.
21
 *
22
 * @package PHPTAL
23
 * @subpackage Php
24
 */
25
interface PHPTAL_Tales
0 ignored issues
show
Coding Style Compatibility introduced by
Each interface must be in a namespace of at least one level (a top-level vendor name)

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
26
{
27
}
28
29
30
/**
31
 * translates TALES expression with alternatives into single PHP expression.
32
 * Identical to phptal_tales() for singular expressions.
33
 *
34
 * Please use this function rather than PHPTAL_Php_TalesInternal methods.
35
 *
36
 * @see PHPTAL_Php_TalesInternal::compileToPHPExpressions()
37
 * @return string
38
 */
39
function phptal_tale($expression, $nothrow=false)
40
{
41
    return PHPTAL_Php_TalesInternal::compileToPHPExpression($expression, $nothrow);
42
}
43
44
/**
45
 * returns PHP code that will evaluate given TALES expression.
46
 * e.g. "string:foo${bar}" may be transformed to "'foo'.phptal_escape($ctx->bar)"
47
 *
48
 * Expressions with alternatives ("foo | bar") will cause it to return array
49
 * Use phptal_tale() if you always want string.
50
 *
51
 * @param bool $nothrow if true, invalid expression will return NULL (at run time) rather than throwing exception
52
 * @return string or array
53
 */
54
function phptal_tales($expression, $nothrow=false)
55
{
56
    return PHPTAL_Php_TalesInternal::compileToPHPExpressions($expression, $nothrow);
57
}
58
59