[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace Httpful; 4 5 class Httpful { 6 const VERSION = '0.1.7'; 7 8 private static $mimeRegistrar = array(); 9 private static $default = null; 10 11 /** 12 * @param string $mime_type 13 * @param MimeHandlerAdapter $handler 14 */ 15 public static function register($mimeType, \Httpful\Handlers\MimeHandlerAdapter $handler) 16 { 17 self::$mimeRegistrar[$mimeType] = $handler; 18 } 19 20 /** 21 * @param string $mime_type defaults to MimeHandlerAdapter 22 * @return MimeHandlerAdapter 23 */ 24 public static function get($mimeType = null) 25 { 26 if (isset(self::$mimeRegistrar[$mimeType])) { 27 return self::$mimeRegistrar[$mimeType]; 28 } 29 30 if (empty(self::$default)) { 31 self::$default = new \Httpful\Handlers\MimeHandlerAdapter(); 32 } 33 34 return self::$default; 35 } 36 37 /** 38 * Does this particular Mime Type have a parser registered 39 * for it? 40 * @return bool 41 */ 42 public static function hasParserRegistered($mimeType) 43 { 44 return isset(self::$mimeRegistrar[$mimeType]); 45 } 46 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |