Method init_form_fields
has 63 lines of code (exceeds 25 allowed). Consider refactoring.
function init_form_fields()
{
$url = admin_url(sprintf('admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', VINDI, $this->get_token()));
$logs_url = '<a href="' . $url . '" target="_blank">' . __('Ver Logs', VINDI) . '</a>';
$nfe_know_more = '<a href="http://atendimento.vindi.com.br/hc/pt-br/articles/204450944-Notas-fiscais" target="_blank">' . __('Saiba mais', VINDI) . '</a>';
Avoid unused private fields such as '$plugin'.
private $plugin;
Avoid unused local variables such as '$sand_box_article'.
$sand_box_article = '<a href="https://atendimento.vindi.com.br/hc/pt-br/articles/115012242388-Sandbox" target="_blank">' . __('DĆŗvidas?', VINDI) . '</a>';
The method get_return_status uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
return 'processing';
}
The method check_ssl uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
return is_ssl();
}
The method api_key_field uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
update_option('vindi_invalid_api_key', false);
$this->invalidApiKey = false;
}
Visibility must be declared on method "__construct"
function __construct()
Visibility must be declared on method "init_form_fields"
function init_form_fields()
Visibility must be declared on method "checkKey"
function checkKey()
The 'get_is_active_sandbox()' method which returns a boolean should be named 'is...()' or 'has...()'
public function get_is_active_sandbox()
{
return $this->settings['sandbox'];
}
Line exceeds 120 characters; contains 159 characters
$nfe_know_more = '<a href="http://atendimento.vindi.com.br/hc/pt-br/articles/204450944-Notas-fiscais" target="_blank">' . __('Saiba mais', VINDI) . '</a>';
Line exceeds 120 characters; contains 136 characters
$prospects_url = '<a href="https://app.vindi.com.br/prospects/new" target="_blank">' . __('NĆ£o possui uma conta?', VINDI) . '</a>';
Line exceeds 120 characters; contains 123 characters
$url = admin_url(sprintf('admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', VINDI, $this->get_token()));
Line exceeds 120 characters; contains 128 characters
'description' => __('Status que o pedido deverĆ” ter apĆ³s receber a confirmaĆ§Ć£o de pagamento da Vindi.', VINDI),
Line exceeds 120 characters; contains 159 characters
$sand_box_article = '<a href="https://atendimento.vindi.com.br/hc/pt-br/articles/115012242388-Sandbox" target="_blank">' . __('DĆŗvidas?', VINDI) . '</a>';
Line exceeds 120 characters; contains 166 characters
'description' => sprintf(__('Envia informaƧƵes de RG e InscriĆ§Ć£o Estadual para EmissĆ£o de NFe\'s com nossos parceiros. %s', VINDI), $nfe_know_more),
Line exceeds 120 characters; contains 133 characters
'description' => sprintf(__('Ative esta opĆ§Ć£o para habilitar logs de depuraĆ§Ć£o do servidor. %s', VINDI), $logs_url),
Line exceeds 120 characters; contains 126 characters
'description' => __('Ative esta opĆ§Ć£o para habilitar a comunicaĆ§Ć£o com o ambiente Sandbox da Vindi.', VINDI),
Spaces must be used to indent lines; tabs are not allowed
public function get_webhooks_url() {
Spaces must be used to indent lines; tabs are not allowed
return sprintf('%s/index.php/wc-api/%s?token=%s',
Line indented incorrectly; expected at least 8 spaces, found 4
$this->form_fields = array(
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected at least 8 spaces, found 6
'sandbox' => array(
Line indented incorrectly; expected at least 8 spaces, found 4
$this->debug = $this->get_option('debug') == 'yes' ? true : false;
Line indented incorrectly; expected 4 spaces, found 2
public static function add_settings_tab($settings_tabs)
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 8 spaces, found 4
wc_get_template(
Line indented incorrectly; expected at least 8 spaces, found 6
'testing' => array(
Line indented incorrectly; expected 4 spaces, found 2
public $woocommerce;
Line indented incorrectly; expected at least 8 spaces, found 4
global $woocommerce;
Line indented incorrectly; expected 4 spaces, found 2
public function settings_tab()
Line indented incorrectly; expected 4 spaces, found 2
public function get_template($name, $args = array())
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected at least 8 spaces, found 6
'vindi_synchronism' => array(
Line indented incorrectly; expected 4 spaces, found 2
public function get_is_active_sandbox()
Line indented incorrectly; expected 4 spaces, found 2
private $plugin;
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 8 spaces, found 6
'debug' => array(
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected 4 spaces, found 2
private $token;
Line indented incorrectly; expected at least 8 spaces, found 4
$this->init_form_fields();
Line indented incorrectly; expected at least 8 spaces, found 4
$this->routes = new VindiRoutes($this);
Space after opening parenthesis of function call prohibited
$this->invalidApiKey = get_option( 'vindi_invalid_api_key', false );
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 8 spaces, found 6
sprintf(
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected 4 spaces, found 2
function checkKey()
Line indented incorrectly; expected 4 spaces, found 2
private $debug;
Line indented incorrectly; expected at least 8 spaces, found 4
$this->logger = new VindiLogger(VINDI, $this->debug);
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 8 spaces, found 6
$name,
Line indented incorrectly; expected at least 8 spaces, found 4
$nfe_know_more = '<a href="http://atendimento.vindi.com.br/hc/pt-br/articles/204450944-Notas-fiscais" target="_blank">' . __('Saiba mais', VINDI) . '</a>';
Line indented incorrectly; expected 4 spaces, found 2
function __construct()
Line indented incorrectly; expected at least 8 spaces, found 4
$this->init_settings();
Line indented incorrectly; expected at least 8 spaces, found 4
$settings_tabs['settings_vindi'] = __('Vindi', VINDI);
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected 4 spaces, found 2
}
Multi-line function call not indented correctly; expected 8 spaces but found 6
'',
Line indented incorrectly; expected at least 8 spaces, found 6
'',
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected at least 8 spaces, found 4
$this->token = sanitize_file_name(wp_hash(VINDI));
Multi-line function call not indented correctly; expected 8 spaces but found 6
$args,
Line indented incorrectly; expected at least 8 spaces, found 4
$sand_box_article = '<a href="https://atendimento.vindi.com.br/hc/pt-br/articles/115012242388-Sandbox" target="_blank">' . __('DĆŗvidas?', VINDI) . '</a>';
Line indented incorrectly; expected 4 spaces, found 2
public function get_api_key()
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 8 spaces, found 4
return $this->settings['sandbox'];
Line indented incorrectly; expected at least 8 spaces, found 4
$this->api = new VindiApi($this->get_api_key(), $this->logger, $this->get_is_active_sandbox());
Line indented incorrectly; expected 8 spaces, found 4
if (is_admin()) {
Multi-line function call not indented correctly; expected 8 spaces but found 6
$name,
Multi-line function call not indented correctly; expected 8 spaces but found 6
sprintf(
Line indented incorrectly; expected 4 spaces, found 2
public function get_token()
Line indented incorrectly; expected at least 8 spaces, found 6
)
Line indented incorrectly; expected at least 8 spaces, found 6
'api_key' => array(
Line indented incorrectly; expected 4 spaces, found 2
public $routes;
Line indented incorrectly; expected 4 spaces, found 2
private $invalidApiKey;
Multi-line function call not indented correctly; expected 8 spaces but found 6
)
Line indented incorrectly; expected at least 8 spaces, found 6
'shipping_and_tax_config' => array(
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected 4 spaces, found 2
public $api;
Line indented incorrectly; expected 8 spaces, found 4
}
Line indented incorrectly; expected at least 8 spaces, found 4
return $settings_tabs;
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected at least 10 spaces, found 4
);
Line indented incorrectly; expected at least 8 spaces, found 4
return 'text';
Line indented incorrectly; expected 4 spaces, found 2
public $dependencies;
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 8 spaces, found 4
$this->woocommerce = $woocommerce;
Line indented incorrectly; expected at least 8 spaces, found 4
$this->dependencies = new VindiDependencies;
Line indented incorrectly; expected at least 8 spaces, found 4
$this->invalidApiKey = get_option( 'vindi_invalid_api_key', false );
Line indented incorrectly; expected 4 spaces, found 2
function init_form_fields()
Line indented incorrectly; expected at least 8 spaces, found 4
$url = admin_url(sprintf('admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', VINDI, $this->get_token()));
Line indented incorrectly; expected at least 8 spaces, found 4
$logs_url = '<a href="' . $url . '" target="_blank">' . __('Ver Logs', VINDI) . '</a>';
Line indented incorrectly; expected at least 8 spaces, found 6
'return_status' => array(
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected at least 8 spaces, found 6
),
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 8 spaces, found 4
return $this->settings['api_key'];
Line indented incorrectly; expected at least 8 spaces, found 6
$args,
Line indented incorrectly; expected at least 8 spaces, found 6
'send_nfe_information' => array(
Line indented incorrectly; expected at least 8 spaces, found 4
return $this->token;
Line indented incorrectly; expected 4 spaces, found 2
public $logger;
Expected 0 spaces before closing bracket; 1 found
$this->invalidApiKey = get_option( 'vindi_invalid_api_key', false );
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 8 spaces, found 4
$this->get_template('admin-settings.html.php', array('settings' => $this));
Line indented incorrectly; expected at least 8 spaces, found 4
);
Line indented incorrectly; expected at least 8 spaces, found 4
$prospects_url = '<a href="https://app.vindi.com.br/prospects/new" target="_blank">' . __('NĆ£o possui uma conta?', VINDI) . '</a>';
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 12 spaces, found 6
update_option('vindi_invalid_api_key', false);
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected 8 spaces, found 4
if(isset($this->settings['return_status'])) {
Line indented incorrectly; expected 8 spaces, found 4
}
Line indented incorrectly; expected at least 12 spaces, found 6
return true;
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected 4 spaces, found 2
public function get_return_status()
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected 8 spaces, found 4
} else {
Line indented incorrectly; expected at least 12 spaces, found 6
$this->invalidApiKey = true;
Line indented incorrectly; expected 4 spaces, found 2
public function is_api_key_valid()
Line indented incorrectly; expected at least 8 spaces, found 4
return 'yes' === $this->settings['shipping_and_tax_config'];
Line indented incorrectly; expected at least 8 spaces, found 4
return 'yes' === $this->settings['send_nfe_information'];
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected 8 spaces, found 4
if ($this->get_is_active_sandbox()) {
Expected 1 space after IF keyword; 0 found
if($this->invalidApiKey) {
Expected 1 space after IF keyword; 0 found
if(isset($this->settings['return_status'])) {
Multi-line function call not indented correctly; expected 8 spaces but found 4
);
Line indented incorrectly; expected at least 8 spaces, found 4
$this->api = new VindiApi($api_key, $this->logger, $this->get_is_active_sandbox());
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected 4 spaces, found 2
public function check_ssl()
Line indented incorrectly; expected 8 spaces, found 4
}
Line indented incorrectly; expected 8 spaces, found 4
} else {
Line indented incorrectly; expected 4 spaces, found 2
}
Opening brace should be on a new line
public function get_webhooks_url() {
Line indented incorrectly; expected at least 12 spaces, found 6
update_option('vindi_invalid_api_key', true);
Line indented incorrectly; expected at least 8 spaces, found 4
return 'yes' === $this->settings['vindi_synchronism'];
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected 8 spaces, found 4
if ('unauthorized' === $this->api->test_api_key($api_key)) {
Line indented incorrectly; expected 8 spaces, found 4
}
Line indented incorrectly; expected 8 spaces, found 4
}
Line indented incorrectly; expected 4 spaces, found 2
public function send_nfe_information()
Line indented incorrectly; expected 8 spaces, found 4
if (!$api_key) {
Line indented incorrectly; expected at least 12 spaces, found 6
include_once VINDI_SRC . 'views/invalid-api-key.php';
Line indented incorrectly; expected at least 12 spaces, found 6
$this->invalidApiKey = false;
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected 8 spaces, found 4
if($this->invalidApiKey) {
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 8 spaces, found 4
$api_key = $this->get_api_key();
Line indented incorrectly; expected 4 spaces, found 2
public function api_key_field()
Line indented incorrectly; expected 4 spaces, found 2
public function get_shipping_and_tax_config()
Line indented incorrectly; expected at least 12 spaces, found 6
return is_ssl();
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 12 spaces, found 6
return 'processing';
Line indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 12 spaces, found 6
return $this->settings['return_status'];
Line indented incorrectly; expected 8 spaces, found 4
}
Line indented incorrectly; expected at least 12 spaces, found 6
return;
Line indented incorrectly; expected at least 12 spaces, found 6
include_once VINDI_SRC . 'views/invalid-api-key.php';
Line indented incorrectly; expected at least 4 spaces, found 2
{
Line indented incorrectly; expected at least 4 spaces, found 2
{
Opening parenthesis of a multi-line function call must be the last content on the line
return sprintf('%s/index.php/wc-api/%s?token=%s',
Line indented incorrectly; expected at least 8 spaces, found 4
);
Line indented incorrectly; expected 8 spaces, found 4
} else {
Closing brace indented incorrectly; expected 4 spaces, found 2
}
Line indented incorrectly; expected 4 spaces, found 2
public function get_synchronism_status()
Line indented incorrectly; expected 4 spaces, found 2
}
There are no issues that match your filters.