1<?php
2/**
3 * A Horde_Injector:: based Horde_LoginTasks:: factory.
4 *
5 * PHP version 5
6 *
7 * @category Horde
8 * @package  Core
9 * @author   Michael Slusarz <slusarz@horde.org>
10 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
11 */
12
13/**
14 * A Horde_Injector:: based Horde_LoginTasks:: factory.
15 *
16 * Copyright 2010-2017 Horde LLC (http://www.horde.org/)
17 *
18 * See the enclosed file COPYING for license information (LGPL). If you
19 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
20 *
21 * @category Horde
22 * @package  Core
23 * @author   Michael Slusarz <slusarz@horde.org>
24 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
25 */
26class Horde_Core_Factory_LoginTasks extends Horde_Core_Factory_Base
27{
28    /**
29     * Instances.
30     *
31     * @var array
32     */
33    private $_instances = array();
34
35    /**
36     * Return the Horde_LoginTasks:: instance.
37     *
38     * @param string $app  The current application.
39     *
40     * @return Horde_Core_LoginTasks|boolean  The singleton instance. Returns
41     *                                        false if logintasks not
42     *                                        available.
43     */
44    public function create($app)
45    {
46        if (!$GLOBALS['registry']->getAuth()) {
47            return false;
48        }
49
50        if (!isset($this->_instances[$app])) {
51            $this->_instances[$app] = new Horde_Core_LoginTasks(
52                new Horde_Core_LoginTasks_Backend_Horde($app),
53                $app
54            );
55        }
56
57        return $this->_instances[$app];
58    }
59
60}
61