Completed
Push — master ( ebd957...370ac4 )
by CodexShaper
12:32
created
src/Composer/ComposerScripts.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 * @param  \Composer\Script\Event $event The composer event.
33 33
 	 * @return void
34 34
 	 */
35
-	public static function post_install( Event $event ) {
36
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
35
+	public static function post_install(Event $event) {
36
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
37 37
 	}
38 38
 
39 39
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  \Composer\Script\Event $event The composer event.
43 43
 	 * @return void
44 44
 	 */
45
-	public static function post_update( Event $event ) {
46
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
45
+	public static function post_update(Event $event) {
46
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,20 +52,20 @@  discard block
 block discarded – undo
52 52
 	 * @param  \Composer\Script\Event $event The composer event.
53 53
 	 * @return void
54 54
 	 */
55
-	public static function post_autoload_dump( Event $event ) {
56
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
55
+	public static function post_autoload_dump(Event $event) {
56
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
57 57
 
58
-		$dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
59
-		$root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
58
+		$dir  = $event->getComposer()->getConfig()->get('vendor-dir').'/../';
59
+		$root = dirname($event->getComposer()->getConfig()->get('vendor-dir'));
60 60
 
61
-		$vendor_name         = strtolower( basename( $root ) );
62
-		$partials            = explode( '-', $vendor_name );
61
+		$vendor_name         = strtolower(basename($root));
62
+		$partials            = explode('-', $vendor_name);
63 63
 		$camel_case_partials = array();
64
-		foreach ( $partials as $partial ) {
65
-			$camel_case_partials[] = ucfirst( strtolower( $partial ) );
64
+		foreach ($partials as $partial) {
65
+			$camel_case_partials[] = ucfirst(strtolower($partial));
66 66
 		}
67
-		$camel_case = implode( '_', $camel_case_partials );
68
-		$snake_case = implode( '_', $partials );
67
+		$camel_case = implode('_', $camel_case_partials);
68
+		$snake_case = implode('_', $partials);
69 69
 
70 70
 		$files = array(
71 71
 			'/admin/class-wpb-admin.php',
@@ -113,38 +113,38 @@  discard block
 block discarded – undo
113 113
 			'/wpb.php',
114 114
 		);
115 115
 
116
-		foreach ( $files as $file ) {
117
-			$file = $root . $file;
118
-			if ( file_exists( $file ) ) {
116
+		foreach ($files as $file) {
117
+			$file = $root.$file;
118
+			if (file_exists($file)) {
119 119
 				global $wp_filesystem;
120 120
 
121
-				$contents = $wp_filesystem->get_contents( $file );
122
-				$contents = str_replace( 'wpb_', $snake_case . '_', $contents );
123
-				$contents = str_replace( 'wpb', $vendor_name, $contents );
124
-				$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
125
-				$contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
126
-				$contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
127
-				$contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
128
-				$contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
129
-				$contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
130
-				$contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
131
-				$contents = str_replace( 'WPB', $camel_case, $contents );
121
+				$contents = $wp_filesystem->get_contents($file);
122
+				$contents = str_replace('wpb_', $snake_case.'_', $contents);
123
+				$contents = str_replace('wpb', $vendor_name, $contents);
124
+				$contents = str_replace('WPB_APP_ROOT', strtoupper($camel_case).'_APP_ROOT', $contents);
125
+				$contents = str_replace('WPB_FILE', strtoupper($camel_case).'_FILE', $contents);
126
+				$contents = str_replace('WPB_PATH', strtoupper($camel_case).'_PATH', $contents);
127
+				$contents = str_replace('WPB_INCLUDES', strtoupper($camel_case).'_INCLUDES', $contents);
128
+				$contents = str_replace('WPB_URL', strtoupper($camel_case).'_URL', $contents);
129
+				$contents = str_replace('WPB_ASSETS', strtoupper($camel_case).'_ASSETS', $contents);
130
+				$contents = str_replace('WPB_VERSION', strtoupper($camel_case).'_VERSION', $contents);
131
+				$contents = str_replace('WPB', $camel_case, $contents);
132 132
 				$wp_filesystem->put_contents(
133 133
 					$file,
134 134
 					$contents
135 135
 				);
136 136
 
137
-				$dir           = dirname( $file );
138
-				$file_name     = basename( $file );
139
-				$new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
137
+				$dir           = dirname($file);
138
+				$file_name     = basename($file);
139
+				$new_file_name = str_replace('wpb', $vendor_name, $file_name);
140 140
 
141
-				if ( $file_name !== $new_file_name ) {
142
-					rename( $file, $dir . '/' . $new_file_name );
141
+				if ($file_name !== $new_file_name) {
142
+					rename($file, $dir.'/'.$new_file_name);
143 143
 				}
144 144
 			}
145 145
 		}
146 146
 
147
-		static::update_bootstrap( $root, $camel_case );
147
+		static::update_bootstrap($root, $camel_case);
148 148
 	}
149 149
 
150 150
 	/**
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return void
160 160
 	 */
161
-	protected static function update_bootstrap( $root, $camel_case ) {
162
-		$file = $root . '/bootstrap/app.php';
163
-		if ( file_exists( $file ) ) {
161
+	protected static function update_bootstrap($root, $camel_case) {
162
+		$file = $root.'/bootstrap/app.php';
163
+		if (file_exists($file)) {
164 164
 			global $wp_filesystem;
165
-			$contents = $wp_filesystem->get_contents( $file );
166
-			$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
165
+			$contents = $wp_filesystem->get_contents($file);
166
+			$contents = str_replace('WPB_APP_ROOT', strtoupper($camel_case).'_APP_ROOT', $contents);
167 167
 			$wp_filesystem->put_contents(
168 168
 				$file,
169 169
 				$contents
Please login to merge, or discard this patch.