src/lib/KevinGH/Wisdom/Silex/Provider.php
public static function createService(Application $app, $serviceName, $pathName, $optionsName)
    {
        $app[$optionsName] = array();
        $app[$serviceName] = $app->share(
            function () use (
                $app,
                $serviceName,
                $pathName,
                $optionsName
                ) {
                $app[$optionsName] = array_merge(
                    array(
                        'cache_path' => '',
                        'debug' => $app['debug'],
                        'prefix' => $app['debug'] ? 'dev.' : 'prod.'
                    ),
                    $app[$optionsName]
                );

                if (false === isset($app[$optionsName]['loaders'])) {
                    $options = $app[$optionsName];

                    $options['loaders'] = array(
                        'KevinGH\Wisdom\Loader\INI',
                        'KevinGH\Wisdom\Loader\JSON'
                    );

                    if (class_exists('Symfony\Component\Yaml\Yaml')) {
                        $options['loaders'][] = 'KevinGH\Wisdom\Loader\YAML';
                    }

                    $app[$optionsName] = $options;
                }

                $wisdom = new Wisdom ($app[$pathName]);

                $wisdom->setCache($app[$optionsName]['cache_path']);
                $wisdom->setDebug($app[$optionsName]['debug']);
                $wisdom->setPrefix($app[$optionsName]['prefix']);
                $wisdom->setValues($app);

                foreach ((array) $app[$optionsName]['loaders'] as $class) {
                    $wisdom->addLoader(new $class);
                }

                return $wisdom;
            }
        );
    }
public static function createService(Application $app, $serviceName, $pathName, $optionsName)
    {
        $app[$optionsName] = array();
        $app[$serviceName] = $app->share(
            function () use (
                $app,
                $serviceName,
                $pathName,
                $optionsName
                ) {
                $app[$optionsName] = array_merge(
                    array(
                        'cache_path' => '',
                        'debug' => $app['debug'],
                        'prefix' => $app['debug'] ? 'dev.' : 'prod.'
                    ),
                    $app[$optionsName]
                );

                if (false === isset($app[$optionsName]['loaders'])) {
                    $options = $app[$optionsName];

                    $options['loaders'] = array(
                        'KevinGH\Wisdom\Loader\INI',
                        'KevinGH\Wisdom\Loader\JSON'
                    );

                    if (class_exists('Symfony\Component\Yaml\Yaml')) {
                        $options['loaders'][] = 'KevinGH\Wisdom\Loader\YAML';
                    }

                    $app[$optionsName] = $options;
                }

                $wisdom = new Wisdom ($app[$pathName]);

                $wisdom->setCache($app[$optionsName]['cache_path']);
                $wisdom->setDebug($app[$optionsName]['debug']);
                $wisdom->setPrefix($app[$optionsName]['prefix']);
                $wisdom->setValues($app);

                foreach ((array) $app[$optionsName]['loaders'] as $class) {
                    $wisdom->addLoader(new $class);
                }

                return $wisdom;
            }
        );
    }
public static function createService ( Application $ app , $ serviceName , $ pathName , $ optionsName ) { $ app [ $ optionsName ] = array ( ) ; $ app [ $ serviceName ] = $ app -> share ( function ( ) use ( $ app , $ serviceName , $ pathName , $ optionsName ) { $ app [ $ optionsName ] = array_merge ( array ( 'cache_path' => '' , 'debug' => $ app [ 'debug' ] , 'prefix' => $ app [ 'debug' ] ? 'dev.' : 'prod.' ) , $ app [ $ optionsName ] ) ; if ( false === isset ( $ app [ $ optionsName ] [ 'loaders' ] ) ) { $ options = $ app [ $ optionsName ] ; $ options [ 'loaders' ] = array ( 'KevinGH\Wisdom\Loader\INI' , 'KevinGH\Wisdom\Loader\JSON' ) ; if ( class_exists ( 'Symfony\Component\Yaml\Yaml' ) ) { $ options [ 'loaders' ] [ ] = 'KevinGH\Wisdom\Loader\YAML' ; } $ app [ $ optionsName ] = $ options ; } $ wisdom = new Wisdom ( $ app [ $ pathName ] ) ; $ wisdom -> setCache ( $ app [ $ optionsName ] [ 'cache_path' ] ) ; $ wisdom -> setDebug ( $ app [ $ optionsName ] [ 'debug' ] ) ; $ wisdom -> setPrefix ( $ app [ $ optionsName ] [ 'prefix' ] ) ; $ wisdom -> setValues ( $ app ) ; foreach ( ( array ) $ app [ $ optionsName ] [ 'loaders' ] as $ class ) { $ wisdom -> addLoader ( new $ class ) ; } return $ wisdom ; } ) ; }
Creates a Wisdom service provider.

@param Application $app         The Silex application.
@param string      $serviceName The new service name.
@param string      $pathName    The new path parameter name.
@param string      $optionsName The new options parameter name.
Creates a Wisdom service provider .