2323 * @property PDO $pdo
2424 *
2525 */
26- class Converter {
26+ class Converter
27+ {
28+ /**
29+ * Parser version.
30+ */
2731 const VERSION = '1 ' ;
2832
2933 /**
@@ -195,7 +199,8 @@ class Converter {
195199 *
196200 * @param string $tmp
197201 */
198- public function __construct ($ tmp = null ) {
202+ public function __construct ($ tmp = null )
203+ {
199204 $ this ->errors = array ();
200205 $ this ->temporaryDir = (is_dir ($ tmp ))?$ tmp :sys_get_temp_dir ();
201206 }
@@ -205,7 +210,8 @@ public function __construct($tmp = null) {
205210 *
206211 * @return array
207212 */
208- public function getErrors () {
213+ public function getErrors ()
214+ {
209215 return $ this ->errors ;
210216 }
211217
@@ -214,7 +220,8 @@ public function getErrors() {
214220 *
215221 * @param string $author
216222 */
217- public function setAuthor ($ author ) {
223+ public function setAuthor ($ author )
224+ {
218225 if (mb_strlen ($ author ) > 64 ) $ author = mb_substr ($ author ,0 ,64 );
219226 $ this ->author = $ author ;
220227 }
@@ -224,7 +231,8 @@ public function setAuthor($author) {
224231 *
225232 * @param string $license
226233 */
227- public function setLicense ($ license ) {
234+ public function setLicense ($ license )
235+ {
228236 $ this ->license = $ license ;
229237 }
230238
@@ -239,7 +247,8 @@ public function setLicense($license) {
239247 * @param string $enclosure
240248 * @param string $escape
241249 */
242- public function addCSV ($ name ,$ file ,$ ignoreFirstRows =true ,$ encoding ='UTF-8 ' ,$ delimiter =', ' ,$ enclosure ='" ' ,$ escape ='\\' ) {
250+ public function addCSV ($ name ,$ file ,$ ignoreFirstRows =true ,$ encoding ='UTF-8 ' ,$ delimiter =', ' ,$ enclosure ='" ' ,$ escape ='\\' )
251+ {
243252 $ this ->iterator ['csv ' ]++;
244253 $ srcId = 'CSV # ' .$ this ->iterator ['csv ' ];
245254 if (!is_string ($ name ) || !preg_match ('/^[a-z0-9]+$/ui ' ,$ name )) {
@@ -283,7 +292,8 @@ public function addCSV($name,$file,$ignoreFirstRows=true,$encoding='UTF-8',$deli
283292 * @param integer $key
284293 * @param array $fields
285294 */
286- public function addRegister ($ name , $ csv , $ key , $ fields ) {
295+ public function addRegister ($ name , $ csv , $ key , $ fields )
296+ {
287297 $ fieldIterator = 0 ;
288298 $ transforms = array ('up ' ,'low ' ,'none ' );
289299 $ this ->iterator ['register ' ]++;
@@ -330,7 +340,8 @@ public function addRegister($name, $csv, $key, $fields) {
330340 * @param integer $lastIp
331341 * @param array $registers
332342 */
333- public function addNetworks ($ csv ,$ ipFormat ,$ firstIp ,$ lastIp ,$ registers ) {
343+ public function addNetworks ($ csv ,$ ipFormat ,$ firstIp ,$ lastIp ,$ registers )
344+ {
334345 $ registersIterator = 0 ;
335346 $ this ->iterator ['network ' ]++;
336347 $ netId = 'Network # ' .$ this ->iterator ['network ' ];
@@ -380,7 +391,8 @@ public function addNetworks($csv,$ipFormat,$firstIp,$lastIp,$registers) {
380391 *
381392 * @param string $file
382393 */
383- public function create ($ file ) {
394+ public function create ($ file )
395+ {
384396 if (!empty ($ this ->errors )) return null ;
385397 $ tmpDb = $ this ->temporaryDir . DIRECTORY_SEPARATOR . uniqid ().'tmp.sqlite ' ;
386398 try {
@@ -454,7 +466,8 @@ public function create($file) {
454466 /**
455467 * Create temporary database.
456468 */
457- protected function createTmpDb () {
469+ protected function createTmpDb ()
470+ {
458471 if (empty ($ this ->registers )) return ;
459472 foreach ($ this ->registers as $ table =>$ register ) {
460473 $ fields = array ('`_pk` ' , '`_used` ' );
@@ -600,7 +613,8 @@ protected function createTmpDb() {
600613 *
601614 * @return array
602615 */
603- protected function createTmpRegisters () {
616+ protected function createTmpRegisters ()
617+ {
604618 if (empty ($ this ->registers )) return array ();
605619 $ files = array ();
606620 foreach ($ this ->registers as $ table =>$ register ) {
@@ -673,7 +687,8 @@ protected function createTmpRegisters() {
673687 *
674688 * @return string
675689 */
676- protected function createTmpNetworks () {
690+ protected function createTmpNetworks ()
691+ {
677692 $ ip = 0 ;
678693 $ fields = array ();
679694 $ values = array ();
@@ -745,7 +760,8 @@ protected function createTmpNetworks() {
745760 * @param array $array
746761 * @return string
747762 */
748- public static function packArray ($ format ,$ array ) {
763+ public static function packArray ($ format ,$ array )
764+ {
749765 $ packParams = array_values ($ array );
750766 array_unshift ($ packParams ,$ format );
751767 return call_user_func_array ('pack ' ,$ packParams );
@@ -757,7 +773,8 @@ public static function packArray($format,$array) {
757773 * @param string $prefixOrInetnum
758774 * @return array
759775 */
760- public static function parseInetnum ($ prefixOrInetnum ) {
776+ public static function parseInetnum ($ prefixOrInetnum )
777+ {
761778 $ result = ['first ' =>null ,'last ' =>null ];
762779 if (strpos ($ prefixOrInetnum ,'- ' ) !== false ) {
763780 $ d = explode ('- ' ,$ prefixOrInetnum );
0 commit comments