Test Setup Failed
Push — master ( c9dde2...c96a31 )
by Craig
03:54
created
src/ServiceProvider.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 		], 'config');
20 20
 
21 21
 		//set our migratinos directory
22
-		$this->loadMigrationsFrom(__DIR__.'/Database/migrations');
22
+		$this->loadMigrationsFrom(__DIR__ . '/Database/migrations');
23 23
 
24 24
 		//Router
25 25
 		Route::middleware('web')
26
-			->group(__DIR__.'/routes.php');
26
+			->group(__DIR__ . '/routes.php');
27 27
 
28 28
 		//Breadcrumbs
29 29
 		if (class_exists('Breadcrumbs')) {
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 		}
32 32
 
33 33
 		//Translations
34
-		$this->loadTranslationsFrom(__DIR__.'/translations', 'phpsa-datastore');
34
+		$this->loadTranslationsFrom(__DIR__ . '/translations', 'phpsa-datastore');
35 35
 
36 36
 		$this->publishes([
37
-			__DIR__.'/translations' => resource_path('lang/vendor/phpsa-datastore'),
37
+			__DIR__ . '/translations' => resource_path('lang/vendor/phpsa-datastore'),
38 38
 			// Assets
39
-			__DIR__.'/resources/js' => public_path('vendor/phpsa-datastore/js'),
40
-			__DIR__.'/resources/css' => public_path('vendor/phpsa-datastore/css'),
41
-			__DIR__.'/resources/img' => public_path('vendor/phpsa-datastore/img'),
42
-			__DIR__.'/resources/thumbs' => public_path('vendor/phpsa-datastore/thumbs'),
39
+			__DIR__ . '/resources/js' => public_path('vendor/phpsa-datastore/js'),
40
+			__DIR__ . '/resources/css' => public_path('vendor/phpsa-datastore/css'),
41
+			__DIR__ . '/resources/img' => public_path('vendor/phpsa-datastore/img'),
42
+			__DIR__ . '/resources/thumbs' => public_path('vendor/phpsa-datastore/thumbs'),
43 43
 		]);
44 44
 
45 45
 		$this->registerBladeHelpers();
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
             'datastore'
53 53
         );
54 54
 
55
-        $this->app->bind('datastore', function () {
55
+        $this->app->bind('datastore', function() {
56 56
             return new Datastore();
57 57
 		});
58 58
 
59
-		$this->loadViewsFrom(__DIR__.'/views', 'phpsa-datastore');
59
+		$this->loadViewsFrom(__DIR__ . '/views', 'phpsa-datastore');
60 60
 	}
61 61
 
62 62
 
63
-	public function registerBladeHelpers(){
64
-		Blade::directive('datastoreAssetList', function ($grouped = false) {
63
+	public function registerBladeHelpers() {
64
+		Blade::directive('datastoreAssetList', function($grouped = false) {
65 65
             return Helpers::getAssetList($grouped, false);
66 66
 		});
67 67
 
68
-		Blade::directive('forDatastores', function () {
68
+		Blade::directive('forDatastores', function() {
69 69
 			return "<?php foreach(Phpsa\Datastore\Helpers::getAssetList(1, 0) as \$datastoreKey => \$datastoreData): ?>";
70 70
 		});
71 71
 
72
-		Blade::directive('endforDatastores', function () {
72
+		Blade::directive('endforDatastores', function() {
73 73
 			return "<?php endforeach; ?>";
74 74
 		});
75 75
 	}
Please login to merge, or discard this patch.
src/Asset.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @author Craig Smith <[email protected]>
34 34
  */
35
-class Asset{
35
+class Asset {
36 36
 
37 37
 	/**
38 38
 	 * Constants for the different asset types!
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 	const AUTOCALLBACKADDER  = AutoCallBackAdderAsset::class; // ajax powered autocomplete backed on a callback
45
-	const AUTOCALLBACK       = AutoCallBackAsset::class;      // ajax powered autocomplete backed on a callback
45
+	const AUTOCALLBACK       = AutoCallBackAsset::class; // ajax powered autocomplete backed on a callback
46 46
 	const AUTOCOMPLETE       = AutoCompleteAsset::class;
47 47
 	const BOOL               = BooleanAsset::class;
48 48
 	const DATEPICKER         = DatepickerAsset::class;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	const HTML               = HtmlAsset::class;
53 53
 	const IDENTITY           = IdentityAsset::class;
54 54
 	const IMG                = ImageAsset::class;
55
-	const METATEXT			 = MetatextAsset::class;
55
+	const METATEXT = MetatextAsset::class;
56 56
 	const STRING             = StringAsset::class;
57 57
 	const SUBHEADING         = SubHeadingAsset::class;
58 58
 	const TEXT               = TextAsset::class;
@@ -65,70 +65,70 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @var string
67 67
 	 */
68
-	public $help             = null;
68
+	public $help = null;
69 69
 
70 70
 	/**
71 71
 	 * Sets the required rule for a property
72 72
 	 *
73 73
 	 * @var bool
74 74
 	 */
75
-	public $required         = true;
75
+	public $required = true;
76 76
 
77 77
 	/**
78 78
 	 * which property is the actual value name for your asset - target one of the properties
79 79
 	 *
80 80
 	 * @var string
81 81
 	 */
82
-	public $value_equals     = null;
82
+	public $value_equals = null;
83 83
 
84 84
 	/**
85 85
 	 * Assets namespace, most often extended as an asset, however may be a property if adding a new input type.
86 86
 	 *
87 87
 	 * @var string
88 88
 	 */
89
-	public $namespace        = self::ASSET;
89
+	public $namespace = self::ASSET;
90 90
 
91 91
 	/**
92 92
 	 * Generally left alone unless overrideing to be a property then should have the instance class
93 93
 	 *
94 94
 	 * @var string
95 95
 	 */
96
-	public $type             = 'asset';
96
+	public $type = 'asset';
97 97
 
98 98
 	/**
99 99
 	 * Properties for thie asset - used to define the property assets to use to build up the asset
100 100
 	 *
101 101
 	 * @var array
102 102
 	 */
103
-	public $properties       = array();
103
+	public $properties = array();
104 104
 
105 105
 	/**
106 106
 	 * Public name - This is used to identify
107 107
 	 *
108 108
 	 * @var [type]
109 109
 	 */
110
-	public $name             = null;
110
+	public $name = null;
111 111
 
112 112
 	/**
113 113
 	 *  just a shortname to use instead of the full $name above
114 114
 	 *
115 115
 	 * @var string
116 116
 	 */
117
-	public $shortname        = null;
117
+	public $shortname = null;
118 118
 
119 119
 	/**
120 120
 	 * the max number of instances, 0 means unlimited - normally used for presets like the robots.txt
121 121
 	 *
122 122
 	 * @var int
123 123
 	 */
124
-	public $max_instances    = 0;
124
+	public $max_instances = 0;
125 125
 
126 126
 	/**
127 127
 	 * IE if private is true, we do not show the page link block... and idsable the meta
128 128
 	 * but if private is false, we show the page link and let meta decide for itself:
129 129
 	 * @var bool
130 130
 	 */
131
-	public $private          = false;
131
+	public $private = false;
132 132
 
133 133
 	/**
134 134
 	 * @deprecated Initial -
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @var [type]
138 138
 	 */
139
-	public $embedded         = null;
139
+	public $embedded = null;
140 140
 
141 141
 	/**
142 142
 	 * @deprecated version
143 143
 	 * * @TODO - Remove from here and from teh database object
144 144
 	 * @var [type]
145 145
 	 */
146
-	public $theme            = null;
146
+	public $theme = null;
147 147
 
148 148
 	/**
149 149
 	 * set to 'off' to turn it off
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @var [type]
159 159
 	 */
160
-	public $meta_keywords    = null;
160
+	public $meta_keywords = null;
161 161
 
162 162
 	/**
163 163
 	 * set to 'off' to turn it off
164 164
 	 *
165 165
 	 * @var [type]
166 166
 	 */
167
-	public $page_css         = null;
167
+	public $page_css = null;
168 168
 
169 169
 	/**
170 170
 	 * set to 'off' to turn it off
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 	public $page_js          = null;
175 175
 
176 176
 
177
-	public $options          = false;						// Options for the element -- should actually be removed from the database table most likely
178
-	public $status_equals    = null;                        // does the asset has a status linked to a prop
179
-	public $start_date       = null;                        // does the asset has a start date linked to a prop
180
-	public $end_date         = null;                        // does the asset has an end date linked to a prop
181
-	public $comment_equals   = null;                        // does the asset allow comments (linked to a specific property - similar to status_equals)
182
-	public $warning          = null;                        // field for warnings - deprected in favour of validation_messages
177
+	public $options          = false; // Options for the element -- should actually be removed from the database table most likely
178
+	public $status_equals    = null; // does the asset has a status linked to a prop
179
+	public $start_date       = null; // does the asset has a start date linked to a prop
180
+	public $end_date         = null; // does the asset has an end date linked to a prop
181
+	public $comment_equals   = null; // does the asset allow comments (linked to a specific property - similar to status_equals)
182
+	public $warning          = null; // field for warnings - deprected in favour of validation_messages
183 183
 	//public $published		= null;							//published status
184 184
 	//public $validation_messages = null					//validation messages
185 185
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	public $module           = null;
188 188
 	public $value            = null;
189 189
 	public $status           = null;
190
-	public $meta             = false;                       // ancillary meta info/data - similar to options
190
+	public $meta             = false; // ancillary meta info/data - similar to options
191 191
 	public $callback         = null;
192 192
 
193 193
 	/**
@@ -195,36 +195,36 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @var [type]
197 197
 	 */
198
-	public $children         = null;
198
+	public $children = null;
199 199
 
200 200
 	/**
201 201
 	 * Is this a child only asset? if marked as true does not auto display on menu options and can only be linked in as a child property to an asset.
202 202
 	 *
203 203
 	 * @var bool
204 204
 	 */
205
-	public $is_child         = false;
205
+	public $is_child = false;
206 206
 
207 207
 	/**
208 208
 	 * Asset that can be a child, ie an article belonging to a category
209 209
 	 *
210 210
 	 * @var [type]
211 211
 	 */
212
-	public $accept           = null;
212
+	public $accept = null;
213 213
 
214 214
 	/**
215 215
 	 * assets that can be children, a value means it is limited to that many children, -1 means unlimited
216 216
 	 * @TodO update this to better display with a selct / multiSelect null / 0 / -1 or any falsy is unlimited, else it is limited to that number...
217 217
 	 * @var [type]
218 218
 	 */
219
-	public $accept_limit     = null;
219
+	public $accept_limit = null;
220 220
 
221 221
 
222 222
 	/**
223 223
 	 * generate the route for this asset
224 224
 	 * Overwrite this in your own assets to generate your own route
225 225
 	 */
226
-	public static function route(DatastorePages $record, $route = null){
227
-		if(null === $route){
226
+	public static function route(DatastorePages $record, $route = null) {
227
+		if (null === $route) {
228 228
 			$route = 'frontend.ams.page.slug';
229 229
 		}
230 230
 		$page = $record->page;
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 	 *
256 256
 	 * @return array
257 257
 	 */
258
-	public static function getDefaultProperties(){
259
-		$obj	 = new ReflectionClass(get_called_class());
258
+	public static function getDefaultProperties() {
259
+		$obj = new ReflectionClass(get_called_class());
260 260
 		return $obj->getDefaultProperties();
261 261
 	}
262 262
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	public static function getValueLabel()
271 271
 	{
272 272
 		$props = self::getDefaultProperties();
273
-		if(empty($props['value_equals']) || empty($props['properties'][$props['value_equals']]['name'])){
273
+		if (empty($props['value_equals']) || empty($props['properties'][$props['value_equals']]['name'])) {
274 274
 			throw new DatastoreException("value_equals is a required parameter");
275 275
 		}
276 276
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		{
338 338
 			$args['unique_id'] = uniqid();
339 339
 		}
340
-		$data['data']			 = $args;
340
+		$data['data'] = $args;
341 341
 		$data['asset_classname'] = $injectedform;
342 342
 		return View::make($template, $data)->render();
343 343
 	}
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 	public static function render($args = [], $params = false)
354 354
 	{
355 355
 
356
-		if(is_string($params)){
356
+		if (is_string($params)) {
357 357
 			$template = $params;
358
-		} else {
358
+		}else {
359 359
 			$template = is_array($params) && !empty($params['view']) ? $params['view'] : self::getAssetView();
360 360
 		}
361 361
 
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @return void
396 396
 	 * @author Craig Smith <[email protected]>
397 397
 	 */
398
-	public static function getPath($className = null){
399
-		if(null === $className) {
398
+	public static function getPath($className = null) {
399
+		if (null === $className) {
400 400
 			$className = get_called_class();
401 401
 		}
402 402
 		return Helpers::getPath($className);
Please login to merge, or discard this patch.
src/Datastore.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 use ReflectionClass;
16 16
 use ReflectionProperty;
17 17
 
18
-class Datastore{
18
+class Datastore {
19 19
 
20
-	protected $__asset				 = false;
21
-	protected $__asset_properties	 = false;
22
-	protected $__value_equals		 = false;
23
-	protected $__status_equals		 = false;
24
-	protected $__start_date			 = null;
25
-	protected $__end_date			 = null;
20
+	protected $__asset = false;
21
+	protected $__asset_properties = false;
22
+	protected $__value_equals = false;
23
+	protected $__status_equals = false;
24
+	protected $__start_date = null;
25
+	protected $__end_date = null;
26 26
 
27 27
 	/**
28 28
 	 *
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 		{
56 56
 			$this->__model = DatastoreModel::findOrFail($id);
57 57
 
58
-			if(!$this->__model){
58
+			if (!$this->__model) {
59 59
 				//could not load <div class="">thr</div>
60 60
 				throw new DatastoreException("Record not found");
61 61
 			}
62 62
 
63 63
 			foreach ($this->__model->toArray() as $k => $v)
64 64
 			{
65
-				if($k === 'options' || $k === 'meta'){
65
+				if ($k === 'options' || $k === 'meta') {
66 66
 					$v = json_decode($v, true);
67 67
 				}
68
-				if(in_array($k, ['created_at','updated_at','date_start','date_end'])){
68
+				if (in_array($k, ['created_at', 'updated_at', 'date_start', 'date_end'])) {
69 69
 					$v = Carbon::parse($v);
70 70
 				}
71 71
 				$this->{$k} = $v;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 					$this->ownDatastore[] = self::getAssetById($ds->id);
81 81
 				}
82 82
 			}
83
-		}else{
83
+		}else {
84 84
 			$this->__model = new DatastoreModel();
85 85
 		}
86 86
 	}
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return void
94 94
 	 */
95
-	public static function getAssetById($id){
95
+	public static function getAssetById($id) {
96 96
 		$datastore = new self($id);
97 97
 		$datastore->setAssetType($datastore->type);
98 98
 		return $datastore;
99 99
 	}
100 100
 
101
-	public static function find($id){
102
-		if(!is_array($id)){
103
-			if(is_object($id)){
101
+	public static function find($id) {
102
+		if (!is_array($id)) {
103
+			if (is_object($id)) {
104 104
 				return self::getAssetById($id->id);
105 105
 			}
106 106
 			return self::getAssetById($id);
107 107
 		}
108 108
 
109
-		if(is_array($id)){
109
+		if (is_array($id)) {
110 110
 			$assets = [];
111
-			foreach($id as $i){
111
+			foreach ($id as $i) {
112 112
 				$assets[] = self::getAssetById($i);
113 113
 			}
114 114
 			return $assets;
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 
132
-	public function ownDatastore(){
133
-		return ($this->ownDatastore)?$this->ownDatastore: array();
132
+	public function ownDatastore() {
133
+		return ($this->ownDatastore) ? $this->ownDatastore : array();
134 134
 	}
135 135
 
136 136
 	/**
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 
192 192
 			if (!isset($this->__asset_properties[$p]))
193 193
 			{
194
-				$this->__asset_properties[$p]['temp']					 = self::getAsset($this->__asset->properties[$p]['type']);
194
+				$this->__asset_properties[$p]['temp'] = self::getAsset($this->__asset->properties[$p]['type']);
195 195
 				$this->__asset_properties[$p]['temp']->name				 = (isset($this->__asset->properties[$p]['name'])) ? $this->__asset->properties[$p]['name'] : null;
196
-				$this->__asset_properties[$p]['temp']->key				 = $p;
196
+				$this->__asset_properties[$p]['temp']->key = $p;
197 197
 				$this->__asset_properties[$p]['temp']->private			 = (isset($this->__asset->properties[$p]['private'])) ? $this->__asset->properties[$p]['private'] : false; // accessibility
198 198
 				$this->__asset_properties[$p]['temp']->value			 = (isset($this->__asset->properties[$p]['value'])) ? $this->__asset->properties[$p]['value'] : null; // the actual value of the property
199 199
 				$this->__asset_properties[$p]['temp']->options			 = (isset($this->__asset->properties[$p]['options'])) ? $this->__asset->properties[$p]['options'] : null; // additional options specific to the property
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 				$this->__asset_properties[$p]['temp']->help				 = (isset($this->__asset->properties[$p]['help'])) ? $this->__asset->properties[$p]['help'] : null; // additional options specific to the property
203 203
 				$this->__asset_properties[$p]['temp']->required			 = (isset($this->__asset->properties[$p]['required'])) ? $this->__asset->properties[$p]['required'] : true; // is the property required
204 204
 				$this->__asset_properties[$p]['temp']->limit			 = (isset($this->__asset->properties[$p]['limit'])) ? $this->__asset->properties[$p]['limit'] : null; // additional options specific to the property
205
-				$this->__asset_properties[$p]['temp']->warning			 = (isset($this->__asset->properties[$p]['warning'])) ? $this->__asset->properties[$p]['warning'] : null; // additional options specific to the property
206
-				$this->__asset_properties[$p]['temp']->max_instances	 = (isset($this->__asset->properties[$p]['max_instances'])) ? $this->__asset->properties[$p]['max_instances'] : 0; // there can be only one
205
+				$this->__asset_properties[$p]['temp']->warning = (isset($this->__asset->properties[$p]['warning'])) ? $this->__asset->properties[$p]['warning'] : null; // additional options specific to the property
206
+				$this->__asset_properties[$p]['temp']->max_instances = (isset($this->__asset->properties[$p]['max_instances'])) ? $this->__asset->properties[$p]['max_instances'] : 0; // there can be only one
207 207
 			}
208 208
 		}
209 209
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 					$this->__asset_properties[$each->key]	 = array('temp' => $each);
223 223
 					@$this->ownDatastore[$idx]->required		 = (isset($this->__asset->properties[$each->key]['required'])) ? $this->__asset->properties[$each->key]['required'] : true;
224 224
 					@$this->ownDatastore[$idx]->limit		 = (isset($this->__asset->properties[$each->key]['limit'])) ? $this->__asset->properties[$each->key]['limit'] : null;
225
-					@$this->ownDatastore[$idx]->warning		 = (isset($this->__asset->properties[$each->key]['warning'])) ? $this->__asset->properties[$each->key]['warning'] : null;
225
+					@$this->ownDatastore[$idx]->warning = (isset($this->__asset->properties[$each->key]['warning'])) ? $this->__asset->properties[$each->key]['warning'] : null;
226 226
 					@$this->ownDatastore[$idx]->help			 = (isset($this->__asset->properties[$each->key]['help'])) ? $this->__asset->properties[$each->key]['help'] : null;
227 227
 					@$this->ownDatastore[$idx]->max_instances = (isset($this->__asset->properties[$each->key]['max_instances'])) ? $this->__asset->properties[$each->key]['max_instances'] : 0;
228 228
 					@$this->ownDatastore[$idx]->options = (isset($this->__asset->properties[$each->key]['options'])) ? $this->__asset->properties[$each->key]['options'] : null;
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
 			{
238 238
 
239 239
 				// we need to create a temporary new bean to store new data
240
-				$this->__asset_properties[$prop]['temp']				 = self::getAsset($this->__asset->properties[$prop]['type']);
241
-				$this->__asset_properties[$prop]['temp']->name			 = (isset($this->__asset->properties[$prop]['name'])) ? $this->__asset->properties[$prop]['name'] : null;
242
-				$this->__asset_properties[$prop]['temp']->key			 = $prop;
240
+				$this->__asset_properties[$prop]['temp'] = self::getAsset($this->__asset->properties[$prop]['type']);
241
+				$this->__asset_properties[$prop]['temp']->name = (isset($this->__asset->properties[$prop]['name'])) ? $this->__asset->properties[$prop]['name'] : null;
242
+				$this->__asset_properties[$prop]['temp']->key = $prop;
243 243
 				$this->__asset_properties[$prop]['temp']->private		 = (isset($this->__asset->properties[$prop]['private'])) ? $this->__asset->properties[$prop]['private'] : false; // accessibility
244
-				$this->__asset_properties[$prop]['temp']->value			 = (isset($this->__asset->properties[$prop]['value'])) ? $this->__asset->properties[$prop]['value'] : null; // the actual value of the property
244
+				$this->__asset_properties[$prop]['temp']->value = (isset($this->__asset->properties[$prop]['value'])) ? $this->__asset->properties[$prop]['value'] : null; // the actual value of the property
245 245
 				$this->__asset_properties[$prop]['temp']->options		 = (isset($this->__asset->properties[$prop]['options'])) ? $this->__asset->properties[$prop]['options'] : null; // additional options specific to the property
246 246
 				$this->__asset_properties[$prop]['temp']->callback		 = (isset($this->__asset->properties[$prop]['callback'])) ? $this->__asset->properties[$prop]['callback'] : null; // additional options specific to the property
247 247
 				$this->__asset_properties[$prop]['temp']->meta			 = (isset($this->__asset->properties[$prop]['meta'])) ? $this->__asset->properties[$prop]['meta'] : null; // additional options specific to the property
248 248
 				$this->__asset_properties[$prop]['temp']->help			 = (isset($this->__asset->properties[$prop]['help'])) ? $this->__asset->properties[$prop]['help'] : null; // additional options specific to the property
249 249
 				$this->__asset_properties[$prop]['temp']->required		 = (isset($this->__asset->properties[$prop]['required'])) ? $this->__asset->properties[$prop]['required'] : true; // is the property required
250
-				$this->__asset_properties[$prop]['temp']->limit			 = (isset($this->__asset->properties[$prop]['limit'])) ? $this->__asset->properties[$prop]['limit'] : null; // additional options specific to the property
251
-				$this->__asset_properties[$prop]['temp']->warning		 = (isset($this->__asset->properties[$prop]['warning'])) ? $this->__asset->properties[$prop]['warning'] : null; // additional options specific to the property
252
-				$this->__asset_properties[$prop]['temp']->max_instances	 = (isset($this->__asset->properties[$prop]['max_instances'])) ? $this->__asset->properties[$prop]['max_instances'] : null; // there can be only one
250
+				$this->__asset_properties[$prop]['temp']->limit = (isset($this->__asset->properties[$prop]['limit'])) ? $this->__asset->properties[$prop]['limit'] : null; // additional options specific to the property
251
+				$this->__asset_properties[$prop]['temp']->warning = (isset($this->__asset->properties[$prop]['warning'])) ? $this->__asset->properties[$prop]['warning'] : null; // additional options specific to the property
252
+				$this->__asset_properties[$prop]['temp']->max_instances = (isset($this->__asset->properties[$prop]['max_instances'])) ? $this->__asset->properties[$prop]['max_instances'] : null; // there can be only one
253 253
 
254 254
 			}
255 255
 		}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public static function getKey($string)
266 266
 	{
267
-		$new	 = Helpers::splitByCaps($string);
267
+		$new = Helpers::splitByCaps($string);
268 268
 		$explode = explode(' ', $new);
269 269
 
270 270
 		if (isset($explode[0]) && $explode[0] == 'Ams')
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 				break;
320 320
 
321 321
 			case 2:
322
-				$prop	 = func_get_arg(0);
323
-				$val	 = func_get_arg(1);
322
+				$prop = func_get_arg(0);
323
+				$val = func_get_arg(1);
324 324
 				if (isset($this->__asset_properties[$prop]))
325 325
 				{
326 326
 					// check whether this is new or existing
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 				break;
397 397
 
398 398
 			default:
399
-				$val		 = func_get_arg(0);
399
+				$val = func_get_arg(0);
400 400
 				$this->value = $val;
401 401
 		}
402 402
 	}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
 		foreach ($props as $prop)
424 424
 		{
425
-			if (!in_array($prop->name, array('status_equals', 'properties','help','value_equals')))
425
+			if (!in_array($prop->name, array('status_equals', 'properties', 'help', 'value_equals')))
426 426
 			{
427 427
 				$record->{$prop->name} = isset($asset->{$prop->name}) ? $asset->{$prop->name} : NULL;
428 428
 			}
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
 
431 431
 		if ($asset->__status_equals)
432 432
 		{
433
-			$record->status = isset($record->{$asset->__status_equals})? $record->{$asset->__status_equals} : $this->prop($this->__status_equals);
433
+			$record->status = isset($record->{$asset->__status_equals}) ? $record->{$asset->__status_equals} : $this->prop($this->__status_equals);
434 434
 		}
435 435
 		if ($asset->__start_date)
436 436
 		{
437
-			$record->start_date = isset($record->{$asset->__start_date})? $record->{$asset->__start_date} : $this->prop($this->__start_date);
437
+			$record->start_date = isset($record->{$asset->__start_date}) ? $record->{$asset->__start_date} : $this->prop($this->__start_date);
438 438
 		}
439 439
 		if ($asset->__end_date)
440 440
 		{
441
-			$record->end_date = isset($record->{$asset->__end_date})? $record->{$asset->__end_date} : $this->prop($this->__end_date);
441
+			$record->end_date = isset($record->{$asset->__end_date}) ? $record->{$asset->__end_date} : $this->prop($this->__end_date);
442 442
 		}
443 443
 
444 444
 		$record->options = json_encode($record->options);
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	public function getMarkup($template = false)
495 495
 	{
496 496
 
497
-		$vars				 = $this->export();
498
-		$vars['_unique_id']	 = uniqid();
497
+		$vars = $this->export();
498
+		$vars['_unique_id'] = uniqid();
499 499
 
500 500
 		// we also want to know what asset this property belongs to
501 501
 		$output = Helpers::callStatic($this->type, 'render', array($vars, $template));
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 		if ($this->__status_equals)
529 529
 		{
530 530
 
531
-			$data['status'] = isset($data[$this->__status_equals])? $data[$this->__status_equals] : $this->prop($this->__status_equals);
531
+			$data['status'] = isset($data[$this->__status_equals]) ? $data[$this->__status_equals] : $this->prop($this->__status_equals);
532 532
 		}
533 533
 		if ($this->__start_date)
534 534
 		{
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 		}
590 590
 	}
591 591
 
592
-	public function getFieldValues(){
592
+	public function getFieldValues() {
593 593
 		$data = [];
594
-		foreach(array_keys($this->__asset->properties) as $key){
594
+		foreach (array_keys($this->__asset->properties) as $key) {
595 595
 			$data[$key] = $this->prop($key);
596 596
 		}
597 597
 		return $data;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 		return $output;
656 656
 	}
657 657
 
658
-	public function propGetValue($prop){
658
+	public function propGetValue($prop) {
659 659
 		dd($prop);
660 660
 	}
661 661
 
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 		{
684 684
 			if (isset($this->__asset_properties[$prop]['temp']))
685 685
 			{
686
-				$xvars				 = $this->__asset_properties[$prop]['temp']->export();
687
-				$xvars['unique_id']	 = $unique_id;
686
+				$xvars = $this->__asset_properties[$prop]['temp']->export();
687
+				$xvars['unique_id'] = $unique_id;
688 688
 
689 689
 				$output .= Helpers::callStatic($this->__asset_properties[$prop]['temp']->type, 'form', array($xvars, $this->type));
690 690
 			}
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 			{
693 693
 				if (isset($this->__asset_properties[$prop]))
694 694
 				{
695
-					$xvars				 = $this->ownDatastore[$this->__asset_properties[$prop]]->export();
696
-					$xvars['unique_id']	 = $unique_id;
695
+					$xvars = $this->ownDatastore[$this->__asset_properties[$prop]]->export();
696
+					$xvars['unique_id'] = $unique_id;
697 697
 
698 698
 					$output .= Helpers::callStatic($this->ownDatastore[$this->__asset_properties[$prop]]->type, 'form', array($xvars, $this->type));
699 699
 				}
@@ -709,8 +709,8 @@  discard block
 block discarded – undo
709 709
 		return $output;
710 710
 	}
711 711
 
712
-	public function hasMetadataForm(){
713
-		if ($this->namespace == 'asset' && !$this->is_child){
712
+	public function hasMetadataForm() {
713
+		if ($this->namespace == 'asset' && !$this->is_child) {
714 714
 			return ($this->meta_description !== 'off' || $this->meta_keywords !== 'off');
715 715
 		}
716 716
 		return false;
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
 		return $output;
758 758
 	}
759 759
 
760
-	public function hasDeveloperForm(){
761
-		if ($this->namespace == 'asset' && !$this->is_child){
760
+	public function hasDeveloperForm() {
761
+		if ($this->namespace == 'asset' && !$this->is_child) {
762 762
 			return ($this->page_js !== 'off' || $this->page_css !== 'off');
763 763
 		}
764 764
 		return false;
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 				$output .= Helpers::callStatic(ASSET::METATEXT, 'form', array($data, 'metatext'));
787 787
 			}
788 788
 
789
-			if ($this->page_js !== 'off' )
789
+			if ($this->page_js !== 'off')
790 790
 			{
791 791
 				$data = array(
792 792
 					'name'		 => 'Custom JS',
@@ -817,11 +817,11 @@  discard block
 block discarded – undo
817 817
 		$messages = array();
818 818
 		foreach ($this->__asset->properties as $key => $property)
819 819
 		{
820
-			if($property['type'] !== \Phpsa\Datastore\Ams\AutoCallBackAdderAsset::class && (empty($property['required']) || $property['required'] === true) )
820
+			if ($property['type'] !== \Phpsa\Datastore\Ams\AutoCallBackAdderAsset::class && (empty($property['required']) || $property['required'] === true))
821 821
 			{
822 822
 				$rules = empty($property['validation_rules']) ? 'required' : $property['validation_rules'];
823
-				if(!empty($property['validation_messages'])){
824
-					if(is_string($property['validation_messages'])){
823
+				if (!empty($property['validation_messages'])) {
824
+					if (is_string($property['validation_messages'])) {
825 825
 						$messages[$key . '.required'] = $property['validation_messages'];
826 826
 					}
827 827
 				}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		{
835 835
 			$validator = Validator::make($request, $config, $messages);
836 836
 
837
-			if($validator->fails()){
837
+			if ($validator->fails()) {
838 838
 				throw new ValidationException($validator);
839 839
 			}
840 840
 		}
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return void
947 947
 	 */
948
-	public function statusOptions(){
948
+	public function statusOptions() {
949 949
 		return ($this->__status_equals) ? $this->__asset_properties[$this->__status_equals]['temp']->options : false;
950 950
 	}
951 951
 
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	 *
955 955
 	 * @return void
956 956
 	 */
957
-	public function getStatusValue(){
957
+	public function getStatusValue() {
958 958
 		$options = $this->statusOptions();
959 959
 		return ($options && Helpers::isAssocArray($options) && isset($options[$this->status])) ? $options[$this->status] : $this->status;
960 960
 	}
@@ -986,10 +986,10 @@  discard block
 block discarded – undo
986 986
 	 *
987 987
 	 * @return bool
988 988
 	 */
989
-	public function statusIsActive(){
990
-		if($this->__status_equals){
989
+	public function statusIsActive() {
990
+		if ($this->__status_equals) {
991 991
 
992
-			if(!isset($this->__asset->properties[$this->__status_equals]['published'])){
992
+			if (!isset($this->__asset->properties[$this->__status_equals]['published'])) {
993 993
 				throw new DatastoreException("Statused assests need a published option in the asset definition");
994 994
 			}
995 995
 
@@ -1029,10 +1029,10 @@  discard block
 block discarded – undo
1029 1029
 	 * @deprecated ???
1030 1030
 	 * @return void
1031 1031
 	 */
1032
-	public static function getAssetByTypeValue($type,$value)
1032
+	public static function getAssetByTypeValue($type, $value)
1033 1033
 	{
1034
-		$asset = DatastoreModel::where('type' , $type)->where('value', $value)->where('namespace', 'asset')->orderBy('modified', 'desc')->first();
1035
-		if($asset){
1034
+		$asset = DatastoreModel::where('type', $type)->where('value', $value)->where('namespace', 'asset')->orderBy('modified', 'desc')->first();
1035
+		if ($asset) {
1036 1036
 			return self::getAsset($asset->type, $asset->id);
1037 1037
 		}
1038 1038
 		return false;
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 	 *
1044 1044
 	 * @return void
1045 1045
 	 */
1046
-	public function urlPath(){
1046
+	public function urlPath() {
1047 1047
 		return Helpers::getPath($this->type);
1048 1048
 	}
1049 1049
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	 *
1057 1057
 	 * @return void
1058 1058
 	 */
1059
-	public function getViewName($prefix = 'frontend.ams'){
1059
+	public function getViewName($prefix = 'frontend.ams') {
1060 1060
 		return $this->__asset::getAssetView($prefix);
1061 1061
 	}
1062 1062
 
@@ -1067,11 +1067,11 @@  discard block
 block discarded – undo
1067 1067
 	 *
1068 1068
 	 * @return void
1069 1069
 	 */
1070
-	public function __get($name){
1070
+	public function __get($name) {
1071 1071
 		return $this->propExists($name) ? $this->prop($name) : $this->__model->{$name};
1072 1072
 	}
1073 1073
 
1074
-	public function getTitleField(){
1074
+	public function getTitleField() {
1075 1075
 		return $this->__value_equals;
1076 1076
 	}
1077 1077
 
Please login to merge, or discard this patch.