phramework doc
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • Phramework
    • Authentication
    • Database
      • Operations
    • Exceptions
    • Extensions
    • Models
    • URIStrategy
    • Validate
    • Viewers

Classes

  • Cache
  • Compress
  • Email
  • Execute
  • Filter
  • Language
  • Operator
  • Request
  • Response
  • Upload
  • Util

Class Filter

Provides various methods for filtering data

Namespace: Phramework\Models
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since 0
Located at Models/Filter.php

Methods summary

public static array
# in( array $data, array $whitelist )

Allow only keys of $whitelist in every row of $data array

Allow only keys of $whitelist in every row of $data array

Parameters

$data
$whitelist

Returns

array
public static array
# inEntry( array $data, array $whitelist )

Allow only keys of $whitelist in object

Allow only keys of $whitelist in object

Parameters

$data
$whitelist

Returns

array
public static array
# out( array $data, array $blacklist )

Exclude blackisted keys of $blacklist in every row of $data array

Exclude blackisted keys of $blacklist in every row of $data array

Parameters

$data
$blacklist

Returns

array
public static array
# outEntry( array $data, array $blacklist )

Exclude blackisted keys of $blacklist in $data object

Exclude blackisted keys of $blacklist in $data object

Parameters

$data
$blacklist

Returns

array
public static string
# string( string $value, integer|null $max_length = null )

Filter string, applies FILTER_SANITIZE_STRING

Filter string, applies FILTER_SANITIZE_STRING

Parameters

$value
Input string
$max_length
Max length of the string, optional. Default value is NULL (no limit)

Returns

string
Returns the filtered string
public static string
# email( string $value )

Filter email

Filter email

Parameters

$value

Returns

string
Returns the filtered email
public static boolean
# boolean( string|boolean $value )

Parse input value as boolean

Parse input value as boolean

Parameters

$value
Input value

Returns

boolean
Return the input value as boolean
public static mixed
# typecast( mixed & $value, string $type )

Typecast a value

Typecast a value

Deprecated

since 1.1.0

Parameters

$value
$type

Returns

mixed
The typecasted value
public static array
# castEntry( array $entry, array $model )

Type cast entry's attributs based on the provided model

Type cast entry's attributs based on the provided model

If any TYPE_UNIX_TIMESTAMP are present an additional attribute will be included with the suffix _formatted, the format of the string can be changed from timestamp_format setting.

Deprecated

since 1.1.0

Parameters

$entry
$model

Returns

array
Returns the typecasted entry
public static array
# cast( array $list, array $model )

Type cast each entry of list based on the provided model

Type cast each entry of list based on the provided model

Deprecated

since 1.1.0

Parameters

$list
$model

Returns

array
Returns the typecasted list
phramework doc API documentation generated by ApiGen