vindi/vindi-woocommerce

View on GitHub
src/services/Webhooks.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 172 of 172 total issues

File Webhooks.php has 367 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
namespace VindiPaymentGateways;
 
use WC_Subscriptions_Manager;
Severity: Minor
Found in src/services/Webhooks.php - About 4 hrs to fix

    The class VindiWebhooks has an overall complexity of 75 which is very high. The configured complexity threshold is 50.
    Open

    class VindiWebhooks
    {
    /**
    * @var VindiSettings
    */
    Severity: Minor
    Found in src/services/Webhooks.php by phpmd

    VindiWebhooks has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class VindiWebhooks
    {
    /**
    * @var VindiSettings
    */
    Severity: Minor
    Found in src/services/Webhooks.php - About 3 hrs to fix

      Method bill_paid has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      private function bill_paid($data)
      {
      try {
      if (empty($data->bill->subscription)) {
      $order = $this->find_order_by_id($data->bill->code);
      Severity: Minor
      Found in src/services/Webhooks.php - About 1 hr to fix

        Function bill_paid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        private function bill_paid($data)
        {
        try {
        if (empty($data->bill->subscription)) {
        $order = $this->find_order_by_id($data->bill->code);
        Severity: Minor
        Found in src/services/Webhooks.php - About 25 mins to fix

        Avoid unused parameters such as '$data'.
        Open

        private function test($data)
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        The method handle() contains an exit expression.
        Open

        die('invalid access token');
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        The method handle() contains an exit expression.
        Open

        die($e->getMessage());
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        Avoid using static access to class '\WC_Subscriptions_Manager' in method 'subscription_renew'.
        Open

        WC_Subscriptions_Manager::prepare_renewal($subscription->id);
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        The method bill_paid uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

        } else {
        $vindi_subscription_id = $data->bill->subscription->id;
        $cycle = $data->bill->period->cycle;
        $order = $this->find_order_by_subscription_and_cycle($vindi_subscription_id, $cycle);
        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        The method bill_canceled uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

        } else {
        $vindi_subscription_id = $data->bill->subscription->id;
        $cycle = $data->bill->period->cycle;
        $order = $this->find_order_by_subscription_and_cycle($vindi_subscription_id, $cycle);
        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        The property $vindi_settings is not named in camelCase.
        Open

        class VindiWebhooks
        {
        /**
        * @var VindiSettings
        */
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

        private function find_order_by_id($id)
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

        private function find_bill_by_charge_id($id)
        Severity: Minor
        Found in src/services/Webhooks.php by phpmd

        Opening brace indented incorrectly; expected 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Opening brace indented incorrectly; expected 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Opening brace indented incorrectly; expected 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Blank line found at start of control structure
        Open

        if ($vindi_subscription && isset($vindi_subscription['next_billing_at'])) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Opening brace indented incorrectly; expected 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if ('charge_underpay' !== $issue_type)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if (empty($subscription))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if (null == $body || empty($body->event))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if (empty($charge))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if ('open' !== $issue_status)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if (empty($order))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if ('charge' !== $item_type)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Inline control structures are not allowed
        Open

        if (false === $query->have_posts())
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(sprintf(__('Pendência criada com o tipo "%s" não processada!', VINDI), $issue_type));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        $order->id,
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 8 spaces but found 6
        Open

        $issue_data->expected_amount,
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 6
        Open

        } catch (Exception $e) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 6
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        $this->vindi_settings = $vindi_settings;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(__('Falha ao interpretar JSON do webhook: Evento do Webhook não encontrado!', VINDI));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        if (method_exists($this, $type)) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 10 spaces but found 8
        Open

        $renew_infos['cicle'],
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 8
        Open

        $subscription->get_last_order()
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        ));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $issue_type = $data->issue->issue_type;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $issue_status = $data->issue->status;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function find_bill_by_charge_id($id)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(sprintf(__('Cobrança #%s não encontrada!', VINDI), $id), 2);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 8
        Open

        __('Já existe o ciclo %s para a assinatura #%s pedido #%s!', VINDI),
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        try {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 8 spaces but found 6
        Open

        __('Divergencia de valores do Pedido #%s: Valor Esperado R$ %s, Valor Pago R$ %s.', VINDI),
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 10 spaces but found 8
        Open

        $subscription->get_last_order()
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 16 spaces, found 8
        Open

        $order = $this->find_order_by_subscription_and_cycle($vindi_subscription_id, $cycle);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(sprintf(__('Pendência criada com o item do tipo "%s" não processada!', VINDI), $item_type));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if (empty($subscription))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $args = array(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return $token === $this->vindi_settings->get_token();
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        return $this->{$type}($data);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 8
        Open

        $renew_infos['vindi_subscription_id'],
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function validate_access_token($token)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if ('charge' !== $item_type)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function process_event($body)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function test($data)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(sprintf(__('Pedido #%s não encontrado!', VINDI), $id), 2);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $this->vindi_settings->logger->log(__('Evento de teste do webhook.', VINDI));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        ),
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 8 spaces but found 6
        Open

        $order->id,
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 8 spaces but found 6
        Open

        $issue_data->transaction_amount
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        ));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'post_status' => 'any',
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $vindi_subscription = $this->routes->getSubscription($data->bill->subscription->id);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        if ($vindi_subscription && isset($vindi_subscription['next_billing_at'])) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $data = $body->event->data;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        throw new Exception(sprintf(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 8
        Open

        $renew_infos['cicle'],
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if ('charge_underpay' !== $issue_type)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $bill = $this->find_bill_by_charge_id($item_id);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        ));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $subscription = wcs_get_subscription(end($sanitized_id));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return $order;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        );
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'post_type' => 'shop_order',
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $this->vindi_settings->logger->log(sprintf(__('Evento do webhook ignorado pelo plugin: ', VINDI), $type));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $subscription = $this->find_subscription_by_id($renew_infos['wc_subscription_id']);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(sprintf(__('Pendência criada com o status "%s" não processada!', VINDI), $issue_status));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $order = $this->find_order_by_bill_id($bill->id);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $order->add_order_note(sprintf(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private $vindi_settings;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 6
        Open

        try {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $this->vindi_settings->logger->log(sprintf(__('Novo Evento processado: %s', VINDI), $type));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'meta_key' => 'vindi_bill_id',
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return date('Y-m-d H:i:s', strtotime($date));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 16 spaces, found 8
        Open

        $cycle = $data->bill->period->cycle;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function find_order_by_id($id)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return wc_get_order($query->post->ID);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        ));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 6
        Open

        } else {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 6
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $item_type = strtolower($data->issue->item_type);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'post_status' => 'any',
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        ),
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $type = $body->event->type;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 10 spaces but found 8
        Open

        $renew_infos['vindi_subscription_id'],
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 6
        Open

        if (empty($data->bill->subscription)) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 16 spaces, found 8
        Open

        $order = $this->find_order_by_id($data->bill->code);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 16 spaces, found 8
        Open

        $vindi_subscription_id = $data->bill->subscription->id;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $order->update_status('cancelled', __('Pagamento cancelado dentro da Vindi!', VINDI));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $issue_data = $data->issue->data;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return $subscription;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $order = wc_get_order($id);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        throw new Exception(sprintf(__('Pedido com bill_id #%s não encontrado!', VINDI), $bill_id), 2);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $next_billing_at = $vindi_subscription['next_billing_at'];
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 6
        Open

        if ($end_at != null && $next_billing_at > $end_at) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 16 spaces, found 8
        Open

        return false;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function format_date($date)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function bill_canceled($data)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private function issue_created($data)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $charge = $this->routes->getCharge($id);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $query = $this->query_order_by_metas(array(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $subscription->update_dates(array('end_date' => $end_date));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        $this->routes = $vindi_settings->routes;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if (null == $body || empty($body->event))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 10 spaces but found 8
        Open

        __('Já existe o ciclo %s para a assinatura #%s pedido #%s!', VINDI),
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        if ($this->subscription_has_order_in_cycle($renew_infos['vindi_subscription_id'], $renew_infos['cycle'])) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if ('open' !== $issue_status)
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 4
        Open

        } catch (Exception $e) {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $item_id = (int) $data->issue->item_id;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        __('Divergencia de valores do Pedido #%s: Valor Esperado R$ %s, Valor Pago R$ %s.', VINDI),
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if (empty($charge))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if (empty($order))
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'post_type' => 'shop_order',
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'meta_value' => $bill_id,
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $next_payment = $this->format_date($next_billing_at);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $subscription = $this->find_subscription_by_id($data->bill->subscription->code);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $subscription->update_dates(array('next_payment' => $next_payment));
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        $issue_data->expected_amount,
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        $issue_data->transaction_amount
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return (object) $charge['bill'];
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return wc_get_order($query->post->ID);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        array(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return $query->have_posts();
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $args = array(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 6
        Open

        }
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $query = $this->query_order_by_metas(array(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected 4 spaces, found 2
        Open

        private $routes;
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 16 spaces, found 14
        Open

        $order = $this->find_order_by_id($data->bill->code);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        if (false === $query->have_posts())
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        $query = new WP_Query($args);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        );
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $end_date = $this->format_date($end_at);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        'meta_query' => $metas,
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 4 spaces, found 2
        Open

        {
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 6
        Open

        array(
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 8 spaces, found 4
        Open

        return new WP_Query($args);
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        Line indented incorrectly; expected at least 12 spaces, found 6
        Open

        $end_at = $vindi_subscription['end_at'];
        Severity: Minor
        Found in src/services/Webhooks.php by phpcodesniffer

        There are no issues that match your filters.

        Category
        Status