diff --git a/bootstrap.php b/bootstrap.php index 628eb8de..7016a321 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -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)) { diff --git a/src/B8Framework/Application.php b/src/B8Framework/Application.php index d90e8def..cf206023 100644 --- a/src/B8Framework/Application.php +++ b/src/B8Framework/Application.php @@ -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 { diff --git a/src/B8Framework/Controller.php b/src/B8Framework/Controller.php index e199f5ad..007a38d4 100644 --- a/src/B8Framework/Controller.php +++ b/src/B8Framework/Controller.php @@ -5,6 +5,7 @@ namespace b8; use b8\Http\Request; use b8\Http\Response; use PHPCensor\View; +use PHPCensor\Config; abstract class Controller { diff --git a/src/B8Framework/Form/Element.php b/src/B8Framework/Form/Element.php index 2d89f80d..a3542334 100644 --- a/src/B8Framework/Form/Element.php +++ b/src/B8Framework/Form/Element.php @@ -3,7 +3,7 @@ namespace b8\Form; use PHPCensor\View; -use b8\Config; +use PHPCensor\Config; abstract class Element { diff --git a/src/B8Framework/Http/Router.php b/src/B8Framework/Http/Router.php index d0653241..4ba1f174 100644 --- a/src/B8Framework/Http/Router.php +++ b/src/B8Framework/Http/Router.php @@ -3,7 +3,7 @@ namespace b8\Http; use b8\Application; -use b8\Config; +use PHPCensor\Config; class Router { diff --git a/src/PHPCensor/Application.php b/src/PHPCensor/Application.php index d2a1f141..016910de 100644 --- a/src/PHPCensor/Application.php +++ b/src/PHPCensor/Application.php @@ -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); diff --git a/src/PHPCensor/Builder.php b/src/PHPCensor/Builder.php index a0df4ae9..64b476f9 100644 --- a/src/PHPCensor/Builder.php +++ b/src/PHPCensor/Builder.php @@ -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; diff --git a/src/PHPCensor/Command/InstallCommand.php b/src/PHPCensor/Command/InstallCommand.php index 993d0437..e1210ebe 100644 --- a/src/PHPCensor/Command/InstallCommand.php +++ b/src/PHPCensor/Command/InstallCommand.php @@ -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; diff --git a/src/PHPCensor/Command/RunCommand.php b/src/PHPCensor/Command/RunCommand.php index 81885b4a..bc613f29 100644 --- a/src/PHPCensor/Command/RunCommand.php +++ b/src/PHPCensor/Command/RunCommand.php @@ -2,7 +2,7 @@ namespace PHPCensor\Command; -use b8\Config; +use PHPCensor\Config; use Monolog\Logger; use PHPCensor\Logging\BuildDBLogHandler; use PHPCensor\Logging\LoggedBuildContextTidier; diff --git a/src/PHPCensor/Command/WorkerCommand.php b/src/PHPCensor/Command/WorkerCommand.php index 644e9394..81f25525 100644 --- a/src/PHPCensor/Command/WorkerCommand.php +++ b/src/PHPCensor/Command/WorkerCommand.php @@ -2,7 +2,7 @@ namespace PHPCensor\Command; -use b8\Config; +use PHPCensor\Config; use Monolog\Logger; use PHPCensor\Logging\OutputLogHandler; use PHPCensor\Worker\BuildWorker; diff --git a/src/B8Framework/Config.php b/src/PHPCensor/Config.php similarity index 98% rename from src/B8Framework/Config.php rename to src/PHPCensor/Config.php index fa3d6c1b..89ec30c7 100644 --- a/src/B8Framework/Config.php +++ b/src/PHPCensor/Config.php @@ -1,11 +1,11 @@ [], 'right' => [], ]; - $widgets_config = b8\Config::getInstance()->get('php-censor.dashboard_widgets', [ + $widgets_config = Config::getInstance()->get('php-censor.dashboard_widgets', [ 'all_projects' => [ 'side' => 'left', ], diff --git a/src/PHPCensor/Controller/UserController.php b/src/PHPCensor/Controller/UserController.php index 1ad35a69..2395754f 100644 --- a/src/PHPCensor/Controller/UserController.php +++ b/src/PHPCensor/Controller/UserController.php @@ -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, diff --git a/src/PHPCensor/Controller/WebhookController.php b/src/PHPCensor/Controller/WebhookController.php index 49a25266..4102ce3b 100644 --- a/src/PHPCensor/Controller/WebhookController.php +++ b/src/PHPCensor/Controller/WebhookController.php @@ -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; diff --git a/src/PHPCensor/Database.php b/src/PHPCensor/Database.php index 3decd58b..9091f8bb 100644 --- a/src/PHPCensor/Database.php +++ b/src/PHPCensor/Database.php @@ -2,8 +2,6 @@ namespace PHPCensor; -use b8\Config; - class Database extends \PDO { const MYSQL_TYPE = 'mysql'; diff --git a/src/PHPCensor/Helper/Bitbucket.php b/src/PHPCensor/Helper/Bitbucket.php index a6fe475c..36f869f1 100644 --- a/src/PHPCensor/Helper/Bitbucket.php +++ b/src/PHPCensor/Helper/Bitbucket.php @@ -2,7 +2,7 @@ namespace PHPCensor\Helper; -use b8\Config; +use PHPCensor\Config; use GuzzleHttp\Client; /** diff --git a/src/PHPCensor/Helper/Email.php b/src/PHPCensor/Helper/Email.php index dd5eb78a..b96d3265 100644 --- a/src/PHPCensor/Helper/Email.php +++ b/src/PHPCensor/Helper/Email.php @@ -2,7 +2,7 @@ namespace PHPCensor\Helper; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Builder; /** @@ -99,13 +99,13 @@ class Email 'php-censor.email_settings.from_address', self::DEFAULT_FROM ); - + if (strpos($from, '<') === false) { return (string)$from; } - + preg_match('#^(.*?)<(.*)>$#ui', $from, $fromParts); - + return [$fromParts[2] => $fromParts[1]]; } diff --git a/src/PHPCensor/Helper/Github.php b/src/PHPCensor/Helper/Github.php index 0f8874a3..1bcc041b 100644 --- a/src/PHPCensor/Helper/Github.php +++ b/src/PHPCensor/Helper/Github.php @@ -2,7 +2,7 @@ namespace PHPCensor\Helper; -use b8\Config; +use PHPCensor\Config; use GuzzleHttp\Client; use Symfony\Component\Cache\Simple\FilesystemCache; diff --git a/src/PHPCensor/Helper/Lang.php b/src/PHPCensor/Helper/Lang.php index 5322ecda..831ac9d0 100644 --- a/src/PHPCensor/Helper/Lang.php +++ b/src/PHPCensor/Helper/Lang.php @@ -2,7 +2,7 @@ namespace PHPCensor\Helper; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Store\Factory; use PHPCensor\Store\UserStore; diff --git a/src/PHPCensor/Helper/SshKey.php b/src/PHPCensor/Helper/SshKey.php index b532f181..efce7298 100644 --- a/src/PHPCensor/Helper/SshKey.php +++ b/src/PHPCensor/Helper/SshKey.php @@ -2,7 +2,7 @@ namespace PHPCensor\Helper; -use b8\Config; +use PHPCensor\Config; /** * Helper class for dealing with SSH keys. diff --git a/src/PHPCensor/Model/Build/BitbucketBuild.php b/src/PHPCensor/Model/Build/BitbucketBuild.php index 3b29d38d..412e28d7 100644 --- a/src/PHPCensor/Model/Build/BitbucketBuild.php +++ b/src/PHPCensor/Model/Build/BitbucketBuild.php @@ -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; diff --git a/src/PHPCensor/Model/Build/GithubBuild.php b/src/PHPCensor/Model/Build/GithubBuild.php index b3968b93..52fcaf9f 100644 --- a/src/PHPCensor/Model/Build/GithubBuild.php +++ b/src/PHPCensor/Model/Build/GithubBuild.php @@ -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; diff --git a/src/PHPCensor/Model/User.php b/src/PHPCensor/Model/User.php index 405666be..2bba224c 100644 --- a/src/PHPCensor/Model/User.php +++ b/src/PHPCensor/Model/User.php @@ -2,7 +2,7 @@ namespace PHPCensor\Model; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Model; /** diff --git a/src/PHPCensor/Security/Authentication/Service.php b/src/PHPCensor/Security/Authentication/Service.php index 7b5aa0ef..da8e7d5a 100644 --- a/src/PHPCensor/Security/Authentication/Service.php +++ b/src/PHPCensor/Security/Authentication/Service.php @@ -2,7 +2,7 @@ namespace PHPCensor\Security\Authentication; -use b8\Config; +use PHPCensor\Config; /** * Authentication facade. diff --git a/src/PHPCensor/Service/BuildService.php b/src/PHPCensor/Service/BuildService.php index c583cec8..aa59aaca 100644 --- a/src/PHPCensor/Service/BuildService.php +++ b/src/PHPCensor/Service/BuildService.php @@ -2,7 +2,7 @@ namespace PHPCensor\Service; -use b8\Config; +use PHPCensor\Config; use Pheanstalk\Pheanstalk; use Pheanstalk\PheanstalkInterface; use PHPCensor\BuildFactory; diff --git a/src/PHPCensor/Store/BuildErrorWriter.php b/src/PHPCensor/Store/BuildErrorWriter.php index 3fe2d5ed..5ec6d3d7 100644 --- a/src/PHPCensor/Store/BuildErrorWriter.php +++ b/src/PHPCensor/Store/BuildErrorWriter.php @@ -2,7 +2,7 @@ namespace PHPCensor\Store; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Database; use PHPCensor\Model\BuildError; diff --git a/src/PHPCensor/View.php b/src/PHPCensor/View.php index 544f12e8..1e06d1ac 100644 --- a/src/PHPCensor/View.php +++ b/src/PHPCensor/View.php @@ -2,7 +2,6 @@ namespace PHPCensor; -use b8\Config; use PHPCensor\Store\Factory; use PHPCensor\Model\User; use PHPCensor\Store\UserStore; diff --git a/tests/B8Framework/FormTest.php b/tests/B8Framework/FormTest.php index e9def9d9..9b59e465 100755 --- a/tests/B8Framework/FormTest.php +++ b/tests/B8Framework/FormTest.php @@ -3,7 +3,7 @@ namespace Tests\b8; use b8\Form; -use b8\Config; +use PHPCensor\Config; class FormTest extends \PHPUnit\Framework\TestCase { diff --git a/tests/PHPCensor/Controller/WebhookControllerTest.php b/tests/PHPCensor/Controller/WebhookControllerTest.php index 43e81f60..4ff3a5b3 100644 --- a/tests/PHPCensor/Controller/WebhookControllerTest.php +++ b/tests/PHPCensor/Controller/WebhookControllerTest.php @@ -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() ); diff --git a/tests/PHPCensor/DatabaseMysqlTest.php b/tests/PHPCensor/DatabaseMysqlTest.php index 6a52b2f2..6e4d7613 100755 --- a/tests/PHPCensor/DatabaseMysqlTest.php +++ b/tests/PHPCensor/DatabaseMysqlTest.php @@ -2,7 +2,7 @@ namespace Tests\b8; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Database; class DatabaseMysqlTest extends \PHPUnit_Extensions_Database_TestCase diff --git a/tests/PHPCensor/DatabasePostgresqlTest.php b/tests/PHPCensor/DatabasePostgresqlTest.php index 721af120..e89b0c18 100755 --- a/tests/PHPCensor/DatabasePostgresqlTest.php +++ b/tests/PHPCensor/DatabasePostgresqlTest.php @@ -2,7 +2,7 @@ namespace Tests\b8; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Database; class DatabasePostgresqlTest extends \PHPUnit_Extensions_Database_TestCase diff --git a/tests/PHPCensor/Plugin/EmailTest.php b/tests/PHPCensor/Plugin/EmailTest.php index 60cd4fa0..315424c1 100644 --- a/tests/PHPCensor/Plugin/EmailTest.php +++ b/tests/PHPCensor/Plugin/EmailTest.php @@ -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; diff --git a/tests/PHPCensor/StoreMysqlTest.php b/tests/PHPCensor/StoreMysqlTest.php index 18f7e3b2..0bd3981f 100755 --- a/tests/PHPCensor/StoreMysqlTest.php +++ b/tests/PHPCensor/StoreMysqlTest.php @@ -2,7 +2,7 @@ namespace Tests\PHPCensor; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Database; use PHPCensor\Store\Factory; use PHPCensor\Model\Project; diff --git a/tests/PHPCensor/StorePostgresqlTest.php b/tests/PHPCensor/StorePostgresqlTest.php index fd2f26f7..5f3bef70 100755 --- a/tests/PHPCensor/StorePostgresqlTest.php +++ b/tests/PHPCensor/StorePostgresqlTest.php @@ -2,7 +2,7 @@ namespace Tests\PHPCensor; -use b8\Config; +use PHPCensor\Config; use PHPCensor\Database; use PHPCensor\Store\Factory; use PHPCensor\Model\Project; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index d07365a4..055f8d1d 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -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', '') . '/');