Skip to content

Commit 321ffcc

Browse files
committed
Merge branch 'sonarcloud'
2 parents 295e7cc + 54eba47 commit 321ffcc

36 files changed

+79
-75
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor
109109
[release]: https://github.com/eclipxe13/CfdiUtils/releases
110110
[license]: https://github.com/eclipxe13/CfdiUtils/blob/master/LICENSE
111111
[build]: https://github.com/eclipxe13/CfdiUtils/actions/workflows/build.yml?query=branch:master
112-
[reliability]:https://sonarcloud.io/component_measures?id=eclipxe13_phpcfdi&metric=Reliability
113-
[maintainability]: https://sonarcloud.io/component_measures?id=eclipxe13_phpcfdi&metric=Maintainability
114-
[coverage]: https://sonarcloud.io/component_measures?id=eclipxe13_phpcfdi&metric=Coverage
115-
[violations]: https://sonarcloud.io/project/issues?id=eclipxe13_phpcfdi&resolved=false
112+
[reliability]:https://sonarcloud.io/component_measures?id=eclipxe13_cfdiutils&metric=Reliability
113+
[maintainability]: https://sonarcloud.io/component_measures?id=eclipxe13_cfdiutils&metric=Maintainability
114+
[coverage]: https://sonarcloud.io/component_measures?id=eclipxe13_cfdiutils&metric=Coverage
115+
[violations]: https://sonarcloud.io/project/issues?id=eclipxe13_cfdiutils&resolved=false
116116
[downloads]: https://packagist.org/packages/eclipxe/CfdiUtils
117117

118118
[badge-source]: https://img.shields.io/badge/source-eclipxe13/CfdiUtils-blue?logo=github&style=flat-square
@@ -122,8 +122,8 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor
122122
[badge-release]: https://img.shields.io/github/release/eclipxe13/CfdiUtils?logo=git&style=flat-square
123123
[badge-license]: https://img.shields.io/github/license/eclipxe13/CfdiUtils?logo=open-source-initiative&style=flat-square
124124
[badge-build]: https://img.shields.io/github/actions/workflow/status/eclipxe13/CfdiUtils/build.yml?branch=master&logo=github-actions&style=flat-square
125-
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_phpcfdi&metric=reliability_rating
126-
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_phpcfdi&metric=sqale_rating
127-
[badge-coverage]: https://img.shields.io/sonar/coverage/eclipxe13_phpcfdi/master?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
128-
[badge-violations]: https://img.shields.io/sonar/violations/eclipxe13_phpcfdi/master?format=long&logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
125+
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_cfdiutils&metric=reliability_rating
126+
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_cfdiutils&metric=sqale_rating
127+
[badge-coverage]: https://img.shields.io/sonar/coverage/eclipxe13_cfdiutils/master?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
128+
[badge-violations]: https://img.shields.io/sonar/violations/eclipxe13_cfdiutils/master?format=long&logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
129129
[badge-downloads]: https://img.shields.io/packagist/dt/eclipxe/CfdiUtils?logo=composer&style=flat-square

docs/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ y se encuentra amparada por la Licencia MIT (MIT). Consulte el archivo [LICENSE]
130130
[release]: https://github.com/eclipxe13/CfdiUtils/releases
131131
[license]: https://github.com/eclipxe13/CfdiUtils/blob/master/LICENSE
132132
[build]: https://github.com/eclipxe13/CfdiUtils/actions/workflows/build.yml?query=branch:master
133-
[reliability]:https://sonarcloud.io/component_measures?id=eclipxe13_phpcfdi&metric=Reliability
134-
[maintainability]: https://sonarcloud.io/component_measures?id=eclipxe13_phpcfdi&metric=Maintainability
135-
[coverage]: https://sonarcloud.io/component_measures?id=eclipxe13_phpcfdi&metric=Coverage
136-
[violations]: https://sonarcloud.io/project/issues?id=eclipxe13_phpcfdi&resolved=false
133+
[reliability]:https://sonarcloud.io/component_measures?id=eclipxe13_cfdiutils&metric=Reliability
134+
[maintainability]: https://sonarcloud.io/component_measures?id=eclipxe13_cfdiutils&metric=Maintainability
135+
[coverage]: https://sonarcloud.io/component_measures?id=eclipxe13_cfdiutils&metric=Coverage
136+
[violations]: https://sonarcloud.io/project/issues?id=eclipxe13_cfdiutils&resolved=false
137137
[downloads]: https://packagist.org/packages/eclipxe/CfdiUtils
138138

