Skip to content

Commit 911afd3

Browse files
committed
🔥 Wipe leftover services logic, from ctrl cleanup
1 parent 9cf5906 commit 911afd3

File tree

7 files changed

+0
-344
lines changed

7 files changed

+0
-344
lines changed

src/Services/Files/FilesHandler.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace App\Services\Files;
44

5-
use Symfony\Component\Finder\Finder;
6-
75
/**
86
* This service is responsible for handling files in terms of internal usage, like moving/renaming/etc...
97
* Class FilesHandler
@@ -12,30 +10,6 @@
1210
class FilesHandler
1311
{
1412

15-
/**
16-
* Will list all files in given directories
17-
*
18-
* @param array $directories
19-
*
20-
* @return array
21-
*/
22-
public function listAllFilesInDirectories(array $directories): array
23-
{
24-
$filesPathsList = [];
25-
26-
foreach ($directories as $directory) {
27-
$finder = new Finder();
28-
$finder->depth(0);
29-
$finder->files()->in($directory);
30-
31-
foreach ($finder as $file) {
32-
$filesPathsList[$directory][] = $file->getFilename();
33-
}
34-
}
35-
36-
return $filesPathsList;
37-
}
38-
3913
/**
4014
* Removes first and last slash from $dirPath
4115
*
@@ -61,20 +35,6 @@ public static function trimFirstAndLastSlash(string $dirPath)
6135
return $trimmedDirPath;
6236
}
6337

64-
/**
65-
* @param string $dirPath
66-
*
67-
* @return int
68-
*/
69-
public static function countFilesInTree(string $dirPath)
70-
{
71-
$finder = new Finder();
72-
$finder->files()->in($dirPath);
73-
$filesCountInTree = count($finder);
74-
75-
return $filesCountInTree;
76-
}
77-
7838
/**
7939
* This function will return file path with leading slash if such is missing
8040
*

src/Services/Files/ImageHandler.php

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/Services/Files/PathService.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,4 @@ public static function getAllStorageBaseDirs(): array
122122
EnvReader::getImagesUploadDir(),
123123
];
124124
}
125-
126-
/**
127-
* If the file_path has `upload` directory from front then it will be stripped
128-
* this is for example needed for generating further miniatures for uploaded files
129-
*
130-
* @param string $filePath
131-
* @return string
132-
*/
133-
public static function stripUploadDirectoryFromFilePathFront(string $filePath): string
134-
{
135-
$match = "#^" . EnvReader::getUploadDir() . "/#";
136-
137-
if( preg_match($match, $filePath) ){
138-
$filePath = preg_replace("#" . EnvReader::getUploadDir() . "/#", "", $filePath , 1);
139-
}
140-
141-
return $filePath;
142-
}
143125
}

src/Services/Utils.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ class Utils extends AbstractController {
1212
const TRUE_AS_STRING = "true";
1313
const FALSE_AS_STRING = "false";
1414

15-
/**
16-
* @param string $dir
17-
* @return bool
18-
*/
19-
public static function removeFolderRecursively(string $dir) {
20-
$files = array_diff(scandir($dir), array('.','..'));
21-
foreach ($files as $file) {
22-
(is_dir("$dir/$file")) ? static::removeFolderRecursively("$dir/$file") : unlink("$dir/$file");
23-
}
24-
return rmdir($dir);
25-
}
26-
2715
/**
2816
* Get one random element from array
2917
* @param array $array

src/Services/Validation/ConstraintValidationService.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use App\DTO\ValidationResultDto;
66
use Symfony\Component\Validator\ConstraintViolation;
77
use Symfony\Component\Validator\ConstraintViolationList;
8-
use Symfony\Component\Validator\Validator\ValidatorInterface;
98

109
/**
1110
* Standard validator which can be used to validate if object constraints/assertions are correct
@@ -18,34 +17,6 @@
1817
*/
1918
class ConstraintValidationService
2019
{
21-
22-
/**
23-
* @var ValidatorInterface $validator
24-
*/
25-
private ValidatorInterface $validator;
26-
27-
public function __construct(ValidatorInterface $validator)
28-
{
29-
$this->validator = $validator;
30-
}
31-
32-
// todo: Use ValidationResultVO instead - remove that dto
33-
34-
/**
35-
* Validates the object and returns the array of violations
36-
*
37-
* @param object $object
38-
*
39-
* @return ValidationResultDto
40-
*/
41-
public function validateAndReturnValidationResultDto(object $object): ValidationResultDto
42-
{
43-
$violations = $this->validator->validate($object);
44-
$validationResultVo = $this->checkConstraintViolationsAndReturnValidationResultVo($violations);
45-
46-
return $validationResultVo;
47-
}
48-
4920
/**
5021
* Will check violations array and creates the ValidationResultDTO
5122
*

src/Services/Validation/FileValidatorService.php

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)