-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from eclipxe13/version-1.3.4
Correcciones de ubicaciones de archivos XSD y limpieza de Addenda (versión 1.3.4)
- Loading branch information
Showing
10 changed files
with
100 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phive xmlns="https://phar.io/phive"> | ||
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> | ||
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> | ||
<phar name="php-cs-fixer" version="^3.59.3" installed="3.59.3" location="./tools/php-cs-fixer" copy="false"/> | ||
<phar name="phpstan" version="^1.11.5" installed="1.11.5" location="./tools/phpstan" copy="false"/> | ||
<phar name="composer-normalize" version="^2.43.0" installed="2.43.0" location="./tools/composer-normalize" copy="false"/> | ||
<phar name="phpcs" version="^3.10.3" installed="3.10.3" location="./tools/phpcs" copy="false"/> | ||
<phar name="phpcbf" version="^3.10.3" installed="3.10.3" location="./tools/phpcbf" copy="false"/> | ||
<phar name="php-cs-fixer" version="^3.64.0" installed="3.64.0" location="./tools/php-cs-fixer" copy="false"/> | ||
<phar name="phpstan" version="^1.12.6" installed="1.12.6" location="./tools/phpstan" copy="false"/> | ||
<phar name="composer-normalize" version="^2.44.0" installed="2.44.0" location="./tools/composer-normalize" copy="false"/> | ||
</phive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpCfdi\CfdiCleaner\Tests\Traits; | ||
|
||
use RuntimeException; | ||
use Throwable; | ||
|
||
trait UseSatNsRegistryTrait | ||
{ | ||
/** @var array<object{namespace: ?string, prefix: ?string, version: ?string, xsd: ?string}>|null */ | ||
private $satNsRegistry = null; | ||
|
||
/** @return array<object{namespace: ?string, prefix: ?string, version: ?string, xsd: ?string}> */ | ||
protected function getSatNsRegistry(): array | ||
{ | ||
if (null === $this->satNsRegistry) { | ||
$this->satNsRegistry = $this->loadSatNsRegistry(); | ||
} | ||
|
||
return $this->satNsRegistry; | ||
} | ||
|
||
/** @return array<object{namespace: ?string, prefix: ?string, version: ?string, xsd: ?string}> */ | ||
protected function loadSatNsRegistry(): array | ||
{ | ||
// obtain the list of known locations from phpcfdi/sat-ns-registry | ||
$satNsRegistryUrl = 'https://raw.githubusercontent.com/phpcfdi/sat-ns-registry/master/complementos_v1.json'; | ||
try { | ||
/** @var array<object{namespace: ?string, prefix: ?string, version: ?string, xsd: ?string}> $registry */ | ||
$registry = json_decode((string) file_get_contents($satNsRegistryUrl), false, 512, JSON_THROW_ON_ERROR); | ||
} catch (Throwable $exception) { | ||
$message = sprintf('Unable to load SAT Namespaces Registry from %s', $satNsRegistryUrl); | ||
throw new RuntimeException($message, 0, $exception); | ||
} | ||
|
||
return $registry; | ||
} | ||
} |