PHP Classes

File: src/Contract/FilterInterface.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   Ionizer PHP Filter Input   src/Contract/FilterInterface.php   Download  
File: src/Contract/FilterInterface.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Ionizer PHP Filter Input
Filter input values by chaining filter objects
Author: By
Last change:
Date: 2 years ago
Size: 1,201 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);
namespace
ParagonIE\Ionizer\Contract;

use
ParagonIE\Ionizer\InvalidDataException;

/**
 * Interface FilterInterface
 * @package ParagonIE\Ionizer\Contract
 */
interface FilterInterface
{
   
/**
     * Sets the expected input type (e.g. string, boolean)
     *
     * @param string $typeIndicator
     * @return FilterInterface
     */
   
public function setType(string $typeIndicator): FilterInterface;

   
/**
     * Set the default value (not applicable to booleans)
     *
     * @param string|int|float|bool|array|null $value
     * @return FilterInterface
     */
   
public function setDefault($value): FilterInterface;

   
/**
     * Add a callback to this filter (supports more than one)
     *
     * @param callable $func
     * @return FilterInterface
     */
   
public function addCallback(callable $func): FilterInterface;

   
/**
     * Process data using the filter rules.
     *
     * @param mixed $data
     * @return mixed
     * @throws InvalidDataException
     */
   
public function process($data);


   
/**
     * @param string $index
     * @return FilterInterface
     */
   
public function setIndex(string $index): FilterInterface;
}