139139
[badge-source]: https://img.shields.io/badge/source-eclipxe13/CfdiUtils-blue?logo=github&style=flat-square
@@ -143,8 +143,8 @@ y se encuentra amparada por la Licencia MIT (MIT). Consulte el archivo [LICENSE]
143143
[badge-release]: https://img.shields.io/github/release/eclipxe13/CfdiUtils?logo=git&style=flat-square
144144
[badge-license]: https://img.shields.io/github/license/eclipxe13/CfdiUtils?logo=open-source-initiative&style=flat-square
145145
[badge-build]: https://img.shields.io/github/actions/workflow/status/eclipxe13/CfdiUtils/build.yml?branch=master&logo=github-actions&style=flat-square
146-
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_phpcfdi&metric=reliability_rating
147-
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_phpcfdi&metric=sqale_rating
148-
[badge-coverage]: https://img.shields.io/sonar/coverage/eclipxe13_phpcfdi/master?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
149-
[badge-violations]: https://img.shields.io/sonar/violations/eclipxe13_phpcfdi/master?format=long&logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
146+
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_cfdiutils&metric=reliability_rating
147+
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=eclipxe13_cfdiutils&metric=sqale_rating
148+
[badge-coverage]: https://img.shields.io/sonar/coverage/eclipxe13_cfdiutils/master?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
149+
[badge-violations]: https://img.shields.io/sonar/violations/eclipxe13_cfdiutils/master?format=long&logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
150150
[badge-downloads]: https://img.shields.io/packagist/dt/eclipxe/CfdiUtils?logo=composer&style=flat-square

src/CfdiUtils/CadenaOrigen/XsltBuilderPropertyTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trait XsltBuilderPropertyTrait
88

99
public function hasXsltBuilder(): bool
1010
{
11-
return ($this->xsltBuilder instanceof XsltBuilderInterface);
11+
return $this->xsltBuilder instanceof XsltBuilderInterface;
1212
}
1313

1414
public function getXsltBuilder(): XsltBuilderInterface

src/CfdiUtils/Certificado/Certificado.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function verify(string $data, string $signature, int $algorithm = OPENSSL
259259
if (-1 === $verify) {
260260
throw new \RuntimeException('OpenSSL Error: ' . openssl_error_string());
261261
}
262-
return (1 === $verify);
262+
return 1 === $verify;
263263
}
264264

