GeneralSettings::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
class GeneralSettings extends CiiSettingsModel
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...
4
{
5
	protected $name = NULL;
6
7
	protected $dateFormat = 'F jS, Y';
8
9
	protected $timeFormat = 'H:i';
10
11
	protected $defaultLanguage = 'en_US';
12
13
	protected $forceSecureSSL = false;
14
15
	protected $bcrypt_cost = 13;
16
17
	protected $searchPaginationSize = 10;
18
19
	protected $categoryPaginationSize = 10;
20
21
	protected $contentPaginationSize = 10;
22
23
	protected $useDisqusComments = 0;
24
25
	protected $disqus_shortname = NULL;
26
27
	//protected $useDiscourseComments = 0;
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...
28
29
	//protected $discourseUrl = '';
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...
30
31
	public function groups()
32
	{
33
		return array(
34
			Yii::t('ciims.models.general', 'Site Settings') => array('name', 'forceSecureSSL', 'bcrypt_cost', 'categoryPaginationSize','contentPaginationSize','searchPaginationSize'),
35
			Yii::t('ciims.models.general', 'Disqus') => array('useDisqusComments', 'disqus_shortname'),
36
			//Yii::t('ciims.models.general', 'Discourse') => array('useDiscourseComments', 'discourseUrl'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
37
			Yii::t('ciims.models.general', 'Display Settings') => array('dateFormat', 'timeFormat', 'defaultLanguage'),
38
		);
39
	}
40
41
	/**
42
	 * Validation rules
43
	 * @return array
44
	 */
45
	public function rules()
46
	{
47
		return array(
48
			array('name, dateFormat, timeFormat, defaultLanguage', 'required'),
49
			array('name', 'length', 'max' => 255),
50
			array('dateFormat, timeFormat, defaultLanguage', 'length', 'max' => 25),
51
			array('useDisqusComments, forceSecureSSL', 'boolean'),
52
			array('disqus_shortname', 'length', 'max' => 255),
53
			array('bcrypt_cost', 'numerical', 'integerOnly'=>true, 'min' => 13),
54
			array('searchPaginationSize, categoryPaginationSize, contentPaginationSize', 'numerical', 'integerOnly' => true, 'min' => 10),
55
			//array('url', 'url')
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
56
		);
57
	}
58
59
	/**
60
	 * Attribute labels
61
	 * @return array
62
	 */
63
	public function attributeLabels()
64
	{
65
		return array(
66
			'name' => Yii::t('ciims.models.general', 'Site Name'),
67
			'dateFormat' => Yii::t('ciims.models.general', 'Date Format'),
68
			'timeFormat' => Yii::t('ciims.models.general', 'Time Format'),
69
			'defaultLanguage' => Yii::t('ciims.models.general', 'Default Language'),
70
			'forceSecureSSL' => Yii::t('ciims.models.general', 'Force SSL for Secure Areas'),
71
			'bcrypt_cost' => Yii::t('ciims.models.general', 'Password Strength Settings'),
72
			'searchPaginationSize' => Yii::t('ciims.models.general', 'Search Post Count'),
73
			'categoryPaginationSize' => Yii::t('ciims.models.general', 'Category Post Count'),
74
			'contentPaginationSize' => Yii::t('ciims.models.general', 'Content Post Cost'),
75
76
			// Discourse
77
			'useDisqusComments'    => Yii::t('ciims.models.general', 'Use Disqus Comments'),
78
			'disqus_shortname'     => Yii::t('ciims.models.general', 'Disqus Shortcode'),
79
80
			// Discourse
81
			//'useDiscourseComments' => Yii::t('ciims.models.general', 'Use Discourse Comments'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
82
			//'discourseUrl' => Yii::t('ciims.models.general', 'Discourse URL'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
83
		);
84
	}
85
}
86