[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_media 6 * 7 * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Media\Administrator\Event; 12 13 use Joomla\CMS\Event\AbstractImmutableEvent; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('_JEXEC') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Event object to set an url. 21 * 22 * @since 4.1.0 23 */ 24 final class FetchMediaItemUrlEvent extends AbstractImmutableEvent 25 { 26 /** 27 * Constructor. 28 * 29 * @param string $name The event name. 30 * @param array $arguments The event arguments. 31 * 32 * @throws \BadMethodCallException 33 * 34 * @since 4.1.0 35 */ 36 public function __construct($name, array $arguments = array()) 37 { 38 // Check for required arguments 39 if (!\array_key_exists('adapter', $arguments) || !is_string($arguments['adapter'])) { 40 throw new \BadMethodCallException("Argument 'adapter' of event $name is not of the expected type"); 41 } 42 43 $this->arguments[$arguments['adapter']] = $arguments['adapter']; 44 unset($arguments['adapter']); 45 46 // Check for required arguments 47 if (!\array_key_exists('path', $arguments) || !is_string($arguments['path'])) { 48 throw new \BadMethodCallException("Argument 'path' of event $name is not of the expected type"); 49 } 50 51 $this->arguments[$arguments['path']] = $arguments['path']; 52 unset($arguments['path']); 53 54 // Check for required arguments 55 if (!\array_key_exists('url', $arguments) || !is_string($arguments['url'])) { 56 throw new \BadMethodCallException("Argument 'url' of event $name is not of the expected type"); 57 } 58 59 parent::__construct($name, $arguments); 60 } 61 62 /** 63 * Validate $value to be a string 64 * 65 * @param string $value The value to set 66 * 67 * @return string 68 * 69 * @since 4.1.0 70 */ 71 protected function setUrl(string $value): string 72 { 73 return $value; 74 } 75 76 /** 77 * Forbid setting $path 78 * 79 * @param string $value The value to set 80 * 81 * @since 4.1.0 82 * 83 * @throws \BadMethodCallException 84 */ 85 protected function setPath(string $value): string 86 { 87 throw new \BadMethodCallException('Cannot set the argument "path" of the immutable event ' . $this->name . '.'); 88 } 89 90 /** 91 * Forbid setting $path 92 * 93 * @param string $value The value to set 94 * 95 * @since 4.1.0 96 * 97 * @throws \BadMethodCallException 98 */ 99 protected function setAdapter(string $value): string 100 { 101 throw new \BadMethodCallException('Cannot set the argument "adapter" of the immutable event ' . $this->name . '.'); 102 } 103 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |