Oihana PHP System

AlterNormalizePropertyTrait

Table of Contents

Methods

alterNormalizeProperty()  : mixed
Normalize a document property using configurable flags.

Methods

alterNormalizeProperty()

Normalize a document property using configurable flags.

public alterNormalizeProperty(mixed $value[, array<string|int, mixed> $definition = [] ][, bool &$modified = false ]) : mixed

The normalization can be customized via the $definition array:

  • If empty or no flags provided, uses CleanFlag::DEFAULT | CleanFlag::RETURN_NULL
  • If a flags value is provided at index 0, uses that instead
Parameters
$value : mixed

The value to normalize

$definition : array<string|int, mixed> = []

Optional flags array: [CleanFlag value, ...other params]

$modified : bool = false

Reference flag indicating if the value was modified

Tags
example
// Use default flags
$this->alterNormalizeProperty( $value );
// Uses: CleanFlag::DEFAULT | CleanFlag::RETURN_NULL

// Use custom flags
$this->alterNormalizeProperty($value, [ CleanFlag::NULLS | CleanFlag::EMPTY ] );

// Only remove nulls
$this->alterNormalizeProperty($value, [CleanFlag::NULLS]);
Return values
mixed

The normalized value, or null if cleaned away


        
On this page

Search results