hoaproject / Ruler

The Hoa\Ruler library.
https://hoa-project.net
625 stars 66 forks source link

Enhanced Context to access offsets as object properties. #121

Closed SilverFire closed 6 years ago

SilverFire commented 6 years ago

This commit enhances Context behavior so the following context

$context = new Context();
$context['user'] = new Context([
   'activityIndex' => function () use ($activityCalculator) {
       // Takes a lot of time to calculate
       return $activityCalculator($user);
   }
]);

Can be accessed with either an array

user['activityIndex'] > 20

or an object syntax

user.activityIndex > 20
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.01%) to 97.398% when pulling 7d5754d7165a3f909686b719ce3375c07ab5b5d6 on SilverFire:context-as-property into 10205061a1d397d4878b7f4ff18e53c146b472ec on hoaproject:master.

vonglasow commented 6 years ago

bors r+

Thanks for your contribution

bors[bot] commented 6 years ago

:lock: Permission denied

Existing reviewers: click here to make vonglasow a reviewer

vonglasow commented 6 years ago

bors r+

bors[bot] commented 6 years ago

:lock: Permission denied

Existing reviewers: click here to make vonglasow a reviewer