Avail feature updated
[ninja.git] / application / vendor / swiftmailer / classes / Swift / Preferences.php
blob20a2e5f18d6cf01891001d0ff472cb75daa7f200
1 <?php
3 /*
4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
11 //@require 'Swift/DependencyContainer.php';
13 /**
14 * Changes some global preference settings in Swift Mailer.
15 * @package Swift
16 * @author Chris Corbyn
18 class Swift_Preferences
21 /** Singleton instance */
22 private static $_instance = null;
24 /** Constructor not to be used */
25 private function __construct() { }
27 /**
28 * Get a new instance of Preferences.
29 * @return Swift_Preferences
31 public static function getInstance()
33 if (!isset(self::$_instance))
35 self::$_instance = new self();
37 return self::$_instance;
40 /**
41 * Set the default charset used.
42 * @param string
43 * @return Swift_Preferences
45 public function setCharset($charset)
47 Swift_DependencyContainer::getInstance()
48 ->register('properties.charset')->asValue($charset);
49 return $this;
52 /**
53 * Set the directory where temporary files can be saved.
54 * @param string $dir
55 * @return Swift_Preferences
57 public function setTempDir($dir)
59 Swift_DependencyContainer::getInstance()
60 ->register('tempdir')->asValue($dir);
61 return $this;
64 /**
65 * Set the type of cache to use (i.e. "disk" or "array").
66 * @param string $type
67 * @return Swift_Preferences
69 public function setCacheType($type)
71 Swift_DependencyContainer::getInstance()
72 ->register('cache')->asAliasOf(sprintf('cache.%s', $type));
73 return $this;