Oihana Php Masking

resolveMaskingRule.php

Table of Contents

Functions

resolveMaskingRule()  : array<string, mixed>|null
Returns the first masking rule (in declaration order) that targets a leaf.

Functions

resolveMaskingRule()

Returns the first masking rule (in declaration order) that targets a leaf.

resolveMaskingRule(array<string|int, mixed> $maskings, string $key, string|null $exactPath) : array<string, mixed>|null

A leaf is identified by its attribute name ($key) and its exact dotted path ($exactPath, which is null once an array has been crossed, disabling exact-path matching). The supported path forms are:

  • "*" — matches every leaf ;
  • "`a.b`" — a backtick/tick quoted literal attribute name ;
  • ".name" — any leaf whose attribute name is name, at any depth ;
  • "a.b" — the exact dotted path.

The first matching rule wins, so a more specific rule listed earlier shadows a broader one listed later.

Parameters
$maskings : array<string|int, mixed>

The list of rules for this collection.

$key : string

The attribute name of the leaf.

$exactPath : string|null

The exact dotted path of the leaf, or null.

Tags
example
use function oihana\masking\resolveMaskingRule;

$rules = [ [ 'path' => 'person.name' , 'type' => 'xifyFront' ] ] ;
resolveMaskingRule( $rules , 'name' , 'person.name' ); // the rule
resolveMaskingRule( $rules , 'name' , 'other.name' );  // null
since
1.0.0
author

Marc Alcaraz

Return values
array<string, mixed>|null

The matching rule, or null.

On this page

Search results