[ 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 // phpcs:disable PSR1.Files.SideEffects 14 \defined('_JEXEC') or die; 15 // phpcs:enable PSR1.Files.SideEffects 16 17 /** 18 * Event object for fetch media items. 19 * 20 * @since 4.1.0 21 */ 22 final class FetchMediaItemsEvent extends AbstractMediaItemValidationEvent 23 { 24 /** 25 * Constructor. 26 * 27 * @param string $name The event name. 28 * @param array $arguments The event arguments. 29 * 30 * @throws \BadMethodCallException 31 * 32 * @since 4.1.0 33 */ 34 public function __construct($name, array $arguments = array()) 35 { 36 parent::__construct($name, $arguments); 37 38 // Check for required arguments 39 if (!\array_key_exists('items', $arguments) || !is_array($arguments['items'])) { 40 throw new \BadMethodCallException("Argument 'items' of event $name is not of the expected type"); 41 } 42 } 43 44 /** 45 * Validate $item to be an array 46 * 47 * @param array $items The value to set 48 * 49 * @return array 50 * 51 * @since 4.1.0 52 */ 53 protected function setItems(array $items): array 54 { 55 $result = []; 56 57 foreach ($items as $item) { 58 $clone = clone $item; 59 60 $this->validate($clone); 61 62 $result[] = $clone; 63 } 64 65 return $result; 66 } 67 68 /** 69 * Returns the items. 70 * 71 * @param array $items The value to set 72 * 73 * @return array 74 * 75 * @since 4.1.0 76 */ 77 protected function getItems(array $items): array 78 { 79 $result = []; 80 81 foreach ($items as $item) { 82 $result[] = clone $item; 83 } 84 85 return $result; 86 } 87 }
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 |