• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gr8man / kohana-php8 / 30173149905

25 Jul 2026 08:13PM UTC coverage: 51.859% (+0.2%) from 51.63%
30173149905

push

github

gr8man
refactor: improve docblock consistency and type-hinting across core and database components

1 of 3 new or added lines in 2 files covered. (33.33%)

13 existing lines in 8 files now uncovered.

4421 of 8525 relevant lines covered (51.86%)

9.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/modules/codebench/classes/Bench/GruberURL.php
1
<?php
2

3
declare(strict_types=1);
4
defined('SYSPATH') or die('No direct access allowed.');
5
/**
6
 * @package    Kohana/Codebench
7
 * @category   Tests
8
 * @author     Geert De Deckere <geert@idoe.be>
9
 */
10
class Bench_GruberURL extends Codebench
11
{
12
        public $description =
13
                'Optimization for http://daringfireball.net/2009/11/liberal_regex_for_matching_urls';
14

15
        public $loops = 10000;
16

17
        public $subjects = array(
18
                'http://foo.com/blah_blah',
19
                'http://foo.com/blah_blah/',
20
                '(Something like http://foo.com/blah_blah)',
21
                'http://foo.com/blah_blah_(wikipedia)',
22
                '(Something like http://foo.com/blah_blah_(wikipedia))',
23
                'http://foo.com/blah_blah.',
24
                'http://foo.com/blah_blah/.',
25
                '<http://foo.com/blah_blah>',
26
                '<http://foo.com/blah_blah/>',
27
                'http://foo.com/blah_blah,',
28
                'http://www.example.com/wpstyle/?p=364.',
29
                'http://✪df.ws/e7l',
30
                'rdar://1234',
31
                'rdar:/1234',
32
                'x-yojimbo-item://6303E4C1-xxxx-45A6-AB9D-3A908F59AE0E',
33
                'message://%3c330e7f8409726r6a4ba78dkf1fd71420c1bf6ff@mail.gmail.com%3e',
34
                'http://➡.ws/䨹',
35
                'www.➡.ws/䨹',
36
                '<tag>http://example.com</tag>',
37
                'Just a www.example.com link.',
38
                // To test the use of possessive quatifiers:
39
                'httpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp',
40
        );
41

UNCOV
42
        public function bench_daringfireball($subject): string|false
×
43
        {
44
                // Original regex by John Gruber
45
                preg_match('~\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))~', (string) $subject, $matches);
×
46
                return (empty($matches)) ? false : $matches[0];
×
47
        }
48

UNCOV
49
        public function bench_daringfireball_v2($subject): string|false
×
50
        {
51
                // Removed outer capturing parentheses, made another pair non-capturing
52
                preg_match('~\b(?:[\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|(?:[^[:punct:]\s]|/))~', (string) $subject, $matches);
×
53
                return (empty($matches)) ? false : $matches[0];
×
54
        }
55

UNCOV
56
        public function bench_daringfireball_v3($subject): string|false
×
57
        {
58
                // Made quantifiers possessive where possible
59
                preg_match('~\b(?:[\w-]++://?+|www[.])[^\s()<>]+(?:\([\w\d]++\)|(?:[^[:punct:]\s]|/))~', (string) $subject, $matches);
×
60
                return (empty($matches)) ? false : $matches[0];
×
61
        }
62

63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc