Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class PCREFilter implements Filtrator
00016 {
00017 private $search = null;
00018 private $replace = null;
00019 private $limit = -1;
00020
00024 public static function create()
00025 {
00026 return new self;
00027 }
00028
00032 public function setExpression($search, $replace)
00033 {
00034 $this->search = $search;
00035 $this->replace = $replace;
00036
00037 return $this;
00038 }
00039
00040 public function apply($value)
00041 {
00042 return
00043 preg_replace(
00044 $this->search,
00045 $this->replace,
00046 $value,
00047 $this->limit
00048 );
00049 }
00050
00054 public function setLimit($limit)
00055 {
00056 $this->limit = $limit;
00057
00058 return $this;
00059 }
00060 }
00061 ?>