Completed
Pull Request — master (#1534)
by Naveen
01:04
created
src/wordlift.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 // If this file is called directly, abort.
35 35
 if ( ! defined( 'WPINC' ) ) {
36
-	die;
36
+    die;
37 37
 }
38 38
 
39 39
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 if ( ! apply_filters( 'wl_is_enabled', true ) ) {
45
-	return;
45
+    return;
46 46
 }
47 47
 
48 48
 require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
@@ -72,29 +72,29 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function activate_wordlift() {
74 74
 
75
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
76
-
77
-	$log->info( 'Activating WordLift...' );
78
-
79
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
80
-	Wordlift_Activator::activate();
81
-
82
-	/**
83
-	 * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks.
84
-	 *
85
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
86
-	 * @since 3.19.2
87
-	 */
88
-	Wordlift_Http_Api::activate();
89
-
90
-	// Ensure the post type is registered before flushing the rewrite rules.
91
-	Wordlift_Entity_Post_Type_Service::get_instance()->register();
92
-	flush_rewrite_rules();
93
-	/**
94
-	 * @since 3.27.7
95
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
96
-	 */
97
-	Top_Entities::activate();
75
+    $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
76
+
77
+    $log->info( 'Activating WordLift...' );
78
+
79
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
80
+    Wordlift_Activator::activate();
81
+
82
+    /**
83
+     * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks.
84
+     *
85
+     * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
86
+     * @since 3.19.2
87
+     */
88
+    Wordlift_Http_Api::activate();
89
+
90
+    // Ensure the post type is registered before flushing the rewrite rules.
91
+    Wordlift_Entity_Post_Type_Service::get_instance()->register();
92
+    flush_rewrite_rules();
93
+    /**
94
+     * @since 3.27.7
95
+     * @see https://github.com/insideout10/wordlift-plugin/issues/1214
96
+     */
97
+    Top_Entities::activate();
98 98
 }
99 99
 
100 100
 /**
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function deactivate_wordlift() {
105 105
 
106
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
107
-	Wordlift_Deactivator::deactivate();
108
-	Wordlift_Http_Api::deactivate();
109
-	Ttl_Cache_Cleaner::deactivate();
110
-	/**
111
-	 * @since 3.27.7
112
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
113
-	 */
114
-	Top_Entities::deactivate();
115
-	/**
116
-	 * @since 3.27.8
117
-	 * Remove notification flag on deactivation.
118
-	 */
119
-	Key_Validation_Notice::remove_notification_flag();
120
-	flush_rewrite_rules();
106
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
107
+    Wordlift_Deactivator::deactivate();
108
+    Wordlift_Http_Api::deactivate();
109
+    Ttl_Cache_Cleaner::deactivate();
110
+    /**
111
+     * @since 3.27.7
112
+     * @see https://github.com/insideout10/wordlift-plugin/issues/1214
113
+     */
114
+    Top_Entities::deactivate();
115
+    /**
116
+     * @since 3.27.8
117
+     * Remove notification flag on deactivation.
118
+     */
119
+    Key_Validation_Notice::remove_notification_flag();
120
+    flush_rewrite_rules();
121 121
 
122 122
 }
123 123
 
@@ -140,77 +140,77 @@  discard block
 block discarded – undo
140 140
  * @since    1.0.0
141 141
  */
