Conditions | 2 |
Paths | 2 |
Total Lines | 52 |
Code Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
32 | public function install() |
||
33 | { |
||
34 | // Set up an initial value for a module variable. Note that all module |
||
35 | // variables should be initialised with some value in this way rather |
||
36 | // than just left blank, this helps the user-side code and means that |
||
37 | // there doesn't need to be a check to see if the variable is set in |
||
38 | // the rest of the code as it always will be. |
||
39 | $this->setSystemVar('debug', '0'); |
||
40 | $this->setSystemVar('startdate', date('m/Y', time())); |
||
41 | $this->setSystemVar('adminmail', '[email protected]'); |
||
42 | $this->setSystemVar('Default_Theme', 'ZikulaBootstrapTheme'); |
||
43 | $this->setSystemVar('timezone', date_default_timezone_get()); |
||
44 | $this->setSystemVar('funtext', '1'); |
||
45 | $this->setSystemVar('reportlevel', '0'); |
||
46 | $this->setSystemVar('startpage', ''); |
||
47 | $this->setSystemVar('Version_Num', ZikulaKernel::VERSION); |
||
48 | $this->setSystemVar('Version_Sub', ZikulaKernel::VERSION_SUB); |
||
49 | $this->setSystemVar('debug_sql', '0'); |
||
50 | $this->setSystemVar('multilingual', '1'); |
||
51 | $this->setSystemVar('useflags', '0'); |
||
52 | $this->setSystemVar('theme_change', '0'); |
||
53 | $this->setSystemVar('UseCompression', '0'); |
||
54 | $this->setSystemVar('siteoff', 0); |
||
55 | $this->setSystemVar('siteoffreason', ''); |
||
56 | $this->setSystemVar('startargs', ''); |
||
57 | $this->setSystemVar('language_detect', 0); |
||
58 | // Multilingual support |
||
59 | foreach ($this->container->get('zikula_settings_module.locale_api')->getSupportedLocales() as $lang) { |
||
60 | $this->setSystemVar('sitename_' . $lang, $this->__('Site name')); |
||
61 | $this->setSystemVar('slogan_' . $lang, $this->__('Site description')); |
||
62 | $this->setSystemVar('defaultpagetitle_' . $lang, $this->__('Site name')); |
||
63 | $this->setSystemVar('defaultmetadescription_' . $lang, $this->__('Site description')); |
||
64 | } |
||
65 | |||
66 | $this->setSystemVar(SettingsConstant::SYSTEM_VAR_PROFILE_MODULE, ''); |
||
67 | $this->setSystemVar(SettingsConstant::SYSTEM_VAR_MESSAGE_MODULE, ''); |
||
68 | $this->setSystemVar('languageurl', 0); |
||
69 | $this->setSystemVar('ajaxtimeout', 5000); |
||
70 | //! this is a comma-separated list of special characters to search for in permalinks |
||
71 | $this->setSystemVar('permasearch', $this->__('À,Á,Â,Ã,Å,à,á,â,ã,å,Ò,Ó,Ô,Õ,Ø,ò,ó,ô,õ,ø,È,É,Ê,Ë,è,é,ê,ë,Ç,ç,Ì,Í,Î,Ï,ì,í,î,ï,Ù,Ú,Û,ù,ú,û,ÿ,Ñ,ñ,ß,ä,Ä,ö,Ö,ü,Ü')); |
||
72 | //! this is a comma-separated list of special characters to replace in permalinks |
||
73 | $this->setSystemVar('permareplace', $this->__('A,A,A,A,A,a,a,a,a,a,O,O,O,O,O,o,o,o,o,o,E,E,E,E,e,e,e,e,C,c,I,I,I,I,i,i,i,i,U,U,U,u,u,u,y,N,n,ss,ae,Ae,oe,Oe,ue,Ue')); |
||
74 | |||
75 | $locale = $this->container->getParameter('locale'); |
||
76 | $this->setSystemVar('locale', $locale); |
||
77 | $this->setSystemVar('language_i18n', $locale); |
||
78 | |||
79 | $this->setSystemVar('idnnames', 1); |
||
80 | |||
81 | // Initialisation successful |
||
82 | return true; |
||
83 | } |
||
84 | |||
196 |