Skip to content

Commit e0127e6

Browse files
committed
CS fixed
1 parent 05059ff commit e0127e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+341
-187
lines changed

includes/Component/Icon.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class Icon {
1717
* Icon constructor
1818
*/
1919
public function __construct() {
20-
if( $this->get_include() ) {
20+
if ( $this->get_include() ) {
2121
$this->map = include $this->get_include();
2222
}
2323
}

includes/Component/Icon/IconSvg.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function get_include(): string {
2626
* @return string
2727
*/
2828
public function get( string $language ): string {
29-
return $this->map[ $language ] ?? $this->maybe( $language, 'flag-icon-' );
29+
return $this->map[ $language ] ?? $this->maybe( $language, 'flag-icon-' );
3030
}
3131

3232
}

includes/Component/Input/Checkbox.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ class Checkbox implements InputInterface {
2525
* @param string $value
2626
*/
2727
public function __construct( string $key, ?string $value ) {
28-
$this->key = esc_attr( $key );
28+
$this->key = esc_attr( $key );
2929
$this->selected = checked( 1, $value, false );
3030
}
3131

3232
/**
3333
* @return string
3434
*/
3535
public function render(): string {
36-
return sprintf( '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>', $this->key, $this->selected );
36+
return sprintf( '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>',
37+
$this->key,
38+
$this->selected );
3739
}
3840

3941
}

includes/Component/Input/Text.php

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function render(): string {
5252
$this->size,
5353
$this->readonly
5454
);
55-
5655
}
5756

5857
}

