Passed
Push — master ( bd3828...767719 )
by Mike
06:57 queued 18s
created

woocommerce-rest-api.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Plugin Name: WooCommerce REST API
4
 * Plugin URI: https://github.com/woocommerce/woocommerce-rest-api
5
 * Description: The WooCommerce core REST API, installed as a feature plugin for development and testing purposes. Requires WooCommerce 3.7+ and PHP 5.3+.
6
 * Author: Automattic
7
 * Author URI: https://woocommerce.com
8
 * Version: 1.0.0-dev
9
 * Requires PHP: 5.6
10
 * License: GPLv3
11
 *
12
 * @package WooCommerce/RestApi
13
 */
14
15
defined( 'ABSPATH' ) || exit;
16
17
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
18
	return;
19
}
20
21
/**
22
 * Get API feature plugin version and callback function.
23
 */
24
$version       = include __DIR__ . '/version.php';
25
$init_callback = include __DIR__ . '/init.php';
26
27
/**
28
 * This callback registers this version of the API with WooCommerce.
29
 */
30
$register_callback = function() use ( $version, $init_callback ) {
31
	if ( ! is_callable( array( wc()->api, 'register' ) ) ) {
32
		return;
33
	}
34
	wc()->api->register( $version, $init_callback, __DIR__ );
0 ignored issues
show
The method register() does not exist on WC_API. Did you maybe mean register_wp_admin_settings()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
	wc()->api->/** @scrutinizer ignore-call */ 
35
            register( $version, $init_callback, __DIR__ );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
};
36
37
add_action( 'woocommerce_loaded', $register_callback );
38