Completed
Branch develop (fa72bb)
by
unknown
26:08
created
includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject
17 17
 {
18
-    /**
19
-     * The Exception thrown.
20
-     *
21
-     * @var Swift_TransportException
22
-     */
23
-    private $exception;
18
+	/**
19
+	 * The Exception thrown.
20
+	 *
21
+	 * @var Swift_TransportException
22
+	 */
23
+	private $exception;
24 24
 
25
-    /**
26
-     * Create a new TransportExceptionEvent for $transport.
27
-     */
28
-    public function __construct(Swift_Transport $transport, Swift_TransportException $ex)
29
-    {
30
-        parent::__construct($transport);
31
-        $this->exception = $ex;
32
-    }
25
+	/**
26
+	 * Create a new TransportExceptionEvent for $transport.
27
+	 */
28
+	public function __construct(Swift_Transport $transport, Swift_TransportException $ex)
29
+	{
30
+		parent::__construct($transport);
31
+		$this->exception = $ex;
32
+	}
33 33
 
34
-    /**
35
-     * Get the TransportException thrown.
36
-     *
37
-     * @return Swift_TransportException
38
-     */
39
-    public function getException()
40
-    {
41
-        return $this->exception;
42
-    }
34
+	/**
35
+	 * Get the TransportException thrown.
36
+	 *
37
+	 * @return Swift_TransportException
38
+	 */
39
+	public function getException()
40
+	{
41
+		return $this->exception;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendEvent.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -15,112 +15,112 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Events_SendEvent extends Swift_Events_EventObject
17 17
 {
18
-    /** Sending has yet to occur */
19
-    const RESULT_PENDING = 0x0001;
20
-
21
-    /** Email is spooled, ready to be sent */
22
-    const RESULT_SPOOLED = 0x0011;
23
-
24
-    /** Sending was successful */
25
-    const RESULT_SUCCESS = 0x0010;
26
-
27
-    /** Sending worked, but there were some failures */
28
-    const RESULT_TENTATIVE = 0x0100;
29
-
30
-    /** Sending failed */
31
-    const RESULT_FAILED = 0x1000;
32
-
33
-    /**
34
-     * The Message being sent.
35
-     *
36
-     * @var Swift_Mime_SimpleMessage
37
-     */
38
-    private $message;
39
-
40
-    /**
41
-     * Any recipients which failed after sending.
42
-     *
43
-     * @var string[]
44
-     */
45
-    private $failedRecipients = [];
46
-
47
-    /**
48
-     * The overall result as a bitmask from the class constants.
49
-     *
50
-     * @var int
51
-     */
52
-    private $result;
53
-
54
-    /**
55
-     * Create a new SendEvent for $source and $message.
56
-     */
57
-    public function __construct(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
58
-    {
59
-        parent::__construct($source);
60
-        $this->message = $message;
61
-        $this->result = self::RESULT_PENDING;
62
-    }
63
-
64
-    /**
65
-     * Get the Transport used to send the Message.
66
-     *
67
-     * @return Swift_Transport
68
-     */
69
-    public function getTransport()
70
-    {
71
-        return $this->getSource();
72
-    }
73
-
74
-    /**
75
-     * Get the Message being sent.
76
-     *
77
-     * @return Swift_Mime_SimpleMessage
78
-     */
79
-    public function getMessage()
80
-    {
81
-        return $this->message;
82
-    }
83
-
84
-    /**
85
-     * Set the array of addresses that failed in sending.
86
-     *
87
-     * @param array $recipients
88
-     */
89
-    public function setFailedRecipients($recipients)
90
-    {
91
-        $this->failedRecipients = $recipients;
92
-    }
93
-
94
-    /**
95
-     * Get an recipient addresses which were not accepted for delivery.
96
-     *
97
-     * @return string[]
98
-     */
99
-    public function getFailedRecipients()
100
-    {
101
-        return $this->failedRecipients;
102
-    }
103
-
104
-    /**
105
-     * Set the result of sending.
106
-     *
107
-     * @param int $result
108
-     */
109
-    public function setResult($result)
110
-    {
111
-        $this->result = $result;
112
-    }
113
-
114
-    /**
115
-     * Get the result of this Event.
116
-     *
117
-     * The return value is a bitmask from
118
-     * {@see RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}
119
-     *
120
-     * @return int
121
-     */
122
-    public function getResult()
123
-    {
124
-        return $this->result;
125
-    }
18
+	/** Sending has yet to occur */
19
+	const RESULT_PENDING = 0x0001;
20
+
21
+	/** Email is spooled, ready to be sent */
22
+	const RESULT_SPOOLED = 0x0011;
23
+
24
+	/** Sending was successful */
25
+	const RESULT_SUCCESS = 0x0010;
26
+
27
+	/** Sending worked, but there were some failures */
28
+	const RESULT_TENTATIVE = 0x0100;
29
+
30
+	/** Sending failed */
31
+	const RESULT_FAILED = 0x1000;
32
+
33
+	/**
34
+	 * The Message being sent.
35
+	 *
36
+	 * @var Swift_Mime_SimpleMessage
37
+	 */
38
+	private $message;
39
+
40
+	/**
41
+	 * Any recipients which failed after sending.
42
+	 *
43
+	 * @var string[]
44
+	 */
45
+	private $failedRecipients = [];
46
+
47
+	/**
48
+	 * The overall result as a bitmask from the class constants.
49
+	 *
50
+	 * @var int
51
+	 */
52
+	private $result;
53
+
54
+	/**
55
+	 * Create a new SendEvent for $source and $message.
56
+	 */
57
+	public function __construct(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
58
+	{
59
+		parent::__construct($source);
60
+		$this->message = $message;
61
+		$this->result = self::RESULT_PENDING;
62
+	}
63
+
64
+	/**
65
+	 * Get the Transport used to send the Message.
66
+	 *
67
+	 * @return Swift_Transport
68
+	 */
69
+	public function getTransport()
70
+	{
71
+		return $this->getSource();
72
+	}
73
+
74
+	/**
75
+	 * Get the Message being sent.
76
+	 *
77
+	 * @return Swift_Mime_SimpleMessage
78
+	 */
79
+	public function getMessage()
80
+	{
81
+		return $this->message;
82
+	}
83
+
84
+	/**
85
+	 * Set the array of addresses that failed in sending.
86
+	 *
87
+	 * @param array $recipients
88
+	 */
89
+	public function setFailedRecipients($recipients)
90
+	{
91
+		$this->failedRecipients = $recipients;
92
+	}
93
+
94
+	/**
95
+	 * Get an recipient addresses which were not accepted for delivery.
96
+	 *
97
+	 * @return string[]
98
+	 */
99
+	public function getFailedRecipients()
100
+	{
101
+		return $this->failedRecipients;
102
+	}
103
+
104
+	/**
105
+	 * Set the result of sending.
106
+	 *
107
+	 * @param int $result
108
+	 */
109
+	public function setResult($result)
110
+	{
111
+		$this->result = $result;
112
+	}
113
+
114
+	/**
115
+	 * Get the result of this Event.
116
+	 *
117
+	 * The return value is a bitmask from
118
+	 * {@see RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}
119
+	 *
120
+	 * @return int
121
+	 */
122
+	public function getResult()
123
+	{
124
+		return $this->result;
125
+	}
126 126
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/FailoverTransport.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,19 +15,19 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
17 17
 {
18
-    /**
19
-     * Creates a new FailoverTransport with $transports.
20
-     *
21
-     * @param Swift_Transport[] $transports
22
-     */
23
-    public function __construct($transports = [])
24
-    {
25
-        \call_user_func_array(
26
-            [$this, 'Swift_Transport_FailoverTransport::__construct'],
27
-            Swift_DependencyContainer::getInstance()
28
-                ->createDependenciesFor('transport.failover')
29
-            );
18
+	/**
19
+	 * Creates a new FailoverTransport with $transports.
20
+	 *
21
+	 * @param Swift_Transport[] $transports
22
+	 */
23
+	public function __construct($transports = [])
24
+	{
25
+		\call_user_func_array(
26
+			[$this, 'Swift_Transport_FailoverTransport::__construct'],
27
+			Swift_DependencyContainer::getInstance()
28
+				->createDependenciesFor('transport.failover')
29
+			);
30 30
 
31
-        $this->setTransports($transports);
32
-    }
31
+		$this->setTransports($transports);
32
+	}
33 33
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php 1 patch
Indentation   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -15,373 +15,373 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_DependencyContainer
17 17
 {
18
-    /** Constant for literal value types */
19
-    const TYPE_VALUE = 0x00001;
20
-
21
-    /** Constant for new instance types */
22
-    const TYPE_INSTANCE = 0x00010;
23
-
24
-    /** Constant for shared instance types */
25
-    const TYPE_SHARED = 0x00100;
26
-
27
-    /** Constant for aliases */
28
-    const TYPE_ALIAS = 0x01000;
29
-
30
-    /** Constant for arrays */
31
-    const TYPE_ARRAY = 0x10000;
32
-
33
-    /** Singleton instance */
34
-    private static $instance = null;
35
-
36
-    /** The data container */
37
-    private $store = [];
38
-
39
-    /** The current endpoint in the data container */
40
-    private $endPoint;
41
-
42
-    /**
43
-     * Constructor should not be used.
44
-     *
45
-     * Use {@link getInstance()} instead.
46
-     */
47
-    public function __construct()
48
-    {
49
-    }
50
-
51
-    /**
52
-     * Returns a singleton of the DependencyContainer.
53
-     *
54
-     * @return self
55
-     */
56
-    public static function getInstance()
57
-    {
58
-        if (!isset(self::$instance)) {
59
-            self::$instance = new self();
60
-        }
61
-
62
-        return self::$instance;
63
-    }
64
-
65
-    /**
66
-     * List the names of all items stored in the Container.
67
-     *
68
-     * @return array
69
-     */
70
-    public function listItems()
71
-    {
72
-        return array_keys($this->store);
73
-    }
74
-
75
-    /**
76
-     * Test if an item is registered in this container with the given name.
77
-     *
78
-     * @see register()
79
-     *
80
-     * @param string $itemName
81
-     *
82
-     * @return bool
83
-     */
84
-    public function has($itemName)
85
-    {
86
-        return \array_key_exists($itemName, $this->store)
87
-            && isset($this->store[$itemName]['lookupType']);
88
-    }
89
-
90
-    /**
91
-     * Lookup the item with the given $itemName.
92
-     *
93
-     * @see register()
94
-     *
95
-     * @param string $itemName
96
-     *
97
-     * @return mixed
98
-     *
99
-     * @throws Swift_DependencyException If the dependency is not found
100
-     */
101
-    public function lookup($itemName)
102
-    {
103
-        if (!$this->has($itemName)) {
104
-            throw new Swift_DependencyException('Cannot lookup dependency "'.$itemName.'" since it is not registered.');
105
-        }
106
-
107
-        switch ($this->store[$itemName]['lookupType']) {
108
-            case self::TYPE_ALIAS:
109
-                return $this->createAlias($itemName);
110
-            case self::TYPE_VALUE:
111
-                return $this->getValue($itemName);
112
-            case self::TYPE_INSTANCE:
113
-                return $this->createNewInstance($itemName);
114
-            case self::TYPE_SHARED:
115
-                return $this->createSharedInstance($itemName);
116
-            case self::TYPE_ARRAY:
117
-                return $this->createDependenciesFor($itemName);
118
-        }
119
-    }
120
-
121
-    /**
122
-     * Create an array of arguments passed to the constructor of $itemName.
123
-     *
124
-     * @param string $itemName
125
-     *
126
-     * @return array
127
-     */
128
-    public function createDependenciesFor($itemName)
129
-    {
130
-        $args = [];
131
-        if (isset($this->store[$itemName]['args'])) {
132
-            $args = $this->resolveArgs($this->store[$itemName]['args']);
133
-        }
134
-
135
-        return $args;
136
-    }
137
-
138
-    /**
139
-     * Register a new dependency with $itemName.
140
-     *
141
-     * This method returns the current DependencyContainer instance because it
142
-     * requires the use of the fluid interface to set the specific details for the
143
-     * dependency.
144
-     *
145
-     * @see asNewInstanceOf(), asSharedInstanceOf(), asValue()
146
-     *
147
-     * @param string $itemName
148
-     *
149
-     * @return $this
150
-     */
151
-    public function register($itemName)
152
-    {
153
-        $this->store[$itemName] = [];
154
-        $this->endPoint = &$this->store[$itemName];
155
-
156
-        return $this;
157
-    }
158
-
159
-    /**
160
-     * Specify the previously registered item as a literal value.
161
-     *
162
-     * {@link register()} must be called before this will work.
163
-     *
164
-     * @param mixed $value
165
-     *
166
-     * @return $this
167
-     */
168
-    public function asValue($value)
169
-    {
170
-        $endPoint = &$this->getEndPoint();
171
-        $endPoint['lookupType'] = self::TYPE_VALUE;
172
-        $endPoint['value'] = $value;
173
-
174
-        return $this;
175
-    }
176
-
177
-    /**
178
-     * Specify the previously registered item as an alias of another item.
179
-     *
180
-     * @param string $lookup
181
-     *
182
-     * @return $this
183
-     */
184
-    public function asAliasOf($lookup)
185
-    {
186
-        $endPoint = &$this->getEndPoint();
187
-        $endPoint['lookupType'] = self::TYPE_ALIAS;
188
-        $endPoint['ref'] = $lookup;
189
-
190
-        return $this;
191
-    }
192
-
193
-    /**
194
-     * Specify the previously registered item as a new instance of $className.
195
-     *
196
-     * {@link register()} must be called before this will work.
197
-     * Any arguments can be set with {@link withDependencies()},
198
-     * {@link addConstructorValue()} or {@link addConstructorLookup()}.
199
-     *
200
-     * @see withDependencies(), addConstructorValue(), addConstructorLookup()
201
-     *
202
-     * @param string $className
203
-     *
204
-     * @return $this
205
-     */
206
-    public function asNewInstanceOf($className)
207
-    {
208
-        $endPoint = &$this->getEndPoint();
209
-        $endPoint['lookupType'] = self::TYPE_INSTANCE;
210
-        $endPoint['className'] = $className;
211
-
212
-        return $this;
213
-    }
214
-
215
-    /**
216
-     * Specify the previously registered item as a shared instance of $className.
217
-     *
218
-     * {@link register()} must be called before this will work.
219
-     *
220
-     * @param string $className
221
-     *
222
-     * @return $this
223
-     */
224
-    public function asSharedInstanceOf($className)
225
-    {
226
-        $endPoint = &$this->getEndPoint();
227
-        $endPoint['lookupType'] = self::TYPE_SHARED;
228
-        $endPoint['className'] = $className;
229
-
230
-        return $this;
231
-    }
232
-
233
-    /**
234
-     * Specify the previously registered item as array of dependencies.
235
-     *
236
-     * {@link register()} must be called before this will work.
237
-     *
238
-     * @return $this
239
-     */
240
-    public function asArray()
241
-    {
242
-        $endPoint = &$this->getEndPoint();
243
-        $endPoint['lookupType'] = self::TYPE_ARRAY;
244
-
245
-        return $this;
246
-    }
247
-
248
-    /**
249
-     * Specify a list of injected dependencies for the previously registered item.
250
-     *
251
-     * This method takes an array of lookup names.
252
-     *
253
-     * @see addConstructorValue(), addConstructorLookup()
254
-     *
255
-     * @return $this
256
-     */
257
-    public function withDependencies(array $lookups)
258
-    {
259
-        $endPoint = &$this->getEndPoint();
260
-        $endPoint['args'] = [];
261
-        foreach ($lookups as $lookup) {
262
-            $this->addConstructorLookup($lookup);
263
-        }
264
-
265
-        return $this;
266
-    }
267
-
268
-    /**
269
-     * Specify a literal (non looked up) value for the constructor of the
270
-     * previously registered item.
271
-     *
272
-     * @see withDependencies(), addConstructorLookup()
273
-     *
274
-     * @param mixed $value
275
-     *
276
-     * @return $this
277
-     */
278
-    public function addConstructorValue($value)
279
-    {
280
-        $endPoint = &$this->getEndPoint();
281
-        if (!isset($endPoint['args'])) {
282
-            $endPoint['args'] = [];
283
-        }
284
-        $endPoint['args'][] = ['type' => 'value', 'item' => $value];
285
-
286
-        return $this;
287
-    }
288
-
289
-    /**
290
-     * Specify a dependency lookup for the constructor of the previously
291
-     * registered item.
292
-     *
293
-     * @see withDependencies(), addConstructorValue()
294
-     *
295
-     * @param string $lookup
296
-     *
297
-     * @return $this
298
-     */
299
-    public function addConstructorLookup($lookup)
300
-    {
301
-        $endPoint = &$this->getEndPoint();
302
-        if (!isset($this->endPoint['args'])) {
303
-            $endPoint['args'] = [];
304
-        }
305
-        $endPoint['args'][] = ['type' => 'lookup', 'item' => $lookup];
306
-
307
-        return $this;
308
-    }
309
-
310
-    /** Get the literal value with $itemName */
311
-    private function getValue($itemName)
312
-    {
313
-        return $this->store[$itemName]['value'];
314
-    }
315
-
316
-    /** Resolve an alias to another item */
317
-    private function createAlias($itemName)
318
-    {
319
-        return $this->lookup($this->store[$itemName]['ref']);
320
-    }
321
-
322
-    /** Create a fresh instance of $itemName */
323
-    private function createNewInstance($itemName)
324
-    {
325
-        $reflector = new ReflectionClass($this->store[$itemName]['className']);
326
-        if ($reflector->getConstructor()) {
327
-            return $reflector->newInstanceArgs(
328
-                $this->createDependenciesFor($itemName)
329
-                );
330
-        }
331
-
332
-        return $reflector->newInstance();
333
-    }
334
-
335
-    /** Create and register a shared instance of $itemName */
336
-    private function createSharedInstance($itemName)
337
-    {
338
-        if (!isset($this->store[$itemName]['instance'])) {
339
-            $this->store[$itemName]['instance'] = $this->createNewInstance($itemName);
340
-        }
341
-
342
-        return $this->store[$itemName]['instance'];
343
-    }
344
-
345
-    /** Get the current endpoint in the store */
346
-    private function &getEndPoint()
347
-    {
348
-        if (!isset($this->endPoint)) {
349
-            throw new BadMethodCallException('Component must first be registered by calling register()');
350
-        }
351
-
352
-        return $this->endPoint;
353
-    }
354
-
355
-    /** Get an argument list with dependencies resolved */
356
-    private function resolveArgs(array $args)
357
-    {
358
-        $resolved = [];
359
-        foreach ($args as $argDefinition) {
360
-            switch ($argDefinition['type']) {
361
-                case 'lookup':
362
-                    $resolved[] = $this->lookupRecursive($argDefinition['item']);
363
-                    break;
364
-                case 'value':
365
-                    $resolved[] = $argDefinition['item'];
366
-                    break;
367
-            }
368
-        }
369
-
370
-        return $resolved;
371
-    }
372
-
373
-    /** Resolve a single dependency with an collections */
374
-    private function lookupRecursive($item)
375
-    {
376
-        if (\is_array($item)) {
377
-            $collection = [];
378
-            foreach ($item as $k => $v) {
379
-                $collection[$k] = $this->lookupRecursive($v);
380
-            }
381
-
382
-            return $collection;
383
-        }
384
-
385
-        return $this->lookup($item);
386
-    }
18
+	/** Constant for literal value types */
19
+	const TYPE_VALUE = 0x00001;
20
+
21
+	/** Constant for new instance types */
22
+	const TYPE_INSTANCE = 0x00010;
23
+
24
+	/** Constant for shared instance types */
25
+	const TYPE_SHARED = 0x00100;
26
+
27
+	/** Constant for aliases */
28
+	const TYPE_ALIAS = 0x01000;
29
+
30
+	/** Constant for arrays */
31
+	const TYPE_ARRAY = 0x10000;
32
+
33
+	/** Singleton instance */
34
+	private static $instance = null;
35
+
36
+	/** The data container */
37
+	private $store = [];
38
+
39
+	/** The current endpoint in the data container */
40
+	private $endPoint;
41
+
42
+	/**
43
+	 * Constructor should not be used.
44
+	 *
45
+	 * Use {@link getInstance()} instead.
46
+	 */
47
+	public function __construct()
48
+	{
49
+	}
50
+
51
+	/**
52
+	 * Returns a singleton of the DependencyContainer.
53
+	 *
54
+	 * @return self
55
+	 */
56
+	public static function getInstance()
57
+	{
58
+		if (!isset(self::$instance)) {
59
+			self::$instance = new self();
60
+		}
61
+
62
+		return self::$instance;
63
+	}
64
+
65
+	/**
66
+	 * List the names of all items stored in the Container.
67
+	 *
68
+	 * @return array
69
+	 */
70
+	public function listItems()
71
+	{
72
+		return array_keys($this->store);
73
+	}
74
+
75
+	/**
76
+	 * Test if an item is registered in this container with the given name.
77
+	 *
78
+	 * @see register()
79
+	 *
80
+	 * @param string $itemName
81
+	 *
82
+	 * @return bool
83
+	 */
84
+	public function has($itemName)
85
+	{
86
+		return \array_key_exists($itemName, $this->store)
87
+			&& isset($this->store[$itemName]['lookupType']);
88
+	}
89
+
90
+	/**
91
+	 * Lookup the item with the given $itemName.
92
+	 *
93
+	 * @see register()
94
+	 *
95
+	 * @param string $itemName
96
+	 *
97
+	 * @return mixed
98
+	 *
99
+	 * @throws Swift_DependencyException If the dependency is not found
100
+	 */
101
+	public function lookup($itemName)
102
+	{
103
+		if (!$this->has($itemName)) {
104
+			throw new Swift_DependencyException('Cannot lookup dependency "'.$itemName.'" since it is not registered.');
105
+		}
106
+
107
+		switch ($this->store[$itemName]['lookupType']) {
108
+			case self::TYPE_ALIAS:
109
+				return $this->createAlias($itemName);
110
+			case self::TYPE_VALUE:
111
+				return $this->getValue($itemName);
112
+			case self::TYPE_INSTANCE:
113
+				return $this->createNewInstance($itemName);
114
+			case self::TYPE_SHARED:
115
+				return $this->createSharedInstance($itemName);
116
+			case self::TYPE_ARRAY:
117
+				return $this->createDependenciesFor($itemName);
118
+		}
119
+	}
120
+
121
+	/**
122
+	 * Create an array of arguments passed to the constructor of $itemName.
123
+	 *
124
+	 * @param string $itemName
125
+	 *
126
+	 * @return array
127
+	 */
128
+	public function createDependenciesFor($itemName)
129
+	{
130
+		$args = [];
131
+		if (isset($this->store[$itemName]['args'])) {
132
+			$args = $this->resolveArgs($this->store[$itemName]['args']);
133
+		}
134
+
135
+		return $args;
136
+	}
137
+
138
+	/**
139
+	 * Register a new dependency with $itemName.
140
+	 *
141
+	 * This method returns the current DependencyContainer instance because it
142
+	 * requires the use of the fluid interface to set the specific details for the
143
+	 * dependency.
144
+	 *
145
+	 * @see asNewInstanceOf(), asSharedInstanceOf(), asValue()
146
+	 *
147
+	 * @param string $itemName
148
+	 *
149
+	 * @return $this
150
+	 */
151
+	public function register($itemName)
152
+	{
153
+		$this->store[$itemName] = [];
154
+		$this->endPoint = &$this->store[$itemName];
155
+
156
+		return $this;
157
+	}
158
+
159
+	/**
160
+	 * Specify the previously registered item as a literal value.
161
+	 *
162
+	 * {@link register()} must be called before this will work.
163
+	 *
164
+	 * @param mixed $value
165
+	 *
166
+	 * @return $this
167
+	 */
168
+	public function asValue($value)
169
+	{
170
+		$endPoint = &$this->getEndPoint();
171
+		$endPoint['lookupType'] = self::TYPE_VALUE;
172
+		$endPoint['value'] = $value;
173
+
174
+		return $this;
175
+	}
176
+
177
+	/**
178
+	 * Specify the previously registered item as an alias of another item.
179
+	 *
180
+	 * @param string $lookup
181
+	 *
182
+	 * @return $this
183
+	 */
184
+	public function asAliasOf($lookup)
185
+	{
186
+		$endPoint = &$this->getEndPoint();
187
+		$endPoint['lookupType'] = self::TYPE_ALIAS;
188
+		$endPoint['ref'] = $lookup;
189
+
190
+		return $this;
191
+	}
192
+
193
+	/**
194
+	 * Specify the previously registered item as a new instance of $className.
195
+	 *
196
+	 * {@link register()} must be called before this will work.
197
+	 * Any arguments can be set with {@link withDependencies()},
198
+	 * {@link addConstructorValue()} or {@link addConstructorLookup()}.
199
+	 *
200
+	 * @see withDependencies(), addConstructorValue(), addConstructorLookup()
201
+	 *
202
+	 * @param string $className
203
+	 *
204
+	 * @return $this
205
+	 */
206
+	public function asNewInstanceOf($className)
207
+	{
208
+		$endPoint = &$this->getEndPoint();
209
+		$endPoint['lookupType'] = self::TYPE_INSTANCE;
210
+		$endPoint['className'] = $className;
211
+
212
+		return $this;
213
+	}
214
+
215
+	/**
216
+	 * Specify the previously registered item as a shared instance of $className.
217
+	 *
218
+	 * {@link register()} must be called before this will work.
219
+	 *
220
+	 * @param string $className
221
+	 *
222
+	 * @return $this
223
+	 */
224
+	public function asSharedInstanceOf($className)
225
+	{
226
+		$endPoint = &$this->getEndPoint();
227
+		$endPoint['lookupType'] = self::TYPE_SHARED;
228
+		$endPoint['className'] = $className;
229
+
230
+		return $this;
231
+	}
232
+
233
+	/**
234
+	 * Specify the previously registered item as array of dependencies.
235
+	 *
236
+	 * {@link register()} must be called before this will work.
237
+	 *
238
+	 * @return $this
239
+	 */
240
+	public function asArray()
241
+	{
242
+		$endPoint = &$this->getEndPoint();
243
+		$endPoint['lookupType'] = self::TYPE_ARRAY;
244
+
245
+		return $this;
246
+	}
247
+
248
+	/**
249
+	 * Specify a list of injected dependencies for the previously registered item.
250
+	 *
251
+	 * This method takes an array of lookup names.
252
+	 *
253
+	 * @see addConstructorValue(), addConstructorLookup()
254
+	 *
255
+	 * @return $this
256
+	 */
257
+	public function withDependencies(array $lookups)
258
+	{
259
+		$endPoint = &$this->getEndPoint();
260
+		$endPoint['args'] = [];
261
+		foreach ($lookups as $lookup) {
262
+			$this->addConstructorLookup($lookup);
263
+		}
264
+
265
+		return $this;
266
+	}
267
+
268
+	/**
269
+	 * Specify a literal (non looked up) value for the constructor of the
270
+	 * previously registered item.
271
+	 *
272
+	 * @see withDependencies(), addConstructorLookup()
273
+	 *
274
+	 * @param mixed $value
275
+	 *
276
+	 * @return $this
277
+	 */
278
+	public function addConstructorValue($value)
279
+	{
280
+		$endPoint = &$this->getEndPoint();
281
+		if (!isset($endPoint['args'])) {
282
+			$endPoint['args'] = [];
283
+		}
284
+		$endPoint['args'][] = ['type' => 'value', 'item' => $value];
285
+
286
+		return $this;
287
+	}
288
+
289
+	/**
290
+	 * Specify a dependency lookup for the constructor of the previously
291
+	 * registered item.
292
+	 *
293
+	 * @see withDependencies(), addConstructorValue()
294
+	 *
295
+	 * @param string $lookup
296
+	 *
297
+	 * @return $this
298
+	 */
299
+	public function addConstructorLookup($lookup)
300
+	{
301
+		$endPoint = &$this->getEndPoint();
302
+		if (!isset($this->endPoint['args'])) {
303
+			$endPoint['args'] = [];
304
+		}
305
+		$endPoint['args'][] = ['type' => 'lookup', 'item' => $lookup];
306
+
307
+		return $this;
308
+	}
309
+
310
+	/** Get the literal value with $itemName */
311
+	private function getValue($itemName)
312
+	{
313
+		return $this->store[$itemName]['value'];
314
+	}
315
+
316
+	/** Resolve an alias to another item */
317
+	private function createAlias($itemName)
318
+	{
319
+		return $this->lookup($this->store[$itemName]['ref']);
320
+	}
321
+
322
+	/** Create a fresh instance of $itemName */
323
+	private function createNewInstance($itemName)
324
+	{
325
+		$reflector = new ReflectionClass($this->store[$itemName]['className']);
326
+		if ($reflector->getConstructor()) {
327
+			return $reflector->newInstanceArgs(
328
+				$this->createDependenciesFor($itemName)
329
+				);
330
+		}
331
+
332
+		return $reflector->newInstance();
333
+	}
334
+
335
+	/** Create and register a shared instance of $itemName */
336
+	private function createSharedInstance($itemName)
337
+	{
338
+		if (!isset($this->store[$itemName]['instance'])) {
339
+			$this->store[$itemName]['instance'] = $this->createNewInstance($itemName);
340
+		}
341
+
342
+		return $this->store[$itemName]['instance'];
343
+	}
344
+
345
+	/** Get the current endpoint in the store */
346
+	private function &getEndPoint()
347
+	{
348
+		if (!isset($this->endPoint)) {
349
+			throw new BadMethodCallException('Component must first be registered by calling register()');
350
+		}
351
+
352
+		return $this->endPoint;
353
+	}
354
+
355
+	/** Get an argument list with dependencies resolved */
356
+	private function resolveArgs(array $args)
357
+	{
358
+		$resolved = [];
359
+		foreach ($args as $argDefinition) {
360
+			switch ($argDefinition['type']) {
361
+				case 'lookup':
362
+					$resolved[] = $this->lookupRecursive($argDefinition['item']);
363
+					break;
364
+				case 'value':
365
+					$resolved[] = $argDefinition['item'];
366
+					break;
367
+			}
368
+		}
369
+
370
+		return $resolved;
371
+	}
372
+
373
+	/** Resolve a single dependency with an collections */
374
+	private function lookupRecursive($item)
375
+	{
376
+		if (\is_array($item)) {
377
+			$collection = [];
378
+			foreach ($item as $k => $v) {
379
+				$collection[$k] = $this->lookupRecursive($v);
380
+			}
381
+
382
+			return $collection;
383
+		}
384
+
385
+		return $this->lookup($item);
386
+	}
387 387
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_NullTransport extends Swift_Transport_NullTransport
17 17
 {
18
-    public function __construct()
19
-    {
20
-        \call_user_func_array(
21
-            [$this, 'Swift_Transport_NullTransport::__construct'],
22
-            Swift_DependencyContainer::getInstance()
23
-                ->createDependenciesFor('transport.null')
24
-        );
25
-    }
18
+	public function __construct()
19
+	{
20
+		\call_user_func_array(
21
+			[$this, 'Swift_Transport_NullTransport::__construct'],
22
+			Swift_DependencyContainer::getInstance()
23
+				->createDependenciesFor('transport.null')
24
+		);
25
+	}
26 26
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/FileStream.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
  */
16 16
 interface Swift_FileStream extends Swift_OutputByteStream
17 17
 {
18
-    /**
19
-     * Get the complete path to the file.
20
-     *
21
-     * @return string
22
-     */
23
-    public function getPath();
18
+	/**
19
+	 * Get the complete path to the file.
20
+	 *
21
+	 * @return string
22
+	 */
23
+	public function getPath();
24 24
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/OutputByteStream.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,29 +18,29 @@
 block discarded – undo
18 18
  */
19 19
 interface Swift_OutputByteStream
20 20
 {
21
-    /**
22
-     * Reads $length bytes from the stream into a string and moves the pointer
23
-     * through the stream by $length.
24
-     *
25
-     * If less bytes exist than are requested the remaining bytes are given instead.
26
-     * If no bytes are remaining at all, boolean false is returned.
27
-     *
28
-     * @param int $length
29
-     *
30
-     * @throws Swift_IoException
31
-     *
32
-     * @return string|bool
33
-     */
34
-    public function read($length);
21
+	/**
22
+	 * Reads $length bytes from the stream into a string and moves the pointer
23
+	 * through the stream by $length.
24
+	 *
25
+	 * If less bytes exist than are requested the remaining bytes are given instead.
26
+	 * If no bytes are remaining at all, boolean false is returned.
27
+	 *
28
+	 * @param int $length
29
+	 *
30
+	 * @throws Swift_IoException
31
+	 *
32
+	 * @return string|bool
33
+	 */
34
+	public function read($length);
35 35
 
36
-    /**
37
-     * Move the internal read pointer to $byteOffset in the stream.
38
-     *
39
-     * @param int $byteOffset
40
-     *
41
-     * @throws Swift_IoException
42
-     *
43
-     * @return bool
44
-     */
45
-    public function setReadPointer($byteOffset);
36
+	/**
37
+	 * Move the internal read pointer to $byteOffset in the stream.
38
+	 *
39
+	 * @param int $byteOffset
40
+	 *
41
+	 * @throws Swift_IoException
42
+	 *
43
+	 * @return bool
44
+	 */
45
+	public function setReadPointer($byteOffset);
46 46
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
  */
16 16
 interface Swift_CharacterReaderFactory
17 17
 {
18
-    /**
19
-     * Returns a CharacterReader suitable for the charset applied.
20
-     *
21
-     * @param string $charset
22
-     *
23
-     * @return Swift_CharacterReader
24
-     */
25
-    public function getReaderFor($charset);
18
+	/**
19
+	 * Returns a CharacterReader suitable for the charset applied.
20
+	 *
21
+	 * @param string $charset
22
+	 *
23
+	 * @return Swift_CharacterReader
24
+	 */
25
+	public function getReaderFor($charset);
26 26
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -15,90 +15,90 @@
 block discarded – undo
15 15
  */
16 16
 interface Swift_KeyCache
17 17
 {
18
-    /** Mode for replacing existing cached data */
19
-    const MODE_WRITE = 1;
18
+	/** Mode for replacing existing cached data */
19
+	const MODE_WRITE = 1;
20 20
 
21
-    /** Mode for appending data to the end of existing cached data */
22
-    const MODE_APPEND = 2;
21
+	/** Mode for appending data to the end of existing cached data */
22
+	const MODE_APPEND = 2;
23 23
 
24
-    /**
25
-     * Set a string into the cache under $itemKey for the namespace $nsKey.
26
-     *
27
-     * @see MODE_WRITE, MODE_APPEND
28
-     *
29
-     * @param string $nsKey
30
-     * @param string $itemKey
31
-     * @param string $string
32
-     * @param int    $mode
33
-     */
34
-    public function setString($nsKey, $itemKey, $string, $mode);
24
+	/**
25
+	 * Set a string into the cache under $itemKey for the namespace $nsKey.
26
+	 *
27
+	 * @see MODE_WRITE, MODE_APPEND
28
+	 *
29
+	 * @param string $nsKey
30
+	 * @param string $itemKey
31
+	 * @param string $string
32
+	 * @param int    $mode
33
+	 */
34
+	public function setString($nsKey, $itemKey, $string, $mode);
35 35
 
36
-    /**
37
-     * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
38
-     *
39
-     * @see MODE_WRITE, MODE_APPEND
40
-     *
41
-     * @param string $nsKey
42
-     * @param string $itemKey
43
-     * @param int    $mode
44
-     */
45
-    public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode);
36
+	/**
37
+	 * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
38
+	 *
39
+	 * @see MODE_WRITE, MODE_APPEND
40
+	 *
41
+	 * @param string $nsKey
42
+	 * @param string $itemKey
43
+	 * @param int    $mode
44
+	 */
45
+	public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode);
46 46
 
47
-    /**
48
-     * Provides a ByteStream which when written to, writes data to $itemKey.
49
-     *
50
-     * NOTE: The stream will always write in append mode.
51
-     * If the optional third parameter is passed all writes will go through $is.
52
-     *
53
-     * @param string                $nsKey
54
-     * @param string                $itemKey
55
-     * @param Swift_InputByteStream $is      optional input stream
56
-     *
57
-     * @return Swift_InputByteStream
58
-     */
59
-    public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $is = null);
47
+	/**
48
+	 * Provides a ByteStream which when written to, writes data to $itemKey.
49
+	 *
50
+	 * NOTE: The stream will always write in append mode.
51
+	 * If the optional third parameter is passed all writes will go through $is.
52
+	 *
53
+	 * @param string                $nsKey
54
+	 * @param string                $itemKey
55
+	 * @param Swift_InputByteStream $is      optional input stream
56
+	 *
57
+	 * @return Swift_InputByteStream
58
+	 */
59
+	public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $is = null);
60 60
 
61
-    /**
62
-     * Get data back out of the cache as a string.
63
-     *
64
-     * @param string $nsKey
65
-     * @param string $itemKey
66
-     *
67
-     * @return string
68
-     */
69
-    public function getString($nsKey, $itemKey);
61
+	/**
62
+	 * Get data back out of the cache as a string.
63
+	 *
64
+	 * @param string $nsKey
65
+	 * @param string $itemKey
66
+	 *
67
+	 * @return string
68
+	 */
69
+	public function getString($nsKey, $itemKey);
70 70
 
71
-    /**
72
-     * Get data back out of the cache as a ByteStream.
73
-     *
74
-     * @param string                $nsKey
75
-     * @param string                $itemKey
76
-     * @param Swift_InputByteStream $is      stream to write the data to
77
-     */
78
-    public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is);
71
+	/**
72
+	 * Get data back out of the cache as a ByteStream.
73
+	 *
74
+	 * @param string                $nsKey
75
+	 * @param string                $itemKey
76
+	 * @param Swift_InputByteStream $is      stream to write the data to
77
+	 */
78
+	public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is);
79 79
 
80
-    /**
81
-     * Check if the given $itemKey exists in the namespace $nsKey.
82
-     *
83
-     * @param string $nsKey
84
-     * @param string $itemKey
85
-     *
86
-     * @return bool
87
-     */
88
-    public function hasKey($nsKey, $itemKey);
80
+	/**
81
+	 * Check if the given $itemKey exists in the namespace $nsKey.
82
+	 *
83
+	 * @param string $nsKey
84
+	 * @param string $itemKey
85
+	 *
86
+	 * @return bool
87
+	 */
88
+	public function hasKey($nsKey, $itemKey);
89 89
 
90
-    /**
91
-     * Clear data for $itemKey in the namespace $nsKey if it exists.
92
-     *
93
-     * @param string $nsKey
94
-     * @param string $itemKey
95
-     */
96
-    public function clearKey($nsKey, $itemKey);
90
+	/**
91
+	 * Clear data for $itemKey in the namespace $nsKey if it exists.
92
+	 *
93
+	 * @param string $nsKey
94
+	 * @param string $itemKey
95
+	 */
96
+	public function clearKey($nsKey, $itemKey);
97 97
 
98
-    /**
99
-     * Clear all data in the namespace $nsKey if it exists.
100
-     *
101
-     * @param string $nsKey
102
-     */
103
-    public function clearAll($nsKey);
98
+	/**
99
+	 * Clear all data in the namespace $nsKey if it exists.
100
+	 *
101
+	 * @param string $nsKey
102
+	 */
103
+	public function clearAll($nsKey);
104 104
 }
Please login to merge, or discard this patch.