Skip to content

Commit

Permalink
Downgrade safe (#46)
Browse files Browse the repository at this point in the history
* downgrade Safe to allow merge with Lychee
  • Loading branch information
ildyria authored Jun 29, 2022
1 parent 0b05b47 commit 777b74f
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 54 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"ext-fileinfo": "*",
"neitanod/forceutf8": "^2.0.4",
"php-ffmpeg/php-ffmpeg": "^1.0",
"thecodingmachine/safe": "^2.2"
"thecodingmachine/safe": "^1.3"
},
"require-dev": {
"lychee-org/phpstan-lychee": "dev-master",
Expand Down
95 changes: 48 additions & 47 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions lib/PHPExif/Adapter/Exiftool.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
use InvalidArgumentException;
use RuntimeException;

use function Safe\exec;
use function Safe\json_decode;
use function Safe\stream_get_contents;
use function Safe\fclose;
use function Safe\sprintf;

/**
* PHP Exif Exiftool Reader Adapter
Expand Down Expand Up @@ -102,8 +102,10 @@ public function getToolPath() : string
if ($this->toolPath === '') {
// Do not use "which": not available on sh
$path = exec('command -v ' . self::TOOL_NAME);
// $path = exec('which ' . self::TOOL_NAME);
$this->setToolPath($path);
if ($path !== false) {
// $path = exec('which ' . self::TOOL_NAME);
$this->setToolPath($path);
}
}

return $this->toolPath;
Expand Down
6 changes: 4 additions & 2 deletions lib/PHPExif/Adapter/FFprobe.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use InvalidArgumentException;
use FFMpeg;

use function Safe\exec;
use function Safe\sprintf;
use function Safe\mime_content_type;
use function Safe\filesize;
use function Safe\array_replace_recursive;
Expand Down Expand Up @@ -76,7 +76,9 @@ public function getToolPath(): string
// Do not use "which": not available on sh
$path = exec('command -v ' . self::TOOL_NAME);
// $path = exec('which ' . self::TOOL_NAME);
$this->setToolPath($path);
if ($path !== false) {
$this->setToolPath($path);
}
}

return $this->toolPath;
Expand Down
3 changes: 2 additions & 1 deletion lib/PHPExif/Mapper/Exiftool.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use function Safe\preg_match;
use function Safe\preg_replace;
use function Safe\sprintf;

/**
* PHP Exif Exiftool Mapper
Expand Down Expand Up @@ -201,7 +202,7 @@ public function setNumeric(bool $numeric) : Exiftool
public function mapRawData(array $data) : array
{
$mappedData = array();

foreach ($data as $field => $value) {
if (!array_key_exists($field, $this->map)) {
// silently ignore unknown fields
Expand Down
1 change: 1 addition & 0 deletions lib/PHPExif/Mapper/FFprobe.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use PHPExif\Exif;
use Safe\DateTime;
use function Safe\sprintf;

use function Safe\preg_match;

Expand Down
1 change: 1 addition & 0 deletions lib/PHPExif/Mapper/ImageMagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use function Safe\preg_match;
use function Safe\preg_replace;
use function Safe\preg_split;
use function Safe\sprintf;

/**
* PHP Exif Imagick Mapper
Expand Down
1 change: 1 addition & 0 deletions lib/PHPExif/Mapper/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use function Safe\preg_match;
use function Safe\preg_replace;
use function Safe\sprintf;

/**
* PHP Exif Native Mapper
Expand Down
Loading

0 comments on commit 777b74f

Please sign in to comment.