Link.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Block\Account;
  7. use Magento\Customer\Block\Account\SortLinkInterface;
  8. /**
  9. * Class Link
  10. *
  11. * @api
  12. * @SuppressWarnings(PHPMD.DepthOfInheritance)
  13. * @since 100.0.2
  14. */
  15. class Link extends \Magento\Framework\View\Element\Html\Link implements SortLinkInterface
  16. {
  17. /**
  18. * @var \Magento\Customer\Model\Url
  19. */
  20. protected $_customerUrl;
  21. /**
  22. * @param \Magento\Framework\View\Element\Template\Context $context
  23. * @param \Magento\Customer\Model\Url $customerUrl
  24. * @param array $data
  25. */
  26. public function __construct(
  27. \Magento\Framework\View\Element\Template\Context $context,
  28. \Magento\Customer\Model\Url $customerUrl,
  29. array $data = []
  30. ) {
  31. $this->_customerUrl = $customerUrl;
  32. parent::__construct($context, $data);
  33. }
  34. /**
  35. * @return string
  36. */
  37. public function getHref()
  38. {
  39. return $this->_customerUrl->getAccountUrl();
  40. }
  41. /**
  42. * {@inheritdoc}
  43. * @since 101.0.0
  44. */
  45. public function getSortOrder()
  46. {
  47. return $this->getData(self::SORT_ORDER);
  48. }
  49. }