[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/symfony/ldap/Adapter/ExtLdap/ -> UpdateOperation.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <[email protected]>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Ldap\Adapter\ExtLdap;
  13  
  14  use Symfony\Component\Ldap\Exception\UpdateOperationException;
  15  
  16  class UpdateOperation
  17  {
  18      private $operationType;
  19      private $values;
  20      private $attribute;
  21  
  22      private const VALID_OPERATION_TYPES = [
  23          \LDAP_MODIFY_BATCH_ADD,
  24          \LDAP_MODIFY_BATCH_REMOVE,
  25          \LDAP_MODIFY_BATCH_REMOVE_ALL,
  26          \LDAP_MODIFY_BATCH_REPLACE,
  27      ];
  28  
  29      /**
  30       * @param int    $operationType An LDAP_MODIFY_BATCH_* constant
  31       * @param string $attribute     The attribute to batch modify on
  32       *
  33       * @throws UpdateOperationException on consistency errors during construction
  34       */
  35      public function __construct(int $operationType, string $attribute, ?array $values)
  36      {
  37          if (!\in_array($operationType, self::VALID_OPERATION_TYPES, true)) {
  38              throw new UpdateOperationException(sprintf('"%s" is not a valid modification type.', $operationType));
  39          }
  40          if (\LDAP_MODIFY_BATCH_REMOVE_ALL === $operationType && null !== $values) {
  41              throw new UpdateOperationException(sprintf('$values must be null for LDAP_MODIFY_BATCH_REMOVE_ALL operation, "%s" given.', get_debug_type($values)));
  42          }
  43  
  44          $this->operationType = $operationType;
  45          $this->attribute = $attribute;
  46          $this->values = $values;
  47      }
  48  
  49      public function toArray(): array
  50      {
  51          return [
  52              'attrib' => $this->attribute,
  53              'modtype' => $this->operationType,
  54              'values' => $this->values,
  55          ];
  56      }
  57  }


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