EMTTretNumber
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 0
lcom 0
cbo 1
dl 0
loc 67
c 1
b 0
f 0
1
<?php
2
3
/**
4
* Evgeny Muravjev Typograph, http://mdash.ru
5
* Version: 3.4 Gold Master
6
* Release Date: September 20, 2014
7
* Authors: Evgeny Muravjev & Alexander Drutsa  
8
*/
9
10
namespace Fenrizbes\TypographBundle\EMT;
11
12
/**
13
 * @see EMTTret
14
 */
15
16
class EMTTretNumber extends EMTTret
17
{
18
	public $title = "Числа, дроби, математические знаки";
19
	
20
	
21
	public $rules = array(
22
		'minus_between_nums' => array(
23
				'description'	=> 'Расстановка знака минус между числами',
24
				'pattern' 		=> '/(\d+)\-(\d)/i',
25
				'replacement' 	=> '\1&minus;\2'
26
			),
27
		'minus_in_numbers_range' => array(
28
				'description'	=> 'Расстановка знака минус между диапозоном чисел',
29
				'pattern' 		=> '/(^|\s|\&nbsp\;)(\&minus\;|\-)(\d+)(\.\.\.|\&hellip\;)(\s|\&nbsp\;)?(\+|\-|\&minus\;)?(\d+)/ie',
30
				'replacement' 	=> '$m[1] ."&minus;".$m[3] . $m[4].$m[5].($m[6]=="+"?$m[6]:"&minus;").$m[7]'
31
			),
32
		'auto_times_x' => array(
33
				'description'	=> 'Замена x на символ × в размерных единицах',
34
				'cycled' 		=> true,
35
				'pattern' 		=> '/([^a-zA-Z><]|^)(\&times\;)?(\d+)(\040*)(x|х)(\040*)(\d+)([^a-zA-Z><]|$)/u',
36
				'replacement' 	=> '\1\2\3&times;\7\8'
37
			),
38
//		'numeric_sub' => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
39
//				'description'	=> 'Нижний индекс',
40
//				'pattern' 		=> '/([a-zа-яё0-9])\_([\d]{1,3})([^а-яёa-z0-9]|$)/ieu',
41
//				'replacement' 	=> '$m[1] . $this->tag($this->tag($m[2],"small"),"sub") . $m[3]'
42
//			),
43
//		'numeric_sup' => array(
44
//				'description'	=> 'Верхний индекс',
45
//				'pattern' 		=> '/([a-zа-яё0-9])\^([\d]{1,3})([^а-яёa-z0-9]|$)/ieu',
46
//				'replacement' 	=> '$m[1] . $this->tag($this->tag($m[2],"small"),"sup") . $m[3]'
47
//			),
48
		'simple_fraction' => array(
49
				'description'	=> 'Замена дробей 1/2, 1/4, 3/4 на соответствующие символы',
50
				'pattern' 		=> array('/(^|\D)1\/(2|4)(\D)/', '/(^|\D)3\/4(\D)/'),
51
				'replacement' 	=> array('\1&frac1\2;\3', '\1&frac34;\2')
52
			),
53
		'math_chars' => array(
54
				'description'	=> 'Математические знаки больше/меньше/плюс минус/неравно',
55
				'pattern' 		=> array('/!=/', '/\<=/', '/([^=]|^)\>=/', '/~=/', '/\+-/'),
56
				'replacement' 	=> array('&ne;', '&le;', '\1&ge;', '&cong;', '&plusmn;' )
57
			),
58
			/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
59
		'split_number_to_triads' => array(
60
				'description'	=> 'Разбиение числа на триады',
61
				'cycled'		=> true,
62
				'pattern' 		=> '/([0-9])([0-9]{3})([^0-9]|$)/u',
63
				'replacement' 	=> '\1&thinsp;\2\3'
64
			),
65
			*/
66
		'thinsp_between_number_triads' => array(
67
				'description'	=> 'Объединение триад чисел полупробелом',			
68
				'pattern' 		=> '/([0-9]{1,3}( [0-9]{3}){1,})(.|$)/ue',
69
				'replacement' 	=> '($m[3]=="-"? $m[0]:str_replace(" ","&thinsp;",$m[1]).$m[3])'
70
			),
71
		'thinsp_between_no_and_number' => array(
72
				'description'	=> 'Пробел между симоволом номера и числом',			
73
				'pattern' 		=> '/(№|\&#8470\;)(\s|&nbsp;)*(\d)/iu',
74
				'replacement' 	=> '&#8470;&thinsp;\3'
75
			),
76
		'thinsp_between_sect_and_number' => array(
77
				'description'	=> 'Пробел между параграфом и числом',			
78
				'pattern' 		=> '/(§|\&sect\;)(\s|&nbsp;)*(\d+|[IVX]+|[a-zа-яё]+)/ui',
79
				'replacement' 	=> '&sect;&thinsp;\3'
80
			),
81
		);
82
}
83