Maslosoft Addendum Logo Maslosoft Addendum Documentation
Easy to use php annotations

Edit

Params Expander

Params expander should be used inside annotation init method. Annotation should have empty default values for this to work. The annotation should also have value property containing empty array.

The ParamsExpander class has method expand() for easier extracting parameters from annotation value.

If value have numeric keys, these will be mapped to params in order.

The method expand() accepts (current) annotation as a first parameter, and second parameter should contain property names to check for.

expand() will return hashmap containing keys and values.

Example usage

class I18NAnnotation extends MetaAnnotation
{

    public $value = [];

    public $allowDefault = null;

    public $allowAny = null;

    public function init()
    {
        $data = ParamsExpander::expand($this, ['allowDefault', 'allowAny']);
    }
}