1 Dec 2010 01:04
Re: [PHP-DEV] RFC: C-sharp style property get/set syntax for PHP
<president <at> basnetworks.net>
2010-12-01 00:04:48 GMT
2010-12-01 00:04:48 GMT
> ...
>
>> /**
>> *
>> */
>> public function set name(string $name) {
>> $this->name = htmlentities($name);
>> $this->name = strip_tags($this->name);
>> }
>>
>> /**
>> *
>> */
>> public function get name($name) {
>> return $this->name;
>> }
>>
>> Greetings,
>> Christian
>>
>
> For whatever it's worth, I think that this syntax fits much better
> into PHP than do either of the those in the RFC.
I feel that the downfall of this syntax, is that the get and set methods
can easily be scattered at either end of a class definition. With the
syntaxes I provided, it is easy to tell which of the methods a property
has defined at a quick glance, because everything is in on spot.
Additionally, public/private/protected/final/abstract/etc only has to be
(Continue reading)
>
>
>
> --
RSS Feed