Refactored Config.
This commit is contained in:
parent
e23ad3237a
commit
dd9f43b7dd
|
@ -32,7 +32,7 @@ $conf['b8']['app']['namespace'] = 'PHPCensor';
|
|||
$conf['b8']['app']['default_controller'] = 'Home';
|
||||
$conf['b8']['view']['path'] = SRC_DIR . 'View/';
|
||||
|
||||
$config = new b8\Config($conf);
|
||||
$config = new PHPCensor\Config($conf);
|
||||
|
||||
$configFile = APP_DIR . 'config.yml';
|
||||
if (file_exists($configFile)) {
|
||||
|
|
|
@ -6,6 +6,7 @@ use b8\Exception\HttpException\NotFoundException;
|
|||
use b8\Http\Response;
|
||||
use b8\Http\Request;
|
||||
use b8\Http\Router;
|
||||
use PHPCensor\Config;
|
||||
|
||||
class Application
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace b8;
|
|||
use b8\Http\Request;
|
||||
use b8\Http\Response;
|
||||
use PHPCensor\View;
|
||||
use PHPCensor\Config;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace b8\Form;
|
||||
|
||||
use PHPCensor\View;
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
|
||||
abstract class Element
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace b8\Http;
|
||||
|
||||
use b8\Application;
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
|
||||
class Router
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ class Application extends b8\Application
|
|||
*/
|
||||
protected function shouldSkipAuth()
|
||||
{
|
||||
$config = b8\Config::getInstance();
|
||||
$config = Config::getInstance();
|
||||
$disableAuth = (bool)$config->get('php-censor.security.disable_auth', false);
|
||||
$defaultUserId = (integer)$config->get('php-censor.security.default_user_id', 1);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ use PHPCensor\Helper\MailerFactory;
|
|||
use PHPCensor\Logging\BuildLogger;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Store\Factory;
|
||||
use b8\Config;
|
||||
use PHPCensor\Store\BuildErrorWriter;
|
||||
use Psr\Log\LoggerAwareInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace PHPCensor\Command;
|
|||
use Exception;
|
||||
use PDO;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Model\ProjectGroup;
|
||||
use PHPCensor\Store\UserStore;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Command;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use Monolog\Logger;
|
||||
use PHPCensor\Logging\BuildDBLogHandler;
|
||||
use PHPCensor\Logging\LoggedBuildContextTidier;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Command;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use Monolog\Logger;
|
||||
use PHPCensor\Logging\OutputLogHandler;
|
||||
use PHPCensor\Worker\BuildWorker;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace b8;
|
||||
namespace PHPCensor;
|
||||
|
||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||
|
||||
if (!defined('B8_PATH')) {
|
||||
define('B8_PATH', __DIR__ . '/');
|
||||
define('B8_PATH', dirname(__DIR__) . '/B8Framework/');
|
||||
}
|
||||
|
||||
class Config
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Console;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Store\Factory;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Exception\HttpException\ForbiddenException;
|
||||
use b8\Http\Request;
|
||||
use b8\Http\Response;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Controller;
|
||||
|
||||
use b8;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Controller;
|
||||
|
||||
|
@ -22,7 +22,7 @@ class HomeController extends Controller
|
|||
'left' => [],
|
||||
'right' => [],
|
||||
];
|
||||
$widgets_config = b8\Config::getInstance()->get('php-censor.dashboard_widgets', [
|
||||
$widgets_config = Config::getInstance()->get('php-censor.dashboard_widgets', [
|
||||
'all_projects' => [
|
||||
'side' => 'left',
|
||||
],
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Controller;
|
||||
|
||||
use b8;
|
||||
use PHPCensor\Config;
|
||||
use b8\Exception\HttpException\NotFoundException;
|
||||
use b8\Form;
|
||||
use PHPCensor\Controller;
|
||||
|
@ -116,7 +116,7 @@ class UserController extends Controller
|
|||
$language->setLabel(Lang::get('language'));
|
||||
$language->setRequired(true);
|
||||
$language->setOptions(array_merge(
|
||||
[null => Lang::get('default') . ' (' . b8\Config::getInstance()->get('php-censor.language') . ')'],
|
||||
[null => Lang::get('default') . ' (' . Config::getInstance()->get('php-censor.language') . ')'],
|
||||
Lang::getLanguageOptions())
|
||||
);
|
||||
$language->setValue($user->getLanguage());
|
||||
|
@ -128,7 +128,7 @@ class UserController extends Controller
|
|||
$perPage->setLabel(Lang::get('per_page'));
|
||||
$perPage->setRequired(true);
|
||||
$perPage->setOptions([
|
||||
null => Lang::get('default') . ' (' . b8\Config::getInstance()->get('php-censor.per_page') . ')',
|
||||
null => Lang::get('default') . ' (' . Config::getInstance()->get('php-censor.per_page') . ')',
|
||||
10 => 10,
|
||||
25 => 25,
|
||||
50 => 50,
|
||||
|
|
|
@ -12,7 +12,7 @@ use PHPCensor\Service\BuildService;
|
|||
use PHPCensor\Store\BuildStore;
|
||||
use PHPCensor\Store\ProjectStore;
|
||||
use b8\Controller;
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use b8\Exception\HttpException\NotFoundException;
|
||||
use PHPCensor\Store\Factory;
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
|
||||
class Database extends \PDO
|
||||
{
|
||||
const MYSQL_TYPE = 'mysql';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Helper;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Helper;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Builder;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Helper;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use GuzzleHttp\Client;
|
||||
use Symfony\Component\Cache\Simple\FilesystemCache;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Helper;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Store\UserStore;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Helper;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
|
||||
/**
|
||||
* Helper class for dealing with SSH keys.
|
||||
|
|
|
@ -6,7 +6,7 @@ use GuzzleHttp\Client;
|
|||
use PHPCensor\Builder;
|
||||
use PHPCensor\Helper\Bitbucket;
|
||||
use PHPCensor\Helper\Diff;
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Model\BuildError;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use GuzzleHttp\Client;
|
|||
use PHPCensor\Builder;
|
||||
use PHPCensor\Helper\Diff;
|
||||
use PHPCensor\Helper\Github;
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Model\BuildError;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Model;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Model;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Security\Authentication;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
|
||||
/**
|
||||
* Authentication facade.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Service;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use Pheanstalk\Pheanstalk;
|
||||
use Pheanstalk\PheanstalkInterface;
|
||||
use PHPCensor\BuildFactory;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\BuildError;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Model\User;
|
||||
use PHPCensor\Store\UserStore;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Tests\b8;
|
||||
|
||||
use b8\Form;
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
|
||||
class FormTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ class WebhookControllerTest extends \PHPUnit\Framework\TestCase
|
|||
public function test_wrong_action_name_return_json_with_error()
|
||||
{
|
||||
$webController = new WebhookController(
|
||||
$this->prophesize('b8\Config')->reveal(),
|
||||
$this->prophesize('PHPCensor\Config')->reveal(),
|
||||
$this->prophesize('b8\Http\Request')->reveal(),
|
||||
$this->prophesize('b8\Http\Response')->reveal()
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\b8;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Database;
|
||||
|
||||
class DatabaseMysqlTest extends \PHPUnit_Extensions_Database_TestCase
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\b8;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Database;
|
||||
|
||||
class DatabasePostgresqlTest extends \PHPUnit_Extensions_Database_TestCase
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\PHPCensor\Plugin;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Plugin;
|
||||
use PHPCensor\Plugin\Email as EmailPlugin;
|
||||
use PHPCensor\Model\Build;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Model\Project;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Tests\PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Model\Project;
|
||||
|
|
|
@ -33,7 +33,7 @@ $conf['b8']['app']['default_controller'] = 'Home';
|
|||
$conf['b8']['view']['path'] = SRC_DIR . 'View/';
|
||||
$conf['php-censor']['url'] = 'http://php-censor.local';
|
||||
|
||||
$config = new b8\Config($conf);
|
||||
$config = new PHPCensor\Config($conf);
|
||||
|
||||
if (!defined('APP_URL')) {
|
||||
define('APP_URL', $config->get('php-censor.url', '') . '/');
|
||||
|
|
Loading…
Reference in a new issue