Skip to content

Array helper for properties (by trait) #7

@Sett

Description

@Sett

Sometimes (more often, than wanted) there are array-properties in a class. It would be so cool, to get helpers for working with them.

I can show you the realization of this:

class My
{
    use Ohanzee\Helper\Trait\Arr;

    public $data = [
        'foo' => ['bar' => 'foobar']
    ];

    // somewhere in a methods code
    ...
    // Getting $this->data['foo']['bar']
    $this->{'foo.bar'}; 
    ...
}

What do you think about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions