PageRenderTime 87ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/ZendFramework/tests/Zend/Http/TestAsset/PopulatedStorage.php

https://bitbucket.org/Dal-Papa/is-340-publish-base
PHP | 94 lines | 23 code | 6 blank | 65 comment | 0 complexity | a266c52deca7ac619328eef50aed277b MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Http
  17. * @subpackage UserAgent
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Http_UserAgent_Storage_Interface
  23. */
  24. require_once 'Zend/Http/UserAgent/Storage.php';
  25. /**
  26. * Non-Persistent Browser Storage
  27. *
  28. * Since HTTP Browserentication happens again on each request, this will always be
  29. * re-populated. So there's no need to use sessions, this simple value class
  30. * will hold the data for rest of the current request.
  31. *
  32. * @package Zend_Http
  33. * @subpackage UserAgent
  34. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. */
  37. class Zend_Http_TestAsset_PopulatedStorage
  38. implements Zend_Http_UserAgent_Storage
  39. {
  40. /**
  41. * Holds the actual Browser data
  42. * @var mixed
  43. */
  44. protected $_data = 'a:6:{s:12:"browser_type";s:7:"desktop";s:6:"config";a:4:{s:23:"identification_sequence";s:14:"mobile,desktop";s:26:"persistent_storage_adapter";s:13:"NonPersistent";s:8:"wurflapi";a:2:{s:13:"wurfl_lib_dir";s:63:"/home/matthew/git/zf-standard/tests/Zend/Http/_files/Wurfl/1.1/";s:17:"wurfl_config_file";s:85:"/home/matthew/git/zf-standard/tests/Zend/Http/_files/Wurfl/resources/wurfl-config.php";}s:7:"desktop";a:1:{s:7:"matcher";a:1:{s:9:"classname";s:33:"Zend_Http_TestAsset_DesktopDevice";}}}s:12:"device_class";s:33:"Zend_Http_TestAsset_DesktopDevice";s:6:"device";s:793:"a:5:{s:10:"_aFeatures";a:19:{s:12:"browser_name";s:7:"desktop";s:12:"product_name";s:7:"desktop";s:10:"user_agent";s:7:"desktop";s:18:"is_wireless_device";b:0;s:9:"is_mobile";b:0;s:10:"is_desktop";b:1;s:9:"is_tablet";b:0;s:6:"is_bot";b:0;s:8:"is_email";b:0;s:7:"is_text";b:0;s:25:"device_claims_web_support";b:0;s:9:"client_ip";s:9:"127.0.0.1";s:11:"php_version";s:5:"5.3.1";s:9:"server_os";s:6:"apache";s:17:"server_os_version";s:6:"2.2.12";s:18:"server_http_accept";s:3:"*/*";s:27:"server_http_accept_language";s:5:"fr-FR";s:9:"server_ip";s:9:"127.0.0.1";s:11:"server_name";s:8:"zfmobile";}s:8:"_browser";s:7:"desktop";s:15:"_browserVersion";s:0:"";s:10:"_userAgent";s:7:"desktop";s:7:"_images";a:6:{i:0;s:4:"jpeg";i:1;s:3:"gif";i:2;s:3:"png";i:3;s:5:"pjpeg";i:4;s:5:"x-png";i:5;s:3:"bmp";}}";s:10:"user_agent";s:7:"desktop";s:11:"http_accept";s:3:"*/*";}';
  45. /**
  46. * Returns true if and only if storage is empty
  47. *
  48. * @throws Zend_Http_UserAgent_Storage_Exception If it is impossible to determine whether storage is empty
  49. * @return boolean
  50. */
  51. public function isEmpty()
  52. {
  53. return empty($this->_data);
  54. }
  55. /**
  56. * Returns the contents of storage
  57. *
  58. * Behavior is undefined when storage is empty.
  59. *
  60. * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible
  61. * @return mixed
  62. */
  63. public function read()
  64. {
  65. return $this->_data;
  66. }
  67. /**
  68. * Writes $contents to storage
  69. *
  70. * @param mixed $contents
  71. * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible
  72. * @return void
  73. */
  74. public function write($contents)
  75. {
  76. $this->_data = $contents;
  77. }
  78. /**
  79. * Clears contents from storage
  80. *
  81. * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible
  82. * @return void
  83. */
  84. public function clear()
  85. {
  86. $this->_data = null;
  87. }
  88. }