@@ -33,8 +33,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |