Skip to content

Commit

Permalink
Merge branch 'update-sonarcloud' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipxe13 committed Oct 2, 2022
2 parents 993ca66 + ea6a088 commit 1c96923
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 41 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.scrutinizer.yml export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
Expand Down
21 changes: 0 additions & 21 deletions .scrutinizer.yml

This file was deleted.

40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# phpcfdi/cfdi-to-json

[![Source Code][badge-source]][source]
[![Packagist PHP Version Support][badge-php-version]][php-version]
[![Discord][badge-discord]][discord]
[![Latest Version][badge-release]][release]
[![Software License][badge-license]][license]
[![Build Status][badge-build]][build]
[![Scrutinizer][badge-quality]][quality]
[![Coverage Status][badge-coverage]][coverage]
[![Reliability][badge-reliability]][reliability]
[![Maintainability][badge-maintainability]][maintainability]
[![Code Coverage][badge-coverage]][coverage]
[![Violations][badge-violations]][violations]
[![Total Downloads][badge-downloads]][downloads]

> Herramienta para convertir archivos CFDI a JSON
## Acerca de
## Acerca de `phpcfdi/cfdi-to-json`

Esta es una herramienta que sigue sus propias convenciones para convertir los archivos de CFDI (XML de SAT)
a formato JSON.
Expand Down Expand Up @@ -250,30 +254,38 @@ sin temor a romper tu aplicación.

## Contribuciones

Las contribuciones con bienvenidas. Por favor lee [CONTRIBUTING][] para más detalles
Las contribuciones con bienvenidas. Por favor, revisa [CONTRIBUTING][] para más detalles
y recuerda revisar el archivo de tareas pendientes [TODO][] y el archivo [CHANGELOG][].

## Copyright and License

