Passed
Push — master ( 0f5253...9796fd )
by Karel
08:02
created
src/Models/Redirect.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 class Redirect extends Eloquent
8 8
 {
9
-	/**
9
+    /**
10 10
      * The attributes that are mass assignable.
11 11
      *
12 12
      * @var array
Please login to merge, or discard this patch.
src/Models/Template.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 class Template extends Eloquent
8 8
 {
9 9
     public function pages(){
10
-    	return $this->hasMany('Chuckbe\Chuckcms\Models\Page');
10
+        return $this->hasMany('Chuckbe\Chuckcms\Models\Page');
11 11
     }
12 12
 
13 13
     protected $casts = [
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Template extends Eloquent
8 8
 {
9
-    public function pages(){
9
+    public function pages() {
10 10
     	return $this->hasMany('Chuckbe\Chuckcms\Models\Page');
11 11
     }
12 12
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
         $templates = $this->where('active', 1)->where('type', 'default')->get();
32 32
         $emailTemplates = [];
33 33
         foreach ($templates as $template) {
34
-            if(file_exists(base_path('vendor/'.$template->path.'/src/views/templates/'.$template->slug.'/mails'))){
35
-                $mailDir = array_slice(scandir(base_path('vendor/'.$template->path.'/src/views/templates/'.$template->slug.'/mails')), 2);
34
+            if (file_exists(base_path('vendor/' . $template->path . '/src/views/templates/' . $template->slug . '/mails'))) {
35
+                $mailDir = array_slice(scandir(base_path('vendor/' . $template->path . '/src/views/templates/' . $template->slug . '/mails')), 2);
36 36
                 if (count($mailDir) > 0) {
37 37
                     $emailTemplates[$template->slug]['hintpath'] = $template->hintpath;
38
-                    foreach($mailDir as $mdKey => $mdValue) {
38
+                    foreach ($mailDir as $mdKey => $mdValue) {
39 39
                         if (strpos($mdValue, '.blade.php')) {
40 40
                             $emailTemplates[$template->slug]['files'][] = str_replace('.blade.php', '', $mdValue);
41 41
                         }    
42 42
                     }
43 43
                 }
44 44
             }
45
-            if(file_exists(base_path('resources/views/vendor/'.$template->slug.'/templates/'.$template->slug.'/mails'))){
46
-                $mailDirVendor = array_slice(scandir(base_path('resources/views/vendor/'.$template->slug.'/templates/'.$template->slug.'/mails')), 2);
45
+            if (file_exists(base_path('resources/views/vendor/' . $template->slug . '/templates/' . $template->slug . '/mails'))) {
46
+                $mailDirVendor = array_slice(scandir(base_path('resources/views/vendor/' . $template->slug . '/templates/' . $template->slug . '/mails')), 2);
47 47
                 if (count($mailDirVendor) > 0) {
48 48
                     $emailTemplates[$template->slug]['hintpath'] = $template->hintpath;
49
-                    foreach($mailDirVendor as $mdKey => $mdValue) {
49
+                    foreach ($mailDirVendor as $mdKey => $mdValue) {
50 50
                         if (strpos($mdValue, '.blade.php')) {
51 51
                             $emailTemplates[$template->slug]['files'][] = str_replace('.blade.php', '', $mdValue);
52 52
                         }    
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
         $templates = $this->where('active', 1)->where('type', 'default')->get();
63 63
         $pageViews = [];
64 64
         foreach ($templates as $template) {
65
-            if(file_exists(base_path('vendor/'.$template->path.'/src/views/templates/'.$template->slug))){
66
-                $pageDir = array_slice(scandir(base_path('vendor/'.$template->path.'/src/views/templates/'.$template->slug)), 2);
65
+            if (file_exists(base_path('vendor/' . $template->path . '/src/views/templates/' . $template->slug))) {
66
+                $pageDir = array_slice(scandir(base_path('vendor/' . $template->path . '/src/views/templates/' . $template->slug)), 2);
67 67
                 if (count($pageDir) > 0) {
68 68
                     $pageViews[$template->slug]['hintpath'] = $template->hintpath;
69
-                    foreach($pageDir as $pdKey => $pdValue) {
69
+                    foreach ($pageDir as $pdKey => $pdValue) {
70 70
                         if (strpos($pdValue, '.blade.php')) {
71 71
                             $pageViews[$template->slug]['files'][] = str_replace('.blade.php', '', $pdValue);
72 72
                         }    
73 73
                     }
74 74
                 }
75 75
             }
76
-            if(file_exists(base_path('resources/views/vendor/'.$template->slug.'/templates/'.$template->slug))){
77
-                $pageDir = array_slice(scandir(base_path('resources/views/vendor/'.$template->slug.'/templates/'.$template->slug)), 2);
76
+            if (file_exists(base_path('resources/views/vendor/' . $template->slug . '/templates/' . $template->slug))) {
77
+                $pageDir = array_slice(scandir(base_path('resources/views/vendor/' . $template->slug . '/templates/' . $template->slug)), 2);
78 78
                 if (count($pageDir) > 0) {
79 79
                     $pageViews[$template->slug]['hintpath'] = $template->hintpath;
80
-                    foreach($pageDir as $pdKey => $pdValue) {
80
+                    foreach ($pageDir as $pdKey => $pdValue) {
81 81
                         if (strpos($pdValue, '.blade.php')) {
82 82
                             $pageViews[$template->slug]['files'][] = str_replace('.blade.php', '', $pdValue);
83 83
                         }    
Please login to merge, or discard this patch.
src/Models/Form.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Form extends Eloquent
10 10
 {
11
-	/**
11
+    /**
12 12
      * The attributes that are mass assignable.
13 13
      *
14 14
      * @var array
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $contentStart += $startDelimiterLength;
149 149
         $contentEnd = strpos($str, $endDelimiter, $contentStart);
150 150
         if (false === $contentEnd) {
151
-          break;
151
+            break;
152 152
         }
153 153
         $contents[] = substr($str, $contentStart, $contentEnd - $contentStart);
154 154
         $startFrom = $contentEnd + $endDelimiterLength;
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function getRules()
30 30
     {
31 31
         $rules = [];
32
-        foreach($this->form['fields'] as $fieldKey => $fieldValue){
32
+        foreach ($this->form['fields'] as $fieldKey => $fieldValue) {
33 33
             $rules[$fieldKey] = $fieldValue['validation'];
34 34
         }
35 35
         $rules['chuckpot'] = 'honeypot';
@@ -39,25 +39,25 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function storeEntry($input)
41 41
     {
42
-        if($this->form['actions']['store'] == 'true'){
42
+        if ($this->form['actions']['store'] == 'true') {
43 43
             $entry = new FormEntry();
44 44
             $entry->slug = $input->get('_form_slug');
45 45
             $json = [];
46
-            foreach($this->form['fields'] as $fieldKey => $fieldValue){
47
-                if($fieldValue['type'] !== 'file'){
46
+            foreach ($this->form['fields'] as $fieldKey => $fieldValue) {
47
+                if ($fieldValue['type'] !== 'file') {
48 48
                     $json[$fieldKey] = $input->get($fieldKey);
49 49
                 }
50 50
             }
51
-            if($this->form['files'] == 'true'){
52
-                foreach($this->form['fields'] as $fieldKey => $fieldValue){
53
-                    if($fieldValue['type'] == 'file'){
54
-                        if($input->hasFile($fieldKey)){
51
+            if ($this->form['files'] == 'true') {
52
+                foreach ($this->form['fields'] as $fieldKey => $fieldValue) {
53
+                    if ($fieldValue['type'] == 'file') {
54
+                        if ($input->hasFile($fieldKey)) {
55 55
                             $avatar = $input->file($fieldKey);
56 56
                             $filename = time() . '.' . $avatar->getClientOriginalExtension();
57 57
                             if (!file_exists(public_path('/files/uploads/'))) {
58 58
                                 mkdir(public_path('/files/uploads/'), 0777, true);
59 59
                             }
60
-                            $avatar->move( public_path('/files/uploads/'), $filename );
60
+                            $avatar->move(public_path('/files/uploads/'), $filename);
61 61
                             $filepath = '/files/uploads/' . $filename;
62 62
                         } else {
63 63
                             $filepath = null;
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
                 }
68 68
             }
69 69
             $entry->entry = $json;
70
-            if($entry->save()){
70
+            if ($entry->save()) {
71 71
                 return $entry;
72 72
             } else {
73 73
                 return 'error';
74 74
             }
75
-        }else {
75
+        } else {
76 76
             return 'pass';
77 77
         }
78 78
     }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     public function deleteById($id)
81 81
     {
82 82
         $form = $this->where('id', $id)->first();
83
-        if($form){
83
+        if ($form) {
84 84
             FormEntry::where('slug', $form->slug)->delete();
85
-            if($form->delete()){
85
+            if ($form->delete()) {
86 86
                 return 'success';
87 87
             } else {
88 88
                 return 'error';
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
     public function deleteBySlug($slug)
96 96
     {
97 97
         $form = $this->where('slug', $slug)->first();
98
-        if($form){
98
+        if ($form) {
99 99
             FormEntry::where('slug', $slug)->delete();
100
-            if($form->delete()){
100
+            if ($form->delete()) {
101 101
                 return 'success';
102 102
             } else {
103 103
                 return 'error';
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
     public function getMailData($sendData, $input, $entry)
111 111
     {
112 112
         $mailData = [];
113
-        foreach($sendData as $sendKey => $sendValue){
113
+        foreach ($sendData as $sendKey => $sendValue) {
114 114
             $findThis = $this->getResources($sendValue, '[', ']');
115
-            if(count($findThis) > 0){
115
+            if (count($findThis) > 0) {
116 116
             
117
-                foreach($findThis as $founded){
118
-                    if(strpos($founded, $input->get('_form_slug')) !== false) {
117
+                foreach ($findThis as $founded) {
118
+                    if (strpos($founded, $input->get('_form_slug')) !== false) {
119 119
                         $sendValue = str_replace('[' . $founded . ']', $input->get($founded), $sendValue);
120 120
                     }
121 121
                 }
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
             }
127 127
 
128 128
             $mailData[$sendKey] = $inputData;
129
-            if($sendKey == 'files' && $sendValue == 'true') {
129
+            if ($sendKey == 'files' && $sendValue == 'true') {
130 130
                 $mailData[$sendKey] = [];
131
-                foreach($this->form['fields'] as $fKey => $fValue) {
132
-                    if($fValue['type'] == 'file') {
131
+                foreach ($this->form['fields'] as $fKey => $fValue) {
132
+                    if ($fValue['type'] == 'file') {
133 133
                         $mailData[$sendKey][] = $entry->entry[$fKey];
134 134
                     }
135 135
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
             } else {
73 73
                 return 'error';
74 74
             }
75
-        }else {
75
+        } else {
76 76
             return 'pass';
77 77
         }
78 78
     }
Please login to merge, or discard this patch.
src/Models/Site.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 class Site extends Eloquent
8 8
 {
9
-	/**
9
+    /**
10 10
      * The attributes that are mass assignable.
11 11
      *
12 12
      * @var array
Please login to merge, or discard this patch.
src/Models/Resource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
         'json' => 'array',
11 11
     ];
12 12
 
13
-    protected $fillable = ['slug','json'];
13
+    protected $fillable = ['slug', 'json'];
14 14
 }
Please login to merge, or discard this patch.
src/Models/Repeater.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 class Repeater extends Eloquent
8 8
 {
9
-	/**
9
+    /**
10 10
      * The attributes that are mass assignable.
11 11
      *
12 12
      * @var array
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $json = $this->json;
31 31
         $split = explode('.', $var);
32 32
         foreach ($split as $value) {
33
-            if(array_key_exists($value, $json)) {
33
+            if (array_key_exists($value, $json)) {
34 34
                 $json = $json[$value];
35 35
             } else {
36 36
                 return null;
Please login to merge, or discard this patch.
src/Models/FormEntry.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 class FormEntry extends Eloquent
8 8
 {
9
-	/**
9
+    /**
10 10
      * The attributes that are mass assignable.
11 11
      *
12 12
      * @var array
Please login to merge, or discard this patch.
src/Models/MenuItems.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@
 block discarded – undo
7 7
 class MenuItems extends Eloquent
8 8
 {
9 9
 
10
-	protected $table = null;
10
+    protected $table = null;
11 11
 
12
-	public function __construct( array $attributes = [] ){
13
-    	//parent::construct( $attributes );
14
-    	$this->table = config('menu.table_prefix') . config('menu.table_name_items');
12
+    public function __construct( array $attributes = [] ){
13
+        //parent::construct( $attributes );
14
+        $this->table = config('menu.table_prefix') . config('menu.table_name_items');
15 15
     }
16 16
 
17 17
     public function getsons($id) {
18
-		return $this -> where("parent", $id) -> get();
19
-	}
20
-	public function getall($id) {
21
-		return $this -> where("menu", $id) -> orderBy("sort", "asc")->get();
22
-	}
18
+        return $this -> where("parent", $id) -> get();
19
+    }
20
+    public function getall($id) {
21
+        return $this -> where("menu", $id) -> orderBy("sort", "asc")->get();
22
+    }
23 23
 
24
-	public static function getNextSortRoot($menu){
24
+    public static function getNextSortRoot($menu){
25 25
         return self::where('menu',$menu)->max('sort') + 1;
26 26
     }
27 27
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	protected $table = null;
11 11
 
12
-	public function __construct( array $attributes = [] ){
12
+	public function __construct(array $attributes = []) {
13 13
     	//parent::construct( $attributes );
14 14
     	$this->table = config('menu.table_prefix') . config('menu.table_name_items');
15 15
     }
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 		return $this -> where("menu", $id) -> orderBy("sort", "asc")->get();
22 22
 	}
23 23
 
24
-	public static function getNextSortRoot($menu){
25
-        return self::where('menu',$menu)->max('sort') + 1;
24
+	public static function getNextSortRoot($menu) {
25
+        return self::where('menu', $menu)->max('sort') + 1;
26 26
     }
27 27
 
28 28
 }
Please login to merge, or discard this patch.
src/Providers/ChuckSiteServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
      */
27 27
     public function register()
28 28
     {
29
-        $this->app->singleton('ChuckSite',function(){
29
+        $this->app->singleton('ChuckSite', function() {
30 30
             $site = Site::first();
31
-            if($site == null) {
31
+            if ($site == null) {
32 32
                 throw new Exception('Whoops! No Site Defined...');
33 33
             }
34 34
             return new \Chuckbe\Chuckcms\Chuck\Accessors\Site($site, \App::make(SiteRepository::class));
Please login to merge, or discard this patch.