Code Duplication    Length = 9-10 lines in 2 locations

src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php 1 location

@@ 139-148 (lines=10) @@
136
     * @param array $tags Tags to be removed
137
     * @return  string The original string without the given tags
138
     */
139
    public static function stripGivenTags($string, $tags)
140
    {
141
        foreach ($tags as $tag) {
142
            $string2 = preg_replace('#</' . $tag . '[^>]*>#i', ' ', $string);
143
            if ($string2 != $string) {
144
                $string = preg_replace('/<' . $tag . '[^>]*>/i', ' ', $string2);
145
            }
146
        }
147
        return $string;
148
    }
149
    /**
150
     * Adds or Subtract a time in hh:mm:ss to a datetime
151
     * @param string $time Time in hh:mm:ss format

main/inc/lib/api.lib.php 1 location

@@ 8297-8305 (lines=9) @@
8294
 * @param array $tags Tags to be removed
8295
 * @return  string The original string without the given tags
8296
 */
8297
function stripGivenTags($string, $tags) {
8298
    foreach ($tags as $tag) {
8299
        $string2 = preg_replace('#</' . $tag . '[^>]*>#i', ' ', $string);
8300
        if ($string2 != $string) {
8301
            $string = preg_replace('/<' . $tag . '[^>]*>/i', ' ', $string2);
8302
        }
8303
    }
8304
    return $string;
8305
}
8306
8307
/**
8308
 * Converts string value to float value