Select2   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addJavascripts() 0 13 3
A addStylesheets() 0 6 1
1
<?php
2
class Select2
3
{
4
    /**
5
     * Adds javascripts for Select2 Widgets
6
     *
7
     * @param null|string $culture Culture
8
     * @return array Array of javascripts
9
     */
10
    public static function addJavascripts($culture = null)
11
    {
12
        $path = sfConfig::get('sf_sfSelect2Widgets_select2_web_dir');
13
        $available_cultures = sfConfig::get('sf_sfSelect2Widgets_available_cultures');
14
15
        $javascripts = array($path . '/select2.js');
16
17
        if ($culture != 'en' && in_array($culture, $available_cultures)) {
18
            $javascripts[] = $path . '/select2_locale_' . $culture . '.js';
19
        }
20
21
        return $javascripts;
22
    }
23
24
    /**
25
     * Adds stylesheets for Select2 Widgets
26
     *
27
     * @return array Array of stylesheets
28
     */
29
    public static function addStylesheets()
30
    {
31
        $path = sfConfig::get('sf_sfSelect2Widgets_select2_web_dir');
32
33
        return array($path . '/select2.css' => 'all');
34
    }
35
}
36