Skip to content

Commit

Permalink
Improved php doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Galvao da Gama committed Jul 7, 2020
1 parent 3a1a3c7 commit 15aa96f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\MediaContentApi\Model\GetAssetIdByContentStatusInterface;

/**
* Class GetAssetIdByContentStatus
* Class responsible to return Asset id by entity status
*/
class GetAssetIdByContentStatus implements GetAssetIdByContentStatusInterface
{
Expand Down Expand Up @@ -48,7 +48,8 @@ class GetAssetIdByContentStatus implements GetAssetIdByContentStatusInterface
private $valueMap;

/**
* GetContentIdByStatus constructor.
* GetAssetIdByContentStatus constructor.
*
* @param ResourceConnection $resource
* @param string $entityType
* @param string $contentTable
Expand All @@ -73,8 +74,7 @@ public function __construct(
}

/**
* @param string $value
* @return array
* @inheritDoc
*/
public function execute(string $value): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\MediaContentApi\Model\GetAssetIdByContentStatusInterface;

/**
* Class GetAssetIdByContentStatusComposite
* Class responsible to return Asset ids by content status
*/
class GetAssetIdByContentStatusComposite implements GetAssetIdByContentStatusInterface
{
Expand All @@ -21,6 +21,7 @@ class GetAssetIdByContentStatusComposite implements GetAssetIdByContentStatusInt

/**
* GetAssetIdByContentStatusComposite constructor.
*
* @param array $getAssetIdByContentStatusArray
*/
public function __construct($getAssetIdByContentStatusArray = [])
Expand All @@ -29,14 +30,16 @@ public function __construct($getAssetIdByContentStatusArray = [])
}

/**
* @param string $value
* Get Asset ids by Content status
*
* @param string $status
* @return array
*/
public function execute(string $value): array
public function execute(string $status): array
{
$ids = [];
foreach ($this->getAssetIdByContentStatusArray as $getAssetIdByContentStatus) {
$ids = array_merge($ids, $getAssetIdByContentStatus->execute($value));
$ids = array_merge($ids, $getAssetIdByContentStatus->execute($status));
}
return array_unique($ids);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

namespace Magento\MediaContent\Model;

use Magento\Eav\Api\Data\AttributeInterface;
use Magento\Eav\Model\Config;
use Magento\Framework\App\ResourceConnection;
use Magento\MediaContentApi\Model\GetAssetIdByContentStatusInterface;

/**
* Class GetAssetIdByEavContentStatus
* Class responsible to return Asset id by eav entity status
*/
class GetAssetIdByEavContentStatus implements GetAssetIdByContentStatusInterface
{
Expand Down Expand Up @@ -46,6 +45,7 @@ class GetAssetIdByEavContentStatus implements GetAssetIdByContentStatusInterface

/**
* GetAssetIdByEavContentStatus constructor.
*
* @param ResourceConnection $resource
* @param Config $config
* @param string $attributeCode
Expand All @@ -67,11 +67,10 @@ public function __construct(
}

/**
* @param string $value
* @return array
* @inheritDoc
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute(string $value): array
public function execute(string $status): array
{
$statusAttribute = $this->config->getAttribute($this->entityType, $this->attributeCode);

Expand All @@ -89,7 +88,7 @@ public function execute(string $value): array
[]
)->where(
'entity_eav_type.value = ?',
$this->getValueFromMap($value)
$this->getValueFromMap($status)
);

$result = $this->connection->getConnection()->fetchAll($sql);
Expand All @@ -100,6 +99,8 @@ public function execute(string $value): array
}

/**
* Get a value from a value map
*
* @param string $value
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
namespace Magento\MediaContentApi\Model;

/**
* Interface used to return Asset id by content status (enabled, disabled).
* Interface used to return Asset id by content status.
*/
interface GetAssetIdByContentStatusInterface
{
/**
* This function returns asset ids by entity status
*
* @param string $status
* @return int[]
*/
Expand Down

0 comments on commit 15aa96f

Please sign in to comment.