Projekt

Obecné

Profil

Stáhnout (4.39 KB) Statistiky
| Větev: | Revize:
1
<?php
2

    
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

    
12
namespace Symfony\Component\HttpKernel;
13

    
14
use Symfony\Component\DependencyInjection\ContainerInterface;
15
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
16
use Symfony\Component\Config\Loader\LoaderInterface;
17

    
18
/**
19
 * The Kernel is the heart of the Symfony system.
20
 *
21
 * It manages an environment made of bundles.
22
 *
23
 * @author Fabien Potencier <fabien@symfony.com>
24
 */
25
interface KernelInterface extends HttpKernelInterface, \Serializable
26
{
27
    /**
28
     * Returns an array of bundles to register.
29
     *
30
     * @return BundleInterface[] An array of bundle instances
31
     */
32
    public function registerBundles();
33

    
34
    /**
35
     * Loads the container configuration.
36
     *
37
     * @param LoaderInterface $loader A LoaderInterface instance
38
     */
39
    public function registerContainerConfiguration(LoaderInterface $loader);
40

    
41
    /**
42
     * Boots the current kernel.
43
     */
44
    public function boot();
45

    
46
    /**
47
     * Shutdowns the kernel.
48
     *
49
     * This method is mainly useful when doing functional testing.
50
     */
51
    public function shutdown();
52

    
53
    /**
54
     * Gets the registered bundle instances.
55
     *
56
     * @return BundleInterface[] An array of registered bundle instances
57
     */
58
    public function getBundles();
59

    
60
    /**
61
     * Returns a bundle and optionally its descendants by its name.
62
     *
63
     * @param string $name  Bundle name
64
     * @param bool   $first Whether to return the first bundle only or together with its descendants
65
     *
66
     * @return BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false
67
     *
68
     * @throws \InvalidArgumentException when the bundle is not enabled
69
     */
70
    public function getBundle($name, $first = true);
71

    
72
    /**
73
     * Returns the file path for a given resource.
74
     *
75
     * A Resource can be a file or a directory.
76
     *
77
     * The resource name must follow the following pattern:
78
     *
79
     *     "@BundleName/path/to/a/file.something"
80
     *
81
     * where BundleName is the name of the bundle
82
     * and the remaining part is the relative path in the bundle.
83
     *
84
     * If $dir is passed, and the first segment of the path is "Resources",
85
     * this method will look for a file named:
86
     *
87
     *     $dir/<BundleName>/path/without/Resources
88
     *
89
     * before looking in the bundle resource folder.
90
     *
91
     * @param string $name  A resource name to locate
92
     * @param string $dir   A directory where to look for the resource first
93
     * @param bool   $first Whether to return the first path or paths for all matching bundles
94
     *
95
     * @return string|array The absolute path of the resource or an array if $first is false
96
     *
97
     * @throws \InvalidArgumentException if the file cannot be found or the name is not valid
98
     * @throws \RuntimeException         if the name contains invalid/unsafe characters
99
     */
100
    public function locateResource($name, $dir = null, $first = true);
101

    
102
    /**
103
     * Gets the name of the kernel.
104
     *
105
     * @return string The kernel name
106
     */
107
    public function getName();
108

    
109
    /**
110
     * Gets the environment.
111
     *
112
     * @return string The current environment
113
     */
114
    public function getEnvironment();
115

    
116
    /**
117
     * Checks if debug mode is enabled.
118
     *
119
     * @return bool true if debug mode is enabled, false otherwise
120
     */
121
    public function isDebug();
122

    
123
    /**
124
     * Gets the application root dir.
125
     *
126
     * @return string The application root dir
127
     */
128
    public function getRootDir();
129

    
130
    /**
131
     * Gets the current container.
132
     *
133
     * @return ContainerInterface A ContainerInterface instance
134
     */
135
    public function getContainer();
136

    
137
    /**
138
     * Gets the request start time (not available if debug is disabled).
139
     *
140
     * @return int The request start timestamp
141
     */
142
    public function getStartTime();
143

    
144
    /**
145
     * Gets the cache directory.
146
     *
147
     * @return string The cache directory
148
     */
149
    public function getCacheDir();
150

    
151
    /**
152
     * Gets the log directory.
153
     *
154
     * @return string The log directory
155
     */
156
    public function getLogDir();
157

    
158
    /**
159
     * Gets the charset of the application.
160
     *
161
     * @return string The charset
162
     */
163
    public function getCharset();
164
}
(8-8/14)