GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ThemeConfiguration   B
last analyzed

Complexity

Total Complexity 51

Size/Duplication

Total Lines 518
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 7
Bugs 0 Features 0
Metric Value
wmc 51
c 7
b 0
f 0
lcom 1
cbo 1
dl 0
loc 518
rs 8.3206

51 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultAdminTitle() 0 4 1
A getLoadMaskXpath() 0 4 1
A getOrderCancelledMessageXpath() 0 4 1
A getFirstTermsRowXpath() 0 4 1
A getCacheSubmitXpath() 0 4 1
A getCacheMassActionOptionXpath() 0 5 1
A getCacheAllTargetsXpath() 0 4 1
A getCacheTargetXpath() 0 5 1
A getCacheNavigationPath() 0 4 1
A getFormButtonXpath() 0 5 1
A getShippingCarrierXpath() 0 5 1
A getShippingTitleXpath() 0 5 1
A getShippingTrackingNumberXpath() 0 5 1
A getXTreeChildNodeExpandPrefixXpath() 0 4 1
A getXTreeNamedRootXpath() 0 5 1
A getXTreeChildNodePrefixXpath() 0 4 1
A getXTreeChildXpath() 0 5 1
A getXTreeRootXpath() 0 4 1
A set() 0 4 1
A getSuccessfulActionXpath() 0 4 1
A getErrorActionXpath() 0 4 1
A getWidgetActionButtonXpath() 0 4 1
A getWidgetAttributeByLabelXpath() 0 4 1
A getWidgetTabHeaderXpath() 0 4 1
A getWidgetTabXpath() 0 4 1
A getGuaranteedPageLoadedElementDisplayedXpath() 0 4 1
A setGuaranteedPageLoadedElementDisplayedXpath() 0 4 1
A getHomeXpath() 0 4 1
A getSystemConfigSettingLabelXpath() 0 5 1
A getTranslator() 0 4 1
A getLoginUsernameField() 0 4 1
A getLoginPasswordField() 0 4 1
A getLoginSubmitButton() 0 4 1
A getNavigationBaseXPathSelector() 0 4 1
A getNavigationChildXPathSelector() 0 5 1
A getBaseUrl() 0 4 1
A getSearchButtonText() 0 4 1
A getSelectOrderXpath() 0 5 1
A getSelectCustomerXpath() 0 5 1
A getTableButtonXpath() 0 5 1
A getTestLoggedInAtBaseUrl() 0 4 1
A getSystemConfigSaveSuccessfulXpath() 0 4 1
A getSystemConfigurationSaveButtonXpath() 0 4 1
A getSystemConfigSectionToggleXpath() 0 5 1
A getSystemConfigSectionDisplayCheckXpath() 0 5 1
A getSystemConfigToggleEnableXpath() 0 5 1
A getSystemConfigTabsXpath() 0 5 1
A getAdminPopupMessageContainerXpath() 0 4 1
A getAdminPopupMessageCloseButtonXpath() 0 4 1
A getUseClicksToNavigate() 0 4 1
A configure() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like ThemeConfiguration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use ThemeConfiguration, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Magium\Magento\Themes\Admin;
4
5
use Magium\AbstractConfigurableElement;
6
use Magium\AbstractTestCase;
7
use Magium\Magento\Themes\NavigableThemeInterface;
8
9
class ThemeConfiguration extends AbstractConfigurableElement implements  NavigableThemeInterface
0 ignored issues
show
Coding Style introduced by
Expected 1 space before "NavigableThemeInterface"; 2 found
Loading history...
10
{
11
12
    const THEME = 'Magium\Magento\Themes\Admin\ThemeConfiguration';
13
14
    public $baseUrl = 'http://localhost/admin';
15
16
    public $homeXpath = '//img[@class="logo"]';
17
18
    public $loginUsernameField           = '//input[@type="text" and @id="username"]';
19
    public $loginPasswordField           = '//input[@type="password" and @id="login"]';
20
    public $loginSubmitButton            = '//input[@type="submit" and @value="{{Login}}"]';
21
    
22
    public $navigationBaseXPathSelector          = '//ul[@id="nav"]';
23
//    public $navigationChildXPathSelector1         = 'li/descendant::span[.="{{%s}}"]';
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
24
    public $navigationChildXPathSelector         = 'a[concat(" ",normalize-space(.)," ") = " {{%s}} "]/..';
25
26
    public $adminPopupMessageContainerXpath         = '//*[@id="message-popup-window"]';
27
    public $adminPopupMessageCloseButtonXpath        = '//*[@id="message-popup-window"]/descendant::*[@title="close"]';
28
29
    public $systemConfigTabsXpath                = '//ul[@id="system_config_tabs"]/descendant::a[concat(" ",normalize-space(.)," ") = " {{%s}} "]';
30
    public $systemConfigSectionToggleXpath             = '//form[@id="config_edit_form"]/descendant::div[contains(concat(" ",normalize-space(@class)," ")," section-config ")]/descendant::a[.="{{%s}}"]';
31
    public $systemConfigSectionDisplayCheckXpath            = '//legend[.="{{%s}}"]/ancestor::fieldset';
32
    public $systemConfigToggleEnableXpath            = '//legend[.="{{%s}}"]/../descendant::td[concat(" ",normalize-space(.)," ") = " {{Enabled}} "]/../td/descendant::select/option[@value="%d"]';
33
34
    public $xTreeRootXpath                          = '//ul[contains(concat(" ",normalize-space(@class)," ")," x-tree-root-ct ")]/div/li[contains(concat(" ",normalize-space(@class)," ")," x-tree-node ")]/div/a';
35
    public $xTreeNamedRootXpath                          = '//ul[contains(concat(" ",normalize-space(@class)," ")," x-tree-root-ct ")]/div/li[contains(concat(" ",normalize-space(@class)," ")," x-tree-node ")]/div/a[contains(concat("---",normalize-space(.)), "---{{%s}} (")]';
36
    public $xTreeChildXpath                          = 'ul/li[contains(concat(" ",normalize-space(@class)," ")," x-tree-node ")]/div/a/span[contains(concat("---",normalize-space(.)), "---{{%s}} (")]/..';
37
    public $xTreeChildNodePrefixXpath                = '/../..';
38
    public $xTreeChildNodeExpandPrefixXpath          = '/../img[contains(concat(" ",normalize-space(@class)," ")," x-tree-ec-icon ")]';
39
40
    public $systemConfigurationSaveButtonXpath       = '//div[@class="main-col-inner"]/div[@class="content-header"]/descendant::button[@title="{{Save Config}}"]';
41
42
    public $systemConfigSaveSuccessfulXpath          = '//li[@class="success-msg"]/descendant::span[.="{{The configuration has been saved}}."]';
43
44
    public $testLoggedInAtBaseUrl                     = '//a[@class="active"]/span[.="{{Dashboard}}"]';
45
46
    public $tableButtonXpath                         = '//table[@class="actions"]/descendant::span[.="{{%s}}"]';
47
48
    public $selectOrderXpath                         = '//table[@id="sales_order_grid_table"]/descendant::td[concat(" ",normalize-space(.)," ") = " %s "]/../td/a[.="{{View}}"]';
49
    public $selectCustomerXpath                         = '//table[@id="customerGrid_table"]/descendant::td[concat(" ",normalize-space(.)," ") = " %s "]/../td/a[.="{{Edit}}"]';
50
51
    public $systemConfigSettingLabelXpath            = '//td[@class="label"]/label[.=" {{%s}}"]';
52
53
    public $widgetTabXpath                           = '//a[contains(@class, "tab-item-link")]/span[.="{{%s}}"]';
54
    public $widgetTabHeaderXpath                     = '//div[@class="entry-edit-head"]/h4[.="{{%s}}"]';
55
    public $widgetAttributeByLabelXpath              = '//table[@class="form-list"]/descendant::td[@class="label"]/label[.="{{%s}} *" or .="{{%s}}*" or .="{{%s}} " or .="{{%s}}"]/ancestor::tr/td[@class="value"]/*[@name]';
56
    public $widgetActionButtonXpath                  = '//div[@class="content-header"]/descendant::button/descendant::span[.="{{%s}}"]';
57
58
    public $guaranteedPageLoadedElementDisplayedXpath = '//div[@class="footer"]';
59
60
    public $successfulActionXpath                    = '//li[@class="success-msg"]';
61
    public $errorActionXpath                    = '//li[@class="error-msg"]';
62
63
    public $shippingCarrierXpath                = '//select[@name="tracking[%d][carrier_code]"]';
64
    public $shippingTitleXpath                = '//input[@name="tracking[%d][title]"]';
65
    public $shippingTrackingNumberXpath                = '//input[@name="tracking[%d][number]"]';
66
67
    public $formButtonXpath = '//div[@class="content-header"]/p[@class="form-buttons"]/descendant::span[.="{{%s}}"]';
68
69
    public $cacheNavigationPath = '{{System}}/{{Cache Management}}';
70
71
    public $cacheTargetXpath = '//input[@name="types" and @value="{{%s}}"]';
72
73
    public $cacheAllTargetsXpath = '//input[@name="types"]';
74
75
    public $cacheMassActionOptionXpath = '//select[@id="cache_grid_massaction-select"]/option[@value="{{%s}}"]';
76
77
    public $cacheSubmitXpath = '//button[@title="{{Submit}}"]';
78
79
    public $firstTermsRowXpath = '//table[@id="agreementGrid_table"]/tbody/tr/td[not(contains(concat(" ",normalize-space(@class)," ")," empty-text "))]';
80
81
    public $orderCancelledMessageXpath = '//div[@id="messages"]/descendant::span[contains(., "{{The order has been cancelled}}")]';
82
83
    public $loadingMaskXpath = '//*[@id="loading-mask"]';
84
85
    public $defaultAdminTitle = '{{Dashboard}}';
86
87
    /**
88
     * @return string
89
     */
90
    public function getDefaultAdminTitle()
91
    {
92
        return $this->translatePlaceholders($this->defaultAdminTitle);
93
    }
94
95
    public function getLoadMaskXpath()
96
    {
97
        return $this->loadingMaskXpath;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    public function getOrderCancelledMessageXpath()
104
    {
105
        return $this->translatePlaceholders($this->orderCancelledMessageXpath);
106
    }
107
108
109
110
    /**
111
     * @return string
112
     */
113
    public function getFirstTermsRowXpath()
114
    {
115
        return $this->firstTermsRowXpath;
116
    }
117
118
    /**
119
     * @return string
120
     */
121
    public function getCacheSubmitXpath()
122
    {
123
        return $this->translatePlaceholders($this->cacheSubmitXpath);
124
    }
125
126
127
128
    /**
129
     * @return string
130
     */
131
    public function getCacheMassActionOptionXpath($option)
132
    {
133
        $xpath = sprintf($this->cacheMassActionOptionXpath, $option);
134
        return $this->translatePlaceholders($xpath);
135
    }
136
137
138
139
    /**
140
     * @return string
141
     */
142
    public function getCacheAllTargetsXpath()
143
    {
144
        return $this->translatePlaceholders($this->cacheAllTargetsXpath);
145
    }
146
147
148
149
    /**
150
     * @return string
151
     */
152
    public function getCacheTargetXpath($type)
153
    {
154
        $xpath = sprintf($this->cacheTargetXpath, $type);
155
        return $this->translatePlaceholders($xpath);
156
    }
157
158
159
160
    /**
161
     * @return string
162
     */
163
    public function getCacheNavigationPath()
164
    {
165
        return $this->translatePlaceholders($this->cacheNavigationPath);
166
    }
167
168
169
    public function getFormButtonXpath($button)
170
    {
171
        $xpath = sprintf($this->formButtonXpath, $button);
172
        return $this->translatePlaceholders($xpath);
173
    }
174
175
    /**
176
     * @return string
177
     */
178
    public function getShippingCarrierXpath($count)
179
    {
180
        $xpath = sprintf($this->shippingCarrierXpath, $count);
181
        return $xpath;
182
    }
183
184
    /**
185
     * @return string
186
     */
187
    public function getShippingTitleXpath($count)
188
    {
189
        $xpath = sprintf($this->shippingTitleXpath, $count);
190
        return $xpath;
191
    }
192
193
    /**
194
     * @return string
195
     */
196
    public function getShippingTrackingNumberXpath($count)
197
    {
198
        $xpath = sprintf($this->shippingTrackingNumberXpath, $count);
199
        return $xpath;
200
    }
201
202
203
204
    /**
205
     * @return string
206
     */
207
    public function getXTreeChildNodeExpandPrefixXpath()
208
    {
209
        return $this->translatePlaceholders($this->xTreeChildNodeExpandPrefixXpath);
210
    }
211
212
    /**
213
     * @return string
214
     */
215
    public function getXTreeNamedRootXpath($category)
216
    {
217
        $xpath = sprintf($this->xTreeNamedRootXpath, $category);
218
        return $this->translatePlaceholders($xpath);
219
    }
220
221
222
223
224
    /**
225
     * @return string
226
     */
227
    public function getXTreeChildNodePrefixXpath()
228
    {
229
        return $this->translatePlaceholders($this->xTreeChildNodePrefixXpath);
230
    }
231
232
    /**
233
     * @return string
234
     */
235
    public function getXTreeChildXpath($name)
236
    {
237
        $xpath = sprintf($this->xTreeChildXpath, $name);
238
        return $this->translatePlaceholders($xpath);
239
    }
240
241
    /**
242
     * @return string
243
     */
244
    public function getXTreeRootXpath()
245
    {
246
        return $this->translatePlaceholders($this->xTreeRootXpath);
247
    }
248
249
250
251
    public function set($name, $value)
252
    {
253
        $this->$name = $value;
254
    }
255
256
    /**
257
     * @return string
258
     */
259
    public function getSuccessfulActionXpath()
260
    {
261
        return $this->successfulActionXpath;
262
    }
263
264
    /**
265
     * @return string
266
     */
267
    public function getErrorActionXpath()
268
    {
269
        return $this->errorActionXpath;
270
    }
271
272
273
274
    /**
275
     * @return string
276
     */
277
    public function getWidgetActionButtonXpath($label)
278
    {
279
        return $this->translatePlaceholders(sprintf($this->widgetActionButtonXpath, $label));
280
    }
281
282
    /**
283
     * @return string
284
     */
285
    public function getWidgetAttributeByLabelXpath($attribute)
286
    {
287
        return $this->translatePlaceholders(sprintf($this->widgetAttributeByLabelXpath, $attribute, $attribute, $attribute, $attribute));
288
    }
289
290
291
292
    /**
293
     * @return string
294
     */
295
    public function getWidgetTabHeaderXpath($name)
296
    {
297
        return $this->translatePlaceholders(sprintf($this->widgetTabHeaderXpath, $name));
298
    }
299
300
    /**
301
     * @return string
302
     */
303
    public function getWidgetTabXpath($name)
304
    {
305
        return $this->translatePlaceholders(sprintf($this->widgetTabXpath, $name));
306
    }
307
308
309
310
    public function getGuaranteedPageLoadedElementDisplayedXpath()
311
    {
312
        return $this->translatePlaceholders($this->guaranteedPageLoadedElementDisplayedXpath);
313
    }
314
315
    /**
316
     * @param mixed $guaranteedPageLoadedElementDisplayedXpath
317
     */
318
    public function setGuaranteedPageLoadedElementDisplayedXpath($guaranteedPageLoadedElementDisplayedXpath)
319
    {
320
        $this->guaranteedPageLoadedElementDisplayedXpath = $guaranteedPageLoadedElementDisplayedXpath;
321
    }
322
323
    /**
324
     * @return string
325
     */
326
    public function getHomeXpath()
327
    {
328
        return $this->homeXpath;
329
    }
330
331
    /**
332
     * @return string
333
     */
334
    public function getSystemConfigSettingLabelXpath($label)
335
    {
336
        $return = sprintf($this->systemConfigSettingLabelXpath, $label);
337
        return $this->translatePlaceholders($return);
338
    }
339
340
    /**
341
     * Why is this an option?  So you can have a different theme setup for different languages and still use the same code.
342
     *
343
     * @var string
344
     */
345
346
    public $searchButtonText                         = '{{Search}}';
347
348
    /**
349
     * @return Translator
350
     */
351
    public function getTranslator()
352
    {
353
        return $this->translator;
354
    }
355
356
    /**
357
     * @return string
358
     */
359
    public function getLoginUsernameField()
360
    {
361
        return $this->translatePlaceholders($this->loginUsernameField);
362
    }
363
364
    /**
365
     * @return string
366
     */
367
    public function getLoginPasswordField()
368
    {
369
        return $this->translatePlaceholders($this->loginPasswordField);
370
    }
371
372
    /**
373
     * @return string
374
     */
375
    public function getLoginSubmitButton()
376
    {
377
        return $this->translatePlaceholders($this->loginSubmitButton);
378
    }
379
380
    /**
381
     * @return string
382
     */
383
    public function getNavigationBaseXPathSelector()
384
    {
385
        return $this->translatePlaceholders($this->navigationBaseXPathSelector);
386
    }
387
388
    /**
389
     * @return string
390
     */
391
    public function getNavigationChildXPathSelector($text)
392
    {
393
        $return = sprintf($this->navigationChildXPathSelector, $text);
394
        return $this->translatePlaceholders($return);
395
    }
396
397
    /**
398
     * @return mixed
399
     */
400
    public function getBaseUrl()
401
    {
402
        return $this->baseUrl;
403
    }
404
405
    /**
406
     * @return string
407
     */
408
    public function getSearchButtonText()
409
    {
410
        return $this->translatePlaceholders($this->searchButtonText);
411
    }
412
413
414
415
    /**
416
     * @return string
417
     */
418
    public function getSelectOrderXpath($order)
419
    {
420
        $return = sprintf($this->selectOrderXpath, $order);
421
        return $this->translatePlaceholders($return);
422
    }
423
    /**
424
     * @return string
425
     */
426
    public function getSelectCustomerXpath($value)
427
    {
428
        $xpath = sprintf($this->selectCustomerXpath, $value);
429
        return $this->translatePlaceholders($xpath);
430
    }
431
432
    /**
433
     * @return string
434
     */
435
    public function getTableButtonXpath($buttonValue)
436
    {
437
        $return = sprintf($this->tableButtonXpath, $buttonValue);
438
        return $this->translatePlaceholders($return);
439
    }
440
441
442
443
    /**
444
     * @return string
445
     */
446
    public function getTestLoggedInAtBaseUrl()
447
    {
448
        return $this->translatePlaceholders($this->testLoggedInAtBaseUrl);
449
    }
450
451
452
453
    /**
454
     * @return string
455
     */
456
    public function getSystemConfigSaveSuccessfulXpath()
457
    {
458
        return $this->translatePlaceholders($this->systemConfigSaveSuccessfulXpath);
459
    }
460
461
    /**
462
     * @return string
463
     */
464
    public function getSystemConfigurationSaveButtonXpath()
465
    {
466
        return $this->translatePlaceholders($this->systemConfigurationSaveButtonXpath);
467
    }
468
469
    /**
470
     * @return string
471
     */
472
    public function getSystemConfigSectionToggleXpath($section)
473
    {
474
        $return = sprintf($this->systemConfigSectionToggleXpath, $section);
475
        return $this->translatePlaceholders($return);
476
    }
477
478
    /**
479
     * @return string
480
     */
481
    public function getSystemConfigSectionDisplayCheckXpath($section)
482
    {
483
        $return = sprintf($this->systemConfigSectionDisplayCheckXpath, $section);
484
        return $this->translatePlaceholders($return);
485
    }
486
487
    /**
488
     * @return string
489
     */
490
    public function getSystemConfigToggleEnableXpath($section, $option)
491
    {
492
        $return = sprintf($this->systemConfigToggleEnableXpath, $section, $option);
493
        return $this->translatePlaceholders($return);
494
    }
495
496
    /**
497
     * @return string
498
     */
499
    public function getSystemConfigTabsXpath($tabName)
500
    {
501
        $return = sprintf($this->systemConfigTabsXpath, $tabName);
502
        return $this->translatePlaceholders($return);
503
    }
504
505
506
    public function getAdminPopupMessageContainerXpath()
507
    {
508
        return $this->translatePlaceholders($this->adminPopupMessageContainerXpath);
509
    }
510
511
    public function getAdminPopupMessageCloseButtonXpath()
512
    {
513
        return $this->translatePlaceholders($this->adminPopupMessageCloseButtonXpath);
514
    }
515
516
    public function getUseClicksToNavigate()
517
    {
518
        return false;
519
    }
520
521
    public function configure(AbstractTestCase $testCase)
522
    {
523
524
    }
525
526
}
527