Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99713 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48948 invoked from network); 3 Jul 2017 15:53:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2017 15:53:47 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.28.122 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.28.122 mx201.easyname.com Received: from [212.232.28.122] ([212.232.28.122:42912] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/24-15131-9886A595 for ; Mon, 03 Jul 2017 11:53:45 -0400 Received: from cable-81-173-135-96.netcologne.de ([81.173.135.96] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1dS3fS-0008EK-5v; Mon, 03 Jul 2017 15:53:42 +0000 References: To: php-internals , gmblar@gmail.com Message-ID: <3d05652e-59ab-7072-a094-f4201b052f04@fleshgrinder.com> Date: Mon, 3 Jul 2017 17:53:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="C73VwHtTKHt9Oph0LGwEsuLgHO4VTDNvd" X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Re: [RFC] [Discussion] Class Naming From: php@fleshgrinder.com (Fleshgrinder) --C73VwHtTKHt9Oph0LGwEsuLgHO4VTDNvd Content-Type: multipart/mixed; boundary="MRhK0Lmkw7BIJKRfP2xPiPrwMu6Mgp8Vs"; protected-headers="v1" From: Fleshgrinder To: php-internals , gmblar@gmail.com Message-ID: <3d05652e-59ab-7072-a094-f4201b052f04@fleshgrinder.com> Subject: Re: [PHP-DEV] Re: [RFC] [Discussion] Class Naming References: In-Reply-To: --MRhK0Lmkw7BIJKRfP2xPiPrwMu6Mgp8Vs Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 7/3/2017 5:30 PM, Andreas Treichel wrote: > With any exception from PascalCase you cannot e.g. generate class names= > from strings without a explicit mapping table: >=20 > =20 > function findParserByRootNode(DomDocument $document) > { > $tagName =3D $document->documentElement->tagName; > $className =3D ucfirst($tagName) . 'Parser'; > if (!class_exists($className)) { > throw new RuntimeException('Parser not found for '.$tagName); > } > return new $className(); > } >=20 > $document =3D new DomDocument(); > $document->loadXml($xml); >=20 > $parser =3D findParserByRootNode($document); > $parser->parse($document); >=20 >=20 >=20 > acronyms in PascalCase looks strange, but consistent strange. >=20 >=20 Not true in PHP because class names are not case sensitive: https://3v4l.org/bcAAC --=20 Richard "Fleshgrinder" Fussenegger --MRhK0Lmkw7BIJKRfP2xPiPrwMu6Mgp8Vs-- --C73VwHtTKHt9Oph0LGwEsuLgHO4VTDNvd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZWmiBAAoJEOKkKcqFPVVrp1MP/iOkyfcf65WEKYcbyiCloP/t N8LSIn7uDiqjErKwARIFxW44jUGAWF9twlyMb0TQ+f7VWHcgE7PxEmBO/i4HCNoK QE3fj9MBmGIv7kiv19ui2EDaGRSR+rMzu7Q+l51uVBxWl0Wfhj+KsnnlzNkUFQsF xSNWxuPWhIx3vALaZItoWqJMNQVpqYx629VgbcQDBbM6zQX8TOp9CAJqQS0T08LO CTOVTJap4xXGVAFQD3BZYqSQf0TGCIm+4Q4XdBobvyfJtysolrmrKKM7WNKfgx3V LTJu4LJz/c4z7G5LKMv0Ca+mU+KfS2EdvH19j26i4g9z5rgwL5/tezhizkOaJtWf 7FK7tfqlZvuVmeetXJbKmQFIs1obixV9F1vNhap76XsO+njcYx0HzO9VE2n+qHYu dYjHYachyrMnysZLQrK5uQUjE7I1rZ1ygZhDqaEzHWQNfkL0Eq/9WQoOeU542bmm xYFoM7KA8wIvwMRwou55zMk7G/fcNKrbFWHQO6TxEbp3U9iwRjlbmLoqpVUaCiE7 Q7NvJ1emuFq9PPXdl+KZmhXRA8zUHF3DBmHqktPSxyUraabYIFyWAhsqKjTrlq0o 0GmCAZYGsdWC90PoQVt6j1fP/L19lewYhHxrco4ZuUp8Wbdddbyt8GAWuRs2zBBl TBDVeZ2Megfcfx8/2pQc =cZek -----END PGP SIGNATURE----- --C73VwHtTKHt9Oph0LGwEsuLgHO4VTDNvd--