src/ClassGeneration/Method.php
public static function createSetterFromProperty(PropertyInterface $property)
    {
        $argument = Argument::createFromProperty($property);

        $code = "\$this->{$property->getName()} = {$argument->getNameFormatted()};"
            . PHP_EOL
            . 'return $this;';

        $method = new self;
        $method
            ->setName('set_' . $property->getName())
            ->setCode($code)
            ->getArgumentCollection()->add($argument);

        return $method;
    }
public static function createSetterFromProperty(PropertyInterface $property)
    {
        $argument = Argument::createFromProperty($property);

        $code = "\$this->{$property->getName()} = {$argument->getNameFormatted()};"
            . PHP_EOL
            . 'return $this;';

        $method = new self;
        $method
            ->setName('set_' . $property->getName())
            ->setCode($code)
            ->getArgumentCollection()->add($argument);

        return $method;
    }
public static function createSetterFromProperty ( PropertyInterface $ property ) { $ argument = Argument :: createFromProperty ( $ property ) ; $ code = "\$this->{$property->getName()} = {$argument->getNameFormatted()};" . PHP_EOL . 'return $this;' ; $ method = new self ; $ method -> setName ( 'set_' . $ property -> getName ( ) ) -> setCode ( $ code ) -> getArgumentCollection ( ) -> add ( $ argument ) ; return $ method ; }
Generate Set Method from Property.
Add a set method in the class based on Object Property.

@param PropertyInterface $property

@return Method
Generate Set Method from Property . Add a set method in the class based on Object Property .