EMTTretOptAlign::oaquote_extra()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 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 EMTTretOptAlign extends EMTTret
17
{
18
	
19
	public $classes = array(
20
			'oa_obracket_sp_s' => "margin-right:0.3em;",
21
			"oa_obracket_sp_b" => "margin-left:-0.3em;",
22
			"oa_obracket_nl_b" => "margin-left:-0.3em;",
23
			"oa_comma_b"       => "margin-right:-0.2em;",
24
			"oa_comma_e"       => "margin-left:0.2em;",
25
			'oa_oquote_nl' => "margin-left:-0.44em;",
26
			'oa_oqoute_sp_s' => "margin-right:0.44em;",
27
			'oa_oqoute_sp_q' => "margin-left:-0.44em;",
28
		);
29
	
30
	/**
31
	 * Базовые параметры тофа
32
	 *
33
	 * @var array
34
	 */
35
	public $title = "Оптическое выравнивание";
36
	public $rules = array(	
37
		'oa_oquote' => array(
38
				'description'	=> 'Оптическое выравнивание открывающей кавычки',
39
				//'disabled'      => true,	
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
40
				'pattern' 		=> array(
41
							'/([a-zа-яё\-]{3,})(\040|\&nbsp\;|\t)(\&laquo\;)/uie',
42
							'/(\n|\r|^)(\&laquo\;)/ei'
43
						),
44
				'replacement' 	=> array(
45
							'$m[1] . $this->tag($m[2], "span", array("class"=>"oa_oqoute_sp_s")) . $this->tag($m[3], "span", array("class"=>"oa_oqoute_sp_q"))',
46
							'$m[1] . $this->tag($m[2], "span", array("class"=>"oa_oquote_nl"))',
47
						),
48
			),
49
		'oa_oquote_extra' => array(
50
			'description'	=> 'Оптическое выравнивание кавычки',
51
			//'disabled'      => true,	
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
52
			'function'	=> 'oaquote_extra'
53
		),
54
		'oa_obracket_coma' => array(
55
				'description'	=> 'Оптическое выравнивание для пунктуации (скобка и запятая)',
56
				//'disabled'      => true,	
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
57
				'pattern' 		=> array(
58
							'/(\040|\&nbsp\;|\t)\(/ei',
59
							'/(\n|\r|^)\(/ei',
60
							'/([а-яёa-z0-9]+)\,(\040+)/iue',
61
						),
62
				'replacement' 	=> array(
63
							'$this->tag($m[1], "span", array("class"=>"oa_obracket_sp_s")) . $this->tag("(", "span", array("class"=>"oa_obracket_sp_b"))',
64
							'$m[1] . $this->tag("(", "span", array("class"=>"oa_obracket_nl_b"))',
65
							'$m[1] . $this->tag(",", "span", array("class"=>"oa_comma_b")) . $this->tag(" ", "span", array("class"=>"oa_comma_e"))',
66
						),
67
			),					
68
		
69
		);
70
		
71
	/**
72
	 * Если стоит открывающая кавычка после <p> надо делать её висячей
73
	 *
74
	 * @return  void
75
	 */	
76
	protected function oaquote_extra()
77
	{
78
		$this->_text = $this->preg_replace_e(
79
				'/(<' .self::BASE64_PARAGRAPH_TAG . '>)([\040\t]+)?(\&laquo\;)/e', 
80
				'$m[1] . $this->tag($m[3], "span", array("class"=>"oa_oquote_nl"))',
81
				$this->_text);
82
	}
83
	
84
	
85
}