App::bootstrap()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 30
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 0
cts 14
cp 0
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 12
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Acquia\Search\Proxy;
4
5
class App
6
{
7
    /**
8
     * @return \Silex\Application
9
     */
10
    static public function bootstrap(array $config = array())
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
11
    {
12
        $config += array('root_dir'  => __DIR__ . '/..');
13
        $config += array('conf_file' => $config['root_dir'] . '/conf/config.yml');
14
15
        $app = new \Silex\Application;
16
17
        // Registers the configuration service provider so that developers can
18
        // configure the app through a config file.
19
        $app->register(new \Igorw\Silex\ConfigServiceProvider($config['conf_file'], array(
20
            'root_dir' => $config['root_dir'],
21
        )));
22
23
        // Optionally add the monolog service provider if the "monolog.logfile"
24
        // configuration option is set.
25
        if (isset($app['monolog.logfile'])) {
26
            $app->register(new \Silex\Provider\MonologServiceProvider());
27
        }
28
29
        // Register the index and service manager as a service so we can query
30
        // our Acquia Search indexes.
31
        $app->register(new \Acquia\Search\Proxy\Silex\AcquiaSearchIndexProvider());
32
33
        // Dispatch the "acquia.search.proxy.bootstrap" event so that developers
34
        // can hook into the bootstrap process and add their providers.
35
        $event = new Event\AppEvent($app);
36
        $app['dispatcher']->dispatch(AppEvents::BOOTSTRAP, $event);
37
38
        return $app;
39
    }
40
}
41