The `phpcfdi/cfdi-to-json` library is copyright © [PhpCfdi](https://www.phpcfdi.com)
The `phpcfdi/cfdi-to-json` library is copyright © [PhpCfdi](https://www.phpcfdi.com/)
and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information.

[contributing]: https://github.com/phpcfdi/cfdi-to-json/blob/main/CONTRIBUTING.md
[changelog]: https://github.com/phpcfdi/cfdi-to-json/blob/main/docs/CHANGELOG.md
[todo]: https://github.com/phpcfdi/cfdi-to-json/blob/main/docs/TODO.md

[source]: https://github.com/phpcfdi/cfdi-to-json
[php-version]: https://packagist.org/packages/phpcfdi/cfdi-to-json
[discord]: https://discord.gg/aFGYXvX
[release]: https://github.com/phpcfdi/cfdi-to-json/releases
[license]: https://github.com/phpcfdi/cfdi-to-json/blob/main/LICENSE
[build]: https://github.com/phpcfdi/cfdi-to-json/actions/workflows/build.yml?query=branch:main
[quality]: https://scrutinizer-ci.com/g/phpcfdi/cfdi-to-json/
[coverage]: https://scrutinizer-ci.com/g/phpcfdi/cfdi-to-json/code-structure/main/code-coverage/src
[reliability]:https://sonarcloud.io/component_measures?id=phpcfdi_cfdi-to-json&metric=Reliability
[maintainability]: https://sonarcloud.io/component_measures?id=phpcfdi_cfdi-to-json&metric=Maintainability
[coverage]: https://sonarcloud.io/component_measures?id=phpcfdi_cfdi-to-json&metric=Coverage
[violations]: https://sonarcloud.io/project/issues?id=phpcfdi_cfdi-to-json&resolved=false
[downloads]: https://packagist.org/packages/phpcfdi/cfdi-to-json

[badge-source]: http://img.shields.io/badge/source-phpcfdi/cfdi--to--json-blue?style=flat-square
[badge-release]: https://img.shields.io/github/release/phpcfdi/cfdi-to-json?style=flat-square
[badge-license]: https://img.shields.io/github/license/phpcfdi/cfdi-to-json?style=flat-square
[badge-build]: https://img.shields.io/github/workflow/status/phpcfdi/cfdi-to-json/build/main?style=flat-square
[badge-quality]: https://img.shields.io/scrutinizer/g/phpcfdi/cfdi-to-json/main?style=flat-square
[badge-coverage]: https://img.shields.io/scrutinizer/coverage/g/phpcfdi/cfdi-to-json/main?style=flat-square
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfdi-to-json?style=flat-square
[badge-source]: https://img.shields.io/badge/source-phpcfdi/cfdi--to--json-blue?logo=github
[badge-discord]: https://img.shields.io/discord/459860554090283019?logo=discord
[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/cfdi-to-json?logo=php
[badge-release]: https://img.shields.io/github/release/phpcfdi/cfdi-to-json?logo=git
[badge-license]: https://img.shields.io/github/license/phpcfdi/cfdi-to-json?logo=open-source-initiative
[badge-build]: https://img.shields.io/github/workflow/status/phpcfdi/cfdi-to-json/build/main?logo=github-actions
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfdi-to-json&metric=reliability_rating
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfdi-to-json&metric=sqale_rating
[badge-coverage]: https://img.shields.io/sonar/coverage/phpcfdi_cfdi-to-json/main?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
[badge-violations]: https://img.shields.io/sonar/violations/phpcfdi_cfdi-to-json/main?format=long&logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfdi-to-json?logo=packagist
4 changes: 2 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ versión aunque sí su incorporación en la rama principal de trabajo, generalme

## Cambios no liberados en una versión

No hay cambios no liberados.

## Listado de cambios

### Versión 0.3.2 2022-10-01
Expand All @@ -29,6 +27,8 @@ Gracias `@gam04` por tu contribución.
- Se elimina la dependencia de `composer` donde no se usa.
- Se actualiza el archivo de configuración de `php-cs-fixer`.
- Se agrega la configuración en Git para que los finales de línea solo sean `LF`.
- Se integra el proyecto a [SonarCloud](https://sonarcloud.io/code?id=phpcfdi_cfdi-to-json).
- Se elimina la integración con Scrutinizer CI a favor de SonarCloud. ¡Gracias Scrutinizer CI!.

### Versión 0.3.1 2022-04-04

Expand Down
8 changes: 5 additions & 3 deletions src/XsdMaxOccurs/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

final class Finder implements FinderInterface
{
const NS_XMLSCHEMA = 'http://www.w3.org/2001/XMLSchema';

/** @var string */
private $targetNamespace = '';

Expand All @@ -38,7 +40,7 @@ private function obtainPathsForXPathQuery(DOMDocument $document, string $query):
{
$paths = [];
$xpath = new DOMXPath($document);
$xpath->registerNamespace('x', 'http://www.w3.org/2001/XMLSchema');
$xpath->registerNamespace('x', self::NS_XMLSCHEMA);
$nodes = $xpath->query($query) ?: new DOMNodeList();
foreach ($nodes as $node) {
if ($node instanceof DOMElement) {
Expand All @@ -63,7 +65,7 @@ private function obtainPathForElement(DOMElement $xsElement): string
private function findParentElement(DOMElement $node): ?DOMElement
{
for ($node = $node->parentNode; $node instanceof DOMElement; $node = $node->parentNode) {
if ('element' !== $node->localName || 'http://www.w3.org/2001/XMLSchema' !== $node->namespaceURI) {
if ('element' !== $node->localName || self::NS_XMLSCHEMA !== $node->namespaceURI) {
continue;
}
return $node;
Expand All @@ -74,7 +76,7 @@ private function findParentElement(DOMElement $node): ?DOMElement
private function findTargetNamespace(DOMDocument $document): string
{
$xpath = new DOMXPath($document);
$xpath->registerNamespace('x', 'http://www.w3.org/2001/XMLSchema');
$xpath->registerNamespace('x', self::NS_XMLSCHEMA);
/** @var DOMNodeList<DOMAttr> $targets */
$targets = $xpath->query('/x:schema/@targetNamespace') ?: new DOMNodeList();
/** @var DOMAttr|null $firstTarget */
Expand Down

0 comments on commit 1c96923

Please sign in to comment.