-
Notifications
You must be signed in to change notification settings - Fork 1
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 #1 from eclipxe13/improvements
Versión 0.2.0
- Loading branch information
Showing
35 changed files
with
811 additions
and
85 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
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 was deleted.
Oops, something went wrong.
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpCfdi\ImageCaptchaResolver\HttpClient; | ||
|
||
use RuntimeException; | ||
use Throwable; | ||
|
||
class UndiscoverableClientException extends RuntimeException | ||
{ | ||
public function __construct(Throwable $previous) | ||
{ | ||
parent::__construct('Cannot discover the HttpClient', 0, $previous); | ||
} | ||
} |
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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpCfdi\ImageCaptchaResolver\Internal; | ||
|
||
use RuntimeException; | ||
|
||
/** | ||
* Class to create a temporary file and remove it on object destruction | ||
* @internal | ||
*/ | ||
final class TemporaryFile | ||
{ | ||
/** @var string */ | ||
private $path; | ||
|
||
public function __construct(string $prefix = '', string $directory = '') | ||
{ | ||
$tempnam = tempnam($directory, $prefix); | ||
if (false === $tempnam) { | ||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
throw new RuntimeException('Unable to create a temporary file'); // @codeCoverageIgnore | ||
} | ||
$this->path = $tempnam; | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
if (file_exists($this->path)) { | ||
/** @noinspection PhpUsageOfSilenceOperatorInspection */ | ||
@unlink($this->path); | ||
} | ||
} | ||
|
||
public function getPath(): string | ||
{ | ||
return $this->path; | ||
} | ||
|
||
public function getContents(): string | ||
{ | ||
return file_get_contents($this->path) ?: ''; | ||
} | ||
|
||
public function putContents(string $data): void | ||
{ | ||
file_put_contents($this->path, $data); | ||
} | ||
} |
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
Oops, something went wrong.