SOAP
[ class tree: SOAP ] [ index: SOAP ] [ all elements ]

Source for file hexBinary.php

Documentation is available at hexBinary.php

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
  17. // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author         |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: hexBinary.php,v 1.6 2005/03/10 23:16:39 yunosh Exp $
  21. //
  22. class SOAP_Type_hexBinary
  23. {
  24.     function to_bin($value)
  25.     {
  26.         $len strlen($value);
  27.         return pack('H' $len$value);
  28.     }
  29.     function to_hex($value)
  30.     {
  31.         return bin2hex($value);
  32.     }
  33.     function is_hexbin($value)
  34.     {
  35.         # first see if there are any invalid chars
  36.         $l strlen($value);
  37.  
  38.         if ($l < 1 || strspn($value'0123456789ABCDEFabcdef'!= $lreturn FALSE;
  39.  
  40.         $bin = SOAP_Type_hexBinary::to_bin($value);
  41.         $hex = SOAP_Type_hexBinary::to_hex($bin);
  42.         return strcasecmp($value$hex== 0;
  43.     }
  44. }
  45.  
  46. ?>

Documentation generated on Mon, 11 Mar 2019 14:33:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.