includes/ContentImport/ContentImporter.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function handle_import( array $data = [] ) {
132132
$data = $this->import_content( $import_coordinates, $data );
133133

134134
if ( $this->has_created_post ) {
135-
$this->update_inserted_blog_post_data($dest_blog_id, $dest_post_id, $data );
135+
$this->update_inserted_blog_post_data( $dest_blog_id, $dest_post_id, $data );
136136
$this->redirect_to_blog_post( $dest_blog_id, $dest_post_id );
137137
}
138138

@@ -238,7 +238,7 @@ public function handle( $handle ) {
238238
/**
239239
* Imports content according to the provided coordinates.
240240
*
241-
* @param ImportCoordinates $import_coordinates
241+
* @param ImportCoordinates $import_coordinates
242242
* @param array $post_fields An optional array of post fields; this can be
243243
* left empty if the method is not called as a consequence
244244
* of filtering the `wp_insert_post_data` filter.
@@ -260,10 +260,11 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
260260
/**
261261
* Filters the data before the import runs.
262262
*
263-
* @since TBD
264-
*
265263
* @param array $post_fields
266264
* @param ImportCoordinates $import_coordinates
265+
*
266+
* @since TBD
267+
*
267268
*/
268269
$post_fields = apply_filters( 'msls_content_import_data_before_import', $post_fields, $import_coordinates );
269270

@@ -305,11 +306,12 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
305306
/**
306307
* Fires after the import ran.
307308
*
308-
* @since TBD
309-
*
310309
* @param ImportCoordinates $import_coordinates
311310
* @param ImportLogger $logger
312311
* @param Relations $relations
312+
*
313+
* @since TBD
314+
*
313315
*/
314316
do_action( 'msls_content_import_after_import', $import_coordinates, $this->logger, $this->relations );
315317

@@ -321,7 +323,11 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
321323
* @param ImportLogger $logger
322324
* @param Relations $relations
323325
*/
324-
return apply_filters( 'msls_content_import_data_after_import', $post_fields, $import_coordinates, $this->logger, $this->relations );
326+
return apply_filters( 'msls_content_import_data_after_import',
327+
$post_fields,
328+
$import_coordinates,
329+
$this->logger,
330+
$this->relations );
325331
}
326332

327333
/**
@@ -330,7 +336,7 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
330336
*
331337
* @return array
332338
*/
333-
protected function update_inserted_blog_post_data($blog_id, $post_id, array $data ) {
339+
protected function update_inserted_blog_post_data( $blog_id, $post_id, array $data ) {
334340
$data['ID'] = $post_id;
335341
$data['post_status'] = empty( $data['post_status'] ) || $data['post_status'] === 'auto-draft'
336342
? 'draft'

includes/ContentImport/ImportLogger.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function save() {
8181
* Logs an error.
8282
*
8383
* @param string $where A location string using `/` as level format.
84-
* @param mixed $what What should be stored in the log.
84+
* @param mixed $what What should be stored in the log.
8585
*/
8686
public function log_error( $where, $what ) {
8787
$this->log( $where, $what, 'error' );
@@ -91,8 +91,8 @@ public function log_error( $where, $what ) {
9191
* Logs something.
9292
*
9393
* @param string $where A location string using `/` as level format.
94-
* @param mixed $what What should be stored in the log.
95-
* @param string $root Where to log the information.
94+
* @param mixed $what What should be stored in the log.
95+
* @param string $root Where to log the information.
9696
*/
9797
protected function log( $where, $what, $root = 'info' ) {
9898
if ( ! isset( $this->data[ $root ] ) ) {
@@ -111,7 +111,8 @@ protected function build_nested_array( $path, $what = '' ) {
111111
. '":' . json_encode( $what )
112112
. implode(
113113
'',
114-
array_fill( 0, count( $path ),
114+
array_fill( 0,
115+
count( $path ),
115116
'}' )
116117
);
117118
$data = json_decode( $json, true );
@@ -152,7 +153,7 @@ public function set_levels_delimiter( $levels_delimiter ) {
152153
* Logs a success.
153154
*
154155
* @param string $where A location string using `/` as level format.
155-
* @param mixed $what What should be stored in the log.
156+
* @param mixed $what What should be stored in the log.
156157
*/
157158
public function log_success( $where, $what ) {
158159
$this->log( $where, $what, 'success' );

includes/ContentImport/Importers/Attachments/Linking.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ class Linking extends BaseImporter {
2222
*/
2323
public static function info() {
2424
return (object) [
25-
'slug' => static::TYPE,
26-
'name' => __( 'Linking', 'multisite-language-switcher' ),
27-
'description' => __( 'Links the media attachments from the source post to the destination post; media attachments are not duplicated.', 'multisite-language-switcher' )
25+
'slug' => static::TYPE,
26+
'name' => __( 'Linking', 'multisite-language-switcher' ),
27+
'description' => __( 'Links the media attachments from the source post to the destination post; media attachments are not duplicated.',
28+
'multisite-language-switcher' )
2829
];
2930
}
3031

3132
public function import( array $data ) {
3233
$this->logger->log_information(
3334
'post-attachments',
34-
__( 'Post attachments were left in place in the source blog and linked in the destination post.', 'multisite-language-switcher' )
35+
__( 'Post attachments were left in place in the source blog and linked in the destination post.',
36+
'multisite-language-switcher' )
3537
);
3638

3739
return parent::import( $data );

includes/ContentImport/Importers/BaseImporter.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ class BaseImporter implements Importer {
2727
* BaseImporter constructor.
2828
*
2929
* @param ImportLogger|null $logger
30-
* @param Relations|null $relations
30+
* @param Relations|null $relations
3131
*/
32-
public function __construct( ImportCoordinates $import_coordinates, ImportLogger $logger = null, Relations $relations = null ) {
32+
public function __construct(
33+
ImportCoordinates $import_coordinates,
34+
ImportLogger $logger = null,
35+
Relations $relations = null
36+
) {
3337
$this->import_coordinates = $import_coordinates;
34-
$this->logger = $logger ?: new ImportLogger( $this->import_coordinates );
35-
$this->relations = $relations ?: new Relations( $this->import_coordinates );
38+
$this->logger = $logger ?: new ImportLogger( $this->import_coordinates );
39+
$this->relations = $relations ?: new Relations( $this->import_coordinates );
3640
}
3741

3842
/**

includes/ContentImport/Importers/Importer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace lloc\Msls\ContentImport\Importers;
34

45
use lloc\Msls\ContentImport\ImportCoordinates;
@@ -36,5 +37,5 @@ public function get_relations();
3637
*
3738
* @return \stdClass
3839
*/
39-
public static function info( );
40+
public static function info();
4041
}

includes/ContentImport/Importers/ImportersBaseFactory.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ public function make( ImportCoordinates $import_coordinates ) {
4545
/**
4646
* Filters the importers map.
4747
*
48-
* @since TBD
49-
*
5048
* @param array $map A map of importers in the shape [ <importer-slug> => <importer-class> ]
5149
* @param ImportCoordinates $import_coordinates
50+
*
51+
* @since TBD
52+
*
5253
*/
5354
$map = apply_filters( "msls_content_import_{$type}_importers_map", $this->importers_map, $import_coordinates );
5455

@@ -87,10 +88,11 @@ public function selected() {
8788
/**
8889
* Filters the selected importer that among the available ones.
8990
*
90-
* @since TBD
91-
*
9291
* @param string $selected The selected importer slug.
9392
* @param ImportersFactory $this
93+
*
94+
* @since TBD
95+
*
9496
*/
9597
$selected = apply_filters( "msls_content_import_{$slug}_selected", $selected, $this );
9698

includes/ContentImport/Importers/Map.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function make( ImportCoordinates $import_coordinates ) {
3838
/**
3939
* Returns a filtered list of factories that will provide the importers.
4040
*
41+
* @return array An associative array in the shape [ <string: $slug> => <ImportersFactory: $factory> ]
4142
* @since TBD
4243
*
43-
* @return array An associative array in the shape [ <string: $slug> => <ImportersFactory: $factory> ]
4444
*/
4545
public function factories() {
4646
$map = [

includes/ContentImport/Importers/PostFieldsImporters.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class PostFieldsImporters extends ImportersBaseFactory {
1919
*/
2020
public function details() {
2121
return (object) [
22-
'slug' => static::TYPE,
23-
'name' => __( 'Post Fields', 'multisite-language-switcher' ),
22+
'slug' => static::TYPE,
23+
'name' => __( 'Post Fields', 'multisite-language-switcher' ),
2424
'importers' => $this->importers_info(),
2525
'selected' => $this->selected(),
2626
];

includes/ContentImport/Importers/PostMeta/Duplicating.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class Duplicating extends BaseImporter {
1515
*/
1616
public static function info() {
1717
return (object) [
18-
'slug' => static::TYPE,
19-
'name' => __( 'Duplicating', 'multisite-language-switcher' ),
18+
'slug' => static::TYPE,
19+
'name' => __( 'Duplicating', 'multisite-language-switcher' ),
2020
'description' => __( 'Copies the source post meta to the destination.', 'multisite-language-switcher' )
2121
];
2222
}
@@ -59,7 +59,10 @@ public function filter_post_meta( array $meta ) {
5959
* @param array $meta
6060
* @param ImportCoordinates $import_coordinates
6161
*/
62-
$blacklist = apply_filters( 'msls_content_import_post_meta_blacklist', $blacklist, $meta, $this->import_coordinates );
62+
$blacklist = apply_filters( 'msls_content_import_post_meta_blacklist',
63+
$blacklist,
64+
$meta,
65+
$this->import_coordinates );
6366

6467
return array_diff_key( $meta, array_combine( $blacklist, $blacklist ) );
6568
}

includes/ContentImport/Importers/PostMetaImporters.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class PostMetaImporters extends ImportersBaseFactory {
1919
*/
2020
public function details() {
2121
return (object) [
22-
'slug' => static::TYPE,
23-
'name' => __( 'Meta Fields', 'multisite-language-switcher' ),
22+
'slug' => static::TYPE,
23+
'name' => __( 'Meta Fields', 'multisite-language-switcher' ),
2424
'importers' => $this->importers_info(),
2525
'selected' => $this->selected(),
2626
];

includes/ContentImport/Importers/PostThumbnail/Linking.php

+12-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public static function info() {
2525
return (object) [
2626
'slug' => static::TYPE,
2727
'name' => __( 'Linking', 'multisite-language-switcher' ),
28-
'description' => __( 'Links the featured image from the source post to the destination post; the image is not duplicated.', 'multisite-language-switcher' )
28+
'description' => __( 'Links the featured image from the source post to the destination post; the image is not duplicated.',
29+
'multisite-language-switcher' )
2930
];
3031
}
3132

@@ -48,7 +49,7 @@ public function import( array $data ) {
4849
return $data;
4950
}
5051

51-
$source_upload_dir = wp_upload_dir();
52+
$source_upload_dir = wp_upload_dir();
5253

5354
switch_to_blog( $this->import_coordinates->dest_blog_id );
5455

@@ -57,7 +58,9 @@ public function import( array $data ) {
5758
array_walk( $source_upload_dir, function ( &$entry ) {
5859
$entry = str_replace( '//', '/', $entry );
5960
} );
60-
$source_uploads_dir = untrailingslashit( str_replace( $source_upload_dir['subdir'], '', $source_upload_dir['path'] ) );
61+
$source_uploads_dir = untrailingslashit( str_replace( $source_upload_dir['subdir'],
62+
'',
63+
$source_upload_dir['path'] ) );
6164
$source_post_thumbnail_file = $source_uploads_dir . '/' . $source_post_thumbnail_meta['_wp_attached_file'];
6265

6366
// Check the type of file. We'll use this as the 'post_mime_type'.
@@ -73,18 +76,20 @@ public function import( array $data ) {
7376
);
7477

7578
$existing_criteria = [
76-
'post_type' => 'attachment',
77-
'title' => $attachment['post_title'],
79+
'post_type' => 'attachment',
80+
'title' => $attachment['post_title'],
7881
];
7982

80-
$found = get_posts( $existing_criteria );
83+
$found = get_posts( $existing_criteria );
8184

8285
if ( $found && $found[0] instanceof \WP_Post ) {
8386
$dest_post_thumbnail_id = $found[0]->ID;
8487
$this->logger->log_success( 'post-thumbnail/existing', $dest_post_thumbnail_id );
8588
} else {
8689
// Insert the attachment.
87-
$dest_post_thumbnail_id = wp_insert_attachment( $attachment, $source_post_thumbnail_file, $dest_post_id );
90+
$dest_post_thumbnail_id = wp_insert_attachment( $attachment,
91+
$source_post_thumbnail_file,
92+
$dest_post_id );
8893

8994
if ( empty( $dest_post_thumbnail_id ) ) {
9095
$this->logger->log_error( 'post-thumbnail/created', $dest_post_thumbnail_id );

includes/ContentImport/Importers/PostThumbnailImporters.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class PostThumbnailImporters extends ImportersBaseFactory {
1919
*/
2020
public function details() {
2121
return (object) [
22-
'slug' => static::TYPE,
23-
'name' => __( 'Featured Image', 'multisite-language-switcher' ),
22+
'slug' => static::TYPE,
23+
'name' => __( 'Featured Image', 'multisite-language-switcher' ),
2424
'importers' => $this->importers_info(),
2525
'selected' => $this->selected(),
2626
];

includes/ContentImport/Importers/Terms/ShallowDuplicating.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public static function info() {
3131
return (object) [
3232
'slug' => static::TYPE,
3333
'name' => __( 'Shallow Duplicating', 'multisite-language-switcher' ),
34-
'description' => __( 'Shallow (one level deep) duplication or assignment of the source post taxonomy terms to the destnation post.', 'multisite-language-switcher' )
34+
'description' => __( 'Shallow (one level deep) duplication or assignment of the source post taxonomy terms to the destnation post.',
35+
'multisite-language-switcher' )
3536
];
3637
}
3738

@@ -124,7 +125,11 @@ protected function filter_term_meta( array $meta, \WP_Term $term ) {
124125
* @param array $meta
125126
* @param ImportCoordinates $import_coordinates
126127
*/
127-
$blacklist = apply_filters( 'msls_content_import_term_meta_blacklist', array(), $term, $meta, $this->import_coordinates );
128+
$blacklist = apply_filters( 'msls_content_import_term_meta_blacklist',
129+
array(),
130+
$term,
131+
$meta,
132+
$this->import_coordinates );
128133

129134
return array_diff_key( $meta, array_combine( $blacklist, $blacklist ) );
130135
}

includes/ContentImport/Importers/TermsImporters.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class TermsImporters extends ImportersBaseFactory {
1919
*/
2020
public function details() {
2121
return (object) [
22-
'slug' => static::TYPE,
23-
'name' => __( 'Taxonomy Terms', 'multisite-language-switcher' ),
22+
'slug' => static::TYPE,
23+
'name' => __( 'Taxonomy Terms', 'multisite-language-switcher' ),
2424
'importers' => $this->importers_info(),
2525
'selected' => $this->selected(),
2626
];

0 commit comments

Comments
 (0)