Completed
Push — master ( 370ac4...071b30 )
by CodexShaper
15:05
created
src/Composer/ComposerScripts.php 2 patches
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -27,150 +27,150 @@
 block discarded – undo
27 27
  */
28 28
 class ComposerScripts {
29 29
 
30
-	/**
31
-	 * Handle the post-install Composer event.
32
-	 *
33
-	 * @param  \Composer\Script\Event $event The composer event.
34
-	 * @return void
35
-	 */
36
-	public static function post_install( Event $event ) {
37
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
38
-	}
39
-
40
-	/**
41
-	 * Handle the post-update Composer event.
42
-	 *
43
-	 * @param  \Composer\Script\Event $event The composer event.
44
-	 * @return void
45
-	 */
46
-	public static function post_update( Event $event ) {
47
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
48
-	}
49
-
50
-	/**
51
-	 * Handle the post-autoload-dump Composer event.
52
-	 *
53
-	 * @param  \Composer\Script\Event $event The composer event.
54
-	 * @return void
55
-	 */
56
-	public static function post_autoload_dump( Event $event ) {
57
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
58
-
59
-		$dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
60
-		$root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
61
-
62
-		$vendor_name         = strtolower( basename( $root ) );
63
-		$partials            = explode( '-', $vendor_name );
64
-		$camel_case_partials = array();
65
-		foreach ( $partials as $partial ) {
66
-			$camel_case_partials[] = ucfirst( strtolower( $partial ) );
67
-		}
68
-		$camel_case = implode( '_', $camel_case_partials );
69
-		$snake_case = implode( '_', $partials );
70
-
71
-		$files = array(
72
-			'/admin/class-wpb-admin.php',
73
-			'/admin/class-wpb-admin-menu.php',
74
-			'/admin/class-wpb-admin-submenu.php',
75
-			'/admin/partials/wpb-admin-display.php',
76
-			'/admin/css/wpb-admin.css',
77
-			'/admin/js/wpb-admin.js',
78
-			'/app/User.php',
79
-			'/app/Post.php',
80
-			'/app/Http/Controllers/ProductController.php',
81
-			'/app/Http/Middleware/AuthMiddleware.php',
82
-			'/app/Http/Middleware/VerifyCsrfToken.php',
83
-			'/app/Http/Kernel.php',
84
-			'/app/Exceptions/Handler.php',
85
-			'/bootstrap/app.php',
86
-			'/database/migrations/class-create-customers-table.php',
87
-			'/database/seeds/class-customers-table.php',
88
-			'/includes/class-wpb-activator.php',
89
-			'/includes/class-wpb-deactivator.php',
90
-			'/includes/class-wpb-i18n.php',
91
-			'/includes/class-wpb-loader.php',
92
-			'/includes/class-wpb.php',
93
-			'/public/class-wpb-public.php',
94
-			'/public/partials/wpb-public-display.php',
95
-			'/public/css/wpb-public.css',
96
-			'/public/js/wpb-public.js',
97
-			'/resources/js/admin/main.js',
98
-			'/resources/js/frontend/main.js',
99
-			'/resources/js/spa/main.js',
100
-			'/routes/web.php',
101
-			'/routes/api.php',
102
-			'/src/Database/Eloquent/Scopes/PostAuthorScope.php',
103
-			'/src/Database/Eloquent/Scopes/PostStatusScope.php',
104
-			'/src/Database/Eloquent/Scopes/PostTypeScope.php',
105
-			'/src/Database/DB.php',
106
-			'/src/Exceptions/Handler.php',
107
-			'/src/Http/Kernel.php',
108
-			'/src/Http/Events/RequestHandler.php',
109
-			'/src/helpers.php',
110
-			'/src/Support/Facades/Config.php',
111
-			'/src/Support/Facades/Route.php',
112
-			'/src/Application.php',
113
-			'/tests/Application.php',
114
-			'/wpb.php',
115
-		);
116
-
117
-		foreach ( $files as $file ) {
118
-			$file = $root . $file;
119
-			if ( file_exists( $file ) ) {
120
-
121
-				$filesystem = new Filesystem();
122
-
123
-				$contents = $filesystem->get( $file );
124
-				$contents = str_replace( 'wpb_', $snake_case . '_', $contents );
125
-				$contents = str_replace( 'wpb', $vendor_name, $contents );
126
-				$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
127
-				$contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
128
-				$contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
129
-				$contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
130
-				$contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
131
-				$contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
132
-				$contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
133
-				$contents = str_replace( 'WPB', $camel_case, $contents );
134
-				$filesystem->put(
135
-					$file,
136
-					$contents
137
-				);
138
-
139
-				$dir           = dirname( $file );
140
-				$file_name     = basename( $file );
141
-				$new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
142
-
143
-				if ( $file_name !== $new_file_name ) {
144
-					rename( $file, $dir . '/' . $new_file_name );
145
-				}
146
-			}
147
-		}
148
-
149
-		static::update_bootstrap( $root, $camel_case );
150
-	}
151
-
152
-	/**
153
-	 * Replace bootstrap file.
154
-	 *
155
-	 * @since    1.0.0
156
-	 * @access   public
157
-	 *
158
-	 * @param Illuminate\Filesystem\Filesystem $filesystem The illuminate filesystem.
159
-	 * @param string                           $root The string is unique root path for each plugin.
160
-	 * @param string                           $camel_case This string is camel case of project name.
161
-	 *
162
-	 * @return void
163
-	 */
164
-	protected static function update_bootstrap( $filesystem, $root, $camel_case ) {
165
-		$file = $root . '/bootstrap/app.php';
166
-		if ( file_exists( $file ) ) {
167
-			$contents = $filesystem->get( $file );
168
-			$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
169
-			$filesystem->put(
170
-				$file,
171
-				$contents
172
-			);
173
-
174
-		}
175
-	}
30
+    /**
31
+     * Handle the post-install Composer event.
32
+     *
33
+     * @param  \Composer\Script\Event $event The composer event.
34
+     * @return void
35
+     */
36
+    public static function post_install( Event $event ) {
37
+        require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
38
+    }
39
+
40
+    /**
41
+     * Handle the post-update Composer event.
42
+     *
43
+     * @param  \Composer\Script\Event $event The composer event.
44
+     * @return void
45
+     */
46
+    public static function post_update( Event $event ) {
47
+        require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
48
+    }
49
+
50
+    /**
51
+     * Handle the post-autoload-dump Composer event.
52
+     *
53
+     * @param  \Composer\Script\Event $event The composer event.
54
+     * @return void
55
+     */
56
+    public static function post_autoload_dump( Event $event ) {
57
+        require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
58
+
59
+        $dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
60
+        $root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
61
+
62
+        $vendor_name         = strtolower( basename( $root ) );
63
+        $partials            = explode( '-', $vendor_name );
64
+        $camel_case_partials = array();
65
+        foreach ( $partials as $partial ) {
66
+            $camel_case_partials[] = ucfirst( strtolower( $partial ) );
67
+        }
68
+        $camel_case = implode( '_', $camel_case_partials );
69
+        $snake_case = implode( '_', $partials );
70
+
71
+        $files = array(
72
+            '/admin/class-wpb-admin.php',
73
+            '/admin/class-wpb-admin-menu.php',
74
+            '/admin/class-wpb-admin-submenu.php',
75
+            '/admin/partials/wpb-admin-display.php',
76
+            '/admin/css/wpb-admin.css',
77
+            '/admin/js/wpb-admin.js',
78
+            '/app/User.php',
79
+            '/app/Post.php',
80
+            '/app/Http/Controllers/ProductController.php',
81
+            '/app/Http/Middleware/AuthMiddleware.php',
82
+            '/app/Http/Middleware/VerifyCsrfToken.php',
83
+            '/app/Http/Kernel.php',
84
+            '/app/Exceptions/Handler.php',
85
+            '/bootstrap/app.php',
86
+            '/database/migrations/class-create-customers-table.php',
87
+            '/database/seeds/class-customers-table.php',
88
+            '/includes/class-wpb-activator.php',
89
+            '/includes/class-wpb-deactivator.php',
90
+            '/includes/class-wpb-i18n.php',
91
+            '/includes/class-wpb-loader.php',
92
+            '/includes/class-wpb.php',
93
+            '/public/class-wpb-public.php',
94
+            '/public/partials/wpb-public-display.php',
95
+            '/public/css/wpb-public.css',
96
+            '/public/js/wpb-public.js',
97
+            '/resources/js/admin/main.js',
98
+            '/resources/js/frontend/main.js',
99
+            '/resources/js/spa/main.js',
100
+            '/routes/web.php',
101
+            '/routes/api.php',
102
+            '/src/Database/Eloquent/Scopes/PostAuthorScope.php',
103
+            '/src/Database/Eloquent/Scopes/PostStatusScope.php',
104
+            '/src/Database/Eloquent/Scopes/PostTypeScope.php',
105
+            '/src/Database/DB.php',
106
+            '/src/Exceptions/Handler.php',
107
+            '/src/Http/Kernel.php',
108
+            '/src/Http/Events/RequestHandler.php',
109
+            '/src/helpers.php',
110
+            '/src/Support/Facades/Config.php',
111
+            '/src/Support/Facades/Route.php',
112
+            '/src/Application.php',
113
+            '/tests/Application.php',
114
+            '/wpb.php',
115
+        );
116
+
117
+        foreach ( $files as $file ) {
118
+            $file = $root . $file;
119
+            if ( file_exists( $file ) ) {
120
+
121
+                $filesystem = new Filesystem();
122
+
123
+                $contents = $filesystem->get( $file );
124
+                $contents = str_replace( 'wpb_', $snake_case . '_', $contents );
125
+                $contents = str_replace( 'wpb', $vendor_name, $contents );
126
+                $contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
127
+                $contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
128
+                $contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
129
+                $contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
130
+                $contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
131
+                $contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
132
+                $contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
133
+                $contents = str_replace( 'WPB', $camel_case, $contents );
134
+                $filesystem->put(
135
+                    $file,
136
+                    $contents
137
+                );
138
+
139
+                $dir           = dirname( $file );
140
+                $file_name     = basename( $file );
141
+                $new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
142
+
143
+                if ( $file_name !== $new_file_name ) {
144
+                    rename( $file, $dir . '/' . $new_file_name );
145
+                }
146
+            }
147
+        }
148
+
149
+        static::update_bootstrap( $root, $camel_case );
150
+    }
151
+
152
+    /**
153
+     * Replace bootstrap file.
154
+     *
155
+     * @since    1.0.0
156
+     * @access   public
157
+     *
158
+     * @param Illuminate\Filesystem\Filesystem $filesystem The illuminate filesystem.
159
+     * @param string                           $root The string is unique root path for each plugin.
160
+     * @param string                           $camel_case This string is camel case of project name.
161
+     *
162
+     * @return void
163
+     */
164
+    protected static function update_bootstrap( $filesystem, $root, $camel_case ) {
165
+        $file = $root . '/bootstrap/app.php';
166
+        if ( file_exists( $file ) ) {
167
+            $contents = $filesystem->get( $file );
168
+            $contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
169
+            $filesystem->put(
170
+                $file,
171
+                $contents
172
+            );
173
+
174
+        }
175
+    }
176 176
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param  \Composer\Script\Event $event The composer event.
34 34
 	 * @return void
35 35
 	 */
36
-	public static function post_install( Event $event ) {
37
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
36
+	public static function post_install(Event $event) {
37
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param  \Composer\Script\Event $event The composer event.
44 44
 	 * @return void
45 45
 	 */
46
-	public static function post_update( Event $event ) {
47
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
46
+	public static function post_update(Event $event) {
47
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
48 48
 	}
49 49
 
50 50
 	/**
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	 * @param  \Composer\Script\Event $event The composer event.
54 54
 	 * @return void
55 55
 	 */
56
-	public static function post_autoload_dump( Event $event ) {
57
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
56
+	public static function post_autoload_dump(Event $event) {
57
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
58 58
 
59
-		$dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
60
-		$root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
59
+		$dir  = $event->getComposer()->getConfig()->get('vendor-dir').'/../';
60
+		$root = dirname($event->getComposer()->getConfig()->get('vendor-dir'));
61 61
 
62
-		$vendor_name         = strtolower( basename( $root ) );
63
-		$partials            = explode( '-', $vendor_name );
62
+		$vendor_name         = strtolower(basename($root));
63
+		$partials            = explode('-', $vendor_name);
64 64
 		$camel_case_partials = array();
65
-		foreach ( $partials as $partial ) {
66
-			$camel_case_partials[] = ucfirst( strtolower( $partial ) );
65
+		foreach ($partials as $partial) {
66
+			$camel_case_partials[] = ucfirst(strtolower($partial));
67 67
 		}
68
-		$camel_case = implode( '_', $camel_case_partials );
69
-		$snake_case = implode( '_', $partials );
68
+		$camel_case = implode('_', $camel_case_partials);
69
+		$snake_case = implode('_', $partials);
70 70
 
71 71
 		$files = array(
72 72
 			'/admin/class-wpb-admin.php',
@@ -114,39 +114,39 @@  discard block
 block discarded – undo
114 114
 			'/wpb.php',
115 115
 		);
116 116
 
117
-		foreach ( $files as $file ) {
118
-			$file = $root . $file;
119
-			if ( file_exists( $file ) ) {
117
+		foreach ($files as $file) {
118
+			$file = $root.$file;
119
+			if (file_exists($file)) {
120 120
 
121 121
 				$filesystem = new Filesystem();
122 122
 
123
-				$contents = $filesystem->get( $file );
124
-				$contents = str_replace( 'wpb_', $snake_case . '_', $contents );
125
-				$contents = str_replace( 'wpb', $vendor_name, $contents );
126
-				$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
127
-				$contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
128
-				$contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
129
-				$contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
130
-				$contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
131
-				$contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
132
-				$contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
133
-				$contents = str_replace( 'WPB', $camel_case, $contents );
123
+				$contents = $filesystem->get($file);
124
+				$contents = str_replace('wpb_', $snake_case.'_', $contents);
125
+				$contents = str_replace('wpb', $vendor_name, $contents);
126
+				$contents = str_replace('WPB_APP_ROOT', strtoupper($camel_case).'_APP_ROOT', $contents);
127
+				$contents = str_replace('WPB_FILE', strtoupper($camel_case).'_FILE', $contents);
128
+				$contents = str_replace('WPB_PATH', strtoupper($camel_case).'_PATH', $contents);
129
+				$contents = str_replace('WPB_INCLUDES', strtoupper($camel_case).'_INCLUDES', $contents);
130
+				$contents = str_replace('WPB_URL', strtoupper($camel_case).'_URL', $contents);
131
+				$contents = str_replace('WPB_ASSETS', strtoupper($camel_case).'_ASSETS', $contents);
132
+				$contents = str_replace('WPB_VERSION', strtoupper($camel_case).'_VERSION', $contents);
133
+				$contents = str_replace('WPB', $camel_case, $contents);
134 134
 				$filesystem->put(
135 135
 					$file,
136 136
 					$contents
137 137
 				);
138 138
 
139
-				$dir           = dirname( $file );
140
-				$file_name     = basename( $file );
141
-				$new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
139
+				$dir           = dirname($file);
140
+				$file_name     = basename($file);
141
+				$new_file_name = str_replace('wpb', $vendor_name, $file_name);
142 142
 
143
-				if ( $file_name !== $new_file_name ) {
144
-					rename( $file, $dir . '/' . $new_file_name );
143
+				if ($file_name !== $new_file_name) {
144
+					rename($file, $dir.'/'.$new_file_name);
145 145
 				}
146 146
 			}
147 147
 		}
148 148
 
149
-		static::update_bootstrap( $root, $camel_case );
149
+		static::update_bootstrap($root, $camel_case);
150 150
 	}
151 151
 
152 152
 	/**
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return void
163 163
 	 */
164
-	protected static function update_bootstrap( $filesystem, $root, $camel_case ) {
165
-		$file = $root . '/bootstrap/app.php';
166
-		if ( file_exists( $file ) ) {
167
-			$contents = $filesystem->get( $file );
168
-			$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
164
+	protected static function update_bootstrap($filesystem, $root, $camel_case) {
165
+		$file = $root.'/bootstrap/app.php';
166
+		if (file_exists($file)) {
167
+			$contents = $filesystem->get($file);
168
+			$contents = str_replace('WPB_APP_ROOT', strtoupper($camel_case).'_APP_ROOT', $contents);
169 169
 			$filesystem->put(
170 170
 				$file,
171 171
 				$contents
Please login to merge, or discard this patch.