265265
/**

src/CfdiUtils/Certificado/CertificadoPropertyInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ interface CertificadoPropertyInterface
66
{
77
public function getCertificado(): Certificado;
88

9-
public function setCertificado(Certificado $Certificado);
9+
public function setCertificado(Certificado $certificado);
1010
}

src/CfdiUtils/Certificado/CertificadoPropertyTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trait CertificadoPropertyTrait
88

99
public function hasCertificado(): bool
1010
{
11-
return ($this->certificado instanceof Certificado);
11+
return $this->certificado instanceof Certificado;
1212
}
1313

1414
public function getCertificado(): Certificado

src/CfdiUtils/CfdiCreatorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function moveSatDefinitionsToComprobante(): void
8484

8585
public function saveXml(string $filename): bool
8686
{
87-
return (false !== file_put_contents($filename, $this->asXml()));
87+
return false !== file_put_contents($filename, $this->asXml());
8888
}
8989

9090
private function buildCadenaDeOrigenUsingXsltLocation(string $xsltLocation): string

src/CfdiUtils/ConsultaCfdiSat/StatusResponse.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,26 @@ public function getValidationEfos(): string
8080

8181
public function responseWasOk(): bool
8282
{
83-
return (str_starts_with($this->code, 'S - '));
83+
return str_starts_with($this->code, 'S - ');
8484
}
8585

8686
public function isVigente(): bool
8787
{
88-
return ('Vigente' === $this->cfdi);
88+
return 'Vigente' === $this->cfdi;
8989
}
9090

9191
public function isNotFound(): bool
9292
{
93-
return ('No Encontrado' === $this->cfdi);
93+
return 'No Encontrado' === $this->cfdi;
9494
}
9595

9696
public function isCancelled(): bool
9797
{
98-
return ('Cancelado' === $this->cfdi);
98+
return 'Cancelado' === $this->cfdi;
9999
}
100100

101101
public function isEfosListed(): bool
102102
{
103-
return ('100' === $this->validationEfos);
103+
return '100' === $this->validationEfos;
104104
}
105105
}

src/CfdiUtils/Elements/Cce11/Traits/DomicilioTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public function getDomicilio(): Domicilio
1717

1818
public function addDomicilio(array $attributes = []): Domicilio
1919
{
20-
$Domicilio = $this->getDomicilio();
21-
$Domicilio->addAttributes($attributes);
22-
return $Domicilio;
20+
$domicilio = $this->getDomicilio();
21+
$domicilio->addAttributes($attributes);
22+
return $domicilio;
2323
}
2424
}

src/CfdiUtils/Nodes/NodeNsDefinitionsMover.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct()
1616

1717
public function hasNamespaceFilter(): bool
1818
{
19-
return (null !== $this->namespaceFilter);
19+
return null !== $this->namespaceFilter;
2020
}
2121

2222
public function getNamespaceFilter(): ?callable

src/CfdiUtils/Nodes/Nodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function removeAll(): self
8989

9090
public function exists(NodeInterface $node): bool
9191
{
92-
return ($this->indexOf($node) >= 0);
92+
return $this->indexOf($node) >= 0;
9393
}
9494

9595
public function first(): ?NodeInterface

src/CfdiUtils/OpenSSL/PemContainer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ public function hasAny(): bool
3030

3131
public function hasCertificate(): bool
3232
{
33-
return ('' !== $this->certificate);
33+
return '' !== $this->certificate;
3434
}
3535

3636
public function hasPublicKey(): bool
3737
{
38-
return ('' !== $this->publicKey);
38+
return '' !== $this->publicKey;
3939
}
4040

4141
public function hasPrivateKey(): bool
4242
{
43-
return ('' !== $this->privateKey);
43+
return '' !== $this->privateKey;
4444
}
4545
}

src/CfdiUtils/QuickReader/QuickReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function getAttributeByName(string $name): ?string
114114

115115
public function offsetExists($offset): bool
116116
{
117-
return (null !== $this->getAttributeByName((string) $offset));
117+
return null !== $this->getAttributeByName((string) $offset);
118118
}
119119

120120
public function offsetGet($offset): string
@@ -136,6 +136,6 @@ public function offsetUnset($offset): void
136136

137137
protected function namesAreEqual(string $first, string $second): bool
138138
{
139-
return (0 === strcasecmp($first, $second));
139+
return 0 === strcasecmp($first, $second);
140140
}
141141
}

src/CfdiUtils/SumasConceptos/SumasConceptos.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,17 @@ public function getRetenciones(): array
238238

239239
public function hasTraslados(): bool
240240
{
241-
return ([] !== $this->traslados);
241+
return [] !== $this->traslados;
242242
}
243243

244244
public function hasExentos(): bool
245245
{
246-
return ([] !== $this->exentos);
246+
return [] !== $this->exentos;
247247
}
248248

249249
public function hasRetenciones(): bool
250250
{
251-
return ([] !== $this->retenciones);
251+
return [] !== $this->retenciones;
252252
}
253253

254254
public function getImpuestosTrasladados(): float
@@ -294,12 +294,12 @@ public function getLocalesRetenciones(): array
294294

295295
public function hasLocalesTraslados(): bool
296296
{
297-
return ([] !== $this->localesTraslados);
297+
return [] !== $this->localesTraslados;
298298
}
299299

300300
public function hasLocalesRetenciones(): bool
301301
{
302-
return ([] !== $this->localesRetenciones);
302+
return [] !== $this->localesRetenciones;
303303
}
304304

305305
public function foundAnyConceptWithDiscount(): bool

src/CfdiUtils/SumasConceptos/SumasConceptosWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private function getImpuestosContents(array $impuestos, bool $hasBase, bool $has
127127

128128
private function valueGreaterThanZero(float $value): bool
129129
{
130-
return (round($value, $this->precision) > 0);
130+
return round($value, $this->precision) > 0;
131131
}
132132

133133
public function format(float $number): string

src/CfdiUtils/Utils/CurrencyDecimals.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function round(float $value): float
3838
public function doesNotExceedDecimals(string $value): bool
3939
{
4040
// use pathinfo trick to retrieve the right part after the dot
41-
return ($this->decimalsCount($value) <= $this->decimals());
41+
return $this->decimalsCount($value) <= $this->decimals();
4242
}
4343

4444
public static function decimalsCount(string $value): int

src/CfdiUtils/Utils/Rfc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ public function rfc(): string
3737

3838
public function isPerson(): bool
3939
{
40-
return (13 === $this->length);
40+
return 13 === $this->length;
4141
}
4242

4343
public function isMoral(): bool
4444
{
45-
return (12 === $this->length);
45+
return 12 === $this->length;
4646
}
4747

4848
public function isGeneric(): bool
4949
{
50-
return (static::RFC_GENERIC === $this->rfc);
50+
return static::RFC_GENERIC === $this->rfc;
5151
}
5252

5353
public function isForeign(): bool
5454
{
55-
return (static::RFC_FOREIGN === $this->rfc);
55+
return static::RFC_FOREIGN === $this->rfc;
5656
}
5757

5858
public function checkSum(): string

src/CfdiUtils/Utils/SchemaLocations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function fromStingStrictXsd(string $schemaLocationValue): self
6464

6565
public function isEmpty(): bool
6666
{
67-
return ([] === $this->pairs);
67+
return [] === $this->pairs;
6868
}
6969

7070
/**

src/CfdiUtils/Utils/Xml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static function isValidXmlName(string $name): bool
9090
. '\xC0-\xD6\xD8-\xF6\xF8-\x{2FF}\x{370}-\x{37D}\x{37F}-\x{1FFF}\x{200C}-\x{200D}\x{2070}-\x{218F}'
9191
. '\x{2C00}-\x{2FEF}\x{3001}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFFD}\x{10000}-\x{EFFFF}'
9292
. '\xB7\x{0300}-\x{036F}\x{203F}-\x{2040}]*$/u';
93-
return (1 === preg_match($pattern, $name));
93+
return 1 === preg_match($pattern, $name);
9494
}
9595

9696
/**

src/CfdiUtils/Validate/Asserts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function mustStop(?bool $newValue = null): bool
6767

6868
public function hasStatus(Status $status): bool
6969
{
70-
return (null !== $this->getFirstStatus($status));
70+
return null !== $this->getFirstStatus($status);
7171
}
7272

7373
public function hasErrors(): bool

src/CfdiUtils/Validate/Cfdi33/Abstracts/AbstractVersion33.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ abstract class AbstractVersion33 implements ValidatorInterface
88
{
99
public function canValidateCfdiVersion(string $version): bool
1010
{
11-
return ('3.3' === $version);
11+
return '3.3' === $version;
1212
}
1313
}

src/CfdiUtils/Validate/Cfdi33/RecepcionPagos/Pagos/AbstractPagoValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ abstract public function validatePago(NodeInterface $pago): bool;
4141

4242
protected function isGreaterThan(float $value, float $compare): bool
4343
{
44-
return ($value - $compare > 0.0000001);
44+
return $value - $compare > 0.0000001;
4545
}
4646

4747
protected function isEqual(float $expected, float $value): bool
4848
{
49-
return (abs($expected - $value) < 0.0000001);
49+
return abs($expected - $value) < 0.0000001;
5050
}
5151

5252
protected function createCurrencyDecimals(string $currency): CurrencyDecimals

src/CfdiUtils/Validate/Cfdi33/RecepcionPagos/Pagos/DoctoRelacionado/ImporteSaldoInsolutoValor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function validateDoctoRelacionado(NodeInterface $docto): bool
2626
}
2727

2828
$expected = (float) $docto['ImpSaldoAnt'] - $this->calculateDocumentAmount($docto, $this->getPago());
29-
if (! $this->isEqual($value, $expected)) {
29+
if (! $this->isEqual($expected, $value)) {
3030
throw $this->exception(
3131
sprintf('ImpSaldoInsoluto: "%s", Esperado: %F', $docto['ImpSaldoInsoluto'], $expected)
3232
);

src/CfdiUtils/Validate/Cfdi33/Standard/ComprobanteTipoDeComprobante.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ private function isZero(string $value): bool
137137
if ('' === $value || ! is_numeric($value)) {
138138
return false;
139139
}
140-
return (abs((float) $value) < 0.0000001);
140+
return abs((float) $value) < 0.0000001;
141141
}
142142

143143
private function isGreaterThanZero(string $value): bool
144144
{
145145
if ('' === $value || ! is_numeric($value)) {
146146
return false;
147147
}
148-
return (abs((float) $value) > 0.0000001);
148+
return abs((float) $value) > 0.0000001;
149149
}
150150
}

src/CfdiUtils/Validate/Cfdi33/Standard/ConceptoDescuento.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ public function conceptoHasInvalidDiscount(NodeInterface $concepto): bool
4848
}
4949
$descuento = (float) $concepto['Descuento'];
5050
$importe = (float) $concepto['Importe'];
51-
return (! ($descuento >= 0 && $descuento <= $importe));
51+
return ! ($descuento >= 0 && $descuento <= $importe);
5252
}
5353
}

src/CfdiUtils/Validate/Cfdi33/Standard/SumasConceptosComprobanteImpuestos.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,6 @@ private function compareImportesAreEqual(float $first, float $second, ?float $de
281281
if (null === $delta) {
282282
$delta = 0.000001;
283283
}
284-
return (abs($first - $second) <= $delta);
284+
return abs($first - $second) <= $delta;
285285
}
286286
}

src/CfdiUtils/Validate/Cfdi33/Utils/AssertFechaFormat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public static function hasFormat(string $format): bool
2727
}
2828
$value = (int) strtotime($format);
2929
$expecteFormat = Format::datetime($value);
30-
return ($expecteFormat === $format);
30+
return $expecteFormat === $format;
3131
}
3232
}

src/CfdiUtils/Validate/Cfdi40/Abstracts/AbstractVersion40.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ abstract class AbstractVersion40 implements ValidatorInterface
88
{
99
public function canValidateCfdiVersion(string $version): bool
1010
{
11-
return ('4.0' === $version);
11+
return '4.0' === $version;
1212
}
1313
}

src/CfdiUtils/Validate/Common/SelloDigitalCertificadoValidatorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private function obtainSello(string $selloBase64): string
152152

153153
protected function compareNames(string $first, string $second): bool
154154
{
155-
return ($this->castNombre($first) === $this->castNombre($second));
155+
return $this->castNombre($first) === $this->castNombre($second);
156156
}
157157

158158
protected function castNombre(string $nombre): string

0 commit comments

Comments
 (0)