[ Index ]

PHP Cross Reference of phpBB-3.3.5-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/ -> MagicSet.php (source)

   1  <?php
   2  /*
   3   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   4   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   5   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   6   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   7   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   8   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   9   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14   *
  15   * This software consists of voluntary contributions made by many individuals
  16   * and is licensed under the MIT license.
  17   */
  18  
  19  declare(strict_types=1);
  20  
  21  namespace ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator;
  22  
  23  use ProxyManager\Generator\MagicMethodGenerator;
  24  use Zend\Code\Generator\ParameterGenerator;
  25  use ReflectionClass;
  26  use Zend\Code\Generator\PropertyGenerator;
  27  
  28  /**
  29   * Magic `__set` for remote objects
  30   *
  31   * @author Vincent Blanchon <blanchon.vincent@gmail.com>
  32   * @license MIT
  33   */
  34  class MagicSet extends MagicMethodGenerator
  35  {
  36      /**
  37       * Constructor
  38       * @param ReflectionClass                        $originalClass
  39       * @param \Zend\Code\Generator\PropertyGenerator $adapterProperty
  40       *
  41       * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
  42       */
  43      public function __construct(ReflectionClass $originalClass, PropertyGenerator $adapterProperty)
  44      {
  45          parent::__construct(
  46              $originalClass,
  47              '__set',
  48              [new ParameterGenerator('name'), new ParameterGenerator('value')]
  49          );
  50  
  51          $this->setDocBlock('@param string \$name\n@param mixed \$value');
  52          $this->setBody(
  53              '$return = $this->' . $adapterProperty->getName() . '->call(' . var_export($originalClass->getName(), true)
  54              . ', \'__set\', array($name, $value));' . "\n\n"
  55              . 'return $return;'
  56          );
  57      }
  58  }


Generated: Mon Oct 4 17:42:11 2021 Cross-referenced by PHPXref 0.7.1