Code Duplication    Length = 9-10 lines in 2 locations

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

@@ 8227-8235 (lines=9) @@
8224
 * @param array $tags Tags to be removed
8225
 * @return  string The original string without the given tags
8226
 */
8227
function stripGivenTags($string, $tags) {
8228
    foreach ($tags as $tag) {
8229
        $string2 = preg_replace('#</' . $tag . '[^>]*>#i', ' ', $string);
8230
        if ($string2 != $string) {
8231
            $string = preg_replace('/<' . $tag . '[^>]*>/i', ' ', $string2);
8232
        }
8233
    }
8234
    return $string;
8235
}
8236
8237
/**
8238
 * Converts string value to float value

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