Contribuyentes::verificarRut()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 7
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * API Gateway: Cliente de API en PHP.
7
 * Copyright (C) API Gateway <https://www.apigateway.cl>
8
 *
9
 * Este programa es software libre: usted puede redistribuirlo y/o modificarlo
10
 * bajo los términos de la GNU Lesser General Public License (LGPL) publicada
11
 * por la Fundación para el Software Libre, ya sea la versión 3 de la Licencia,
12
 * o (a su elección) cualquier versión posterior de la misma.
13
 *
14
 * Este programa se distribuye con la esperanza de que sea útil, pero SIN
15
 * GARANTÍA ALGUNA; ni siquiera la garantía implícita MERCANTIL o de APTITUD
16
 * PARA UN PROPÓSITO DETERMINADO. Consulte los detalles de la GNU Lesser General
17
 * Public License (LGPL) para obtener una información más detallada.
18
 *
19
 * Debería haber recibido una copia de la GNU Lesser General Public License
20
 * (LGPL) junto a este programa. En caso contrario, consulte
21
 * <http://www.gnu.org/licenses/lgpl.html>.
22
 */
23
24
namespace apigatewaycl\api_client\sii;
25
26
use apigatewaycl\api_client\ApiBase;
27
use Psr\Http\Message\ResponseInterface;
28
29
/*
30
 * Módulo para obtener datos de los contribuyentes a través del SII.
31
 *
32
 * Para más información sobre la API, consulte la `documentación completa de
33
 * los Contribuyentes <https://developers.apigateway.cl/#c88f90b6-36bb-4dc2-ba93-6e418ff42098>`_.
34
 *
35
 * Cliente específico para interactuar con los endpoints de contribuyentes
36
 * de la API de API Gateway.
37
 *
38
 * Hereda de ApiClient y utiliza su funcionalidad para realizar solicitudes a la API.
39
 */
40
class Contribuyentes extends ApiBase
41
{
42
    /**
43
     * Obtiene la situación tributaria de un contribuyente.
44
     *
45
     * @param string $rut RUT del contribuyente.
46
     * @return \Psr\Http\Message\ResponseInterface Respuesta JSON con la
47
     * situación tributaria del contribuyente.
48
     */
49
    public function obtenerSituacionTributaria(string $rut): ResponseInterface
50
    {
51
        $url = sprintf(
52
            '/sii/contribuyentes/situacion_tributaria/tercero/%s',
53
            $rut
54
        );
55
        $response = $this->get(resource: $url);
56
57
        return $response;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $response could return the type null which is incompatible with the type-hinted return Psr\Http\Message\ResponseInterface. Consider adding an additional type-check to rule them out.
Loading history...
58
    }
59
60
    /**
61
     * Verifica el RUT de un contribuyente.
62
     *
63
     * @param string $serie Serie del RUT a verificar.
64
     * @return \Psr\Http\Message\ResponseInterface Respuesta JSON con la
65
     * verificación del RUT.
66
     */
67
    public function verificarRut(string $serie): ResponseInterface
68
    {
69
        $url = sprintf(
70
            '/sii/contribuyentes/rut/verificar/%s',
71
            $serie
72
        );
73
        $response = $this->get(resource: $url);
74
75
        return $response;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $response could return the type null which is incompatible with the type-hinted return Psr\Http\Message\ResponseInterface. Consider adding an additional type-check to rule them out.
Loading history...
76
    }
77
}
78