Req #68876 [Com]: Access specifier for class

From: Date: Tue, 24 Feb 2015 23:10:22 +0000
Subject: Req #68876 [Com]: Access specifier for class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190938@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68876&edit=1 ID: 68876 Comment by: edgar dot r dot sandi at gmail dot com Reported by: kulinchoksi at gmail dot com Summary: Access specifier for class Status: Open Type: Feature/Change Request Package: *General Issues Operating System: any PHP Version: 5.6.4 Block user comment: N Private report: N New Comment: I think that you maybe is asking by: https://github.com/php/php-src/pull/947 I'm right? cross your fingers! cheers Previous Comments: ------------------------------------------------------------------------ [2015-01-21 14:13:48] kulinchoksi at gmail dot com Description: ------------ --- From manual page: http://www.php.net/language.oop5.visibility --- In recent versions of PHP, we have introduced feature of namespaces. I was thinking of the scenario where we can specify access specifier/visibility of classes also. We may allow to access instantiation of the class inside namespace only if it's private. Although I'm not sure about allowing the objects of that class outside the namespace but I think, it should be allowed in any case. Example of encapsulating classes in namespace could be: - Different payment classes may represent different payment methods. - A payment manager class can only access the payment factory which will decide to instantiate particular type of payment class. - In application, we would access payment class via manager class only. So manager class can behave like a public interface of payment entities. Example: namespace application/payment; abstract class Payment { ... } private class TypePaypal extends Payment { ... } private class TypePaymentInAdvance extends Payment { ... } class PaymentFactory { ... } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68876&edit=1

« previous php.bugs (#190938) next »