| Total Complexity | 2 |
| Total Lines | 23 |
| 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 Ledger |
||
| 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 | "0af4010a13636f6d6d6f6e2f6c65646765722e70726f746f1206636f6d6d" . |
||
| 19 | "6f6e22550a0e426c6f636b636861696e496e666f120e0a06686569676874" . |
||
| 20 | "18012001280412180a1063757272656e74426c6f636b4861736818022001" . |
||
| 21 | "280c12190a1170726576696f7573426c6f636b4861736818032001280c42" . |
||
| 22 | "760a246f72672e68797065726c65646765722e6661627269632e70726f74" . |
||
| 23 | "6f732e636f6d6d6f6e5a2b6769746875622e636f6d2f68797065726c6564" . |
||
| 24 | "6765722f6661627269632f70726f746f732f636f6d6d6f6eca0220487970" . |
||
| 25 | "65726c65646765725c4661627269635c50726f746f735c436f6d6d6f6e62" . |
||
| 26 | "0670726f746f33" |
||
| 27 | )); |
||
| 28 | |||
| 29 | static::$is_initialized = true; |
||
| 30 | } |
||
| 33 |