| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 100 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 1 |
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 Rwset |
||
| 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 | "0aee020a186c65646765722f72777365742f72777365742e70726f746f12" . |
||
| 19 | "0572777365742283010a0e547852656164577269746553657412330a0a64" . |
||
| 20 | "6174615f6d6f64656c18012001280e321f2e72777365742e547852656164" . |
||
| 21 | "57726974655365742e446174614d6f64656c12270a086e735f7277736574" . |
||
| 22 | "18022003280b32152e72777365742e4e7352656164577269746553657422" . |
||
| 23 | "130a09446174614d6f64656c12060a024b56100022320a0e4e7352656164" . |
||
| 24 | "577269746553657412110a096e616d657370616365180120012809120d0a" . |
||
| 25 | "05727773657418022001280c4288010a2a6f72672e68797065726c656467" . |
||
| 26 | "65722e6661627269632e70726f746f732e6c65646765722e72777365745a" . |
||
| 27 | "316769746875622e636f6d2f68797065726c65646765722f666162726963" . |
||
| 28 | "2f70726f746f732f6c65646765722f7277736574ca022648797065726c65" . |
||
| 29 | "646765725c4661627269635c50726f746f735c4c65646765725c52575365" . |
||
| 30 | "74620670726f746f33" |
||
| 31 | )); |
||
| 32 | |||
| 33 | static::$is_initialized = true; |
||
| 34 | } |
||
| 37 |