Skip to content

Commit 49bf778

Browse files
committed
Rename all method names to camel case.
1 parent 921ebbe commit 49bf778

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/Controller.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public function deploy( string $processed_site_path, string $enabled_deployer )
260260
\WP2Static\WsLog::l( 'S3 Addon deploying' );
261261

262262
$s3_deployer = new Deployer();
263-
$s3_deployer->upload_files( $processed_site_path );
263+
$s3_deployer->uploadFiles( $processed_site_path );
264264
}
265265

266266
public static function createOptionsTable() : void {
@@ -292,12 +292,12 @@ public static function createOptionsTable() : void {
292292
}
293293
}
294294

295-
public static function activate_for_single_site(): void {
295+
public static function activateForSingleSite(): void {
296296
self::createOptionsTable();
297297
self::seedOptions();
298298
}
299299

300-
public static function deactivate_for_single_site() : void {
300+
public static function deactivateForSingleSite() : void {
301301
}
302302

303303
public static function deactivate( bool $network_wide = null ) : void {
@@ -316,12 +316,12 @@ public static function deactivate( bool $network_wide = null ) : void {
316316

317317
foreach ( $site_ids as $site_id ) {
318318
switch_to_blog( $site_id );
319-
self::deactivate_for_single_site();
319+
self::deactivateForSingleSite();
320320
}
321321

322322
restore_current_blog();
323323
} else {
324-
self::deactivate_for_single_site();
324+
self::deactivateForSingleSite();
325325
}
326326
}
327327

@@ -341,12 +341,12 @@ public static function activate( bool $network_wide = null ) : void {
341341

342342
foreach ( $site_ids as $site_id ) {
343343
switch_to_blog( $site_id );
344-
self::activate_for_single_site();
344+
self::activateForSingleSite();
345345
}
346346

347347
restore_current_blog();
348348
} else {
349-
self::activate_for_single_site();
349+
self::activateForSingleSite();
350350
}
351351
}
352352

src/Deployer.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Deployer {
2121

2222
public function __construct() {}
2323

24-
public function upload_files( string $processed_site_path ) : void {
24+
public function uploadFiles( string $processed_site_path ) : void {
2525
// check if dir exists
2626
if ( ! is_dir( $processed_site_path ) ) {
2727
return;
@@ -30,7 +30,7 @@ public function upload_files( string $processed_site_path ) : void {
3030
$namespace = self::DEFAULT_NAMESPACE;
3131

3232
// instantiate S3 client
33-
$s3 = self::s3_client();
33+
$s3 = self::s3Client();
3434

3535
// iterate each file in ProcessedSite
3636
$iterator = new RecursiveIteratorIterator(
@@ -85,7 +85,7 @@ public function upload_files( string $processed_site_path ) : void {
8585
ltrim( $cache_key, '/' ) :
8686
ltrim( $cache_key, '/' );
8787

88-
$mime_type = MimeTypes::GuessMimeType( $filename );
88+
$mime_type = MimeTypes::guessMimeType( $filename );
8989
if ( 'text/' === substr( $mime_type, 0, 5 ) ) {
9090
$mime_type = $mime_type . '; charset=UTF-8';
9191
}
@@ -177,16 +177,16 @@ public function upload_files( string $processed_site_path ) : void {
177177
if ( $distribution_id && $num_stale > 0 ) {
178178
if ( $num_stale > $cf_max_paths ) {
179179
WsLog::l( 'Invalidating all CloudFront paths' );
180-
self::invalidate_items( $distribution_id, [ '/*' ] );
180+
self::invalidateItems( $distribution_id, [ '/*' ] );
181181
} else {
182182
$path_text = ( $num_stale === 1 ) ? 'path' : 'paths';
183183
WsLog::l( "Invalidating $num_stale CloudFront $path_text" );
184-
self::invalidate_items( $distribution_id, $cf_stale_paths );
184+
self::invalidateItems( $distribution_id, $cf_stale_paths );
185185
}
186186
}
187187
}
188188

189-
public static function s3_client() : \Aws\S3\S3Client {
189+
public static function s3Client() : \Aws\S3\S3Client {
190190
$client_options = [
191191
'version' => 'latest',
192192
'region' => Controller::getValue( 's3Region' ),
@@ -218,7 +218,7 @@ public static function s3_client() : \Aws\S3\S3Client {
218218
return new \Aws\S3\S3Client( $client_options );
219219
}
220220

221-
public static function cloudfront_client() : \Aws\CloudFront\CloudFrontClient {
221+
public static function cloudfrontClient() : \Aws\CloudFront\CloudFrontClient {
222222
/*
223223
If no credentials option, SDK attempts to load credentials from
224224
your environment in the following order:
@@ -272,8 +272,8 @@ public static function cloudfront_client() : \Aws\CloudFront\CloudFrontClient {
272272
*
273273
* @param mixed[] $items mixed array
274274
*/
275-
public static function create_invalidation( string $distribution_id, array $items ) : string {
276-
$client = self::cloudfront_client();
275+
public static function createInvalidation( string $distribution_id, array $items ) : string {
276+
$client = self::cloudfrontClient();
277277

278278
return $client->createInvalidation(
279279
[
@@ -294,9 +294,9 @@ public static function create_invalidation( string $distribution_id, array $item
294294
*
295295
* @param mixed[] $items mixed array
296296
*/
297-
public static function invalidate_items( string $distribution_id, array $items ) : ?string {
297+
public static function invalidateItems( string $distribution_id, array $items ) : ?string {
298298
try {
299-
return self::create_invalidation( $distribution_id, $items );
299+
return self::createInvalidation( $distribution_id, $items );
300300
} catch ( AwsException $e ) {
301301
WsLog::l( 'Error creating CloudFront invalidation: ' . $e->getMessage() );
302302
return null;

src/MimeTypes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
class MimeTypes {
66
/*
77
* Takes a filename and returns its mimetype.
8-
* GuessMimeTypes first looks at the file extension and looks it up
8+
* guessMimeTypes first looks at the file extension and looks it up
99
* in an array of known mimetypes. If that lookup misses, it uses
1010
* finfo to guess the mimetype based on magic bytes. If that also fails,
1111
* "application/octet-stream" is returned.
1212
*
1313
* @param string $filename filename
1414
* @return string mimetype
1515
*/
16-
public static function GuessMimeType( string $filename ) : string {
16+
public static function guessMimeType( string $filename ) : string {
1717
static $mime_types = [
1818
'123' => 'application/vnd.lotus-1-2-3',
1919
'3dml' => 'text/vnd.in3d.3dml',

0 commit comments

Comments
 (0)