Skip to content

Commit

Permalink
Чистка
Browse files Browse the repository at this point in the history
  • Loading branch information
ProklUng committed May 29, 2021
1 parent 06170d0 commit 8f3722a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 168 deletions.
45 changes: 0 additions & 45 deletions local/classes/Bundles/Traits/LoadBundleRoutes.php

This file was deleted.

37 changes: 19 additions & 18 deletions local/classes/Services/IconSvgLoaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

namespace Local\Services;

use League\Flysystem\FileNotFoundException;
use League\Flysystem\Filesystem;
use RuntimeException;

/**
* Class IconSvgLoaders
Expand All @@ -14,11 +13,6 @@
*/
class IconSvgLoaders
{
/**
* @var Filesystem $filesystem Файловая система.
*/
private $filesystem;

/**
* @var string $iconPath Путь к файлу с иконками.
*/
Expand All @@ -29,39 +23,46 @@ class IconSvgLoaders
*/
private $buildPath;

/**
* @var string $documentRoot DOCUMENT_ROOT.
*/
private $documentRoot;

/**
* IconSvgLoaders constructor.
*
* @param Filesystem $filesystem Файловая система.
* @param string $buildPath Путь к сборке.
* @param string $iconPath Путь к файлу с иконками.
* @param string $documentRoot DOCUMENT_ROOT.
* @param string $buildPath Путь к сборке.
* @param string $iconPath Путь к файлу с иконками.
*/
public function __construct(
Filesystem $filesystem,
string $documentRoot,
string $buildPath,
string $iconPath
) {
$this->filesystem = $filesystem;
$this->iconPath = $iconPath;
$this->buildPath = $buildPath;
$this->documentRoot = $documentRoot;
}

/**
* Загрузить.
*
* @return string
* @throws FileNotFoundException Файл не найден.
* @throws RuntimeException Файл не найден.
*/
public function load() : string
{
$content = $this->filesystem->read(
'/' . $this->buildPath . $this->iconPath
$content = file_get_contents(
$this->documentRoot . '/' . $this->buildPath . $this->iconPath
);

if (!$content) {
$content = '';
if ($content === false) {
throw new RuntimeException(
'File with icons ' . $this->iconPath . ' not found'
);
}

return $content;
}
}
}
41 changes: 0 additions & 41 deletions local/classes/Services/Responses/JsonResponse.php

This file was deleted.

49 changes: 0 additions & 49 deletions local/classes/Services/Responses/JsonResponseError.php

This file was deleted.

2 changes: 1 addition & 1 deletion local/configs/services/assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
# Загрузчик иконок SVG.
icons.svg:
class: Local\Services\IconSvgLoaders
arguments: ['@filesystem.instance', '@build.path', '/images/icons.svg']
arguments: ['%kernel.project_dir%', '@build.path', '/images/icons.svg']

# Загрузить иконки SVG.
icons.svg.load:
Expand Down
2 changes: 1 addition & 1 deletion local/configs/services/filesystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:

# Адаптер локальной файловой системы.
filesystem.local.adapter:
class: Local\Services\Filesystem\LocalFilesystemAdapter
class: Local\Services\Filesystem\LocalLeagueFilesystemAdapter
arguments: ['%kernel.project_dir%/']

filesystem.local.adapter.factory:
Expand Down
13 changes: 0 additions & 13 deletions local/configs/services/utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ services:
autoconfigure: true
public: true

Symfony\Component\HttpFoundation\Response:
class: Symfony\Component\HttpFoundation\Response

# Json OK response.
json.response:
class: Local\Services\Responses\JsonResponse
arguments: ['@Symfony\Component\HttpFoundation\Response']

# Json error response.
json.response.error:
class: Local\Services\Responses\JsonResponseError
arguments: ['@Symfony\Component\HttpFoundation\Response', '400']

# Адаптированный Pipeline.
Prokl\Pipeline\Hub:
arguments: ['@service_container']
Expand Down

0 comments on commit 8f3722a

Please sign in to comment.