Completed
Pull Request — develop (#716)
by Agel_Nash
09:56
created

TemplateParser::render()   F

Complexity

Conditions 30
Paths 288

Size

Total Lines 112
Code Lines 76

Duplication

Lines 16
Ratio 14.29 %

Importance

Changes 0
Metric Value
cc 30
eloc 76
nc 288
nop 1
dl 16
loc 112
rs 3.4683
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * EVO CMS
4
 * Template parser
5
 *
6
 * Date: 24.06.2017
7
 * @deprecated Use EvolutionCMS\Support\TemplateParser
8
 * @todo could be unnecessary
0 ignored issues
show
Coding Style introduced by
Comment refers to a TODO task

This check looks TODO comments that have been left in the code.

``TODO``s show that something is left unfinished and should be attended to.

Loading history...
9
 *
10
 */
11
Class TemplateParser extends EvolutionCMS\Legacy\TemplateParser
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
12
{
13
}
14
15
?>
16
17
<?php
18
/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% 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...
19
20
include_once MODX_BASE_PATH . MGR_DIR . '/media/style/' . $modx->config['manager_theme'] . '/includes/template.parser.class.inc.php';
21
22
echo TemplateParser::output(array('action' => 88), $userdata);
23
24
*/
25
?>
26
27
28
<!--
29
30
-- --------------------------------------------------------
31
-- Хост:                         127.0.0.1
32
-- Версия сервера:               5.6.29 - MySQL Community Server (GPL)
33
-- Операционная система:         Win64
34
-- HeidiSQL Версия:              9.4.0.5125
35
-- --------------------------------------------------------
36
37
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
38
/*!40101 SET NAMES utf8 */;
39
/*!50503 SET NAMES utf8mb4 */;
40
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
41
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
42
43
44
-- Дамп структуры базы данных modxnewhtml
45
CREATE DATABASE IF NOT EXISTS `modxnewhtml` /*!40100 DEFAULT CHARACTER SET utf8 */;
46
USE `modxnewhtml`;
47
48
-- Дамп структуры для таблица modxnewhtml.modx_system_templates
49
CREATE TABLE IF NOT EXISTS `modx_system_templates` (
50
`id` int(11) NOT NULL AUTO_INCREMENT,
51
  `name` varchar(255) NOT NULL DEFAULT '',
52
  `alias` varchar(255) NOT NULL DEFAULT '',
53
  `type` varchar(50) NOT NULL,
54
  `description` varchar(255) NOT NULL DEFAULT '',
55
  `help` varchar(255) NOT NULL DEFAULT '',
56
  `value` varchar(255) NOT NULL DEFAULT '',
57
  `readonly` int(1) NOT NULL DEFAULT '0',
58
  `elements` text NOT NULL,
59
  `content` text NOT NULL,
60
  `category` int(11) NOT NULL,
61
  `template` int(11) NOT NULL DEFAULT '0',
62
  `tab` int(11) NOT NULL DEFAULT '0',
63
  `rank` int(11) NOT NULL DEFAULT '0',
64
  `action` int(11) NOT NULL DEFAULT '0',
65
  PRIMARY KEY (`id`)
66
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
67
68
-- Дамп данных таблицы modxnewhtml.modx_system_templates: ~14 rows (приблизительно)
69
	/*!40000 ALTER TABLE `modx_system_templates` DISABLE KEYS */;
70
INSERT INTO `modx_system_templates` (`id`, `name`, `alias`, `type`, `description`, `help`, `value`, `readonly`, `elements`, `content`, `category`, `template`, `tab`, `rank`, `action`) VALUES
71
(0, 'fullname', 'user_full_name', 'text', '', '', '', 0, '', '', 9, 0, 1, 1, 88),
72
	(1, 'email', 'user_email', 'text', '', '', '', 0, '', '', 9, 0, 1, 2, 88),
73
	(2, 'phone', 'user_phone', 'text', '', '', '', 0, '', '', 9, 0, 1, 3, 88),
74
	(3, 'mobilephone', 'user_mobile', 'text', '', '', '', 0, '', '', 9, 0, 1, 5, 88),
75
	(4, 'fax', 'user_fax', 'text', '', '', '', 0, '', '', 9, 0, 1, 6, 88),
76
	(5, 'street', 'user_street', 'text', '', '', '', 0, '', '', 9, 0, 1, 7, 88),
77
	(6, 'city', 'user_city', 'text', '', '', '', 0, '', '', 9, 0, 1, 8, 88),
78
	(7, 'state', 'user_state', 'text', '', '', '', 0, '', '', 9, 0, 1, 9, 88),
79
	(8, 'zip', 'user_zip', 'text', '', '', '', 0, '', '', 9, 0, 1, 10, 88),
80
	(9, 'country', 'user_country', 'select', '', '', '', 0, '', '', 9, 0, 1, 11, 88),
81
	(10, 'dob', 'user_dob', 'date', '', '', '', 0, '', '', 9, 0, 1, 12, 88),
82
	(11, 'gender', 'user_gender', 'select', '', '', '', 0, '||user_male==1||user_female==2||user_other==3', '', 9, 0, 1, 13, 88),
83
	(12, 'comment', '', 'textarea', '', '', '', 0, '', '', 9, 0, 1, 14, 88),
84
	(13, 'logincount', 'user_logincount', 'custom', '', '', '', 0, '', '[+value+]', 9, 0, 1, 15, 88);
85
/*!40000 ALTER TABLE `modx_system_templates` ENABLE KEYS */;
86
87
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
88
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
89
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
90
91
-->
92