Completed
Push — master ( e1b3cc...52b7dd )
by Enrico
03:03
created
src/SimpleCsvGateway.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -7,54 +7,54 @@
 block discarded – undo
7 7
 class SimpleCsvGateway 
8 8
 {
9 9
 	
10
-	protected $options;
11
-	protected $factsFactory;
10
+    protected $options;
11
+    protected $factsFactory;
12 12
 	
13 13
 	
14
-	static public function factory(array $options)
15
-	{
16
-		return new SimpleCsvGateway($options);
17
-	}
14
+    static public function factory(array $options)
15
+    {
16
+        return new SimpleCsvGateway($options);
17
+    }
18 18
 	
19 19
 	
20
-	public function __construct(array $options)
21
-	{
22
-		assert(!empty($options['factsProfile']['model']) && isset($options['factsProfile']['options']) && is_array($options['factsProfile']['options'])) ;
23
-		$defaults = array(
24
-			'bufferSize' 		=> 2000,
25
-			'skippFirstLine'	=> true,
26
-			'fieldDelimiter' 	=> ','
27
-		);
28
-		$this->options = array_merge($defaults,$options);
29
-		$this->factsFactory = new \BOTK\FactsFactory($options['factsProfile']);
30
-	}
20
+    public function __construct(array $options)
21
+    {
22
+        assert(!empty($options['factsProfile']['model']) && isset($options['factsProfile']['options']) && is_array($options['factsProfile']['options'])) ;
23
+        $defaults = array(
24
+            'bufferSize' 		=> 2000,
25
+            'skippFirstLine'	=> true,
26
+            'fieldDelimiter' 	=> ','
27
+        );
28
+        $this->options = array_merge($defaults,$options);
29
+        $this->factsFactory = new \BOTK\FactsFactory($options['factsProfile']);
30
+    }
31 31
 	
32 32
 	
33
-	protected function readRawData()
34
-	{
35
-		if( $this->factsFactory->tooManyErrors()) return false;
33
+    protected function readRawData()
34
+    {
35
+        if( $this->factsFactory->tooManyErrors()) return false;
36 36
 		
37
-		return fgetcsv(STDIN, $this->options['bufferSize'], $this->options['fieldDelimiter']);
38
-	}
39
-	
40
-	
41
-	public function run()
42
-	{
43
-		echo $this->factsFactory->generateLinkedDataHeader();
44
-		if($this->options['skippFirstLine']){ $this->readRawData();}
45
-	
46
-	    while ($rawdata = $this->readRawData()) {
47
-	    	if($this->factsFactory->acceptable($rawdata)){
48
-		    	try{
49
-		    		$facts =$this->factsFactory->factualize($rawdata);
50
-		    		echo $facts->asTurtle(), "\n";
51
-		    	}catch (\Exception $e) {
52
-					$this->factsFactory->addError($e->getMessage());
53
-				    echo "\n# Caught exception: " ,  $e->getMessage(), "\n";
54
-				}	    		
55
-	    	}
56
-	    }
37
+        return fgetcsv(STDIN, $this->options['bufferSize'], $this->options['fieldDelimiter']);
38
+    }
39
+	
40
+	
41
+    public function run()
42
+    {
43
+        echo $this->factsFactory->generateLinkedDataHeader();
44
+        if($this->options['skippFirstLine']){ $this->readRawData();}
45
+	
46
+        while ($rawdata = $this->readRawData()) {
47
+            if($this->factsFactory->acceptable($rawdata)){
48
+                try{
49
+                    $facts =$this->factsFactory->factualize($rawdata);
50
+                    echo $facts->asTurtle(), "\n";
51
+                }catch (\Exception $e) {
52
+                    $this->factsFactory->addError($e->getMessage());
53
+                    echo "\n# Caught exception: " ,  $e->getMessage(), "\n";
54
+                }	    		
55
+            }
56
+        }
57 57
 		
58
-		echo $this->factsFactory->generateLinkedDataFooter();		
59
-	}
58
+        echo $this->factsFactory->generateLinkedDataFooter();		
59
+    }
60 60
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,20 +19,20 @@  discard block
 block discarded – undo
19 19
 	
20 20
 	public function __construct(array $options)
21 21
 	{
22
-		assert(!empty($options['factsProfile']['model']) && isset($options['factsProfile']['options']) && is_array($options['factsProfile']['options'])) ;
22
+		assert(!empty($options['factsProfile']['model']) && isset($options['factsProfile']['options']) && is_array($options['factsProfile']['options']));
23 23
 		$defaults = array(
24 24
 			'bufferSize' 		=> 2000,
25 25
 			'skippFirstLine'	=> true,
26 26
 			'fieldDelimiter' 	=> ','
27 27
 		);
28
-		$this->options = array_merge($defaults,$options);
28
+		$this->options = array_merge($defaults, $options);
29 29
 		$this->factsFactory = new \BOTK\FactsFactory($options['factsProfile']);
30 30
 	}
31 31
 	
32 32
 	
33 33
 	protected function readRawData()
34 34
 	{
35
-		if( $this->factsFactory->tooManyErrors()) return false;
35
+		if ($this->factsFactory->tooManyErrors()) return false;
36 36
 		
37 37
 		return fgetcsv(STDIN, $this->options['bufferSize'], $this->options['fieldDelimiter']);
38 38
 	}
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 	public function run()
42 42
 	{
43 43
 		echo $this->factsFactory->generateLinkedDataHeader();
44
-		if($this->options['skippFirstLine']){ $this->readRawData();}
44
+		if ($this->options['skippFirstLine']) { $this->readRawData(); }
45 45
 	
46 46
 	    while ($rawdata = $this->readRawData()) {
47
-	    	if($this->factsFactory->acceptable($rawdata)){
48
-		    	try{
49
-		    		$facts =$this->factsFactory->factualize($rawdata);
47
+	    	if ($this->factsFactory->acceptable($rawdata)) {
48
+		    	try {
49
+		    		$facts = $this->factsFactory->factualize($rawdata);
50 50
 		    		echo $facts->asTurtle(), "\n";
51
-		    	}catch (\Exception $e) {
51
+		    	} catch (\Exception $e) {
52 52
 					$this->factsFactory->addError($e->getMessage());
53
-				    echo "\n# Caught exception: " ,  $e->getMessage(), "\n";
53
+				    echo "\n# Caught exception: ", $e->getMessage(), "\n";
54 54
 				}	    		
55 55
 	    	}
56 56
 	    }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	protected function readRawData()
34 34
 	{
35
-		if( $this->factsFactory->tooManyErrors()) return false;
35
+		if( $this->factsFactory->tooManyErrors()) {
36
+		    return false;
37
+		}
36 38
 		
37 39
 		return fgetcsv(STDIN, $this->options['bufferSize'], $this->options['fieldDelimiter']);
38 40
 	}
@@ -48,7 +50,7 @@  discard block
 block discarded – undo
48 50
 		    	try{
49 51
 		    		$facts =$this->factsFactory->factualize($rawdata);
50 52
 		    		echo $facts->asTurtle(), "\n";
51
-		    	}catch (\Exception $e) {
53
+		    	} catch (\Exception $e) {
52 54
 					$this->factsFactory->addError($e->getMessage());
53 55
 				    echo "\n# Caught exception: " ,  $e->getMessage(), "\n";
54 56
 				}	    		
Please login to merge, or discard this patch.
src/Filters.php 2 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -9,114 +9,114 @@
 block discarded – undo
9 9
  */
10 10
 class Filters {
11 11
 
12
-	/**
13
-	 * empty allowed
14
-	 */
15
-	static function FILTER_SANITIZE_ADDRESS($value)
16
-	{
17
-		$value = preg_replace('/\s*([,;])/', '$1 ', $value);	// a single blanc after comma and semicolon, no space before
18
-		$value = preg_replace('/\-/', ' - ', $value);			// a single blanc after and before dash
19
-		$value = preg_replace('/\s*\.\s*/', '.', $value);		// no blanks before and after dot 
20
-		$value = preg_replace('/,\s,\s/', ', ', $value);		// remove multiple comma
21
-		$value = preg_replace('/;\s;\s/', '; ', $value);		// remove multiple semicolon
22
-		$value = preg_replace('/\-\s\-\s/', '- ', $value);		// remove multiple dash
23
-		$value = preg_replace('/^\s*[\,\;]/', '', $value);		// remove  comma and semicolon at start
24
-		$value = preg_replace('/\\+/', '/', $value);			// backslash changed to slash
25
-		$value = preg_replace('/\s+/', ' ', $value);			// no multiple spaces,
26
-		$value = preg_replace('/\s?,?\s?(N|N\.|NUM\.|NUM|NUMERO|NUMBER|#)\s?(\d+)/i', ', $2', $value);		
27
-																// try normalizing civic numbers
28
-		$value = mb_strtoupper($value,'UTF-8');					// move to upper (preserving accents)
29
-		$value = trim($value); 									// no trailing and ending blancs
12
+    /**
13
+     * empty allowed
14
+     */
15
+    static function FILTER_SANITIZE_ADDRESS($value)
16
+    {
17
+        $value = preg_replace('/\s*([,;])/', '$1 ', $value);	// a single blanc after comma and semicolon, no space before
18
+        $value = preg_replace('/\-/', ' - ', $value);			// a single blanc after and before dash
19
+        $value = preg_replace('/\s*\.\s*/', '.', $value);		// no blanks before and after dot 
20
+        $value = preg_replace('/,\s,\s/', ', ', $value);		// remove multiple comma
21
+        $value = preg_replace('/;\s;\s/', '; ', $value);		// remove multiple semicolon
22
+        $value = preg_replace('/\-\s\-\s/', '- ', $value);		// remove multiple dash
23
+        $value = preg_replace('/^\s*[\,\;]/', '', $value);		// remove  comma and semicolon at start
24
+        $value = preg_replace('/\\+/', '/', $value);			// backslash changed to slash
25
+        $value = preg_replace('/\s+/', ' ', $value);			// no multiple spaces,
26
+        $value = preg_replace('/\s?,?\s?(N|N\.|NUM\.|NUM|NUMERO|NUMBER|#)\s?(\d+)/i', ', $2', $value);		
27
+                                                                // try normalizing civic numbers
28
+        $value = mb_strtoupper($value,'UTF-8');					// move to upper (preserving accents)
29
+        $value = trim($value); 									// no trailing and ending blancs
30 30
 		
31
-		return $value?:null;									// multibyte uppercase
32
-	}
31
+        return $value?:null;									// multibyte uppercase
32
+    }
33 33
 	
34
-	/**
35
-	 * not empty token
36
-	 */
37
-	static function FILTER_SANITIZE_TOKEN($value)
38
-	{
39
-		$value = preg_replace('/[^\w]/', '', $value);
40
-		$value = strtoupper($value);
34
+    /**
35
+     * not empty token
36
+     */
37
+    static function FILTER_SANITIZE_TOKEN($value)
38
+    {
39
+        $value = preg_replace('/[^\w]/', '', $value);
40
+        $value = strtoupper($value);
41 41
 		
42
-		return $value?:false;
43
-	}
42
+        return $value?:false;
43
+    }
44 44
 
45 45
 
46
-	/**
47
-	 * Normalize an italian telephone number
48
-	 * empty allowed
49
-	 */
50
-	static function FILTER_SANITIZE_TELEPHONE($value)
51
-	{
52
-		$value = preg_replace('/^[^0-9\+]+/', '', $value);  	// remove all from beginning execept numbers and +
53
-		$value = preg_replace('/^\+39/', '', $value);  			// remove +39 prefix		
54
-		$value = preg_replace('/^0039/', '', $value);  			// remove 0039 prefix
55
-		$value = preg_replace('/[\s\(\)]+/', '', $value);  		// remove all blanks and parenthesis
46
+    /**
47
+     * Normalize an italian telephone number
48
+     * empty allowed
49
+     */
50
+    static function FILTER_SANITIZE_TELEPHONE($value)
51
+    {
52
+        $value = preg_replace('/^[^0-9\+]+/', '', $value);  	// remove all from beginning execept numbers and +
53
+        $value = preg_replace('/^\+39/', '', $value);  			// remove +39 prefix		
54
+        $value = preg_replace('/^0039/', '', $value);  			// remove 0039 prefix
55
+        $value = preg_replace('/[\s\(\)]+/', '', $value);  		// remove all blanks and parenthesis
56 56
 				
57
-		// separate number from extensions (if any)
58
-		if( preg_match('/([0-9]+)(.*)/', $value, $matches)){
59
-			$value = $matches[1];
60
-			$extension = preg_replace('/[^0-9]/', '', $matches[2]);;
61
-			if($extension){
62
-				$value .= " [$extension]";
63
-			}			
64
-		}					
57
+        // separate number from extensions (if any)
58
+        if( preg_match('/([0-9]+)(.*)/', $value, $matches)){
59
+            $value = $matches[1];
60
+            $extension = preg_replace('/[^0-9]/', '', $matches[2]);;
61
+            if($extension){
62
+                $value .= " [$extension]";
63
+            }			
64
+        }					
65 65
 
66
-		return $value?:null;		
67
-	}
66
+        return $value?:null;		
67
+    }
68 68
 	
69 69
 	
70
-	/**
71
-	 * Normalize email
72
-	 * empty allowed
73
-	 */
74
-	static function FILTER_SANITIZE_EMAIL($value)
75
-	{
76
-		$value =  filter_var($value, FILTER_VALIDATE_EMAIL);
77
-		$value = preg_replace('/\s+/', ' ', $value);			// no multiple spaces,
78
-		$value =  strtoupper($value);
70
+    /**
71
+     * Normalize email
72
+     * empty allowed
73
+     */
74
+    static function FILTER_SANITIZE_EMAIL($value)
75
+    {
76
+        $value =  filter_var($value, FILTER_VALIDATE_EMAIL);
77
+        $value = preg_replace('/\s+/', ' ', $value);			// no multiple spaces,
78
+        $value =  strtoupper($value);
79 79
 		
80
-		return  $value?:null;		
81
-	}
80
+        return  $value?:null;		
81
+    }
82 82
 	
83 83
 	
84
-	/**
85
-	 * not null lowercase id
86
-	 */
87
-	static function FILTER_SANITIZE_ID($value)
88
-	{
89
-		$value = mb_strtolower($value, 'UTF-8');
90
-		$value = preg_replace('/[^\p{L}0-9]+/u', ' ', $value);
91
-		$value = preg_replace('/\s+/', '_', trim($value));
84
+    /**
85
+     * not null lowercase id
86
+     */
87
+    static function FILTER_SANITIZE_ID($value)
88
+    {
89
+        $value = mb_strtolower($value, 'UTF-8');
90
+        $value = preg_replace('/[^\p{L}0-9]+/u', ' ', $value);
91
+        $value = preg_replace('/\s+/', '_', trim($value));
92 92
 		
93
-		return $value?:false;
94
-	}
93
+        return $value?:false;
94
+    }
95 95
 	
96 96
 	
97
-	/**
98
-	 * latitude and longitude coordinates (only dot as decimal place) trunked to 6 decimals
99
-	 * empty allowed
100
-	 */
101
-	static function FILTER_SANITIZE_GEO($value)
102
-	{
103
-		// http://www.regexlib.com/REDetails.aspx?regexp_id=2728
104
-		$value = preg_replace('/,/', '.', $value);
105
-		$value = preg_replace('/(.+)\.(\d{1,6}).*/', '$1.$2', $value);
106
-		return preg_match('/^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)/', $value)?$value:null;
107
-	}
97
+    /**
98
+     * latitude and longitude coordinates (only dot as decimal place) trunked to 6 decimals
99
+     * empty allowed
100
+     */
101
+    static function FILTER_SANITIZE_GEO($value)
102
+    {
103
+        // http://www.regexlib.com/REDetails.aspx?regexp_id=2728
104
+        $value = preg_replace('/,/', '.', $value);
105
+        $value = preg_replace('/(.+)\.(\d{1,6}).*/', '$1.$2', $value);
106
+        return preg_match('/^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)/', $value)?$value:null;
107
+    }
108 108
 	
109 109
 	
110
-	/**
111
-	 * quote quotes and backslash
112
-	 * empty allowed
113
-	 */
114
-	static function FILTER_SANITIZE_TURTLE_STRING($value)
115
-	{
116
-		$value = preg_replace('/"/', '\\"', $value);
117
-		$value = preg_replace('/\{1,}/', '\\\\', $value);
110
+    /**
111
+     * quote quotes and backslash
112
+     * empty allowed
113
+     */
114
+    static function FILTER_SANITIZE_TURTLE_STRING($value)
115
+    {
116
+        $value = preg_replace('/"/', '\\"', $value);
117
+        $value = preg_replace('/\{1,}/', '\\\\', $value);
118 118
 		
119
-		return $value?:null;
120
-	}
119
+        return $value?:null;
120
+    }
121 121
 	
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	static function FILTER_SANITIZE_ADDRESS($value)
16 16
 	{
17
-		$value = preg_replace('/\s*([,;])/', '$1 ', $value);	// a single blanc after comma and semicolon, no space before
18
-		$value = preg_replace('/\-/', ' - ', $value);			// a single blanc after and before dash
19
-		$value = preg_replace('/\s*\.\s*/', '.', $value);		// no blanks before and after dot 
20
-		$value = preg_replace('/,\s,\s/', ', ', $value);		// remove multiple comma
21
-		$value = preg_replace('/;\s;\s/', '; ', $value);		// remove multiple semicolon
22
-		$value = preg_replace('/\-\s\-\s/', '- ', $value);		// remove multiple dash
23
-		$value = preg_replace('/^\s*[\,\;]/', '', $value);		// remove  comma and semicolon at start
24
-		$value = preg_replace('/\\+/', '/', $value);			// backslash changed to slash
25
-		$value = preg_replace('/\s+/', ' ', $value);			// no multiple spaces,
17
+		$value = preg_replace('/\s*([,;])/', '$1 ', $value); // a single blanc after comma and semicolon, no space before
18
+		$value = preg_replace('/\-/', ' - ', $value); // a single blanc after and before dash
19
+		$value = preg_replace('/\s*\.\s*/', '.', $value); // no blanks before and after dot 
20
+		$value = preg_replace('/,\s,\s/', ', ', $value); // remove multiple comma
21
+		$value = preg_replace('/;\s;\s/', '; ', $value); // remove multiple semicolon
22
+		$value = preg_replace('/\-\s\-\s/', '- ', $value); // remove multiple dash
23
+		$value = preg_replace('/^\s*[\,\;]/', '', $value); // remove  comma and semicolon at start
24
+		$value = preg_replace('/\\+/', '/', $value); // backslash changed to slash
25
+		$value = preg_replace('/\s+/', ' ', $value); // no multiple spaces,
26 26
 		$value = preg_replace('/\s?,?\s?(N|N\.|NUM\.|NUM|NUMERO|NUMBER|#)\s?(\d+)/i', ', $2', $value);		
27 27
 																// try normalizing civic numbers
28
-		$value = mb_strtoupper($value,'UTF-8');					// move to upper (preserving accents)
29
-		$value = trim($value); 									// no trailing and ending blancs
28
+		$value = mb_strtoupper($value, 'UTF-8'); // move to upper (preserving accents)
29
+		$value = trim($value); // no trailing and ending blancs
30 30
 		
31
-		return $value?:null;									// multibyte uppercase
31
+		return $value ?: null; // multibyte uppercase
32 32
 	}
33 33
 	
34 34
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		$value = preg_replace('/[^\w]/', '', $value);
40 40
 		$value = strtoupper($value);
41 41
 		
42
-		return $value?:false;
42
+		return $value ?: false;
43 43
 	}
44 44
 
45 45
 
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	static function FILTER_SANITIZE_TELEPHONE($value)
51 51
 	{
52
-		$value = preg_replace('/^[^0-9\+]+/', '', $value);  	// remove all from beginning execept numbers and +
53
-		$value = preg_replace('/^\+39/', '', $value);  			// remove +39 prefix		
54
-		$value = preg_replace('/^0039/', '', $value);  			// remove 0039 prefix
55
-		$value = preg_replace('/[\s\(\)]+/', '', $value);  		// remove all blanks and parenthesis
52
+		$value = preg_replace('/^[^0-9\+]+/', '', $value); // remove all from beginning execept numbers and +
53
+		$value = preg_replace('/^\+39/', '', $value); // remove +39 prefix		
54
+		$value = preg_replace('/^0039/', '', $value); // remove 0039 prefix
55
+		$value = preg_replace('/[\s\(\)]+/', '', $value); // remove all blanks and parenthesis
56 56
 				
57 57
 		// separate number from extensions (if any)
58
-		if( preg_match('/([0-9]+)(.*)/', $value, $matches)){
58
+		if (preg_match('/([0-9]+)(.*)/', $value, $matches)) {
59 59
 			$value = $matches[1];
60
-			$extension = preg_replace('/[^0-9]/', '', $matches[2]);;
61
-			if($extension){
60
+			$extension = preg_replace('/[^0-9]/', '', $matches[2]); ;
61
+			if ($extension) {
62 62
 				$value .= " [$extension]";
63 63
 			}			
64 64
 		}					
65 65
 
66
-		return $value?:null;		
66
+		return $value ?: null;		
67 67
 	}
68 68
 	
69 69
 	
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	static function FILTER_SANITIZE_EMAIL($value)
75 75
 	{
76
-		$value =  filter_var($value, FILTER_VALIDATE_EMAIL);
77
-		$value = preg_replace('/\s+/', ' ', $value);			// no multiple spaces,
78
-		$value =  strtoupper($value);
76
+		$value = filter_var($value, FILTER_VALIDATE_EMAIL);
77
+		$value = preg_replace('/\s+/', ' ', $value); // no multiple spaces,
78
+		$value = strtoupper($value);
79 79
 		
80
-		return  $value?:null;		
80
+		return  $value ?: null;		
81 81
 	}
82 82
 	
83 83
 	
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		$value = preg_replace('/[^\p{L}0-9]+/u', ' ', $value);
91 91
 		$value = preg_replace('/\s+/', '_', trim($value));
92 92
 		
93
-		return $value?:false;
93
+		return $value ?: false;
94 94
 	}
95 95
 	
96 96
 	
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		// http://www.regexlib.com/REDetails.aspx?regexp_id=2728
104 104
 		$value = preg_replace('/,/', '.', $value);
105 105
 		$value = preg_replace('/(.+)\.(\d{1,6}).*/', '$1.$2', $value);
106
-		return preg_match('/^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)/', $value)?$value:null;
106
+		return preg_match('/^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)/', $value) ? $value : null;
107 107
 	}
108 108
 	
109 109
 	
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$value = preg_replace('/"/', '\\"', $value);
117 117
 		$value = preg_replace('/\{1,}/', '\\\\', $value);
118 118
 		
119
-		return $value?:null;
119
+		return $value ?: null;
120 120
 	}
121 121
 	
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
src/FactsFactoryInterface.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 namespace BOTK;
3 3
 
4 4
 Interface FactsFactoryInterface {
5
-	public function removeEmpty( array $data );
6
-	public function factualize( array $rawData );
7
-	public function generateLinkedDataHeader();
8
-	public function generateLinkedDataFooter();
9
-	public function addToTripleCounter( $triplesCount);
10
-	public function getTripleCount();
11
-	public function addError($error);
12
-	public function tooManyErrors();
13
-	public function acceptable( $rawdata);
5
+    public function removeEmpty( array $data );
6
+    public function factualize( array $rawData );
7
+    public function generateLinkedDataHeader();
8
+    public function generateLinkedDataFooter();
9
+    public function addToTripleCounter( $triplesCount);
10
+    public function getTripleCount();
11
+    public function addError($error);
12
+    public function tooManyErrors();
13
+    public function acceptable( $rawdata);
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 namespace BOTK;
3 3
 
4 4
 Interface FactsFactoryInterface {
5
-	public function removeEmpty( array $data );
6
-	public function factualize( array $rawData );
5
+	public function removeEmpty(array $data);
6
+	public function factualize(array $rawData);
7 7
 	public function generateLinkedDataHeader();
8 8
 	public function generateLinkedDataFooter();
9
-	public function addToTripleCounter( $triplesCount);
9
+	public function addToTripleCounter($triplesCount);
10 10
 	public function getTripleCount();
11 11
 	public function addError($error);
12 12
 	public function tooManyErrors();
13
-	public function acceptable( $rawdata);
13
+	public function acceptable($rawdata);
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
src/Model/LocalBusiness.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -9,187 +9,187 @@
 block discarded – undo
9 9
  */
10 10
 class LocalBusiness extends AbstractModel implements \BOTK\ModelInterface 
11 11
 {
12
-	protected static $DEFAULT_OPTIONS = array (
13
-		'businessType'		=> array(		
14
-								// additional types  as extension of schema:LocalBusiness
15
-								'filter'    => FILTER_DEFAULT,
16
-                            	'flags'  	=> FILTER_FORCE_ARRAY,
17
-			                   ),
18
-		'taxID'				=> array(	
19
-								'filter'    => FILTER_CALLBACK,
20
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_TOKEN',
21
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
22
-			                   ),
23
-		'vatID'				=> array(	// italian rules
24
-								'filter'    => FILTER_VALIDATE_REGEXP,
25
-		                        'options' 	=> array('regexp'=>'/^[0-9]{11}$/'),
26
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
27
-			                   ),
28
-		'legalName'			=> array(
29
-								'filter'    => FILTER_CALLBACK,
30
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
31
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
32
-			                   ),
33
-		'businessName'		=> array(
34
-								// a schema:alternateName for schema:PostalAddress
35
-								'filter'    => FILTER_DEFAULT,
36
-                            	'flags'  	=> FILTER_FORCE_ARRAY,
37
-							   ),
38
-		'addressDescription'=> array(	//	
39
-								'filter'    => FILTER_CALLBACK,
40
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
41
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
42
-			                   ),
43
-		'addressCountry'	=> array(
44
-								'default'	=> 'IT',		
45
-								'filter'    => FILTER_VALIDATE_REGEXP,
46
-		                        'options' 	=> array('regexp'=>'/^[A-Z]{2}$/'),
47
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
48
-			                   ),
49
-		'addressLocality'	=> array(	
50
-								'filter'    => FILTER_CALLBACK,
51
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
52
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
53
-			                   ),
54
-		'addressRegion'		=> array(	
55
-								'filter'    => FILTER_CALLBACK,
56
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
57
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
58
-			                   ),
59
-		'streetAddress'		=> array(	
60
-								'filter'    => FILTER_CALLBACK,
61
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
62
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
63
-			                   ),
64
-		'postalCode'		=> array(	// italian rules
65
-								'filter'    => FILTER_VALIDATE_REGEXP,
66
-		                        'options' 	=> array('regexp'=>'/^[0-9]{5}$/'),
67
-                            	'flags'  	=> FILTER_REQUIRE_SCALAR,
68
-			                   ),
69
-		'telephone'			=> array(	
70
-								'filter'    => FILTER_CALLBACK,	
71
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_TELEPHONE',
72
-                            	'flags'  	=> FILTER_FORCE_ARRAY,
73
-			                   ),
74
-		'faxNumber'			=> array(	
75
-								'filter'    => FILTER_CALLBACK,
76
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_TELEPHONE',
77
-                            	'flags'  	=> FILTER_FORCE_ARRAY,
78
-			                   ),
79
-		'email'				=> array(	
80
-								'filter'    => FILTER_CALLBACK,
81
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_EMAIL',
82
-                            	'flags'  	=> FILTER_FORCE_ARRAY,
83
-			                   ),
84
-		'lat'				=> array( 
85
-								'filter'    => FILTER_CALLBACK,
86
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_GEO',
87
-			                   ),
88
-		'long'				=> array( 
89
-								'filter'    => FILTER_CALLBACK,
90
-		                        'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_GEO',
91
-			                   ),
92
-	);
12
+    protected static $DEFAULT_OPTIONS = array (
13
+        'businessType'		=> array(		
14
+                                // additional types  as extension of schema:LocalBusiness
15
+                                'filter'    => FILTER_DEFAULT,
16
+                                'flags'  	=> FILTER_FORCE_ARRAY,
17
+                                ),
18
+        'taxID'				=> array(	
19
+                                'filter'    => FILTER_CALLBACK,
20
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_TOKEN',
21
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
22
+                                ),
23
+        'vatID'				=> array(	// italian rules
24
+                                'filter'    => FILTER_VALIDATE_REGEXP,
25
+                                'options' 	=> array('regexp'=>'/^[0-9]{11}$/'),
26
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
27
+                                ),
28
+        'legalName'			=> array(
29
+                                'filter'    => FILTER_CALLBACK,
30
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
31
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
32
+                                ),
33
+        'businessName'		=> array(
34
+                                // a schema:alternateName for schema:PostalAddress
35
+                                'filter'    => FILTER_DEFAULT,
36
+                                'flags'  	=> FILTER_FORCE_ARRAY,
37
+                                ),
38
+        'addressDescription'=> array(	//	
39
+                                'filter'    => FILTER_CALLBACK,
40
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
41
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
42
+                                ),
43
+        'addressCountry'	=> array(
44
+                                'default'	=> 'IT',		
45
+                                'filter'    => FILTER_VALIDATE_REGEXP,
46
+                                'options' 	=> array('regexp'=>'/^[A-Z]{2}$/'),
47
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
48
+                                ),
49
+        'addressLocality'	=> array(	
50
+                                'filter'    => FILTER_CALLBACK,
51
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
52
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
53
+                                ),
54
+        'addressRegion'		=> array(	
55
+                                'filter'    => FILTER_CALLBACK,
56
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
57
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
58
+                                ),
59
+        'streetAddress'		=> array(	
60
+                                'filter'    => FILTER_CALLBACK,
61
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',
62
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
63
+                                ),
64
+        'postalCode'		=> array(	// italian rules
65
+                                'filter'    => FILTER_VALIDATE_REGEXP,
66
+                                'options' 	=> array('regexp'=>'/^[0-9]{5}$/'),
67
+                                'flags'  	=> FILTER_REQUIRE_SCALAR,
68
+                                ),
69
+        'telephone'			=> array(	
70
+                                'filter'    => FILTER_CALLBACK,	
71
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_TELEPHONE',
72
+                                'flags'  	=> FILTER_FORCE_ARRAY,
73
+                                ),
74
+        'faxNumber'			=> array(	
75
+                                'filter'    => FILTER_CALLBACK,
76
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_TELEPHONE',
77
+                                'flags'  	=> FILTER_FORCE_ARRAY,
78
+                                ),
79
+        'email'				=> array(	
80
+                                'filter'    => FILTER_CALLBACK,
81
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_EMAIL',
82
+                                'flags'  	=> FILTER_FORCE_ARRAY,
83
+                                ),
84
+        'lat'				=> array( 
85
+                                'filter'    => FILTER_CALLBACK,
86
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_GEO',
87
+                                ),
88
+        'long'				=> array( 
89
+                                'filter'    => FILTER_CALLBACK,
90
+                                'options' 	=> '\BOTK\Filters::FILTER_SANITIZE_GEO',
91
+                                ),
92
+    );
93 93
 
94
-	public function __construct(array $data = array(), array $customOptions = array()) 
94
+    public function __construct(array $data = array(), array $customOptions = array()) 
95 95
     {
96
-    	$options = $this->mergeOptions(self::$DEFAULT_OPTIONS,$customOptions);
97
-    	parent::__construct($data, $options);
98
-		$this->addAddressDescription();
99
-	}
96
+        $options = $this->mergeOptions(self::$DEFAULT_OPTIONS,$customOptions);
97
+        parent::__construct($data, $options);
98
+        $this->addAddressDescription();
99
+    }
100 100
 	
101 101
 	
102
-	/**
103
-	 * If not existing, create an address description as a normalized address from following data properties:
104
-	 * 		'addressLocality',
105
-	 * 		'addressRegion',
106
-	 * 		'streetAddress',
107
-	 * 		'postalCode',
108
-	 */
109
-	private function addAddressDescription()
110
-	{	
111
-		extract($this->data);
102
+    /**
103
+     * If not existing, create an address description as a normalized address from following data properties:
104
+     * 		'addressLocality',
105
+     * 		'addressRegion',
106
+     * 		'streetAddress',
107
+     * 		'postalCode',
108
+     */
109
+    private function addAddressDescription()
110
+    {	
111
+        extract($this->data);
112 112
 
113
-		if(empty($addressDescription)){
114
-			if( !empty($streetAddress) && ( !empty($addressLocality) || !empty($postalCode))){
115
-				$addressDescription = "$streetAddress ,";
116
-				if(!empty($postalCode)) { $addressDescription.= " $postalCode";}
117
-				if(!empty($addressLocality)) { $addressDescription.= " $addressLocality"; }
118
-				if(!empty($addressRegion)) { $addressDescription.= " ($addressRegion)"; }
119
-			} else {
120
-				$addressDescription = null;
121
-			}
122
-		}
113
+        if(empty($addressDescription)){
114
+            if( !empty($streetAddress) && ( !empty($addressLocality) || !empty($postalCode))){
115
+                $addressDescription = "$streetAddress ,";
116
+                if(!empty($postalCode)) { $addressDescription.= " $postalCode";}
117
+                if(!empty($addressLocality)) { $addressDescription.= " $addressLocality"; }
118
+                if(!empty($addressRegion)) { $addressDescription.= " ($addressRegion)"; }
119
+            } else {
120
+                $addressDescription = null;
121
+            }
122
+        }
123 123
 		
124
-		$addressDescription = \BOTK\Filters::FILTER_SANITIZE_ADDRESS($addressDescription);
124
+        $addressDescription = \BOTK\Filters::FILTER_SANITIZE_ADDRESS($addressDescription);
125 125
 		
126
-		if(!empty($addressDescription)){
127
-			$this->data['addressDescription']=$addressDescription;
128
-		}
129
-	}
126
+        if(!empty($addressDescription)){
127
+            $this->data['addressDescription']=$addressDescription;
128
+        }
129
+    }
130 130
 	
131 131
 	
132
-	public function asTurtle()
133
-	{
134
-		if(is_null($this->rdf)) {
135
-			extract($this->data);
132
+    public function asTurtle()
133
+    {
134
+        if(is_null($this->rdf)) {
135
+            extract($this->data);
136 136
 
137
-			// create uris
138
-			$organizationUri = $this->getUri();
139
-			$addressUri = $organizationUri.'_address';
140
-			$geoUri = ( !empty($lat) && !empty($long) )?"geo:$lat,$long":null;
137
+            // create uris
138
+            $organizationUri = $this->getUri();
139
+            $addressUri = $organizationUri.'_address';
140
+            $geoUri = ( !empty($lat) && !empty($long) )?"geo:$lat,$long":null;
141 141
 			
142
-			$tripleCounter =0;
143
-			$turtleString='';
142
+            $tripleCounter =0;
143
+            $turtleString='';
144 144
 			
145
-			// define $_ as a macro to write simple rdf
146
-			$_= function($format, $var) use(&$turtleString, &$tripleCounter){
147
-				foreach((array)$var as $v){
148
-					if($var){
149
-						$turtleString.= sprintf($format,$v);
150
-						$tripleCounter++;
151
-					}
152
-				}
153
-			};
145
+            // define $_ as a macro to write simple rdf
146
+            $_= function($format, $var) use(&$turtleString, &$tripleCounter){
147
+                foreach((array)$var as $v){
148
+                    if($var){
149
+                        $turtleString.= sprintf($format,$v);
150
+                        $tripleCounter++;
151
+                    }
152
+                }
153
+            };
154 154
 				
155
-	 		// serialize schema:LocalBusiness
156
- 			$_('<%s> a schema:LocalBusiness;', $organizationUri);
157
-			!empty($businessType) 		&& $_('a %s;', $businessType);
158
-			!empty($id) 				&& $_('dct:identifier "%s";', $id);
159
-			!empty($vatID) 				&& $_('schema:vatID "%s";', $vatID); 
160
-			!empty($taxtID) 			&& $_('schema:taxtID "%s";', $taxID);
161
-			!empty($legalName)			&& $_('schema:legalName "%s";', $legalName);
162
-			!empty($businessName) 		&& $_('schema:alternateName "%s";', $businessName);
163
-			!empty($telephone) 			&& $_('schema:telephone "%s";', $telephone);
164
-			!empty($faxNumber) 			&& $_('schema:faxNumber "%s";', $faxNumber);
165
-			!empty($page) 				&& $_('schema:page <%s>;', $page);
166
-			!empty($email) 				&& $_('schema:email "%s";', $email);
167
-			!empty($homepage) 			&& $_('foaf:homepage <%s>;', $homepage);
168
-			!empty($mailbox) 			&& $_('foaf:mailbox <mailto:%s>;', $mailbox);
169
-			!empty($geoUri) 			&& $_('schema:geo <%s>;', $geoUri);
170
-			$_('schema:address <%s>. ', $addressUri);
155
+                // serialize schema:LocalBusiness
156
+                $_('<%s> a schema:LocalBusiness;', $organizationUri);
157
+            !empty($businessType) 		&& $_('a %s;', $businessType);
158
+            !empty($id) 				&& $_('dct:identifier "%s";', $id);
159
+            !empty($vatID) 				&& $_('schema:vatID "%s";', $vatID); 
160
+            !empty($taxtID) 			&& $_('schema:taxtID "%s";', $taxID);
161
+            !empty($legalName)			&& $_('schema:legalName "%s";', $legalName);
162
+            !empty($businessName) 		&& $_('schema:alternateName "%s";', $businessName);
163
+            !empty($telephone) 			&& $_('schema:telephone "%s";', $telephone);
164
+            !empty($faxNumber) 			&& $_('schema:faxNumber "%s";', $faxNumber);
165
+            !empty($page) 				&& $_('schema:page <%s>;', $page);
166
+            !empty($email) 				&& $_('schema:email "%s";', $email);
167
+            !empty($homepage) 			&& $_('foaf:homepage <%s>;', $homepage);
168
+            !empty($mailbox) 			&& $_('foaf:mailbox <mailto:%s>;', $mailbox);
169
+            !empty($geoUri) 			&& $_('schema:geo <%s>;', $geoUri);
170
+            $_('schema:address <%s>. ', $addressUri);
171 171
 			
172
-			// serialize schema:PostalAddress 
173
-			$_('<%s> a schema:PostalAddress;', $addressUri);
174
-			!empty($addressDescription) && $_('schema:description "%s";', $addressDescription);
175
-			!empty($streetAddress) 		&& $_('schema:streetAddress "%s";', $streetAddress);
176
-			!empty($postalCode) 		&& $_('schema:postalCode "%s";', $postalCode);
177
-			!empty($addressLocality) 	&& $_('schema:addressLocality "%s";', $addressLocality);
178
-			!empty($addressRegion) 		&& $_('schema:addressRegion "%s";', $addressRegion);
179
-			$_('schema:addressCountry "%s". ', $addressCountry);
172
+            // serialize schema:PostalAddress 
173
+            $_('<%s> a schema:PostalAddress;', $addressUri);
174
+            !empty($addressDescription) && $_('schema:description "%s";', $addressDescription);
175
+            !empty($streetAddress) 		&& $_('schema:streetAddress "%s";', $streetAddress);
176
+            !empty($postalCode) 		&& $_('schema:postalCode "%s";', $postalCode);
177
+            !empty($addressLocality) 	&& $_('schema:addressLocality "%s";', $addressLocality);
178
+            !empty($addressRegion) 		&& $_('schema:addressRegion "%s";', $addressRegion);
179
+            $_('schema:addressCountry "%s". ', $addressCountry);
180 180
 
181
-			// serialize schema:GeoCoordinates
182
-			if( !empty($geoUri)){
183
-				$_('<%s> a schema:GeoCoordinates;', $geoUri); 
184
-				$_('wgs:lat "%s"^^xsd:float;', $lat);
185
-				$_('wgs:long "%s"^^xsd:float . ', $long); 
186
-			}
181
+            // serialize schema:GeoCoordinates
182
+            if( !empty($geoUri)){
183
+                $_('<%s> a schema:GeoCoordinates;', $geoUri); 
184
+                $_('wgs:lat "%s"^^xsd:float;', $lat);
185
+                $_('wgs:long "%s"^^xsd:float . ', $long); 
186
+            }
187 187
 
188
-			$this->rdf = $turtleString;
189
-			$this->tripleCount = $tripleCounter;
190
-		}
188
+            $this->rdf = $turtleString;
189
+            $this->tripleCount = $tripleCounter;
190
+        }
191 191
 		
192
-		return $this->rdf;
193
-	}
192
+        return $this->rdf;
193
+    }
194 194
 	
195 195
 }
196 196
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class LocalBusiness extends AbstractModel implements \BOTK\ModelInterface 
11 11
 {
12
-	protected static $DEFAULT_OPTIONS = array (
12
+	protected static $DEFAULT_OPTIONS = array(
13 13
 		'businessType'		=> array(		
14 14
 								// additional types  as extension of schema:LocalBusiness
15 15
 								'filter'    => FILTER_DEFAULT,
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	public function __construct(array $data = array(), array $customOptions = array()) 
95 95
     {
96
-    	$options = $this->mergeOptions(self::$DEFAULT_OPTIONS,$customOptions);
96
+    	$options = $this->mergeOptions(self::$DEFAULT_OPTIONS, $customOptions);
97 97
     	parent::__construct($data, $options);
98 98
 		$this->addAddressDescription();
99 99
 	}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 	{	
111 111
 		extract($this->data);
112 112
 
113
-		if(empty($addressDescription)){
114
-			if( !empty($streetAddress) && ( !empty($addressLocality) || !empty($postalCode))){
113
+		if (empty($addressDescription)) {
114
+			if (!empty($streetAddress) && (!empty($addressLocality) || !empty($postalCode))) {
115 115
 				$addressDescription = "$streetAddress ,";
116
-				if(!empty($postalCode)) { $addressDescription.= " $postalCode";}
117
-				if(!empty($addressLocality)) { $addressDescription.= " $addressLocality"; }
118
-				if(!empty($addressRegion)) { $addressDescription.= " ($addressRegion)"; }
116
+				if (!empty($postalCode)) { $addressDescription .= " $postalCode"; }
117
+				if (!empty($addressLocality)) { $addressDescription .= " $addressLocality"; }
118
+				if (!empty($addressRegion)) { $addressDescription .= " ($addressRegion)"; }
119 119
 			} else {
120 120
 				$addressDescription = null;
121 121
 			}
@@ -123,30 +123,30 @@  discard block
 block discarded – undo
123 123
 		
124 124
 		$addressDescription = \BOTK\Filters::FILTER_SANITIZE_ADDRESS($addressDescription);
125 125
 		
126
-		if(!empty($addressDescription)){
127
-			$this->data['addressDescription']=$addressDescription;
126
+		if (!empty($addressDescription)) {
127
+			$this->data['addressDescription'] = $addressDescription;
128 128
 		}
129 129
 	}
130 130
 	
131 131
 	
132 132
 	public function asTurtle()
133 133
 	{
134
-		if(is_null($this->rdf)) {
134
+		if (is_null($this->rdf)) {
135 135
 			extract($this->data);
136 136
 
137 137
 			// create uris
138 138
 			$organizationUri = $this->getUri();
139 139
 			$addressUri = $organizationUri.'_address';
140
-			$geoUri = ( !empty($lat) && !empty($long) )?"geo:$lat,$long":null;
140
+			$geoUri = (!empty($lat) && !empty($long)) ? "geo:$lat,$long" : null;
141 141
 			
142
-			$tripleCounter =0;
143
-			$turtleString='';
142
+			$tripleCounter = 0;
143
+			$turtleString = '';
144 144
 			
145 145
 			// define $_ as a macro to write simple rdf
146
-			$_= function($format, $var) use(&$turtleString, &$tripleCounter){
147
-				foreach((array)$var as $v){
148
-					if($var){
149
-						$turtleString.= sprintf($format,$v);
146
+			$_ = function($format, $var) use(&$turtleString, &$tripleCounter){
147
+				foreach ((array) $var as $v) {
148
+					if ($var) {
149
+						$turtleString .= sprintf($format, $v);
150 150
 						$tripleCounter++;
151 151
 					}
152 152
 				}
@@ -154,32 +154,32 @@  discard block
 block discarded – undo
154 154
 				
155 155
 	 		// serialize schema:LocalBusiness
156 156
  			$_('<%s> a schema:LocalBusiness;', $organizationUri);
157
-			!empty($businessType) 		&& $_('a %s;', $businessType);
158
-			!empty($id) 				&& $_('dct:identifier "%s";', $id);
159
-			!empty($vatID) 				&& $_('schema:vatID "%s";', $vatID); 
160
-			!empty($taxtID) 			&& $_('schema:taxtID "%s";', $taxID);
161
-			!empty($legalName)			&& $_('schema:legalName "%s";', $legalName);
162
-			!empty($businessName) 		&& $_('schema:alternateName "%s";', $businessName);
163
-			!empty($telephone) 			&& $_('schema:telephone "%s";', $telephone);
164
-			!empty($faxNumber) 			&& $_('schema:faxNumber "%s";', $faxNumber);
165
-			!empty($page) 				&& $_('schema:page <%s>;', $page);
166
-			!empty($email) 				&& $_('schema:email "%s";', $email);
167
-			!empty($homepage) 			&& $_('foaf:homepage <%s>;', $homepage);
168
-			!empty($mailbox) 			&& $_('foaf:mailbox <mailto:%s>;', $mailbox);
169
-			!empty($geoUri) 			&& $_('schema:geo <%s>;', $geoUri);
157
+			!empty($businessType) && $_('a %s;', $businessType);
158
+			!empty($id) && $_('dct:identifier "%s";', $id);
159
+			!empty($vatID) && $_('schema:vatID "%s";', $vatID); 
160
+			!empty($taxtID) && $_('schema:taxtID "%s";', $taxID);
161
+			!empty($legalName) && $_('schema:legalName "%s";', $legalName);
162
+			!empty($businessName) && $_('schema:alternateName "%s";', $businessName);
163
+			!empty($telephone) && $_('schema:telephone "%s";', $telephone);
164
+			!empty($faxNumber) && $_('schema:faxNumber "%s";', $faxNumber);
165
+			!empty($page) && $_('schema:page <%s>;', $page);
166
+			!empty($email) && $_('schema:email "%s";', $email);
167
+			!empty($homepage) && $_('foaf:homepage <%s>;', $homepage);
168
+			!empty($mailbox) && $_('foaf:mailbox <mailto:%s>;', $mailbox);
169
+			!empty($geoUri) && $_('schema:geo <%s>;', $geoUri);
170 170
 			$_('schema:address <%s>. ', $addressUri);
171 171
 			
172 172
 			// serialize schema:PostalAddress 
173 173
 			$_('<%s> a schema:PostalAddress;', $addressUri);
174 174
 			!empty($addressDescription) && $_('schema:description "%s";', $addressDescription);
175
-			!empty($streetAddress) 		&& $_('schema:streetAddress "%s";', $streetAddress);
176
-			!empty($postalCode) 		&& $_('schema:postalCode "%s";', $postalCode);
177
-			!empty($addressLocality) 	&& $_('schema:addressLocality "%s";', $addressLocality);
178
-			!empty($addressRegion) 		&& $_('schema:addressRegion "%s";', $addressRegion);
175
+			!empty($streetAddress) && $_('schema:streetAddress "%s";', $streetAddress);
176
+			!empty($postalCode) && $_('schema:postalCode "%s";', $postalCode);
177
+			!empty($addressLocality) && $_('schema:addressLocality "%s";', $addressLocality);
178
+			!empty($addressRegion) && $_('schema:addressRegion "%s";', $addressRegion);
179 179
 			$_('schema:addressCountry "%s". ', $addressCountry);
180 180
 
181 181
 			// serialize schema:GeoCoordinates
182
-			if( !empty($geoUri)){
182
+			if (!empty($geoUri)) {
183 183
 				$_('<%s> a schema:GeoCoordinates;', $geoUri); 
184 184
 				$_('wgs:lat "%s"^^xsd:float;', $lat);
185 185
 				$_('wgs:long "%s"^^xsd:float . ', $long); 
Please login to merge, or discard this patch.