1: <?php
2:
3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15:
16: class Swift_Preferences
17: {
18:
19: private static $_instance = null;
20:
21:
22: private function __construct() { }
23:
24: 25: 26: 27:
28: public static function getInstance()
29: {
30: if (!isset(self::$_instance)) {
31: self::$_instance = new self();
32: }
33:
34: return self::$_instance;
35: }
36:
37: 38: 39: 40: 41:
42: public function setCharset($charset)
43: {
44: Swift_DependencyContainer::getInstance()
45: ->register('properties.charset')->asValue($charset);
46:
47: return $this;
48: }
49:
50: 51: 52: 53: 54:
55: public function setTempDir($dir)
56: {
57: Swift_DependencyContainer::getInstance()
58: ->register('tempdir')->asValue($dir);
59:
60: return $this;
61: }
62:
63: 64: 65: 66: 67:
68: public function setCacheType($type)
69: {
70: Swift_DependencyContainer::getInstance()
71: ->register('cache')->asAliasOf(sprintf('cache.%s', $type));
72:
73: return $this;
74: }
75:
76: 77: 78: 79: 80:
81: public function setQPDotEscape($dotEscape)
82: {
83: $dotEscape=!empty($dotEscape);
84: Swift_DependencyContainer::getInstance()
85: -> register('mime.qpcontentencoder')
86: -> asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
87: -> withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))
88: -> addConstructorValue($dotEscape);
89:
90: return $this;
91: }
92: }
93: