Completed
Push — master ( 8f9aa0...67ca79 )
by Tom
8s
created
src/TSSFunction/Json.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm\TSSFunction;
3 3
 class Json implements \Transphporm\TSSFunction {
4
-        private $baseDir;
4
+		private $baseDir;
5 5
         
6
-        public function __construct(&$baseDir) {
7
-                $this->baseDir = &$baseDir;
8
-        }
6
+		public function __construct(&$baseDir) {
7
+				$this->baseDir = &$baseDir;
8
+		}
9 9
         
10
-        public function run(array $args, \DomElement $element = null) {
11
-                $json = $args[0];
10
+		public function run(array $args, \DomElement $element = null) {
11
+				$json = $args[0];
12 12
                 
13
-                if (trim($json)[0] != '{') {
14
-                        $path = $this->baseDir . $json;
15
-                        if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
13
+				if (trim($json)[0] != '{') {
14
+						$path = $this->baseDir . $json;
15
+						if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
16 16
 			$json = file_get_contents($json);
17 17
 		}
18 18
 
19 19
 		$map = json_decode($json, true);
20 20
                 
21
-                if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
21
+				if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
22 22
                 
23
-                return $map;
24
-        }
23
+				return $map;
24
+		}
25 25
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
                 $json = $args[0];
12 12
                 
13 13
                 if (trim($json)[0] != '{') {
14
-                        $path = $this->baseDir . $json;
15
-                        if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
14
+                        $path = $this->baseDir.$json;
15
+                        if (!file_exists($path)) throw new \Exception('File does not exist at: '.$path);
16 16
 			$json = file_get_contents($json);
17 17
 		}
18 18
 
19 19
 		$map = json_decode($json, true);
20 20
                 
21
-                if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
21
+                if (!is_array($map)) throw new \Exception('Could not decode json: '.json_last_error_msg());
22 22
                 
23 23
                 return $map;
24 24
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,17 @@
 block discarded – undo
12 12
                 
13 13
                 if (trim($json)[0] != '{') {
14 14
                         $path = $this->baseDir . $json;
15
-                        if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
15
+                        if (!file_exists($path)) {
16
+                        	throw new \Exception('File does not exist at: ' . $path);
17
+                        }
16 18
 			$json = file_get_contents($json);
17 19
 		}
18 20
 
19 21
 		$map = json_decode($json, true);
20 22
                 
21
-                if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
23
+                if (!is_array($map)) {
24
+                	throw new \Exception('Could not decode json: ' . json_last_error_msg());
25
+                }
22 26
                 
23 27
                 return $map;
24 28
         }
Please login to merge, or discard this patch.