### I18n   A last analyzed 2019-07-29 09:50 UTC

#### Complexity

 Total Complexity 9

#### Size/Duplication

 Total Lines 116 Duplicated Lines 27.59 %

#### Coupling/Cohesion

 Components 1 Dependencies 0

#### Importance

 Changes 0
Metric Value
c 0
b 0
f 0
dl 32
loc 116
rs 10
wmc 9
lcom 1
cbo 0

#### 5 Methods

Rating   Name   Duplication   Size   Complexity
A get() 0 21 2
A nget() 0 16 2
A cget() 16 16 2
A cnget() 16 16 2
A sprintf() 0 5 1

#### Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

 1 ` 1) {` 51 ` \$args = func_get_args();` 52 ` /**` 53 ` * Se remplaza con vsprintf` 54 ` * */` 55 ` unset(\$args[0]);` 56 ` \$sentence = vsprintf(\$sentence, \$args);` 57 ` }` 58 59 ` return \$sentence;` 60 ` }` 61 62 ` /**` 63 ` * Obtiene una traduccion al plural, cuando se pasan argumentos adicionales se remplaza con sprintf` 64 ` *` 65 ` * @param string \$sentence1 mensaje en singular` 66 ` * @param string \$sentence2 mensaje en plural` 67 ` * @param int \$n conteo` 68 ` * @return string` 69 ` * */` 70 ` public static function nget(\$sentence1, \$sentence2, \$n)` 71 ` {` 72 ` /**` 73 ` * Obtengo la traduccion` 74 ` * */` 75 ` \$sentence = ngettext(\$sentence1, \$sentence2, \$n);` 76 77 ` /**` 78 ` * Si se pasan multiples parametros` 79 ` * */` 80 ` if (func_num_args() > 3) {` 81 ` \$sentence = \$sentence = self::sprintf(\$sentence, func_get_args(), 3);` 82 ` }` 83 84 ` return \$sentence;` 85 ` }` 86 87 ` /**` 88 ` * Obtiene una traduccion por categoria, cuando se pasan argumentos adicionales se remplaza con sprintf` 89 ` *` 90 ` * @param string \$sentence` 91 ` * @param int \$category categoria del mensaje (LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_ALL)` 92 ` * @return string` 93 ` * */` 94 View Code Duplication ` public static function cget(\$sentence, \$category)` 0 ignored issues – show Duplication introduced 2016-01-01 19:33 UTC by This method seems to be duplicated in your project. Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history... 95 ` {` 96 ` /**` 97 ` * Obtengo la traduccion` 98 ` * */` 99 ` \$sentence = dcgettext(textdomain(null), \$sentence, \$category);` 100 101 ` /**` 102 ` * Si se pasan multiples parametros` 103 ` * */` 104 ` if (func_num_args() > 2) {` 105 ` \$sentence = \$sentence = self::sprintf(\$sentence, func_get_args(), 2);` 106 ` }` 107 108 ` return \$sentence;` 109 ` }` 110 111 ` /**` 112 ` * Obtiene una traduccion al plural por categoria, cuando se pasan argumentos adicionales se remplaza con sprintf` 113 ` *` 114 ` * @param string \$sentence1 mensaje en singular` 115 ` * @param string \$sentence2 mensaje en plural` 116 ` * @param int \$n conteo` 117 ` * @param int \$category categoria del mensaje (LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_ALL)` 118 ` * @return string` 119 ` * */` 120 View Code Duplication ` public static function cnget(\$sentence1, \$sentence2, \$n, \$category)` 0 ignored issues – show Duplication introduced 2016-01-01 19:33 UTC by This method seems to be duplicated in your project. Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history... 121 ` {` 122 ` /**` 123 ` * Obtengo la traduccion en funcion del dominio` 124 ` * */` 125 ` \$sentence = dcngettext(textdomain(null), \$sentence1, \$sentence2, \$n, \$category);` 126 127 ` /**` 128 ` * Si se pasan multiples parametros` 129 ` * */` 130 ` if (func_num_args() > 4) {` 131 ` \$sentence = self::sprintf(\$sentence, func_get_args(), 4);` 132 ` }` 133 134 ` return \$sentence;` 135 ` }` 136 ` ` 137 ` ` 138 ` private static function sprintf(\$sentence, \$args, \$offset)` 139 ` {` 140 ` return vsprintf( \$sentence, array_slice( \$args, \$offset));` 141 ` ` 142 ` }` 143 `}` 144