142 142
 function run_wordlift() {
143
-	/**
144
-	 * Filter: wl_feature__enable__widgets.
145
-	 *
146
-	 * @param bool whether the widgets needed to be registered, defaults to true.
147
-	 *
148
-	 * @return bool
149
-	 * @since 3.27.6
150
-	 */
151
-	if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
152
-		add_action( 'widgets_init', 'wl_register_chord_widget' );
153
-		add_action( 'widgets_init', 'wl_register_geo_widget' );
154
-		add_action( 'widgets_init', 'wl_register_timeline_widget' );
155
-	}
156
-	add_filter( 'widget_text', 'do_shortcode' );
157
-
158
-
159
-	/**
160
-	 * Filter: wl_feature__enable__analysis
161
-	 *
162
-	 * @param bool Whether to send api request to analysis or not
163
-	 *
164
-	 * @return bool
165
-	 * @since 3.27.6
166
-	 */
167
-	if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
168
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
169
-	} else {
170
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
171
-	}
172
-
173
-	$plugin = new Wordlift();
174
-	$plugin->run();
175
-
176
-	// Initialize the TTL Cache Cleaner.
177
-	new Ttl_Cache_Cleaner();
178
-
179
-	// Load the new Post Adapter.
180
-	new Post_Adapter();
181
-
182
-	// Load the API Data Hooks.
183
-	new Api_Data_Hooks();
184
-
185
-	add_action( 'plugins_loaded', function () {
186
-		// All features from registry should be initialized here.
187
-		$features_registry = Features_Registry::get_instance();
188
-		$features_registry->initialize_all_features();
189
-	}, 5 );
190
-
191
-	add_action( 'plugins_loaded', function () use ( $plugin ) {
192
-
193
-		new Wordlift_Products_Navigator_Shortcode_REST();
194
-
195
-		// Register the Dataset module, requires `$api_service`.
196
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
197
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
198
-
199
-		/*
143
+    /**
144
+     * Filter: wl_feature__enable__widgets.
145
+     *
146
+     * @param bool whether the widgets needed to be registered, defaults to true.
147
+     *
148
+     * @return bool
149
+     * @since 3.27.6
150
+     */
151
+    if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
152
+        add_action( 'widgets_init', 'wl_register_chord_widget' );
153
+        add_action( 'widgets_init', 'wl_register_geo_widget' );
154
+        add_action( 'widgets_init', 'wl_register_timeline_widget' );
155
+    }
156
+    add_filter( 'widget_text', 'do_shortcode' );
157
+
158
+
159
+    /**
160
+     * Filter: wl_feature__enable__analysis
161
+     *
162
+     * @param bool Whether to send api request to analysis or not
163
+     *
164
+     * @return bool
165
+     * @since 3.27.6
166
+     */
167
+    if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
168
+        add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
169
+    } else {
170
+        add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
171
+    }
172
+
173
+    $plugin = new Wordlift();
174
+    $plugin->run();
175
+
176
+    // Initialize the TTL Cache Cleaner.
177
+    new Ttl_Cache_Cleaner();
178
+
179
+    // Load the new Post Adapter.
180
+    new Post_Adapter();
181
+
182
+    // Load the API Data Hooks.
183
+    new Api_Data_Hooks();
184
+
185
+    add_action( 'plugins_loaded', function () {
186
+        // All features from registry should be initialized here.
187
+        $features_registry = Features_Registry::get_instance();
188
+        $features_registry->initialize_all_features();
189
+    }, 5 );
190
+
191
+    add_action( 'plugins_loaded', function () use ( $plugin ) {
192
+
193
+        new Wordlift_Products_Navigator_Shortcode_REST();
194
+
195
+        // Register the Dataset module, requires `$api_service`.
196
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
197
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
198
+
199
+        /*
200 200
 		 * Require the Entity annotation cleanup module.
201 201
 		 *
202 202
 		 * @since 3.34.6
203 203
 		 */
204
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php';
204
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php';
205 205
 
206
-		/*
206
+        /*
207 207
 		 * Import LOD entities.
208 208
 		 *
209 209
 		 * @since 3.35.0
210 210
 		 */
211
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php';
211
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php';
212 212
 
213
-	} );
213
+    } );
214 214
 
215 215
 }
216 216
 
@@ -224,50 +224,50 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function wordlift_plugin_autoload_register() {
226 226
 
227
-	spl_autoload_register( function ( $class_name ) {
227
+    spl_autoload_register( function ( $class_name ) {
228 228
 
229
-		// Bail out if these are not our classes.
230
-		if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
231
-			return false;
232
-		}
229
+        // Bail out if these are not our classes.
230
+        if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
231
+            return false;
232
+        }
233 233
 
234
-		$class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
234
+        $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
235 235
 
236
-		preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
236
+        preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
237 237
 
238
-		$path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
239
-		$file = 'class-' . $matches[2] . '.php';
238
+        $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
239
+        $file = 'class-' . $matches[2] . '.php';
240 240
 
241
-		$full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
241
+        $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
242 242
 
243
-		if ( ! file_exists( $full_path ) ) {
244
-			echo esc_html( "Class $class_name not found at $full_path." );
243
+        if ( ! file_exists( $full_path ) ) {
244
+            echo esc_html( "Class $class_name not found at $full_path." );
245 245
 
246
-			return false;
247
-		}
246
+            return false;
247
+        }
248 248
 
249
-		require_once $full_path;
249
+        require_once $full_path;
250 250
 
251
-		return true;
252
-	} );
251
+        return true;
252
+    } );
253 253
 
