-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Tobias Kündig <[email protected]>
- Loading branch information
1 parent
795610e
commit 94000ff
Showing
19 changed files
with
543 additions
and
75 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace OFFLINE\ResponsiveImages\Classes\Convert; | ||
|
||
class ConvertResult | ||
{ | ||
private $directories; | ||
private $files; | ||
private $errors = []; | ||
|
||
public function incrementDirectories(): void | ||
{ | ||
$this->directories++; | ||
} | ||
|
||
public function incrementFiles(): void | ||
{ | ||
$this->files++; | ||
} | ||
|
||
public function addError($error): void | ||
{ | ||
$this->errors[] = $error; | ||
} | ||
|
||
public function print(): array | ||
{ | ||
$result = "\n<fg=black;bg=green>Processing successful!</>\n"; | ||
if ($this->errors) { | ||
$result = "\n<fg=black;bg=red>Processing failed!</>\n"; | ||
} | ||
|
||
$directories = sprintf("\nDirectories: %5d</>\n", $this->directories); | ||
$files = sprintf("Converted files: %5d</>\n", $this->files); | ||
|
||
$errors = ''; | ||
if ($this->errors) { | ||
foreach ($this->errors as $error) { | ||
$errors .= sprintf("\n<fg=white;bg=red>- %s</>", $error); | ||
} | ||
} | ||
|
||
return [$result, $directories, $files, $errors ?: '']; | ||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace OFFLINE\ResponsiveImages\Classes\Convert; | ||
|
||
use Symfony\Component\Finder\SplFileInfo; | ||
|
||
interface Converter | ||
{ | ||
public function convert(SplFileInfo $file); | ||
} |
Oops, something went wrong.