CopernicaMarketingSoftware/PHP-CPP — pull request #14 by valmat (2014-02-07 12:00:22+00:00)
Title: Several additional features

Propose the following additions
:one: FIX class DoubleMember https://github.com/valmat/PHP-CPP/commit/3ec089c679037cd57c6afa79c0b16e70e606194a
:two: Possibility of declaring constants of class.
The following code extension written using **PHP-CPP**
```c
extension.add(
"Foo", Php::Class({
...

Php::Const("VERSION", "v0.01-alpha"),
Php::Const("PI", 3.14159265),
Php::Const("FIVE", 5),
Php::Const("IMISNULL"),
}));
```
corresponds to the **PHP** code
```php
class Foo {
const VERSION = 'v0.01-alpha';
const PI = 3.14159265;
const FIVE = 5;
const IMISNULL = NULL;
}
```
:three: Possibility declaring static properties of class.
The following code extension written using **PHP-CPP**
```c
extension.add(
"Foo", Php::Class({
...
Php::Static("exp", 2.71828182846),
}));
```
corresponds to the **PHP** code
```php
class Foo {
static $exp = 2.71828182846;
}
```
:four: Except `Public` and `Protected` now possible declare `Private` method or property. Example: https://github.com/valmat/PHP-CPP/blob/valmat/Examples/ConstStaticProp/cpp/mytestext.cpp
:five: Added flagged (access types flags of classes) pseudonyms of Class:
`FinalClass`, `AbstractClass`, `Interface`, `Trait`
for example:
was:
```c
extension.add(
"MyTestClass",
Php::Class({
Php::Public("myMethod", Php::Method(&MyTestExt::myMethod)),
...
}));
```
...Php::**Class**({...
is now:
```c
extension.add(
"MyTestClass",
Php::FinalClass({
Php::Public("myMethod", Php::Method(&MyTestExt::myMethod)),
...
}));
```
...Php::**FinalClass**({...
Besides not-flagged type `Class`, now also supported and `FinalClass`, `AbstractClass`, `Interface`, `Trait` https://github.com/valmat/PHP-CPP/commit/eb940328764c0cb306814f699f32d37f1df9b5a4
:six: PHP-CPP classes now can implements php interfaces https://github.com/valmat/PHP-CPP/commit/f3c03693481e970009f8706f5948d41c0e9d8442
for example, following definition:
```c
extension.add(
"Foo",
Php::Class({
....
}
).implementsIterator()
.implementsSerializable()
);
```
equivalent PHP definition:
```php
class Foo implements Iterator, Serializable {
....
}
```
table of correspondence:

|PHP interface | `Calss` method|
| ------------- | ------------- |
|Traversable | implementsTraversable()|
|Iterator | implementsIterator()|
|IteratorAggregate | implementsAggregate()|
|ArrayAccess | implementsArrayAccess()|
|Serializable | implementsSerializable()|

Moreover to implement interfaces from other extensions or own interfaces, it is possible to create a plugin and use it by the method ` Class::Class& implements(ExtInterface *)`. More info: https://github.com/valmat/PHP-CPP/commit/7cc4423b9c0565f89ebca1b2424da84d1c130610#commitcomment-5306621
For example, you can write a separate plug-in that allows you to implement interfaces from the [SPL](http://php.net/manual/en/spl.interfaces.php) extension

## Note
Proposed changes the library PHP-CPP require recompiling all extensions written with its use.

## Other
I tried to follow the general style and ideology of the main repository. I'm pleased to hear your comments and will add changes before merging branches.

Please, forgive me for my english.

Best regards, Valery.