Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63287 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14151 invoked from network); 8 Oct 2012 22:32:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Oct 2012 22:32:12 -0000 Authentication-Results: pb1.pair.com header.from=tbprogrammer@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tbprogrammer@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.42 as permitted sender) X-PHP-List-Original-Sender: tbprogrammer@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:32773] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/D0-07968-B6453705 for ; Mon, 08 Oct 2012 18:32:11 -0400 Received: by mail-oa0-f42.google.com with SMTP id j1so4856778oag.29 for ; Mon, 08 Oct 2012 15:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=PMtDhnFfwxQ5JXAKtFyKwHVQBb1/vp9/Y4XU7uysfOg=; b=OlyyYsw9i/UmjPFhPkkQJSfwzO5B4HQrAFJSZcLBvuMaN9p/ByCC0AyPaIltH0YHAk 5wYzrZRNqhC7jL9C8vzHxLsbeV64F/4N1mMZUaA+yPLjh5rFL2whW3kws+ahgLXvIslQ /6fK0k8BozMcU3osRDI0EnrzcY8uL9qCEfhc0aYEhRsV6sOETBXW4CS3u/MyovdADzVW 5uCi1e5BdjIASo6FKp0drOf/u/4u+KyvjZWQr1leHFsKxBlgADZAu0WCCk5UzTAKFHBK z0HOiZuxJdklawnAc3L4X79Pboy2Y2eG5AJClufslTy1X0pmjidl4N0NXKp1THYoVpds 0+9A== Received: by 10.60.29.230 with SMTP id n6mr14784365oeh.123.1349735528509; Mon, 08 Oct 2012 15:32:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.11.170 with HTTP; Mon, 8 Oct 2012 15:31:48 -0700 (PDT) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <5073328D.5000002@gmail.com> <50735165.8010703@aaronholmes.net> Date: Mon, 8 Oct 2012 15:31:48 -0700 Message-ID: To: Benjamin Eberlei Cc: Aaron Holmes , internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8ff1c146b7b22104cb93caf4 Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 From: tbprogrammer@gmail.com (Jazzer Dane) --e89a8ff1c146b7b22104cb93caf4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I agree. It's more consistent than the $Hours solution and we don't have to add another superglobal or magic constant, which is quite nice. The typehinting is a big plus as well. On Mon, Oct 8, 2012 at 3:26 PM, Benjamin Eberlei wrote= : > The set() one is really nice with the typehints. > > On Tue, Oct 9, 2012 at 12:19 AM, Aaron Holmes > wrote: > > > On 10/8/12 1:07 PM, Denis Portnov wrote: > > > >> 08.10.2012 15:52, Clint Priest =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >> > >>> public $Hours { > >>> get { return $this->Seconds / 3600; } > >>> set { $this->Seconds =3D $value; } > >>> isset { return isset< > >>> http://www.php.net/isset**>($this->Seconds); } > >>> unset { unset< > >>> http://www.php.net/unset**>($this->Seconds); } > >>> } > >>> > >> > >> > >> Hi Clint, > >> > >> I've noticed some magic variable '$value' is introduced. And except fo= r > >> superglobals I guess there is no such thing in PHP, so it looks bit > >> puzzling to me. I'd suggest on of the following: > >> > >> > >> - setter resambles setter method, wich also allows typehinting > >> public $Hours { > >> set ($value) { $this->Seconds =3D $value * 3600; } > >> } > >> > >> public $Hours { > >> set (DateTime $dateTime) { $this->Seconds =3D > >> $dateTime->getTimestamp(); } > >> } > >> > >> This seems like the cleanest method, in my opinion. Javascript does > this > > for object prototypes: > > http://ejohn.org/blog/**javascript-getters-and-**setters/< > http://ejohn.org/blog/javascript-getters-and-setters/> > > > > > >> > >> What do you think? > >> > >> Thanks > >> Denis > >> > >> > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > --e89a8ff1c146b7b22104cb93caf4--