| Conditions | 1 |
| Paths | 1 |
| Total Lines | 110 |
| Code Lines | 85 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| Bugs | 0 | Features | 5 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 76 | protected function initializeConverterHolder(ConverterHolder $converter_holder) |
||
| 77 | { |
||
| 78 | $converter_holder |
||
| 79 | ->registerConverter('Array', new Converter\PgArray(), ['array'], false) |
||
| 80 | ->registerConverter( |
||
| 81 | 'Boolean', |
||
| 82 | new Converter\PgBoolean(), |
||
| 83 | [ |
||
| 84 | 'bool', |
||
| 85 | 'pg_catalog.bool', |
||
| 86 | 'boolean', |
||
| 87 | ], |
||
| 88 | false |
||
| 89 | ) |
||
| 90 | ->registerConverter( |
||
| 91 | 'Number', |
||
| 92 | new Converter\PgNumber(), |
||
| 93 | [ |
||
| 94 | 'int2', 'pg_catalog.int2', |
||
| 95 | 'int4', 'pg_catalog.int4', 'int', 'integer', |
||
| 96 | 'int8', 'pg_catalog.int8', |
||
| 97 | 'numeric', 'pg_catalog.numeric', |
||
| 98 | 'float4', 'pg_catalog.float4', 'float', |
||
| 99 | 'float8', 'pg_catalog.float8', |
||
| 100 | 'oid', 'pg_catalog.oid', |
||
| 101 | ], |
||
| 102 | false |
||
| 103 | ) |
||
| 104 | ->registerConverter( |
||
| 105 | 'String', |
||
| 106 | new Converter\PgString(), |
||
| 107 | [ |
||
| 108 | 'varchar', 'pg_catalog.varchar', |
||
| 109 | 'char', 'pg_catalog.char', |
||
| 110 | 'text', 'pg_catalog.text', |
||
| 111 | 'uuid', 'pg_catalog.uuid', |
||
| 112 | 'tsvector', 'pg_catalog.tsvector', |
||
| 113 | 'xml', 'pg_catalog.xml', |
||
| 114 | 'bpchar', 'pg_catalog.bpchar', |
||
| 115 | 'name', 'pg_catalog.name', |
||
| 116 | 'character varying', |
||
| 117 | 'regclass', 'pg_catalog.regclass', |
||
| 118 | 'regproc', 'pg_catalog.regproc', |
||
| 119 | 'regprocedure', 'pg_catalog.regprocedure', |
||
| 120 | 'regoper', 'pg_catalog.regoper', |
||
| 121 | 'regoperator', 'pg_catalog.regoperator', |
||
| 122 | 'regtype', 'pg_catalog.regtype', |
||
| 123 | 'regrole', 'pg_catalog.regrole', |
||
| 124 | 'regnamespace', 'pg_catalog.regnamespace', |
||
| 125 | 'regconfig', 'pg_catalog.regconfig', |
||
| 126 | 'regdictionary', 'pg_catalog.regdictionary', |
||
| 127 | 'inet', 'pg_catalog.inet', |
||
| 128 | 'cidr', 'pg_catalog.cidr', |
||
| 129 | 'macaddr', 'pg_catalog.macaddr', |
||
| 130 | ], |
||
| 131 | false |
||
| 132 | ) |
||
| 133 | ->registerConverter( |
||
| 134 | 'Timestamp', |
||
| 135 | new Converter\PgTimestamp(), |
||
| 136 | [ |
||
| 137 | 'timestamp', 'pg_catalog.timestamp', |
||
| 138 | 'date', 'pg_catalog.date', |
||
| 139 | 'time', 'pg_catalog.time', |
||
| 140 | 'timestamptz', 'pg_catalog.timestamptz', |
||
| 141 | ], |
||
| 142 | false |
||
| 143 | ) |
||
| 144 | ->registerConverter('Interval', new Converter\PgInterval(), ['interval', 'pg_catalog.interval'], false) |
||
| 145 | ->registerConverter('Binary', new Converter\PgBytea(), ['bytea', 'pg_catalog.bytea'], false) |
||
| 146 | ->registerConverter('Point', new Converter\Geometry\PgPoint(), ['point', 'pg_catalog.point'], false) |
||
| 147 | ->registerConverter('Circle', new Converter\Geometry\PgCircle(), ['circle', 'pg_catalog.circle'], false) |
||
| 148 | ->registerConverter( |
||
| 149 | 'JSON', |
||
| 150 | new Converter\PgJson(), |
||
| 151 | [ |
||
| 152 | 'json', |
||
| 153 | 'jsonb', |
||
| 154 | 'pg_catalog.json', |
||
| 155 | 'pg_catalog.jsonb' |
||
| 156 | ], |
||
| 157 | false |
||
| 158 | ) |
||
| 159 | ->registerConverter( |
||
| 160 | 'NumberRange', |
||
| 161 | new Converter\PgNumRange(), |
||
| 162 | [ |
||
| 163 | 'int4range', 'pg_catalog.int4range', |
||
| 164 | 'int8range', 'pg_catalog.int8range', |
||
| 165 | 'numrange', 'pg_catalog.numrange', |
||
| 166 | ], |
||
| 167 | false |
||
| 168 | ) |
||
| 169 | ->registerConverter( |
||
| 170 | 'TsRange', |
||
| 171 | new Converter\PgTsRange(), |
||
| 172 | [ |
||
| 173 | 'tsrange', |
||
| 174 | 'pg_catalog.tsrange', |
||
| 175 | 'daterange', |
||
| 176 | 'pg_catalog.daterange', |
||
| 177 | 'tstzrange', |
||
| 178 | 'pg_catalog.tstzrange', |
||
| 179 | ], |
||
| 180 | false |
||
| 181 | ) |
||
| 182 | ; |
||
| 183 | |||
| 184 | return $this; |
||
| 185 | } |
||
| 186 | } |
||
| 187 |