00001 <?php
00002 
00003 
00004 
00005 
00006 
00007 
00008 class ConverterCallback implements IConverter {
00009         public function encode($value, $params = false) {
00010                 if (is_callable($params)) {
00011                         return $params($value);
00012                 }
00013                 throw new Exception('Callback in ConverterCallback::encode not callable');
00014         }
00015         
00016         public function decode($value, $params = false) {
00017                 if (is_callable($params)) {
00018                         return $params($value);
00019                 }
00020                 throw new Exception('Callback in ConverterCallback::decode not callable');
00021         }
00022 }