Skip to content

Commit 4621b23

Browse files
committed
update README
1 parent 17e5ccc commit 4621b23

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Prototypes
22
> Dinamically add methods to PHP classes
33
4+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/skrtdev/prototypes/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/skrtdev/prototypes/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/skrtdev/prototypes/badges/build.png?b=master)](https://scrutinizer-ci.com/g/skrtdev/prototypes/build-status/master) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/ab3a826ec45e45d7bcc910c39df1331a)](https://www.codacy.com/gh/skrtdev/prototypes/dashboard?utm_source=github.com&utm_medium=referral&utm_content=skrtdev/prototypes&utm_campaign=Badge_Grade)
45
Using this library you can dinamcally add methods to classes, as in the following example:
56
```php
67
use skrtdev\Prototypes\Prototypeable;
@@ -21,10 +22,11 @@ Output is `What a nice way to use PHP`
2122

2223
### Main Features
2324

24-
- Closures are bound to the original object, so you can access `$this` inside closures in the same way as you do when writing a normal method for that class.
25-
- Supports **static** methods too, and you can access `self` and `static` too.
26-
- A native-like `\Error` will be thrown when trying to call a non-existent method.
27-
- A `skrtdev\Prototypes\Exception` will be thrown if class method already exists, is a prototype, class does not exist or isn't Prototypeable (when using `skrtdev\Prototypes\Prototypes::addMethod()`).
25+
- Closures are bound to the original object, so you can access `$this` inside closures in the same way as you do when writing a normal method for that class.
26+
- Supports **static** methods too, and you can access `self` and `static` too.
27+
- A native-like `\Error` will be thrown when trying to call a non-existent method.
28+
- A `skrtdev\Prototypes\Exception` will be thrown if class method already exists, is a prototype, class does not exist or isn't Prototypeable (when using `skrtdev\Prototypes\Prototypes::addMethod()`).
29+
- Ability to use any kind of `callable`s, not just `Closure`s.
2830

2931
### Check if a Class is Prototypeable
3032

@@ -44,17 +46,15 @@ The `Prototypes` class itself is `Prototypeable`, how strange.
4446

4547
### Known issues
4648

47-
- This library does not have `Inheritance`: you won't be able to use Prototypes methods defined for a class in his child classes. (this is going to be added soon)
48-
- You won't be able to use [named arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments) in Prototypes methods, as `array unpacking` doesn't work with string keys [yet](https://wiki.php.net/rfc/array_unpacking_string_keys).
49-
- You can't override already-prototyped methods, but this will be added soon.
50-
- Any kind of `Error/Exception`(s) look a bit strange in the Stack traces, and method name is hidden. Maybe there is a solution; if you find it, feel free to open an `Issue/Pull Request`.
49+
- This library does not have `Inheritance`: you won't be able to use Prototypes methods defined for a class in his child classes. (this is going to be added soon)
50+
- You won't be able to use [named arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments) in Prototypes methods, as `array unpacking` doesn't work with string keys [yet](https://wiki.php.net/rfc/array_unpacking_string_keys).
51+
- You can't override already-prototyped methods, but this will be added soon.
52+
- Any kind of `Error/Exception`(s) look a bit strange in the Stack traces, and method name is hidden. Maybe there is a solution; if you find it, feel free to open an `Issue/Pull Request`.
5153

5254
### Future scope
5355

54-
- Add the ability to use `callable`s instead of `Closure`s.
55-
- Use `class_parent()` to implement some kind of `Inheritance`. This may slow up calling prototypes in classes with a long hierarchy.
56-
- Maybe add the ability to add a method to a class without adding it to his children. (does it make sense?)
57-
- Allow to add all methods of a normal/anonymous class into a Prototypeable one (Using `Reflection`?).
58-
- Add ability to use some kind of [Attributes](https://www.php.net/manual/en/language.attributes.overview.php) to functions, classes and methods in order to add them as methods to a class, instead of manually adding them.
59-
- Add the ability to define prototype methods that has been already defined as prototypes, overwriting them.
60-
- Add the ability to define prototypes for all the Prototypeable classes. (do you see any use cases?)
56+
- Use `class_parent()` to implement some kind of `Inheritance`. This may slow up calling prototypes in classes with a long hierarchy.
57+
- Maybe add the ability to add a method to a class without adding it to his children. (does it make sense?)
58+
- Allow to add all methods of a normal/anonymous class into a Prototypeable one (Using `Reflection`?).
59+
- Add the ability to define prototype methods that has been already defined as prototypes, overwriting them.
60+
- Add the ability to define prototypes for all the Prototypeable classes. (do you see any use cases?)

0 commit comments

Comments
 (0)