Completed
Push — master ( 494091...32c874 )
by David
27s
created

lib/Dwoo/Plugins/Functions/PluginWhitespace.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Copyright (c) 2013-2017
4
 *
5
 * @category  Library
6
 * @package   Dwoo\Plugins\Functions
7
 * @author    Jordi Boggiano <[email protected]>
8
 * @author    David Sanchez <[email protected]>
9
 * @copyright 2008-2013 Jordi Boggiano
10
 * @copyright 2013-2017 David Sanchez
11
 * @license   http://dwoo.org/LICENSE Modified BSD License
12
 * @version   1.3.2
13
 * @date      2017-01-06
14
 * @link      http://dwoo.org/
15
 */
16
17
namespace Dwoo\Plugins\Functions;
18
19
use Dwoo\Block\Plugin;
20
use Dwoo\Compiler;
21
use Dwoo\ICompilable;
22
23
/**
24
 * Replaces all white-space characters with the given string
25
 * <pre>
26
 *  * value : the text to process
27
 *  * with : the replacement string, note that any number of consecutive white-space characters will be replaced by a
28
 *  single replacement string
29
 * </pre>
30
 * Example :.
31
 * <code>
32
 * {"a    b  c		d
33
 *
34
 * e"|whitespace}
35
 * results in : a b c d e
36
 * </code>
37
 * This software is provided 'as-is', without any express or implied warranty.
38
 * In no event will the authors be held liable for any damages arising from the use of this software.
39
 */
40
class PluginWhitespace extends Plugin implements ICompilable
41
{
42
    /**
43
     * @param Compiler $compiler
44
     * @param string   $value
45
     * @param string   $with
46
     *
47
     * @return string
48
     */
49
    public static function compile(Compiler $compiler, $value, $with = ' ')
0 ignored issues
show
The parameter $compiler is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        return "preg_replace('#\s+#'.(strcasecmp(\$this->charset, 'utf-8')===0?'u':''), $with, $value)";
52
    }
53
}