regexp::get_regexp_for_juste_space()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * © 2018 - Phoponent
5
 * Author: Nicolas Choquet
6
 * Email: [email protected]
7
 * LICENSE GPL ( GNU General Public License )
8
 */
9
10
namespace phoponent\framework\static_classe;
11
12
use phoponent\framework\traits\static_class;
13
14
class regexp {
15
	use static_class;
16
17
	public static function get_regexp_for_autoclosed_tags_without_arguments():string {
18
		return '`\<'.self::get_regexp_for_tag_name().'\/\>`';
19
	}
20
	public static function get_regexp_for_autoclosed_tags_without_arguments_and_spaces():string {
21
		return '`\<'.self::get_regexp_for_tag_name().self::get_regexp_for_juste_space().'\/\>`';
22
	}
23
	public static function get_regexp_for_autoclosed_tags_with_arguments():string {
24
		return '`\<'.self::get_regexp_for_tag_name().self::get_regexp_for_attributs().'\/\>`';
25
	}
26
27
	public static function get_regexp_for_no_autoclosed_tags_with_content_and_arguments():string {
28
		return '`\<'.self::get_regexp_for_tag_name().self::get_regexp_for_attributs().'\>'.self::get_regexp_for_content().'\<\/'.self::get_regexp_for_tag_name(true).'\>`';
29
	}
30
	public static function get_regexp_for_no_autoclosed_tags_with_content_and_not_arguments_and_spaces():string {
31
		return '`\<'.self::get_regexp_for_tag_name().self::get_regexp_for_juste_space().'\>'.self::get_regexp_for_content().'\<\/'.self::get_regexp_for_tag_name(true).'\>`';
32
	}
33
	public static function get_regexp_for_no_autoclosed_tags_with_content_and_not_arguments():string {
34
		return '`\<'.self::get_regexp_for_tag_name().'\>'.self::get_regexp_for_content().'\<\/'.self::get_regexp_for_tag_name(true).'\>`';
35
	}
36
37
	public static function get_regexp_for_no_autoclosed_tags_without_content_and_with_arguments():string {
38
		return '`\<'.self::get_regexp_for_tag_name().self::get_regexp_for_attributs().'>\<\/'.self::get_regexp_for_tag_name(true).'\>`';
39
	}
40
	public static function get_regexp_for_no_autoclosed_tags_without_content_and_arguments_and_with_spaces():string {
41
		return '`\<'.self::get_regexp_for_tag_name().self::get_regexp_for_juste_space().'\>\<\/'.self::get_regexp_for_tag_name(true).'\>`';
42
	}
43
	public static function get_regexp_for_no_autoclosed_tags_without_content_and_arguments():string {
44
		return '`\<'.self::get_regexp_for_tag_name().'\>\<\/'.self::get_regexp_for_tag_name(true).'\>`';
45
	}
46
47
	private static function get_regexp_for_content():string {
48
	    return '([\ a-zA-Z0-9\=\-\_\\\'\"\%\é\&\;\,\:\/\!\§\*ù\$\^\#\{\}\[\]\(\)\+\?\\n\\t]+)';
49
    }
50
51
    private static function get_regexp_for_attributs():string {
52
	    return '\ ([\ a-zA-Z0-9\=\-\_\\\'\"\%\é\&\;\,\:\/\.\!\§\*ù\$\^\#\{\}\[\]\(\)\+\?\\n\\t]+)';
53
    }
54
55
    private static function get_regexp_for_juste_space():string {
56
	    return '[\ ]+';
57
    }
58
59
    private static function get_regexp_for_tag_name($close = false):string {
60
	    $start = $close ? '' : '(';
61
	    $end = $close ? '' : ')';
62
	    return $start.'[A-Z][A-Za-z0-9\-\_]+'.$end;
63
    }
64
65
    public static function regexp_for_parse_attributs_with_only_integers():string {
66
	    return '`([\w\-]+\=\\d+)+`';
67
    }
68
69
    public static function regexp_for_parse_attributs():string {
70
        return '`([\w\-]+\=\"[\w\ \-\/\$\'\?]+\")+`';
71
    }
72
}