Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ReplaceArrayValue.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\helpers;
  8. /**
  9. * Object that represents the replacement of array value while performing [[ArrayHelper::merge()]].
  10. *
  11. * Usage example:
  12. *
  13. * ```php
  14. * $array1 = [
  15. * 'ids' => [
  16. * 1,
  17. * ],
  18. * 'validDomains' => [
  19. * 'example.com',
  20. * 'www.example.com',
  21. * ],
  22. * ];
  23. *
  24. * $array2 = [
  25. * 'ids' => [
  26. * 2,
  27. * ],
  28. * 'validDomains' => new \yii\helpers\ReplaceArrayValue([
  29. * 'yiiframework.com',
  30. * 'www.yiiframework.com',
  31. * ]),
  32. * ];
  33. *
  34. * $result = \yii\helpers\ArrayHelper::merge($array1, $array2);
  35. * ```
  36. *
  37. * The result will be
  38. *
  39. * ```php
  40. * [
  41. * 'ids' => [
  42. * 1,
  43. * 2,
  44. * ],
  45. * 'validDomains' => [
  46. * 'yiiframework.com',
  47. * 'www.yiiframework.com',
  48. * ],
  49. * ]
  50. * ```
  51. *
  52. * @author Robert Korulczyk <robert@korulczyk.pl>
  53. * @since 2.0.10
  54. */
  55. class ReplaceArrayValue
  56. {
  57. /**
  58. * @var mixed value used as replacement.
  59. */
  60. public $value;
  61. /**
  62. * Constructor.
  63. * @param mixed $value value used as replacement.
  64. */
  65. public function __construct($value)
  66. {
  67. $this->value = $value;
  68. }
  69. }