254 254
 }
255 255
 
256 256
 function wl_block_categories( $categories, $post ) {
257
-	return array_merge(
258
-		$categories,
259
-		array(
260
-			array(
261
-				'slug'  => 'wordlift',
262
-				'title' => __( 'WordLift', 'wordlift' ),
263
-			),
264
-		)
265
-	);
257
+    return array_merge(
258
+        $categories,
259
+        array(
260
+            array(
261
+                'slug'  => 'wordlift',
262
+                'title' => __( 'WordLift', 'wordlift' ),
263
+            ),
264
+        )
265
+    );
266 266
 }
267 267
 
268 268
 add_filter( 'block_categories', 'wl_block_categories', 10, 2 );
269 269
 
270 270
 // Temporary fix for a typo in WooCommerce Extension.
271 271
 add_filter( 'wl_feature__enable__dataset', function ( $value ) {
272
-	return apply_filters( 'wl_features__enable__dataset', $value );
272
+    return apply_filters( 'wl_features__enable__dataset', $value );
273 273
 } );
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 use Wordlift\Post\Post_Adapter;
33 33
 
34 34
 // If this file is called directly, abort.
35
-if ( ! defined( 'WPINC' ) ) {
35
+if ( ! defined('WPINC')) {
36 36
 	die;
37 37
 }
38 38
 
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
  * @since 3.33.6
42 42
  *
43 43
  */
44
-if ( ! apply_filters( 'wl_is_enabled', true ) ) {
44
+if ( ! apply_filters('wl_is_enabled', true)) {
45 45
 	return;
46 46
 }
47 47
 
48
-require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
48
+require_once plugin_dir_path(__FILE__).'vendor/autoload.php';
49 49
 
50 50
 /*
51 51
 	 * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http.
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
 // Include WordLift constants.
59
-require_once( 'wordlift_constants.php' );
59
+require_once('wordlift_constants.php');
60 60
 
61 61
 // Load modules.
62
-require_once( 'modules/core/wordlift_core.php' );
62
+require_once('modules/core/wordlift_core.php');
63 63
 
64
-require_once( 'deprecations.php' );
64
+require_once('deprecations.php');
65 65
 
66 66
 // Load early to enable/disable features.
67
-require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php';
67
+require_once plugin_dir_path(__FILE__).'wordlift/features/index.php';
68 68
 
69 69
 /**
70 70
  * The code that runs during plugin activation.
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function activate_wordlift() {
74 74
 
75
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
75
+	$log = Wordlift_Log_Service::get_logger('activate_wordlift');
76 76
 
77
-	$log->info( 'Activating WordLift...' );
77
+	$log->info('Activating WordLift...');
78 78
 
79
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
79
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php';
80 80
 	Wordlift_Activator::activate();
81 81
 
82 82
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function deactivate_wordlift() {
105 105
 
106
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
106
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php';
107 107
 	Wordlift_Deactivator::deactivate();
108 108
 	Wordlift_Http_Api::deactivate();
109 109
 	Ttl_Cache_Cleaner::deactivate();
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 
122 122
 }
123 123
 
124
-register_activation_hook( __FILE__, 'activate_wordlift' );
125
-register_deactivation_hook( __FILE__, 'deactivate_wordlift' );
124
+register_activation_hook(__FILE__, 'activate_wordlift');
125
+register_deactivation_hook(__FILE__, 'deactivate_wordlift');
126 126
 
127 127
 /**
128 128
  * The core plugin class that is used to define internationalization,
129 129
  * admin-specific hooks, and public-facing site hooks.
130 130
  */
131
-require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php';
131
+require plugin_dir_path(__FILE__).'includes/class-wordlift.php';
132 132
 
133 133
 /**
134 134
  * Begins execution of the plugin.
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 * @return bool
149 149
 	 * @since 3.27.6
150 150
 	 */
151
-	if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
152
-		add_action( 'widgets_init', 'wl_register_chord_widget' );
153
-		add_action( 'widgets_init', 'wl_register_geo_widget' );
154
-		add_action( 'widgets_init', 'wl_register_timeline_widget' );
151
+	if (apply_filters('wl_feature__enable__widgets', true)) {
152
+		add_action('widgets_init', 'wl_register_chord_widget');
153
+		add_action('widgets_init', 'wl_register_geo_widget');
154
+		add_action('widgets_init', 'wl_register_timeline_widget');
155 155
 	}
156
-	add_filter( 'widget_text', 'do_shortcode' );
156
+	add_filter('widget_text', 'do_shortcode');
157 157
 
158 158
 
159 159
 	/**
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 	 * @return bool
165 165
 	 * @since 3.27.6
166 166
 	 */
167
-	if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
168
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
167
+	if (apply_filters('wl_feature__enable__analysis', true)) {
168
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action');
169 169
 	} else {
170
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
170
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action');
171 171
 	}
172 172
 
173 173
 	$plugin = new Wordlift();
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 	// Load the API Data Hooks.
183 183
 	new Api_Data_Hooks();
184 184
 
185
-	add_action( 'plugins_loaded', function () {
185
+	add_action('plugins_loaded', function() {
186 186
 		// All features from registry should be initialized here.
187 187
 		$features_registry = Features_Registry::get_instance();
188 188
 		$features_registry->initialize_all_features();
189
-	}, 5 );
189
+	}, 5);
190 190
 
191
-	add_action( 'plugins_loaded', function () use ( $plugin ) {
191
+	add_action('plugins_loaded', function() use ($plugin) {
192 192
 
193 193
 		new Wordlift_Products_Navigator_Shortcode_REST();
194 194
 
195 195
 		// Register the Dataset module, requires `$api_service`.
196
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
197
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
196
+		require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php';
197
+		require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php';
198 198
 
199 199
 		/*
200 200
 		 * Require the Entity annotation cleanup module.
201 201
 		 *
202 202
 		 * @since 3.34.6
203 203
 		 */
204
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php';
204
+		require_once plugin_dir_path(__FILE__).'wordlift/cleanup/index.php';
205 205
 
206 206
 		/*
207 207
 		 * Import LOD entities.
208 208
 		 *
209 209
 		 * @since 3.35.0
210 210
 		 */
211
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php';
211
+		require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php';
212 212
 
213 213
 	} );
214 214
 
@@ -224,24 +224,24 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function wordlift_plugin_autoload_register() {
226 226
 
227
-	spl_autoload_register( function ( $class_name ) {
227
+	spl_autoload_register(function($class_name) {
228 228
 
229 229
 		// Bail out if these are not our classes.
230
-		if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
230
+		if (0 !== strpos($class_name, 'Wordlift\\')) {
231 231
 			return false;
232 232
 		}
233 233
 
234
-		$class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
234
+		$class_name_lc = strtolower(str_replace('_', '-', $class_name));
235 235
 
236
-		preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
236
+		preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches);
237 237
 
238
-		$path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
239
-		$file = 'class-' . $matches[2] . '.php';
238
+		$path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]);
239
+		$file = 'class-'.$matches[2].'.php';
240 240
 
241
-		$full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
241
+		$full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file;
242 242
 
243
-		if ( ! file_exists( $full_path ) ) {
244
-			echo esc_html( "Class $class_name not found at $full_path." );
243
+		if ( ! file_exists($full_path)) {
244
+			echo esc_html("Class $class_name not found at $full_path.");
245 245
 
246 246
 			return false;
247 247
 		}
@@ -253,21 +253,21 @@  discard block
 block discarded – undo
253 253
 
254 254
 }
255 255
 
256
-function wl_block_categories( $categories, $post ) {
256
+function wl_block_categories($categories, $post) {
257 257
 	return array_merge(
258 258
 		$categories,
259 259
 		array(
260 260
 			array(
261 261
 				'slug'  => 'wordlift',
262
-				'title' => __( 'WordLift', 'wordlift' ),
262
+				'title' => __('WordLift', 'wordlift'),
263 263
 			),
264 264
 		)
265 265
 	);
266 266
 }
267 267
 
268
-add_filter( 'block_categories', 'wl_block_categories', 10, 2 );
268
+add_filter('block_categories', 'wl_block_categories', 10, 2);
269 269
 
270 270
 // Temporary fix for a typo in WooCommerce Extension.
271
-add_filter( 'wl_feature__enable__dataset', function ( $value ) {
272
-	return apply_filters( 'wl_features__enable__dataset', $value );
271
+add_filter('wl_feature__enable__dataset', function($value) {
272
+	return apply_filters('wl_features__enable__dataset', $value);
273 273
 } );
Please login to merge, or discard this patch.
src/wordlift/entity/remote-entity/class-valid-remote-entity.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -4,48 +4,48 @@
 block discarded – undo
4 4
 
5 5
 class Valid_Remote_Entity implements Remote_Entity {
6 6
 
7
-	/**
8
-	 * @var array<string>
9
-	 */
10
-	private $types;
11
-
12
-	/**
13
-	 * Title or name of the entity.
14
-	 * @var string
15
-	 */
16
-	private $name;
17
-	/**
18
-	 * The entity description.
19
-	 * @var string
20
-	 */
21
-	private $description;
22
-	/**
23
-	 * An array of sameAs urls.
24
-	 * @var array<string>
25
-	 */
26
-	private $same_as;
27
-
28
-	public function __construct( $types, $name, $description, $same_as ) {
29
-		$this->types = $types;
30
-		$this->name  = $name;
31
-		$this->description = $description;
32
-		$this->same_as = $same_as;
33
-	}
34
-
35
-
36
-	function get_name() {
37
-		return $this->name;
38
-	}
39
-
40
-	function get_description() {
41
-		return $this->description;
42
-	}
43
-
44
-	function get_same_as() {
45
-		return $this->same_as;
46
-	}
47
-
48
-	function get_types() {
49
-		return $this->types;
50
-	}
7
+    /**
8
+     * @var array<string>
9
+     */
10
+    private $types;
11
+
12
+    /**
13
+     * Title or name of the entity.
14
+     * @var string
15
+     */
16
+    private $name;
17
+    /**
18
+     * The entity description.
19
+     * @var string
20
+     */
21
+    private $description;
22
+    /**
23
+     * An array of sameAs urls.
24
+     * @var array<string>
25
+     */
26
+    private $same_as;
27
+
28
+    public function __construct( $types, $name, $description, $same_as ) {
29
+        $this->types = $types;
30
+        $this->name  = $name;
31
+        $this->description = $description;
32
+        $this->same_as = $same_as;
33
+    }
34
+
35
+
36
+    function get_name() {
37
+        return $this->name;
38
+    }
39
+
40
+    function get_description() {
41
+        return $this->description;
42
+    }
43
+
44
+    function get_same_as() {
45
+        return $this->same_as;
46
+    }
47
+
48
+    function get_types() {
49
+        return $this->types;
50
+    }
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 */
26 26
 	private $same_as;
27 27
 
28
-	public function __construct( $types, $name, $description, $same_as ) {
28
+	public function __construct($types, $name, $description, $same_as) {
29 29
 		$this->types = $types;
30 30
 		$this->name  = $name;
31 31
 		$this->description = $description;
Please login to merge, or discard this patch.
src/wordlift/entity/remote-entity/class-remote-entity-factory.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -4,49 +4,49 @@
 block discarded – undo
4 4
 
5 5
 class Remote_Entity_Factory {
6 6
 
7
-	/**
8
-	 *
9
-	 * @param $entity_url string
10
-	 * @param $response \Wordlift\Api\Response
11
-	 *
12
-	 * @return Remote_Entity
13
-	 */
14
-	static function from_response( $entity_url, $response ) {
7
+    /**
8
+     *
9
+     * @param $entity_url string
10
+     * @param $response \Wordlift\Api\Response
11
+     *
12
+     * @return Remote_Entity
13
+     */
14
+    static function from_response( $entity_url, $response ) {
15 15
 
16
-		if ( ! $response->is_success() ) {
17
-			return new Invalid_Remote_Entity();
18
-		}
16
+        if ( ! $response->is_success() ) {
17
+            return new Invalid_Remote_Entity();
18
+        }
19 19
 
20
-		$entity_data = json_decode( $response->get_body(), true );
20
+        $entity_data = json_decode( $response->get_body(), true );
21 21
 
22
-		if ( ! $entity_data ) {
23
-			return new Invalid_Remote_Entity();
24
-		}
22
+        if ( ! $entity_data ) {
23
+            return new Invalid_Remote_Entity();
24
+        }
25 25
 
26
-		if ( ! array_key_exists( '@type', $entity_data )
27
-		     || ! array_key_exists( 'name', $entity_data )
28
-		     || ! array_key_exists( 'description', $entity_data ) ) {
26
+        if ( ! array_key_exists( '@type', $entity_data )
27
+             || ! array_key_exists( 'name', $entity_data )
28
+             || ! array_key_exists( 'description', $entity_data ) ) {
29 29
 
30
-			return new Invalid_Remote_Entity();
31
-		}
30
+            return new Invalid_Remote_Entity();
31
+        }
32 32
 
33 33
 
34
-		return new Valid_Remote_Entity(
35
-			self::may_be_wrap_array( $entity_data['@type'] ),
36
-			$entity_data['name'],
37
-			$entity_data['description'],
38
-			array_merge( array( $entity_url ), self::may_be_wrap_array( $entity_data['sameAs'] ) )
39
-		);
34
+        return new Valid_Remote_Entity(
35
+            self::may_be_wrap_array( $entity_data['@type'] ),
36
+            $entity_data['name'],
37
+            $entity_data['description'],
38
+            array_merge( array( $entity_url ), self::may_be_wrap_array( $entity_data['sameAs'] ) )
39
+        );
40 40
 
41
-	}
41
+    }
42 42
 
43
-	private static function may_be_wrap_array( $el ) {
44
-		if ( is_array( $el ) ) {
45
-			return $el;
46
-		}
43
+    private static function may_be_wrap_array( $el ) {
44
+        if ( is_array( $el ) ) {
45
+            return $el;
46
+        }
47 47
 
48
-		return array( $el );
49
-	}
48
+        return array( $el );
49
+    }
50 50
 
51 51
 
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,41 +11,41 @@
 block discarded – undo
11 11
 	 *
12 12
 	 * @return Remote_Entity
13 13
 	 */
14
-	static function from_response( $entity_url, $response ) {
14
+	static function from_response($entity_url, $response) {
15 15
 
16
-		if ( ! $response->is_success() ) {
16
+		if ( ! $response->is_success()) {
17 17
 			return new Invalid_Remote_Entity();
18 18
 		}
19 19
 
20
-		$entity_data = json_decode( $response->get_body(), true );
20
+		$entity_data = json_decode($response->get_body(), true);
21 21
 
22
-		if ( ! $entity_data ) {
22
+		if ( ! $entity_data) {
23 23
 			return new Invalid_Remote_Entity();
24 24
 		}
25 25
 
26
-		if ( ! array_key_exists( '@type', $entity_data )
27
-		     || ! array_key_exists( 'name', $entity_data )
28
-		     || ! array_key_exists( 'description', $entity_data ) ) {
26
+		if ( ! array_key_exists('@type', $entity_data)
27
+		     || ! array_key_exists('name', $entity_data)
28
+		     || ! array_key_exists('description', $entity_data)) {
29 29
 
30 30
 			return new Invalid_Remote_Entity();
31 31
 		}
32 32
 
33 33
 
34 34
 		return new Valid_Remote_Entity(
35
-			self::may_be_wrap_array( $entity_data['@type'] ),
35
+			self::may_be_wrap_array($entity_data['@type']),
36 36
 			$entity_data['name'],
37 37
 			$entity_data['description'],
38
-			array_merge( array( $entity_url ), self::may_be_wrap_array( $entity_data['sameAs'] ) )
38
+			array_merge(array($entity_url), self::may_be_wrap_array($entity_data['sameAs']))
39 39
 		);
40 40
 
41 41
 	}
42 42
 
43
-	private static function may_be_wrap_array( $el ) {
44
-		if ( is_array( $el ) ) {
43
+	private static function may_be_wrap_array($el) {
44
+		if (is_array($el)) {
45 45
 			return $el;
46 46
 		}
47 47
 
48
-		return array( $el );
48
+		return array($el);
49 49
 	}
50 50
 
51 51
 
Please login to merge, or discard this patch.
src/wordlift/entity/remote-entity/class-invalid-remote-entity.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,19 +4,19 @@
 block discarded – undo
4 4
 
5 5
 class Invalid_Remote_Entity implements Remote_Entity {
6 6
 
7
-	function get_name() {
8
-		// TODO: Implement getName() method.
9
-	}
7
+    function get_name() {
8
+        // TODO: Implement getName() method.
9
+    }
10 10
 
11
-	function get_description() {
12
-		// TODO: Implement getDescription() method.
13
-	}
11
+    function get_description() {
12
+        // TODO: Implement getDescription() method.
13
+    }
14 14
 
15
-	function get_same_as() {
16
-		// TODO: Implement getSameAs() method.
17
-	}
15
+    function get_same_as() {
16
+        // TODO: Implement getSameAs() method.
17
+    }
18 18
 
19
-	function get_types() {
20
-		// TODO: Implement getTypes() method.
21
-	}
19
+    function get_types() {
20
+        // TODO: Implement getTypes() method.
21
+    }
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/entity/remote-entity/class-remote-entity.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@
 block discarded – undo
4 4
 
5 5
 interface Remote_Entity {
6 6
 
7
-	/**
8
-	 * @return string
9
-	 */
10
-	function get_name();
7
+    /**
8
+     * @return string
9
+     */
10
+    function get_name();
11 11
 
12
-	/**
13
-	 * @return string
14
-	 */
15
-	function get_description();
12
+    /**
13
+     * @return string
14
+     */
15
+    function get_description();
16 16
 
17
-	/**
18
-	 * @return array<string>
19
-	 */
20
-	function get_same_as();
17
+    /**
18
+     * @return array<string>
19
+     */
20
+    function get_same_as();
21 21
 
22
-	/**
23
-	 * @return array<string>
24
-	 */
25
-	function get_types();
22
+    /**
23
+     * @return array<string>
24
+     */
25
+    function get_types();
26 26
 
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/entity/remote-entity/class-url-to-remote-entity-converter.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 class Url_To_Remote_Entity_Converter {
8 8
 
9 9
 
10
-	/**
11
-	 * @param $url
12
-	 *
13
-	 * @return Remote_Entity
14
-	 */
15
-	public static function convert( $url ) {
16
-		$target_path = '/id/' . preg_replace( '@^(https?)://@', '$1/', $url );
17
-		$response    = Default_Api_Service::get_instance()->get( $target_path );
18
-
19
-		return Remote_Entity_Factory::from_response( $url, $response );
20
-	}
10
+    /**
11
+     * @param $url
12
+     *
13
+     * @return Remote_Entity
14
+     */
15
+    public static function convert( $url ) {
16
+        $target_path = '/id/' . preg_replace( '@^(https?)://@', '$1/', $url );
17
+        $response    = Default_Api_Service::get_instance()->get( $target_path );
18
+
19
+        return Remote_Entity_Factory::from_response( $url, $response );
20
+    }
21 21
 
22 22
 
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
 	 *
13 13
 	 * @return Remote_Entity
14 14
 	 */
15
-	public static function convert( $url ) {
16
-		$target_path = '/id/' . preg_replace( '@^(https?)://@', '$1/', $url );
17
-		$response    = Default_Api_Service::get_instance()->get( $target_path );
15
+	public static function convert($url) {
16
+		$target_path = '/id/'.preg_replace('@^(https?)://@', '$1/', $url);
17
+		$response    = Default_Api_Service::get_instance()->get($target_path);
18 18
 
19
-		return Remote_Entity_Factory::from_response( $url, $response );
19
+		return Remote_Entity_Factory::from_response($url, $response);
20 20
 	}
21 21
 
22 22
 
Please login to merge, or discard this patch.
entity/remote-entity-importer/class-invalid-remote-entity-importer.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
  */
8 8
 class Invalid_Remote_Entity_Importer implements Remote_Entity_Importer {
9 9
 
10
-	public function import() {
11
-		// Cant import invalid entities.
12
-		return false;
13
-	}
10
+    public function import() {
11
+        // Cant import invalid entities.
12
+        return false;
13
+    }
14 14
 
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/entity/remote-entity-importer/class-remote-entity-importer.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 
8 8
 interface Remote_Entity_Importer {
9 9
 
10
-	/**
11
-	 * @return Wordpress_Content_Id|boolean
12
-	 * Returns content id or false.
13
-	 */
14
-	public function import();
10
+    /**
11
+     * @return Wordpress_Content_Id|boolean
12
+     * Returns content id or false.
13
+     */
14
+    public function import();
15 15
 
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
entity/remote-entity-importer/class-valid-remote-entity-importer.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,38 +8,38 @@
 block discarded – undo
8 8
 
9 9
 class Valid_Remote_Entity_Importer implements Remote_Entity_Importer {
10 10
 
11
-	/**
12
-	 * @var Valid_Remote_Entity
13
-	 */
14
-	private $entity;
11
+    /**
12
+     * @var Valid_Remote_Entity
13
+     */
14
+    private $entity;
15 15
 
16
-	/**
17
-	 * @param $entity Valid_Remote_Entity
18
-	 */
19
-	public function __construct( $entity ) {
20
-		$this->entity = $entity;
21
-	}
16
+    /**
17
+     * @param $entity Valid_Remote_Entity
18
+     */
19
+    public function __construct( $entity ) {
20
+        $this->entity = $entity;
21
+    }
22 22
 
23 23
 
24
-	public function import() {
24
+    public function import() {
25 25
 
26
-		$entity_type_service = Wordlift_Entity_Type_Service::get_instance();
26
+        $entity_type_service = Wordlift_Entity_Type_Service::get_instance();
27 27
 
28
-		$post_id = wp_insert_post( array(
29
-			'post_title'   => $this->entity->get_name(),
30
-			'post_content' => $this->entity->get_description(),
31
-			'post_status'  => 'draft',
32
-			'post_type'    => 'entity',
33
-		) );
28
+        $post_id = wp_insert_post( array(
29
+            'post_title'   => $this->entity->get_name(),
30
+            'post_content' => $this->entity->get_description(),
31
+            'post_status'  => 'draft',
32
+            'post_type'    => 'entity',
33
+        ) );
34 34
 
35
-		foreach ( $this->entity->get_types() as $type ) {
36
-			$entity_type_service->set( $post_id, "http://schema.org/$type", false );
37
-		}
35
+        foreach ( $this->entity->get_types() as $type ) {
36
+            $entity_type_service->set( $post_id, "http://schema.org/$type", false );
37
+        }
38 38
 
39
-		foreach ( $this->entity->get_same_as() as $same_as ) {
40
-			add_post_meta( $post_id, 'entity_same_as', $same_as );
41
-		}
39
+        foreach ( $this->entity->get_same_as() as $same_as ) {
40
+            add_post_meta( $post_id, 'entity_same_as', $same_as );
41
+        }
42 42
 
43
-		return Wordpress_Content_Id::create_post( $post_id );
44
-	}
43
+        return Wordpress_Content_Id::create_post( $post_id );
44
+    }
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @param $entity Valid_Remote_Entity
18 18
 	 */
19
-	public function __construct( $entity ) {
19
+	public function __construct($entity) {
20 20
 		$this->entity = $entity;
21 21
 	}
22 22
 
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$entity_type_service = Wordlift_Entity_Type_Service::get_instance();
27 27
 
28
-		$post_id = wp_insert_post( array(
28
+		$post_id = wp_insert_post(array(
29 29
 			'post_title'   => $this->entity->get_name(),
30 30
 			'post_content' => $this->entity->get_description(),
31 31
 			'post_status'  => 'draft',
32 32
 			'post_type'    => 'entity',
33
-		) );
33
+		));
34 34
 
35
-		foreach ( $this->entity->get_types() as $type ) {
36
-			$entity_type_service->set( $post_id, "http://schema.org/$type", false );
35
+		foreach ($this->entity->get_types() as $type) {
36
+			$entity_type_service->set($post_id, "http://schema.org/$type", false);
37 37
 		}
38 38
 
39
-		foreach ( $this->entity->get_same_as() as $same_as ) {
40
-			add_post_meta( $post_id, 'entity_same_as', $same_as );
39
+		foreach ($this->entity->get_same_as() as $same_as) {
40
+			add_post_meta($post_id, 'entity_same_as', $same_as);
41 41
 		}
42 42
 
43
-		return Wordpress_Content_Id::create_post( $post_id );
43
+		return Wordpress_Content_Id::create_post($post_id);
44 44
 	}
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.