<?php

class RscSgg_Form_Filter_Custom implements RscSgg_Form_Filter_Interface
{
  public $function;

  /**
   * Constructor
   * @param callable $function
   */
  public function __construct(callable $function)
  {
    $this->function = $function;
  }

  /**
   * Filters data
   * @param mixed $data The data that filter will be applied
   * @return mixed
   */
  public function apply($data)
  {
    return call_user_func_array($this->function, [$data]);
  }
}
