Total Complexity | 2 |
Total Lines | 21 |
Duplicated Lines | 100 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
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 | <?php |
||
7 | class Identities |
||
8 | { |
||
9 | public static $is_initialized = false; |
||
10 | |||
11 | public static function initOnce() { |
||
12 | $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); |
||
13 | |||
14 | if (static::$is_initialized == true) { |
||
15 | return; |
||
16 | } |
||
17 | $pool->internalAddGeneratedFile(hex2bin( |
||
18 | "0ac9010a146d73702f6964656e7469746965732e70726f746f12036d7370" . |
||
19 | "22350a1253657269616c697a65644964656e74697479120d0a056d737069" . |
||
20 | "6418012001280912100a0869645f627974657318022001280c426d0a216f" . |
||
21 | "72672e68797065726c65646765722e6661627269632e70726f746f732e6d" . |
||
22 | "73705a286769746875622e636f6d2f68797065726c65646765722f666162" . |
||
23 | "7269632f70726f746f732f6d7370ca021d48797065726c65646765725c46" . |
||
24 | "61627269635c50726f746f735c4d5350620670726f746f33" |
||
25 | )); |
||
26 | |||
27 | static::$is_initialized = true; |
||
28 | } |
||
31 |