Conditions | 1 |
Paths | 1 |
Total Lines | 119 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 | 'Integer', |
||
92 | new Converter\PgInteger(), |
||
93 | [ |
||
94 | 'int2', 'pg_catalog.int2', |
||
95 | 'int4', 'pg_catalog.int4', 'int', 'integer', |
||
96 | 'int8', 'pg_catalog.int8', |
||
97 | 'oid', 'pg_catalog.oid', |
||
98 | ], |
||
99 | false |
||
100 | ) |
||
101 | ->registerConverter( |
||
102 | 'Float', |
||
103 | new Converter\PgFloat(), |
||
104 | [ |
||
105 | 'numeric', 'pg_catalog.numeric', |
||
106 | 'float4', 'pg_catalog.float4', 'float', |
||
107 | 'float8', 'pg_catalog.float8', |
||
108 | ], |
||
109 | false |
||
110 | ) |
||
111 | ->registerConverter( |
||
112 | 'String', |
||
113 | new Converter\PgString(), |
||
114 | [ |
||
115 | 'varchar', 'pg_catalog.varchar', |
||
116 | 'char', 'pg_catalog.char', |
||
117 | 'text', 'pg_catalog.text', |
||
118 | 'citext', 'public.citext', |
||
119 | 'uuid', 'pg_catalog.uuid', |
||
120 | 'tsvector', 'pg_catalog.tsvector', |
||
121 | 'xml', 'pg_catalog.xml', |
||
122 | 'bpchar', 'pg_catalog.bpchar', |
||
123 | 'name', 'pg_catalog.name', |
||
124 | 'character varying', |
||
125 | 'regclass', 'pg_catalog.regclass', |
||
126 | 'regproc', 'pg_catalog.regproc', |
||
127 | 'regprocedure', 'pg_catalog.regprocedure', |
||
128 | 'regoper', 'pg_catalog.regoper', |
||
129 | 'regoperator', 'pg_catalog.regoperator', |
||
130 | 'regtype', 'pg_catalog.regtype', |
||
131 | 'regrole', 'pg_catalog.regrole', |
||
132 | 'regnamespace', 'pg_catalog.regnamespace', |
||
133 | 'regconfig', 'pg_catalog.regconfig', |
||
134 | 'regdictionary', 'pg_catalog.regdictionary', |
||
135 | 'inet', 'pg_catalog.inet', |
||
136 | 'cidr', 'pg_catalog.cidr', |
||
137 | 'macaddr', 'pg_catalog.macaddr', |
||
138 | ], |
||
139 | false |
||
140 | ) |
||
141 | ->registerConverter( |
||
142 | 'Timestamp', |
||
143 | new Converter\PgTimestamp(), |
||
144 | [ |
||
145 | 'timestamp', 'pg_catalog.timestamp', |
||
146 | 'date', 'pg_catalog.date', |
||
147 | 'time', 'pg_catalog.time', |
||
148 | 'timestamptz', 'pg_catalog.timestamptz', |
||
149 | ], |
||
150 | false |
||
151 | ) |
||
152 | ->registerConverter('Interval', new Converter\PgInterval(), ['interval', 'pg_catalog.interval'], false) |
||
153 | ->registerConverter('Binary', new Converter\PgBytea(), ['bytea', 'pg_catalog.bytea'], false) |
||
154 | ->registerConverter('Point', new Converter\Geometry\PgPoint(), ['point', 'pg_catalog.point'], false) |
||
155 | ->registerConverter('Circle', new Converter\Geometry\PgCircle(), ['circle', 'pg_catalog.circle'], false) |
||
156 | ->registerConverter('Box', new Converter\Geometry\PgBox(), ['box', 'pg_catalog.box'], false) |
||
157 | ->registerConverter( |
||
158 | 'JSON', |
||
159 | new Converter\PgJson(), |
||
160 | [ |
||
161 | 'json', |
||
162 | 'jsonb', |
||
163 | 'pg_catalog.json', |
||
164 | 'pg_catalog.jsonb' |
||
165 | ], |
||
166 | false |
||
167 | ) |
||
168 | ->registerConverter( |
||
169 | 'NumberRange', |
||
170 | new Converter\PgNumRange(), |
||
171 | [ |
||
172 | 'int4range', 'pg_catalog.int4range', |
||
173 | 'int8range', 'pg_catalog.int8range', |
||
174 | 'numrange', 'pg_catalog.numrange', |
||
175 | ], |
||
176 | false |
||
177 | ) |
||
178 | ->registerConverter( |
||
179 | 'TsRange', |
||
180 | new Converter\PgTsRange(), |
||
181 | [ |
||
182 | 'tsrange', |
||
183 | 'pg_catalog.tsrange', |
||
184 | 'daterange', |
||
185 | 'pg_catalog.daterange', |
||
186 | 'tstzrange', |
||
187 | 'pg_catalog.tstzrange', |
||
188 | ], |
||
189 | false |
||
190 | ) |
||
191 | ; |
||
192 | |||
193 | return $this; |
||
194 | } |
||
195 | } |
||
196 |