for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Joomla! Statistics Server
*
* @copyright Copyright (C) 2013 - 2017 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License Version 2 or Later
*/
namespace Joomla\StatsServer\Providers;
use Joomla\DI\{
Container, ServiceProviderInterface
};
use Joomla\Registry\Registry;
* Configuration service provider
class ConfigServiceProvider implements ServiceProviderInterface
{
* Configuration instance
* @var Registry
private $config;
* Constructor.
* @param string $file Path to the config file.
* @throws \RuntimeException
public function __construct(string $file)
// Verify the configuration exists and is readable.
if (!is_readable($file))
throw new \RuntimeException('Configuration file does not exist or is unreadable.');
}
$this->config = (new Registry)->loadFile($file);
* Registers the service provider with a DI container.
* @param Container $container The DI container.
* @return void
public function register(Container $container)
$container->share('config', [$this, 'getConfigService'], true);
* Get the `config` service
* @return Registry
public function getConfigService(Container $container) : Registry
$container
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
return $this->config;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.