-
Notifications
You must be signed in to change notification settings - Fork 24
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 #75 from eclipxe13/maintenance-20230525
Mantenimiento 2023-05-25 (corrige integración continua)
- Loading branch information
Showing
10 changed files
with
125 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phive xmlns="https://phar.io/phive"> | ||
<phar name="php-cs-fixer" version="^3.14.4" installed="3.14.4" location="./tools/php-cs-fixer" copy="false"/> | ||
<phar name="phpcs" version="^3.7.1" installed="3.7.1" location="./tools/phpcs" copy="false"/> | ||
<phar name="phpcbf" version="^3.7.1" installed="3.7.1" location="./tools/phpcbf" copy="false"/> | ||
<phar name="phpstan" version="^1.9.17" installed="1.9.17" location="./tools/phpstan" copy="false"/> | ||
<phar name="php-cs-fixer" version="^3.17.0" installed="3.17.0" location="./tools/php-cs-fixer" copy="false"/> | ||
<phar name="phpcs" version="^3.7.2" installed="3.7.2" location="./tools/phpcs" copy="false"/> | ||
<phar name="phpcbf" version="^3.7.2" installed="3.7.2" location="./tools/phpcbf" copy="false"/> | ||
<phar name="phpstan" version="^1.10.15" installed="1.10.15" location="./tools/phpstan" 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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpCfdi\CfdiSatScraper\Tests\Integration; | ||
|
||
use DateTimeImmutable; | ||
use DomainException; | ||
use Exception; | ||
|
||
class RepositoryItemFactory | ||
{ | ||
/** @param array<mixed> $values */ | ||
public function make(array $values): RepositoryItem | ||
{ | ||
$maker = new self(); | ||
return new RepositoryItem( | ||
$maker->stringFromValues($values, 'uuid'), | ||
$maker->dateFromString($maker->stringFromValues($values, 'date')), | ||
$maker->stringFromValues($values, 'state'), | ||
$maker->stringFromValues($values, 'type'), | ||
); | ||
} | ||
|
||
/** @param array<mixed> $values */ | ||
private function stringFromValues(array $values, string $key): string | ||
{ | ||
if (! isset($values[$key]) || ! is_string($values[$key])) { | ||
throw new DomainException(sprintf('Cannot create an entry with invalid %s', $key)); | ||
} | ||
return $values[$key]; | ||
} | ||
|
||
private function dateFromString(string $value): DateTimeImmutable | ||
{ | ||
try { | ||
return new DateTimeImmutable($value); | ||
} catch (Exception $exception) { | ||
throw new DomainException(sprintf('Unable to parse date with value %s', $value)); | ||
} | ||
} | ||
} |
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