- md5
- 182d355f1f5be737f9eb02b0df1195c9
- sha1
- 5e21b4aca227d739dbaf104a74a55d896d711284
- sha256
- 01cc9e4d6054bab5ada5b717f361502ebfca22a18a39b54cba1f4a87c4535f09
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?php
/**
* @package Joomla.Administrator
* @subpackage com_scheduler
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Scheduler\Administrator\Task;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* The TaskOptions class.
* Used as the subject argument for the `onTaskOptionsList` event, plugins that support tasks must add them to the
* object through the addOptions() method.
*
* @since 4.1.0
*/
class TaskOptions
{
/**
* An array of TaskOptions
*
* @var TaskOption[]
* @since 4.1.0
*/
public $options = [];
/**
* A plugin can support several task routines
* This method is used by a plugin's onTaskOptionsList subscriber to advertise supported routines.
*
* @param array $taskRoutines An associative array of {@var TaskOption} constructor argument pairs:
* [ 'routineId' => 'languageConstantPrefix', ... ]
*
* @return void
*
* @since 4.1.0
*/
public function addOptions(array $taskRoutines): void
{
foreach ($taskRoutines as $routineId => $langConstPrefix) {
$this->options[] = new TaskOption($routineId, $langConstPrefix);
}
}
/**
* @param ?string $routineId A unique identifier for a plugin task routine
*
* @return ?TaskOption A matching TaskOption if available, null otherwise
*
* @since 4.1.0
*/
public function findOption(?string $routineId): ?TaskOption
{
if ($routineId === null) {
return null;
}
foreach ($this->options as $option) {
if ($option->id === $routineId) {
return $option;
}
}
return null;
}
}
The same content is in 225 releases, Joomla 4.2.1 to 6.2.1-rc1. See them all, or every version of this file.