thekid/rfc — Issue #95: RFC 0095: Member utilities
Author: thekid
Created: 2011-10-09 15:01:58+00:00
State: open

Scope of Change
====
A new API will be created to easily work with members.

Rationale
====
Remove boilerplate code.

Functionality
====

Current
----
XPClass::getMethods() returns an array of lang.reflect.Method objects. To
select only those decorated with an @inject annotation, the standard loop
and filter approach is used:

```php
getMethods() as $m) {
if (!$m->hasAnnotation('inject')) continue;

$value= $m->getAnnotation('inject');
// ...
}
?>
```

Annotation class
----
The new invoke.Annotation class provides a fast alternative to searching
for methods annotated with a certain annotation.

```php

```

Usage:

```php
methodsOf('some.test.Class') as $m) {
// ...
}
?>
```

Methods class
----
The new invoke.Methods class provides static methods to factor selectors.

```php

```

Examples:

```php
in('some.test.Class') as $m) {
// ...
}

foreach (Methods::findAll('[@inject] public *(ioc.Resource)')->in('some.ioc.Class') as $m) {
$value= $m->getAnnotation('inject');
// ...
}
?>
```

Security considerations
====
n/a

Speed impact
====
n/a

Dependencies
====
- xp-framework/rfc #109 - for the invoke package

Related documents
====
n/a

Comments
====
- friebe, Wed Oct 10 21:46:14 2007
Reset to draft - this needs some more thought