Skip to content

1716: Use Magento naming approach for FolderTree class #29412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\Result\Json;
use Magento\Framework\Controller\ResultFactory;
use Magento\MediaGalleryUi\Model\Directories\FolderTree;
use Magento\MediaGalleryUi\Model\Directories\GetFolderTree;
use Psr\Log\LoggerInterface;

/**
Expand All @@ -33,33 +33,33 @@ class GetTree extends Action implements HttpGetActionInterface
private $logger;

/**
* @var FolderTree
* @var GetFolderTree
*/
private $folderTree;
private $getFolderTree;

/**
* Constructor
*
* @param Action\Context $context
* @param LoggerInterface $logger
* @param FolderTree $folderTree
* @param GetFolderTree $getFolderTree
*/
public function __construct(
Action\Context $context,
LoggerInterface $logger,
FolderTree $folderTree
GetFolderTree $getFolderTree
) {
parent::__construct($context);
$this->logger = $logger;
$this->folderTree = $folderTree;
$this->getFolderTree = $getFolderTree;
}
/**
* @inheritdoc
*/
public function execute()
{
try {
$responseContent[] = $this->folderTree->buildTree();
$responseContent[] = $this->getFolderTree->execute();
$responseCode = self::HTTP_OK;
} catch (\Exception $exception) {
$this->logger->critical($exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Build folder tree structure by path
*/
class FolderTree
class GetFolderTree
{
/**
* @var Filesystem
Expand Down Expand Up @@ -56,7 +56,7 @@ public function __construct(
* @return array
* @throws ValidatorException
*/
public function buildTree(bool $skipRoot = true): array
public function execute(bool $skipRoot = true): array
{
return $this->buildFolderTree($this->getDirectories(), $skipRoot);
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/MediaGalleryUi/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</argument>
</arguments>
</type>
<type name="Magento\MediaGalleryUi\Model\Directories\FolderTree">
<type name="Magento\MediaGalleryUi\Model\Directories\GetFolderTree">
<arguments>
<argument name="path" xsi:type="string">media</argument>
</arguments>
Expand Down