[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/WebAsset/ -> WebAssetItemInterface.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\WebAsset;
  11  
  12  // phpcs:disable PSR1.Files.SideEffects
  13  \defined('JPATH_PLATFORM') or die;
  14  // phpcs:enable PSR1.Files.SideEffects
  15  
  16  /**
  17   * Web Asset Item interface
  18   *
  19   * Asset Item are "read only" object, all properties must be set through class constructor.
  20   * Only properties allowed to be edited is an attributes and an options.
  21   * Changing an uri or a dependencies are not allowed, prefer to create a new asset instance.
  22   *
  23   * @since  4.0.0
  24   */
  25  interface WebAssetItemInterface
  26  {
  27      /**
  28       * Return Asset name
  29       *
  30       * @return  string
  31       *
  32       * @since   4.0.0
  33       */
  34      public function getName(): string;
  35  
  36      /**
  37       * Return Asset version
  38       *
  39       * @return  string
  40       *
  41       * @since   4.0.0
  42       */
  43      public function getVersion(): string;
  44  
  45      /**
  46       * Return dependencies list
  47       *
  48       * @return  array
  49       *
  50       * @since   4.0.0
  51       */
  52      public function getDependencies(): array;
  53  
  54      /**
  55       * Get the URI of the asset
  56       *
  57       * @param   boolean  $resolvePath  Whether need to search for a real paths
  58       *
  59       * @return string
  60       *
  61       * @since   4.0.0
  62       */
  63      public function getUri($resolvePath = true): string;
  64  
  65      /**
  66       * Get the option
  67       *
  68       * @param   string  $key      An option key
  69       * @param   string  $default  A default value
  70       *
  71       * @return mixed
  72       *
  73       * @since   4.0.0
  74       */
  75      public function getOption(string $key, $default = null);
  76  
  77      /**
  78       * Set the option
  79       *
  80       * @param   string  $key    An option key
  81       * @param   string  $value  An option value
  82       *
  83       * @return self
  84       *
  85       * @since   4.0.0
  86       */
  87      public function setOption(string $key, $value = null): WebAssetItemInterface;
  88  
  89      /**
  90       * Get all options of the asset
  91       *
  92       * @return array
  93       *
  94       * @since   4.0.0
  95       */
  96      public function getOptions(): array;
  97  
  98      /**
  99       * Get the attribute
 100       *
 101       * @param   string  $key      An attributes key
 102       * @param   string  $default  A default value
 103       *
 104       * @return mixed
 105       *
 106       * @since   4.0.0
 107       */
 108      public function getAttribute(string $key, $default = null);
 109  
 110      /**
 111       * Set the attribute
 112       *
 113       * @param   string  $key    An attribute key
 114       * @param   string  $value  An attribute value
 115       *
 116       * @return self
 117       *
 118       * @since   4.0.0
 119       */
 120      public function setAttribute(string $key, $value = null): WebAssetItemInterface;
 121  
 122      /**
 123       * Get all attributes
 124       *
 125       * @return array
 126       *
 127       * @since   4.0.0
 128       */
 129      public function getAttributes(): array;
 130  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer