Overview

Namespaces

  • Jyxo
    • Beholder
      • TestCase
    • Gettext
      • Parser
    • Input
      • Chain
      • Filter
      • Validator
    • Mail
      • Email
        • Attachment
      • Parser
      • Sender
    • Rpc
      • Json
      • Xml
    • Shell
    • Spl
    • Svn
    • Time
    • Webdav
  • PHP

Classes

  • Chain
  • Factory
  • Filter
  • Fluent
  • Upload
  • Validator

Interfaces

  • FilterInterface
  • ValidatorInterface

Exceptions

  • Exception
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * Jyxo PHP Library
 5:  *
 6:  * LICENSE
 7:  *
 8:  * This source file is subject to the new BSD license that is bundled
 9:  * with this package in the file license.txt.
10:  * It is also available through the world-wide-web at this URL:
11:  * https://github.com/jyxo/php/blob/master/license.txt
12:  */
13: 
14: namespace Jyxo\Input;
15: 
16: /**
17:  * Class for easier one-line filtering.
18:  *
19:  * @category Jyxo
20:  * @package Jyxo\Input
21:  * @subpackage Filter
22:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
23:  * @license https://github.com/jyxo/php/blob/master/license.txt
24:  * @author Jakub Tománek
25:  */
26: class Filter
27: {
28:     /**
29:      * Static filtering.
30:      *
31:      * @param string $method Filter name
32:      * @param array $params Parameters; the first value gets filtered, the rest will be used as constructor parameters
33:      * @return mixed
34:      */
35:     public static function __callStatic($method, array $params)
36:     {
37:         $factory = \Jyxo\Spl\ObjectCache::get('\Jyxo\Input\Factory') ?: \Jyxo\Spl\ObjectCache::set('\Jyxo\Input\Factory', new Factory());
38:         $value = array_shift($params);
39:         $key = '\Jyxo\Input\Filter\\' . ucfirst($method) . ($params ? '/' . serialize($params) : '');
40:         $filter = \Jyxo\Spl\ObjectCache::get($key) ?: \Jyxo\Spl\ObjectCache::set($key, $factory->getFilterByName($method, $params));
41:         /* @var $filter \Jyxo\Input\FilterInterface */
42:         return $filter->filter($value);
43:     }
44: }
45: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0