@@ -16,8 +16,8 @@ discard block |
||
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 |
||
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 |
@@ -15,7 +15,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -16,7 +16,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <div class="row form-group"> |
2 | - <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key'] ; ?> |
|
2 | + <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key']; ?> |
|
3 | 3 | {{ html()->label($data['name'])->class('col-md-2 form-control-label')->for($key) }} |
4 | 4 | <div class="col-md-10"> |
5 | 5 | |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | ->text() |
8 | 8 | ->attribute('id', $key) |
9 | 9 | ->class('form-control'); |
10 | - if($data['required']){ |
|
10 | + if ($data['required']) { |
|
11 | 11 | $input = $input->required(); |
12 | 12 | } |
13 | - if($asset_classname){ |
|
13 | + if ($asset_classname) { |
|
14 | 14 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
15 | - }else{ |
|
15 | + }else { |
|
16 | 16 | $name = $data['key']; |
17 | 17 | } |
18 | 18 | |
19 | - $name .= (isset($multiform) && $multiform) ? '[]' : '';?> |
|
19 | + $name .= (isset($multiform) && $multiform) ? '[]' : ''; ?> |
|
20 | 20 | |
21 | 21 | {{ $input->name($name)->value(old($name, !empty($data['value']) ? $data['value'] : NULL)) }} |
22 | 22 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | } |
14 | 14 | if($asset_classname){ |
15 | 15 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | $name = $data['key']; |
18 | 18 | } |
19 | 19 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <div class="row form-group"> |
2 | - <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key'] ; ?> |
|
2 | + <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key']; ?> |
|
3 | 3 | {{ html()->label($data['name'])->class('col-md-2 form-control-label')->for($key) }} |
4 | 4 | <div class="col-md-10"> |
5 | 5 | |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | ->text() |
8 | 8 | ->attribute('id', $key) |
9 | 9 | ->class('form-control'); |
10 | - if($data['required']){ |
|
10 | + if ($data['required']) { |
|
11 | 11 | $input = $input->required(); |
12 | 12 | } |
13 | - if($asset_classname){ |
|
13 | + if ($asset_classname) { |
|
14 | 14 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
15 | - }else{ |
|
15 | + }else { |
|
16 | 16 | $name = $data['key']; |
17 | 17 | } |
18 | 18 | |
19 | - $name .= (isset($multiform) && $multiform) ? '[]' : '';?> |
|
19 | + $name .= (isset($multiform) && $multiform) ? '[]' : ''; ?> |
|
20 | 20 | |
21 | 21 | {{ $input->name($name)->value(old($name, !empty($data['value']) ? $data['value'] : NULL)) }} |
22 | 22 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | } |
14 | 14 | if($asset_classname){ |
15 | 15 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | $name = $data['key']; |
18 | 18 | } |
19 | 19 |