Test Setup Failed
Push — develop ( b46587...bd8dda )
by Craig
07:01
created
src/Ams/RobotsTxtAsset.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Phpsa\Datastore\Asset;
6 6
 
7
-class RobotsTxtAsset extends Asset{
7
+class RobotsTxtAsset extends Asset {
8 8
 
9 9
 	public $name = 'Robots.txt';
10 10
 	public $shortname = 'robots_txt';
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	public $private = true; //this is not a standard public facing page!
14 14
 
15 15
 	public $meta_description = 'off'; // set to 'off' to turn it off
16
-	public $meta_keywords	 = 'off'; // set to 'off' to turn it off
16
+	public $meta_keywords = 'off'; // set to 'off' to turn it off
17 17
 
18 18
 	public $value_equals = 'entries';
19 19
 	public $properties = array(
Please login to merge, or discard this patch.
src/Ams/BooleanAsset.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 	public $shortname = 'Bool';
10 10
 
11
-    public $type = BooleanAsset::class;
11
+	public $type = BooleanAsset::class;
12 12
 
13 13
 	public $namespace = 'property';
14 14
 
15
-    public static function html($data) {
16
-        return  !empty($data['value']) ? 'on' : 'off';
17
-    }
15
+	public static function html($data) {
16
+		return  !empty($data['value']) ? 'on' : 'off';
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Ams/IdentityAsset.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 class IdentityAsset extends Asset {
8 8
 
9
-    public $type = IdentityAsset::class;
10
-    public $namespace = 'property';
9
+	public $type = IdentityAsset::class;
10
+	public $namespace = 'property';
11 11
 
12
-    public static function html($data) {
12
+	public static function html($data) {
13 13
 		$record = config('auth.providers.users.model')::find($data['value']);
14 14
 		$user_label = $record ? $record->first_name . ' ' . $record->last_name : '';
15 15
 
16
-        return  $user_label;
17
-    }
16
+		return  $user_label;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Ams/BlockAsset.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
 	}
45 45
 
46 46
 			/**
47
-	 * generate the route for this asset
48
-	 */
47
+			 * generate the route for this asset
48
+			 */
49 49
 	public static function route($record, $path = null){
50 50
 
51 51
 		$path = 'frontend.ams.page.slug';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 			/**
47 47
 	 * generate the route for this asset
48 48
 	 */
49
-	public static function route($record, $path = null){
49
+	public static function route($record, $path = null) {
50 50
 
51 51
 		$path = 'frontend.ams.page.slug';
52 52
 		$page = $record->page;
Please login to merge, or discard this patch.
src/Ams/HtmlAsset.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 
6 6
 class HtmlAsset extends Asset {
7 7
 
8
-    public $type = HtmlAsset::class;
9
-    public $namespace = 'property';
8
+	public $type = HtmlAsset::class;
9
+	public $namespace = 'property';
10 10
 	public $options = ["formatting", "bold", "italic", "deleted", "unorderedlist","orderedlist", "image", "file", "link"];
11 11
 
12
-    // return it raw
13
-    public static function html($data) {
14
-        return $data['value'];
15
-    }
12
+	// return it raw
13
+	public static function html($data) {
14
+		return $data['value'];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
     public $type = HtmlAsset::class;
9 9
     public $namespace = 'property';
10
-	public $options = ["formatting", "bold", "italic", "deleted", "unorderedlist","orderedlist", "image", "file", "link"];
10
+	public $options = ["formatting", "bold", "italic", "deleted", "unorderedlist", "orderedlist", "image", "file", "link"];
11 11
 
12 12
     // return it raw
13 13
     public static function html($data) {
Please login to merge, or discard this patch.
src/Ams/DropdownAsset.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 
6 6
 class DropdownAsset extends Asset {
7 7
 
8
-    public $type = DropdownAsset::class;
9
-    public $namespace = 'property';
8
+	public $type = DropdownAsset::class;
9
+	public $namespace = 'property';
10 10
 
11
-    public static function html($data) {
12
-        return '<span>' . $data['value'] . '</span>';
13
-    }
11
+	public static function html($data) {
12
+		return '<span>' . $data['value'] . '</span>';
13
+	}
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
src/Ams/TextAsset.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 
5 5
 class TextAsset extends Asset {
6 6
 
7
-    public $type = TextAsset::class;
8
-    public $namespace = 'property';
7
+	public $type = TextAsset::class;
8
+	public $namespace = 'property';
9 9
 
10
-    public static function html($data) {
11
-        return '<p>' . $data['value'] . '</p>';
12
-    }
10
+	public static function html($data) {
11
+		return '<p>' . $data['value'] . '</p>';
12
+	}
13 13
 
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
src/Ams/TabsAsset.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
 			'type' => self::HTML
27 27
 		),
28 28
 		'status' => array(
29
-            'name' => 'Published',
30
-            'type' => self::DROPDOWN,
29
+			'name' => 'Published',
30
+			'type' => self::DROPDOWN,
31 31
 			'options' => ['published' => 'Published', 'unpublished' => 'Unpublished'],
32 32
 			'published' => ['published']
33
-        ),
33
+		),
34 34
 	);
35 35
 
36 36
 	public static function about() {
Please login to merge, or discard this patch.
src/Helpers.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	 * @return bool
17 17
 	 */
18 18
 	public static function isAssocArray(array $array){
19
-        if (array() === $array) return false;
20
-        return array_keys($array) !== range(0, count($array) - 1);
19
+		if (array() === $array) return false;
20
+		return array_keys($array) !== range(0, count($array) - 1);
21 21
 	}
22 22
 
23 23
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 
178 178
 
179
-    /**
179
+	/**
180 180
 	 * Gets the module based on the classname
181 181
 	 * @param string $class
182 182
 	 * @return string
Please login to merge, or discard this patch.
Spacing   +31 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return bool
17 17
 	 */
18
-	public static function isAssocArray(array $array){
18
+	public static function isAssocArray(array $array) {
19 19
         if (array() === $array) return false;
20 20
         return array_keys($array) !== range(0, count($array) - 1);
21 21
 	}
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
 		$pattern	 = "/(.)([A-Z])/";
34 34
 		$replacement = "\\1 \\2";
35 35
 		$return		 = ($ucfirst) ?
36
-			ucfirst(preg_replace($pattern, $replacement, $string)) :
37
-			strtolower(preg_replace($pattern, $replacement, $string));
36
+			ucfirst(preg_replace($pattern, $replacement, $string)) : strtolower(preg_replace($pattern, $replacement, $string));
38 37
 
39 38
 		return ($glue) ? str_replace(' ', $glue, $return) : $return;
40 39
 	}
@@ -47,9 +46,9 @@  discard block
 block discarded – undo
47 46
 	 *
48 47
 	 * @return void
49 48
 	 */
50
-	public static function parseAssetType($queryString, $key = false){
49
+	public static function parseAssetType($queryString, $key = false) {
51 50
 		$assetParts = explode(".", strtolower($queryString));
52
-		if(count($assetParts) > 2){
51
+		if (count($assetParts) > 2) {
53 52
 			throw new DatastoreException("Assets are only 2 tiers deep");
54 53
 		}
55 54
 		$asset = array_pop($assetParts);
@@ -57,7 +56,7 @@  discard block
 block discarded – undo
57 56
 
58 57
 		$list = !empty($assetParts) && isset($list[$assetParts[0]]) ? $list[$assetParts[0]] : array_shift($list);
59 58
 
60
-		if(!isset($list[$asset])){
59
+		if (!isset($list[$asset])) {
61 60
 			throw new DatastoreException("Asset not found");
62 61
 		}
63 62
 		return $key ? $list[$asset]['class'] : $list[$asset];
@@ -70,7 +69,7 @@  discard block
 block discarded – undo
70 69
 	 *
71 70
 	 * @return void
72 71
 	 */
73
-	public static function getAssetItem($className){
72
+	public static function getAssetItem($className) {
74 73
 		return array(
75 74
 			'class'			 => $className,
76 75
 			'name'			 => Self::assetInfo($className, 'name'),
@@ -87,22 +86,22 @@  discard block
 block discarded – undo
87 86
 		);
88 87
 	}
89 88
 
90
-	public static function getStatusEquals($className){
89
+	public static function getStatusEquals($className) {
91 90
 		$statusEquals = self::assetInfo($className, 'status_equals');
92
-		if(!$statusEquals){
91
+		if (!$statusEquals) {
93 92
 			return null;
94 93
 		}
95
-		$props = self::getAssetProps($className,$statusEquals);
96
-		return isset($props['published'])?$props['published'] : null;
94
+		$props = self::getAssetProps($className, $statusEquals);
95
+		return isset($props['published']) ? $props['published'] : null;
97 96
 	}
98 97
 
99 98
 
100
-	public static function getAssetProps($className, $property = null){
99
+	public static function getAssetProps($className, $property = null) {
101 100
 		$properties = self::assetInfo($className, 'properties');
102
-		if(!$properties){
101
+		if (!$properties) {
103 102
 			throw new DatastoreException("No Properties found for asset");
104 103
 		}
105
-		if($property){
104
+		if ($property) {
106 105
 			return isset($properties[$property]) ? $properties[$property] : null;
107 106
 		}
108 107
 		return $properties;
@@ -120,7 +119,7 @@  discard block
 block discarded – undo
120 119
 	{
121 120
 		$assets = array();
122 121
 		$datastoreAssets = config("datastore.assets");
123
-		foreach($datastoreAssets as $className){
122
+		foreach ($datastoreAssets as $className) {
124 123
 
125 124
 			$asset = self::getAssetItem($className);
126 125
 
@@ -128,20 +127,20 @@  discard block
 block discarded – undo
128 127
 				throw new DatastoreException('Only assets of type assets should be used ' . $className);
129 128
 			}
130 129
 
131
-			if(!$includeChildren && $asset['is_child']){
130
+			if (!$includeChildren && $asset['is_child']) {
132 131
 				continue;
133 132
 			}
134 133
 
135
-			if($asset['children'] && $includeChildren && !in_array($asset['children'], $datastoreAssets)){
136
-				$child =  self::getAssetItem($asset['children']);
134
+			if ($asset['children'] && $includeChildren && !in_array($asset['children'], $datastoreAssets)) {
135
+				$child = self::getAssetItem($asset['children']);
137 136
 				if (self::assetNamespace($child['class']) !== 'asset') {
138 137
 					throw new DatastoreException('Only assets of type assets should be used ' . $child['class']);
139 138
 				}
140 139
 
141 140
 				if ($grouped)
142 141
 				{
143
-					$mod			 = Helpers::getModule($child['class']);
144
-					$assets[strtolower($mod)][strtolower($child['shortname'])]	 = $child;
142
+					$mod = Helpers::getModule($child['class']);
143
+					$assets[strtolower($mod)][strtolower($child['shortname'])] = $child;
145 144
 				}
146 145
 				else
147 146
 				{
@@ -152,8 +151,8 @@  discard block
 block discarded – undo
152 151
 
153 152
 			if ($grouped)
154 153
 			{
155
-				$mod			 = Helpers::getModule($className);
156
-				$assets[strtolower($mod)][strtolower($asset['shortname'])]	 = $asset;
154
+				$mod = Helpers::getModule($className);
155
+				$assets[strtolower($mod)][strtolower($asset['shortname'])] = $asset;
157 156
 			}
158 157
 			else
159 158
 			{
@@ -164,9 +163,9 @@  discard block
 block discarded – undo
164 163
 		}
165 164
 
166 165
 		ksort($assets);
167
-		if($grouped){
168
-			foreach($assets as &$group){
169
-				uasort($group, function ($a , $b) {
166
+		if ($grouped) {
167
+			foreach ($assets as &$group) {
168
+				uasort($group, function($a, $b) {
170 169
 					return strcmp($a['name'], $b['name']);
171 170
 				});
172 171
 			}
@@ -186,7 +185,7 @@  discard block
 block discarded – undo
186 185
 		$parts = explode('\\', $class);
187 186
 		array_pop($parts);
188 187
 		$ns = '';
189
-		if(end($parts) !== 'Ams'){
188
+		if (end($parts) !== 'Ams') {
190 189
 			$ns = ucfirst(array_pop($parts));
191 190
 		}
192 191
 
@@ -211,10 +210,10 @@  discard block
 block discarded – undo
211 210
 	 * @return void
212 211
 	 * @author Craig Smith <[email protected]>
213 212
 	 */
214
-	public static function getPath($className){
213
+	public static function getPath($className) {
215 214
 		$mod = self::getModule($className);
216 215
 		$sn = Self::assetInfo($className, 'shortname');
217
-		return !empty($mod) ? strtolower($mod .'.' . $sn) : strtolower($sn);
216
+		return !empty($mod) ? strtolower($mod . '.' . $sn) : strtolower($sn);
218 217
 	}
219 218
 
220 219
 	/**
@@ -254,15 +253,15 @@  discard block
 block discarded – undo
254 253
 		}
255 254
 		$fp = fopen(FCPATH . $file, 'r');
256 255
 
257
-		$class	 = $buffer	 = '';
258
-		$i		 = 0;
256
+		$class = $buffer = '';
257
+		$i = 0;
259 258
 		while (!$class)
260 259
 		{
261 260
 			if (feof($fp))
262 261
 				break;
263 262
 
264
-			$buffer	 .= fread($fp, 512);
265
-			$tokens	 = token_get_all($buffer);
263
+			$buffer .= fread($fp, 512);
264
+			$tokens = token_get_all($buffer);
266 265
 
267 266
 			if (strpos($buffer, '{') === false)
268 267
 				continue;
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	 * @return bool
17 17
 	 */
18 18
 	public static function isAssocArray(array $array){
19
-        if (array() === $array) return false;
19
+        if (array() === $array) {
20
+        	return false;
21
+        }
20 22
         return array_keys($array) !== range(0, count($array) - 1);
21 23
 	}
22 24
 
@@ -142,8 +144,7 @@  discard block
 block discarded – undo
142 144
 				{
143 145
 					$mod			 = Helpers::getModule($child['class']);
144 146
 					$assets[strtolower($mod)][strtolower($child['shortname'])]	 = $child;
145
-				}
146
-				else
147
+				} else
147 148
 				{
148 149
 					$assets[strtolower($child['shortname'])] = $child;
149 150
 				}
@@ -154,8 +155,7 @@  discard block
 block discarded – undo
154 155
 			{
155 156
 				$mod			 = Helpers::getModule($className);
156 157
 				$assets[strtolower($mod)][strtolower($asset['shortname'])]	 = $asset;
157
-			}
158
-			else
158
+			} else
159 159
 			{
160 160
 				$assets[strtolower($asset['shortname'])] = $asset;
161 161
 			}
@@ -258,14 +258,16 @@  discard block
 block discarded – undo
258 258
 		$i		 = 0;
259 259
 		while (!$class)
260 260
 		{
261
-			if (feof($fp))
262
-				break;
261
+			if (feof($fp)) {
262
+							break;
263
+			}
263 264
 
264 265
 			$buffer	 .= fread($fp, 512);
265 266
 			$tokens	 = token_get_all($buffer);
266 267
 
267
-			if (strpos($buffer, '{') === false)
268
-				continue;
268
+			if (strpos($buffer, '{') === false) {
269
+							continue;
270
+			}
269 271
 
270 272
 			for (; $i < count($tokens); $i++)
271 273
 			{
Please login to merge, or discard this patch.