GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — v0.89-develop ( 1c4e93...73cefe )
by Zordius
06:28
created

SafeString::stripExtendedComments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/*
3
4
Copyrights for code authored by Yahoo! Inc. is licensed under the following terms:
5
MIT License
6
Copyright (c) 2013-2015 Yahoo! Inc. All Rights Reserved.
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
11
Origin: https://github.com/zordius/lightncandy
12
*/
13
14
/**
15
 * file to keep LightnCandy string utilities
16
 *
17
 * @package    LightnCandy
18
 * @author     Zordius <[email protected]>
19
 */
20
21
namespace LightnCandy;
22
23
/**
24
 * LightnCandy SafeString class
25
 */
26
class SafeString {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the opening brace for this class should be on a new line.
Loading history...
27
    const EXTENDED_COMMENT_SEARCH = '/{{!--.*?--}}/s';
28
    const IS_SUBEXP_SEARCH = '/^\(.+\)$/s';
29
30
    /**
31
     * Strip extended comments {{!-- .... --}}
32
     *
33
     * @param string $template handlebars template string
34
     *
35
     * @return string Stripped template
36
     *
37
     * @expect 'abc' when input 'abc'
38
     * @expect 'abc{{!}}cde' when input 'abc{{!}}cde'
39
     * @expect 'abc{{! }}cde' when input 'abc{{!----}}cde'
40
     */
41 602
    public static function stripExtendedComments($template) {
42 602
        return preg_replace(static::EXTENDED_COMMENT_SEARCH, '{{! }}', $template);
43
    }
44
45
    /**
46
     * Escape template
47
     *
48
     * @param string $template handlebars template string
49
     *
50
     * @return string Escaped template
51
     *
52
     * @expect 'abc' when input 'abc'
53
     * @expect 'a\\\\bc' when input 'a\bc'
54
     * @expect 'a\\\'bc' when input 'a\'bc'
55
     */
56 602
    public static function escapeTemplate($template) {
57 602
        return addcslashes(addcslashes($template, '\\'), "'");
58
    }
59
}
60
61