diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 0000000..b46b01d --- /dev/null +++ b/.styleci.yml @@ -0,0 +1 @@ +preset: psr2 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a967ce..1862cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All Notable changes to `Spark Plug` will be documented in this file. +## [0.4.4](https://github.com/rougin/spark-plug/compare/v0.4.3...v0.4.4) - 2016-09-10 + +### Added +- StyleCI for conforming code to PSR standards + ## [0.4.3](https://github.com/rougin/spark-plug/compare/v0.4.2...v0.4.3) - 2016-05-13 ### Changed diff --git a/composer.json b/composer.json index 7107250..b22da9a 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require-dev": { "phpunit/phpunit" : "4.*", "scrutinizer/ocular": "~1.1", - "rougin/codeigniter": "^3.0.0" + "rougin/codeigniter": "~3.0" }, "autoload": { "psr-4": { diff --git a/src/Instance.php b/src/Instance.php index ce60f42..c157f4d 100644 --- a/src/Instance.php +++ b/src/Instance.php @@ -6,7 +6,7 @@ * Instance * * Creates an instance based on SparkPlug class. - * + * * @package SparkPlug * @author Rougin Royce Gutib */ @@ -14,7 +14,7 @@ class Instance { /** * Creates an instance of CodeIgniter based on the application path. - * + * * @param string $appPath * @param array $server * @param array $globals diff --git a/src/SparkPlug.php b/src/SparkPlug.php index 4832069..2d24d6a 100644 --- a/src/SparkPlug.php +++ b/src/SparkPlug.php @@ -11,7 +11,7 @@ * Spark Plug * * Returns a CodeIgniter's instance. - * + * * @package SparkPlug * @author Rougin Royce Gutib */ @@ -46,7 +46,7 @@ public function __construct(array &$globals, array $server, $path = '') /** * Returns a CodeIgniter instance. - * + * * @return \CI_Controller */ public function getCodeIgniter() @@ -78,21 +78,21 @@ public function getCodeIgniter() /** * Loads the Common and the Base Controller class. - * + * * @return void */ protected function loadClasses() { require BASEPATH . 'core/Common.php'; - if ( ! class_exists('CI_Controller')) { + if (! class_exists('CI_Controller')) { require BASEPATH . 'core/Controller.php'; } } /** * Loads the framework constants. - * + * * @return void */ protected function loadConstants() @@ -122,13 +122,13 @@ protected function setCharSet() ini_set('default_charset', $charset); - if ( ! defined('MB_ENABLED')) { + if (! defined('MB_ENABLED')) { define('MB_ENABLED', extension_loaded('mbstring')); } // mbstring.internal_encoding is deprecated starting with PHP 5.6 // and it's usage triggers E_DEPRECATED messages. - if ( ! is_php('5.6') && ! ini_get('mbstring.internal_encoding')) { + if (! is_php('5.6') && ! ini_get('mbstring.internal_encoding')) { ini_set('mbstring.internal_encoding', $charset); } @@ -139,7 +139,7 @@ protected function setCharSet() // There's an ICONV_IMPL constant, but the PHP manual says that using // iconv's predefined constants is "strongly discouraged". - if ( ! defined('ICONV_ENABLED')) { + if (! defined('ICONV_ENABLED')) { define('ICONV_ENABLED', extension_loaded('iconv')); } } @@ -157,14 +157,14 @@ protected function setEnvironment() $environment = $this->server['CI_ENV']; } - if ( ! defined('ENVIRONMENT')) { + if (! defined('ENVIRONMENT')) { define('ENVIRONMENT', $environment); } } /** * Sets up the APPPATH, VENDOR, and BASEPATH constants. - * + * * @return void */ protected function setPaths() @@ -177,15 +177,15 @@ protected function setPaths() $applicationPath = $this->path . '/application'; } - if ( ! defined('APPPATH')) { + if (! defined('APPPATH')) { define('APPPATH', $applicationPath . '/'); } - if ( ! defined('VENDOR')) { + if (! defined('VENDOR')) { define('VENDOR', $vendorPath . '/'); } - if ( ! defined('VIEWPATH')) { + if (! defined('VIEWPATH')) { define('VIEWPATH', APPPATH . '/views/'); } @@ -199,7 +199,7 @@ protected function setPaths() foreach ($iterator as $file) { $core = 'core' . DIRECTORY_SEPARATOR . 'CodeIgniter.php'; - if (strpos($file->getPathname(), $core) !== FALSE) { + if (strpos($file->getPathname(), $core) !== false) { $path = str_replace($core, '', $file->getPathname()); define('BASEPATH', $path); diff --git a/src/get_instance.php b/src/get_instance.php index 816edd8..7d76af5 100644 --- a/src/get_instance.php +++ b/src/get_instance.php @@ -1,9 +1,9 @@ '', - 'hostname' => 'sqlite:' . APPPATH . 'databases/test.db', - 'username' => '', - 'password' => '', - 'database' => '', - 'dbdriver' => 'pdo', - 'dbprefix' => '', - 'pconnect' => FALSE, - 'db_debug' => (ENVIRONMENT !== 'production'), - 'cache_on' => FALSE, - 'cachedir' => '', - 'char_set' => 'utf8', - 'dbcollat' => 'utf8_general_ci', - 'swap_pre' => '', - 'encrypt' => FALSE, - 'compress' => FALSE, - 'stricton' => FALSE, - 'failover' => array(), - 'save_queries' => TRUE + 'dsn' => '', + 'hostname' => 'sqlite:' . APPPATH . 'databases/test.db', + 'username' => '', + 'password' => '', + 'database' => '', + 'dbdriver' => 'pdo', + 'dbprefix' => '', + 'pconnect' => false, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => false, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => false, + 'compress' => false, + 'stricton' => false, + 'failover' => array(), + 'save_queries' => true ); diff --git a/tests/TestApp/application/config/production/config.php b/tests/TestApp/application/config/production/config.php index 68e9225..e4f0d59 100644 --- a/tests/TestApp/application/config/production/config.php +++ b/tests/TestApp/application/config/production/config.php @@ -1,5 +1,5 @@ + An uncaught Exception was encountered @@ -7,15 +7,15 @@ Filename: getFile(), "\n"; ?> Line Number: getLine(); ?> - + Backtrace: getTrace() as $error): ?> - + File: Line: Function: - + diff --git a/tests/TestApp/application/views/errors/cli/error_general.php b/tests/TestApp/application/views/errors/cli/error_general.php index 6984b61..6d25be7 100644 --- a/tests/TestApp/application/views/errors/cli/error_general.php +++ b/tests/TestApp/application/views/errors/cli/error_general.php @@ -1,8 +1,8 @@ + A PHP Error was encountered @@ -7,15 +7,15 @@ Filename: Line Number: - + Backtrace: - + File: Line: Function: - + diff --git a/tests/TestApp/application/views/errors/html/error_404.php b/tests/TestApp/application/views/errors/html/error_404.php index 756ea9d..20e1dfd 100644 --- a/tests/TestApp/application/views/errors/html/error_404.php +++ b/tests/TestApp/application/views/errors/html/error_404.php @@ -1,5 +1,5 @@ diff --git a/tests/TestApp/application/views/errors/html/error_db.php b/tests/TestApp/application/views/errors/html/error_db.php index f5a43f6..e410c98 100644 --- a/tests/TestApp/application/views/errors/html/error_db.php +++ b/tests/TestApp/application/views/errors/html/error_db.php @@ -1,5 +1,5 @@ diff --git a/tests/TestApp/application/views/errors/html/error_exception.php b/tests/TestApp/application/views/errors/html/error_exception.php index 8784886..2e2417b 100644 --- a/tests/TestApp/application/views/errors/html/error_exception.php +++ b/tests/TestApp/application/views/errors/html/error_exception.php @@ -1,5 +1,5 @@
@@ -11,7 +11,7 @@

Filename: getFile(); ?>

Line Number: getLine(); ?>

- +

Backtrace:

getTrace() as $error): ?> diff --git a/tests/TestApp/application/views/errors/html/error_general.php b/tests/TestApp/application/views/errors/html/error_general.php index fc3b2eb..f4f4f69 100644 --- a/tests/TestApp/application/views/errors/html/error_general.php +++ b/tests/TestApp/application/views/errors/html/error_general.php @@ -1,5 +1,5 @@ diff --git a/tests/TestApp/application/views/errors/html/error_php.php b/tests/TestApp/application/views/errors/html/error_php.php index b146f9c..337fde1 100644 --- a/tests/TestApp/application/views/errors/html/error_php.php +++ b/tests/TestApp/application/views/errors/html/error_php.php @@ -1,5 +1,5 @@
@@ -11,7 +11,7 @@

Filename:

Line Number:

- +

Backtrace: