Test Setup Failed
Push — develop ( b46587...bd8dda )
by Craig
07:01
created
src/views/form/auto-complete-asset.blade.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 
4 4
 		{{ html()->label($data['name'])->class('col-md-2 form-control-label')->for($key) }}
5 5
 		<div class="col-md-10">
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
 			->attribute('id', $key)
15 15
 			->class('form-control autoinput');
16 16
 
17
-			if($data['required']){
17
+			if ($data['required']) {
18 18
 				$input = $input->required();
19 19
 			}
20 20
 
21
-			if($asset_classname){
21
+			if ($asset_classname) {
22 22
 				$name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']';
23
-			}else{
23
+			}else {
24 24
 				$name = $data['key'];
25 25
 			}
26 26
 
27
-			$name .= (isset($multiform) && $multiform) ? '[]' : '';?>
27
+			$name .= (isset($multiform) && $multiform) ? '[]' : ''; ?>
28 28
 
29 29
 			{{ $input->name($name)->value(old($name, !empty($data['value']) ? $data['value'] : NULL)) }}
30 30
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
 			if($asset_classname){
22 22
 				$name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']';
23
-			}else{
23
+			} else{
24 24
 				$name = $data['key'];
25 25
 			}
26 26
 
Please login to merge, or discard this patch.
src/views/form/auto-call-back-adder-asset.blade.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2
-	$user_labels = is_array($data['meta']) ?  $data['meta'] : [];
2
+	$user_labels = is_array($data['meta']) ? $data['meta'] : [];
3 3
 	$options = !empty($data['options']) ? $data['options'] : [];
4 4
 
5
-	$uid =  $data['key'] . $data['unique_id'];
6
-	if($asset_classname){
5
+	$uid = $data['key'] . $data['unique_id'];
6
+	if ($asset_classname) {
7 7
 		$name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']';
8 8
 		$nameMeta = "assetInjectionform[{$asset_classname}][{$data['unique_id']}][_meta_][{$data['key']}]";
9
-	}else{
9
+	}else {
10 10
 		$name = $data['key'];
11 11
 		$nameMeta = "_meta_[{$data['key']}]";
12 12
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 	if($asset_classname){
7 7
 		$name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']';
8 8
 		$nameMeta = "assetInjectionform[{$asset_classname}][{$data['unique_id']}][_meta_][{$data['key']}]";
9
-	}else{
9
+	} else{
10 10
 		$name = $data['key'];
11 11
 		$nameMeta = "_meta_[{$data['key']}]";
12 12
 	}
Please login to merge, or discard this patch.
src/views/frontend/ams/tabs-asset.blade.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
 			{{ $datastore->render('content') }}
10 10
 
11 11
 
12
-			<?php if($children):?>
12
+			<?php if ($children):?>
13 13
 			<nav>
14 14
 				<div class="nav nav-tabs" id="asset-tab" role="tablist">
15
-					<?php foreach($children as $idx => $child): ?>
16
-						<a class="nav-item nav-link<?php echo $idx === 0 ?' active' : '';?>" id="child-{{ $idx }}-tab" data-toggle="tab" href="#asset-{{ $idx }}" role="tab" aria-controls="asset-{{ $idx }}" aria-selected="true">{{ $child->prop('title') }}</a>
15
+					<?php foreach ($children as $idx => $child): ?>
16
+						<a class="nav-item nav-link<?php echo $idx === 0 ? ' active' : ''; ?>" id="child-{{ $idx }}-tab" data-toggle="tab" href="#asset-{{ $idx }}" role="tab" aria-controls="asset-{{ $idx }}" aria-selected="true">{{ $child->prop('title') }}</a>
17 17
 					<?php endforeach; ?>
18 18
 
19 19
 				</div>
20 20
 			</nav>
21 21
 				  <div class="tab-content" id="asset-tabContent">
22
-						<?php foreach($children as $idx => $child): ?>
22
+						<?php foreach ($children as $idx => $child): ?>
23 23
 						<div class="tab-pane fade<?php echo $idx === 0 ? ' show active' : ''; ?>" id="asset-{{ $idx }}" role="tabpanel" aria-labelledby="asset-{{ $idx }}-tab">
24 24
 							{{ $child->prop('content')}}
25 25
 						</div>
Please login to merge, or discard this patch.
src/Models/DatastoreDatastore.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
 
20 20
 
21 21
 	public function parent()
22
-    {
23
-        return $this->belongsTo(DatastoreModel::class, 'datastore2_id');
22
+	{
23
+		return $this->belongsTo(DatastoreModel::class, 'datastore2_id');
24 24
 	}
25 25
 
26 26
 	public function page()
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
 	}
30 30
 
31 31
 
32
-	public function datastore(){
32
+	public function datastore() {
33 33
 		return $this->belongsTo(DatastoreModel::class, 'datastore_id');
34 34
 	}
35 35
 
36
-	public function getItemAttribute(){
36
+	public function getItemAttribute() {
37 37
 		return $this->datastore->datastore;
38 38
 	}
39 39
 
40
-	public function prop($key){
40
+	public function prop($key) {
41 41
 		return $this->item->prop($key);
42 42
 	}
43 43
 
Please login to merge, or discard this patch.
src/Models/DatastorePages.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 		'asset'
20 20
 	];
21 21
 
22
-	public function getDatastoreAttribute(){
22
+	public function getDatastoreAttribute() {
23 23
 		return $this->id ? Datastore::getAssetById($this->asset) : null;
24 24
 	}
25 25
 
Please login to merge, or discard this patch.
src/Models/Traits/Attribute/DatastoreAttribute.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
 {
12 12
 
13 13
 	/**
14
-     * @return string
15
-     */
16
-    public function getEditButtonAttribute()
17
-    {
18
-        return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>';
14
+	 * @return string
15
+	 */
16
+	public function getEditButtonAttribute()
17
+	{
18
+		return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>';
19 19
 	}
20 20
 
21 21
 	  /**
22
-     * @return string
23
-     */
24
-    public function getDeleteButtonAttribute()
25
-    {
22
+	   * @return string
23
+	   */
24
+	public function getDeleteButtonAttribute()
25
+	{
26 26
 
27
-            return '<a href="'.route('admin.ams.content.destroy', $this).'"
27
+			return '<a href="'.route('admin.ams.content.destroy', $this).'"
28 28
 			data-method="delete"
29 29
 			data-trans-button-cancel="'.__('buttons.general.cancel').'"
30 30
 			data-trans-button-confirm="'.__('buttons.general.crud.delete').'"
31 31
 			data-trans-title="'.__('strings.backend.general.are_you_sure').'"
32 32
 			class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete').'"></i></a> ';
33 33
 
34
-    }
34
+	}
35 35
 
36
-	    /**
37
-     * @return string
38
-     */
39
-    public function getActionButtonsAttribute()
40
-    {
36
+		/**
37
+		 * @return string
38
+		 */
39
+	public function getActionButtonsAttribute()
40
+	{
41 41
 
42 42
 		if($this->id)
43 43
 		{
44
-        	return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'">
44
+			return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'">
45 45
 			'.$this->edit_button.'
46 46
 			'.$this->delete_button.'
47 47
 			</div>';
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function getEditButtonAttribute()
17 17
     {
18
-        return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>';
18
+        return '<a href="' . route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]) . '" data-toggle="tooltip" data-placement="top" title="' . __('buttons.general.crud.edit') . '" class="btn btn-primary"><i class="fas fa-edit"></i></a>';
19 19
 	}
20 20
 
21 21
 	  /**
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
     public function getDeleteButtonAttribute()
25 25
     {
26 26
 
27
-            return '<a href="'.route('admin.ams.content.destroy', $this).'"
27
+            return '<a href="' . route('admin.ams.content.destroy', $this) . '"
28 28
 			data-method="delete"
29
-			data-trans-button-cancel="'.__('buttons.general.cancel').'"
30
-			data-trans-button-confirm="'.__('buttons.general.crud.delete').'"
31
-			data-trans-title="'.__('strings.backend.general.are_you_sure').'"
32
-			class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete').'"></i></a> ';
29
+			data-trans-button-cancel="'.__('buttons.general.cancel') . '"
30
+			data-trans-button-confirm="'.__('buttons.general.crud.delete') . '"
31
+			data-trans-title="'.__('strings.backend.general.are_you_sure') . '"
32
+			class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete') . '"></i></a> ';
33 33
 
34 34
     }
35 35
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
     public function getActionButtonsAttribute()
40 40
     {
41 41
 
42
-		if($this->id)
42
+		if ($this->id)
43 43
 		{
44
-        	return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'">
45
-			'.$this->edit_button.'
46
-			'.$this->delete_button.'
44
+        	return '<div class="btn-group" role="group" aria-label="' . __('labels.backend.access.users.user_actions') . '">
45
+			'.$this->edit_button . '
46
+			'.$this->delete_button . '
47 47
 			</div>';
48 48
 		}
49 49
 	}
50 50
 
51
-	public function getContentPathAttribute(){
51
+	public function getContentPathAttribute() {
52 52
 		return Helpers::getPath($this->type);
53 53
 	}
54 54
 
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 
60 60
 	}*/
61 61
 
62
-	public function getDatastoreAttribute(){
63
-		if($this->id){
62
+	public function getDatastoreAttribute() {
63
+		if ($this->id) {
64 64
 			return DatastoreFactory::getAsset($this->type, $this->id);
65 65
 		}
66
-		if($this->type){
66
+		if ($this->type) {
67 67
 			return DatastoreFactory::dispence($this->type);
68 68
 		}
69 69
 	}
70 70
 
71
-	public function getRouteAttribute(){
71
+	public function getRouteAttribute() {
72 72
 		return $this->type ? Helpers::callStatic($this->type, 'route', [$this]) : null;
73 73
 	}
74 74
 
75
-	public function routeChild($parentSlug){
75
+	public function routeChild($parentSlug) {
76 76
 		return $this->type ? Helpers::callStatic($this->type, 'route', [$this, $parentSlug]) : null;
77 77
 
78 78
 	}
Please login to merge, or discard this patch.
src/Models/Datastore.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 	protected $table = 'datastore';
18 18
 
19 19
 	/**
20
-     * @var array
21
-     */
22
-    protected $dates = [
23
-        'start_date',
20
+	 * @var array
21
+	 */
22
+	protected $dates = [
23
+		'start_date',
24 24
 		'end_date',
25 25
 		'updated_at',
26 26
 		'created_at'
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
 	public function properties()
31
-    {
32
-        return $this->hasMany(Datastore::class);
33
-    }
31
+	{
32
+		return $this->hasMany(Datastore::class);
33
+	}
34 34
 
35 35
 	public function assets()
36 36
 	{
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 
54 54
 
55 55
 	/**
56
-     * The has Many Relationship
57
-     *
58
-     * @var array
59
-     */
60
-    public function comments()
61
-    {
62
-        return $this->hasMany(DatastoreComments::class)->whereNull('parent_id');
63
-    }
56
+	 * The has Many Relationship
57
+	 *
58
+	 * @var array
59
+	 */
60
+	public function comments()
61
+	{
62
+		return $this->hasMany(DatastoreComments::class)->whereNull('parent_id');
63
+	}
64 64
 
65 65
 
66 66
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@
 block discarded – undo
42 42
 		return $this->hasOne(DatastorePages::class, 'asset');
43 43
 	}
44 44
 
45
-	public function items(){
45
+	public function items() {
46 46
 		return $this->hasMany(DatastoreDatastore::class, 'datastore2_id', 'id');
47 47
 	}
48 48
 
49
-	public function parents(){
49
+	public function parents() {
50 50
 		return $this->hasManyThrough(self::class, DatastoreDatastore::class, 'datastore_id', 'id', 'id', 'datastore2_id');
51 51
 
52 52
 	}
Please login to merge, or discard this patch.
src/Models/DatastoreComments.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -9,35 +9,35 @@
 block discarded – undo
9 9
 class DatastoreComments extends Model
10 10
 {
11 11
 
12
-    use SoftDeletes;
13
-
14
-    protected $dates = ['deleted_at'];
15
-
16
-    /**
17
-     * The attributes that are mass assignable.
18
-     *
19
-     * @var array
20
-     */
21
-    protected $fillable = ['user_id', 'datastore_id', 'parent_id', 'body'];
22
-
23
-    /**
24
-     * The belongs to Relationship
25
-     *
26
-     * @var array
27
-     */
28
-    public function user()
29
-    {
30
-        return $this->belongsTo(User::class);
31
-    }
32
-
33
-    /**
34
-     * The has Many Relationship
35
-     *
36
-     * @var array
37
-     */
38
-    public function replies()
39
-    {
40
-        return $this->hasMany(DatastoreComments::class, 'parent_id');
41
-    }
12
+	use SoftDeletes;
13
+
14
+	protected $dates = ['deleted_at'];
15
+
16
+	/**
17
+	 * The attributes that are mass assignable.
18
+	 *
19
+	 * @var array
20
+	 */
21
+	protected $fillable = ['user_id', 'datastore_id', 'parent_id', 'body'];
22
+
23
+	/**
24
+	 * The belongs to Relationship
25
+	 *
26
+	 * @var array
27
+	 */
28
+	public function user()
29
+	{
30
+		return $this->belongsTo(User::class);
31
+	}
32
+
33
+	/**
34
+	 * The has Many Relationship
35
+	 *
36
+	 * @var array
37
+	 */
38
+	public function replies()
39
+	{
40
+		return $this->hasMany(DatastoreComments::class, 'parent_id');
41
+	}
42 42
 
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/Datastore.php 2 patches
Braces   +24 added lines, -47 removed lines patch added patch discarded remove patch
@@ -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
 	}
@@ -150,20 +150,16 @@  discard block
 block discarded – undo
150 150
 				if ($k == 'value_equals')
151 151
 				{
152 152
 					$this->__value_equals = $v;
153
-				}
154
-				else if ($k == 'status_equals')
153
+				} else if ($k == 'status_equals')
155 154
 				{
156 155
 					$this->__status_equals = $v;
157
-				}
158
-				else if ($k == 'start_date')
156
+				} else if ($k == 'start_date')
159 157
 				{
160 158
 					$this->__start_date = $v;
161
-				}
162
-				else if ($k == 'end_date')
159
+				} else if ($k == 'end_date')
163 160
 				{
164 161
 					$this->__end_date = $v;
165
-				}
166
-				else
162
+				} else
167 163
 				{
168 164
 					$this->$k = (isset($this->$k)) ? $this->$k : $v;
169 165
 				}
@@ -229,8 +225,7 @@  discard block
 block discarded – undo
229 225
 				}
230 226
 			}
231 227
 			//echo '<pre>$this->ownDatastore: '; print_r($this->ownDatastore); echo '</pre>'; die();
232
-		}
233
-		else
228
+		} else
234 229
 		{
235 230
 			// nope - net to create some datastore beans to represent our properties
236 231
 			foreach ($this->__asset->properties as $prop => $data)
@@ -306,13 +301,11 @@  discard block
 block discarded – undo
306 301
 					if (isset($this->__asset_properties[$prop]['temp']))
307 302
 					{
308 303
 						return $this->__asset_properties[$prop]['temp']->value;
309
-					}
310
-					else
304
+					} else
311 305
 					{
312 306
 						return $this->ownDatastore[$this->__asset_properties[$prop]]->value;
313 307
 					}
314
-				}
315
-				else
308
+				} else
316 309
 				{
317 310
 					return false;
318 311
 				}
@@ -332,44 +325,36 @@  discard block
 block discarded – undo
332 325
 						if ($this->__value_equals && $this->__value_equals == $prop)
333 326
 						{
334 327
 							$this->val(Helpers::callStatic($this->type, 'valueEquals', array($val)));
335
-						}
336
-						else if ($this->__status_equals && $this->__status_equals == $prop)
328
+						} else if ($this->__status_equals && $this->__status_equals == $prop)
337 329
 						{
338 330
 							$this->status($val);
339
-						}
340
-						else if ($this->__start_date && $this->__start_date == $prop)
331
+						} else if ($this->__start_date && $this->__start_date == $prop)
341 332
 						{
342 333
 							$this->start_date($val);
343
-						}
344
-						else if ($this->__end_date && $this->__end_date == $prop)
334
+						} else if ($this->__end_date && $this->__end_date == $prop)
345 335
 						{
346 336
 							$this->end_date($val);
347 337
 						}
348
-					}
349
-					else
338
+					} else
350 339
 					{
351 340
 						$this->ownDatastore[$this->__asset_properties[$prop]]->value = $val;
352 341
 						// if value equals is set, set it too
353 342
 						if ($this->__value_equals && $this->__value_equals == $prop)
354 343
 						{
355 344
 							$this->val(Helpers::callStatic($this->type, 'valueEquals', array($val)));
356
-						}
357
-						else if ($this->__status_equals && $this->__status_equals == $prop)
345
+						} else if ($this->__status_equals && $this->__status_equals == $prop)
358 346
 						{
359 347
 							$this->status($val);
360
-						}
361
-						else if ($this->__start_date && $this->__start_date == $prop)
348
+						} else if ($this->__start_date && $this->__start_date == $prop)
362 349
 						{
363 350
 							$this->start_date($val);
364
-						}
365
-						else if ($this->__end_date && $this->__end_date == $prop)
351
+						} else if ($this->__end_date && $this->__end_date == $prop)
366 352
 						{
367 353
 							$this->end_date($val);
368 354
 						}
369 355
 					}
370 356
 					return $this;
371
-				}
372
-				else
357
+				} else
373 358
 				{
374 359
 					throw new DatastoreException('The property "' . $prop . '" is not defined for the "' . $this->type . '" asset');
375 360
 				}
@@ -476,8 +461,7 @@  discard block
 block discarded – undo
476 461
 		if (isset($this->__asset_properties[$prop]['temp']))
477 462
 		{
478 463
 			return $this->__asset_properties[$prop]['temp']->getMarkup($template);
479
-		}
480
-		else
464
+		} else
481 465
 		{
482 466
 			if (isset($this->__asset_properties[$prop]))
483 467
 			{
@@ -555,8 +539,7 @@  discard block
 block discarded – undo
555 539
 		if (isset($this->__asset_properties[$prop]['temp']))
556 540
 		{
557 541
 			echo $this->__asset_properties[$prop]['temp']->getForm($template, $prop);
558
-		}
559
-		else
542
+		} else
560 543
 		{
561 544
 			if (isset($this->__asset_properties[$prop]))
562 545
 			{
@@ -578,8 +561,7 @@  discard block
 block discarded – undo
578 561
 		if (isset($this->__asset_properties[$prop]['temp']))
579 562
 		{
580 563
 			return $this->__asset_properties[$prop]['temp']->getForm($template, $_prop);
581
-		}
582
-		else
564
+		} else
583 565
 		{
584 566
 			if (isset($this->__asset_properties[$prop]))
585 567
 			{
@@ -614,8 +596,7 @@  discard block
 block discarded – undo
614 596
 			{
615 597
 				$output .= $this->returnForm($prop, false, $_prop);
616 598
 			}
617
-		}
618
-		else
599
+		} else
619 600
 		{
620 601
 			return $this->propGetForm($template, $_prop);
621 602
 		}
@@ -640,8 +621,7 @@  discard block
 block discarded – undo
640 621
 		if (isset($_prop['unique_id']))
641 622
 		{
642 623
 			$vars['_unique_id'] = $_prop['unique_id'];
643
-		}
644
-		else
624
+		} else
645 625
 		{
646 626
 			$vars['_unique_id'] = md5(uniqid(rand(), true)); //UUID ??
647 627
 		}
@@ -672,8 +652,7 @@  discard block
 block discarded – undo
672 652
 		if ($uid)
673 653
 		{
674 654
 			$unique_id = md5($uid);
675
-		}
676
-		else
655
+		} else
677 656
 		{
678 657
 			$unique_id = md5(uniqid(rand(), true));
679 658
 		}
@@ -687,8 +666,7 @@  discard block
 block discarded – undo
687 666
 				$xvars['unique_id']	 = $unique_id;
688 667
 
689 668
 				$output .= Helpers::callStatic($this->__asset_properties[$prop]['temp']->type, 'form', array($xvars, $this->type));
690
-			}
691
-			else
669
+			} else
692 670
 			{
693 671
 				if (isset($this->__asset_properties[$prop]))
694 672
 				{
@@ -919,8 +897,7 @@  discard block
 block discarded – undo
919 897
 								if (isset($this->__asset_properties[$pr]['temp']))
920 898
 								{
921 899
 									$this->__asset_properties[$pr]['temp']->meta = $pv;
922
-								}
923
-								else
900
+								} else
924 901
 								{
925 902
 									$this->ownDatastore[$this->__asset_properties[$pr]]->meta = $pv;
926 903
 								}
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 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
 		}
@@ -990,9 +990,9 @@  discard block
 block discarded – undo
990 990
 	 */
991 991
 	public function statusIsActive() :bool
992 992
 	{
993
-		if($this->__status_equals){
993
+		if ($this->__status_equals) {
994 994
 
995
-			if(!isset($this->__asset->properties[$this->__status_equals]['published'])){
995
+			if (!isset($this->__asset->properties[$this->__status_equals]['published'])) {
996 996
 				throw new DatastoreException("Statused assests need a published option in the asset definition");
997 997
 			}
998 998
 
Please login to merge, or discard this patch.