Code Duplication    Length = 11-11 lines in 9 locations

system/core/utf8.php 9 locations

@@ 257-267 (lines=11) @@
254
     * @param   integer  length limit
255
     * @return  string
256
     */
257
    public static function substr($str, $offset, $length = null)
258
    {
259
        if (! isset(self::$called[__FUNCTION__])) {
260
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
261
262
            // Function has been called
263
            self::$called[__FUNCTION__] = true;
264
        }
265
266
        return _substr($str, $offset, $length);
267
    }
268
269
    /**
270
     * Replaces text within a portion of a UTF-8 string.
@@ 280-290 (lines=11) @@
277
     * @param   integer  offset
278
     * @return  string
279
     */
280
    public static function substr_replace($str, $replacement, $offset, $length = null)
281
    {
282
        if (! isset(self::$called[__FUNCTION__])) {
283
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
284
285
            // Function has been called
286
            self::$called[__FUNCTION__] = true;
287
        }
288
289
        return _substr_replace($str, $replacement, $offset, $length);
290
    }
291
292
    /**
293
     * Makes a UTF-8 string lowercase.
@@ 416-426 (lines=11) @@
413
     * @return  string        if the input was a string
414
     * @return  array         if the input was an array
415
     */
416
    public static function str_ireplace($search, $replace, $str, & $count = null)
417
    {
418
        if (! isset(self::$called[__FUNCTION__])) {
419
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
420
421
            // Function has been called
422
            self::$called[__FUNCTION__] = true;
423
        }
424
425
        return _str_ireplace($search, $replace, $str, $count);
426
    }
427
428
    /**
429
     * Case-insenstive UTF-8 version of strstr. Returns all of input string
@@ 464-474 (lines=11) @@
461
     * @param   integer  length of the string to examine
462
     * @return  integer  length of the initial segment that contains characters in the mask
463
     */
464
    public static function strspn($str, $mask, $offset = null, $length = null)
465
    {
466
        if (! isset(self::$called[__FUNCTION__])) {
467
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
468
469
            // Function has been called
470
            self::$called[__FUNCTION__] = true;
471
        }
472
473
        return _strspn($str, $mask, $offset, $length);
474
    }
475
476
    /**
477
     * Finds the length of the initial segment not matching mask.
@@ 488-498 (lines=11) @@
485
     * @param   integer  length of the string to examine
486
     * @return  integer  length of the initial segment that contains characters not in the mask
487
     */
488
    public static function strcspn($str, $mask, $offset = null, $length = null)
489
    {
490
        if (! isset(self::$called[__FUNCTION__])) {
491
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
492
493
            // Function has been called
494
            self::$called[__FUNCTION__] = true;
495
        }
496
497
        return _strcspn($str, $mask, $offset, $length);
498
    }
499
500
    /**
501
     * Pads a UTF-8 string to a certain length with another string.
@@ 512-522 (lines=11) @@
509
     * @param   string   padding type: STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH
510
     * @return  string
511
     */
512
    public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
513
    {
514
        if (! isset(self::$called[__FUNCTION__])) {
515
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
516
517
            // Function has been called
518
            self::$called[__FUNCTION__] = true;
519
        }
520
521
        return _str_pad($str, $final_str_length, $pad_str, $pad_type);
522
    }
523
524
    /**
525
     * Converts a UTF-8 string to an array.
@@ 579-589 (lines=11) @@
576
     * @param   string   string of characters to remove
577
     * @return  string
578
     */
579
    public static function trim($str, $charlist = null)
580
    {
581
        if (! isset(self::$called[__FUNCTION__])) {
582
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
583
584
            // Function has been called
585
            self::$called[__FUNCTION__] = true;
586
        }
587
588
        return _trim($str, $charlist);
589
    }
590
591
    /**
592
     * Strips whitespace (or other UTF-8 characters) from the beginning of a string.
@@ 602-612 (lines=11) @@
599
     * @param string $str
600
     * @return  string
601
     */
602
    public static function ltrim($str, $charlist = null)
603
    {
604
        if (! isset(self::$called[__FUNCTION__])) {
605
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
606
607
            // Function has been called
608
            self::$called[__FUNCTION__] = true;
609
        }
610
611
        return _ltrim($str, $charlist);
612
    }
613
614
    /**
615
     * Strips whitespace (or other UTF-8 characters) from the end of a string.
@@ 624-634 (lines=11) @@
621
     * @param   string   string of characters to remove
622
     * @return  string
623
     */
624
    public static function rtrim($str, $charlist = null)
625
    {
626
        if (! isset(self::$called[__FUNCTION__])) {
627
            require SYSPATH.'core/utf8/'.__FUNCTION__.EXT;
628
629
            // Function has been called
630
            self::$called[__FUNCTION__] = true;
631
        }
632
633
        return _rtrim($str, $charlist);
634
    }
635
636
    /**
637
     * Returns the unicode ordinal for a character.