Skip to content

Commit

Permalink
Add StyleCI for conforming code to PSR standards
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Sep 12, 2016
1 parent 113c073 commit 5feebd5
Show file tree
Hide file tree
Showing 27 changed files with 128 additions and 125 deletions.
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset: psr2
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

All notable changes to `Wildfire` will be documented in this file.

## [Unreleased](https://github.com/rougin/wildfire/compare/v0.3.0...HEAD)
## [0.3.1](https://github.com/rougin/wildfire/compare/v0.3.0...v0.3.1) - 2016-09-12

### Added
- `Wildfire` as `CI_Model`
- StyleCI for conforming code to PSR standards

## [0.3.0](https://github.com/rougin/wildfire/compare/v0.2.1...v0.3.0) - 2016-06-05

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright (c) 2015 Rougin Royce Gutib <[email protected]>
Copyright (c) 2016 Rougin Royce Gutib <[email protected]>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.3-dev"
"dev-master": "0.4-dev"
}
},
"suggest": {
Expand Down
10 changes: 5 additions & 5 deletions src/Traits/DatabaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Database Trait
*
*
* @package Wildfire
* @author Rougin Royce Gutib <[email protected]>
*/
Expand All @@ -24,14 +24,14 @@ trait DatabaseTrait

/**
* Parses the table name from Describe class.
*
*
* @param string $table
* @param boolean $isForeignKey
* @return string
*/
protected function getTableName($table, $isForeignKey = false)
{
if ( ! $isForeignKey && $this->table) {
if (! $isForeignKey && $this->table) {
$table = $this->table;
}

Expand All @@ -43,7 +43,7 @@ protected function getTableName($table, $isForeignKey = false)

/**
* Sets the database class.
*
*
* @param \CI_DB|null $database
* @return self
*/
Expand All @@ -67,7 +67,7 @@ public function setDatabase($database = null)

/**
* Sets the query result.
*
*
* @param \CI_DB_result $query
* @return self
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/DescribeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
* Describe Trait
*
*
* @package Wildfire
* @author Rougin Royce Gutib <[email protected]>
*/
Expand All @@ -20,7 +20,7 @@ trait DescribeTrait

/**
* Gets the Describe class based on the given database.
*
*
* @param \CI_DB $database
* @return \Rougin\Describe\Describe
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Traits/ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
* Object Trait
*
*
* @package Wildfire
* @author Rougin Royce Gutib <[email protected]>
*
Expand All @@ -32,7 +32,7 @@ protected function createObject($table, $row, $isForeignKey = false)
{
list($model, $newTable) = $this->getModel($table, $isForeignKey);

if ( ! array_key_exists($newTable, $this->tables)) {
if (! array_key_exists($newTable, $this->tables)) {
$tableInfo = $this->describe->getTable($newTable);

$this->tables[$newTable] = $tableInfo;
Expand All @@ -45,7 +45,7 @@ protected function createObject($table, $row, $isForeignKey = false)
foreach ($tableInfo as $column) {
$key = $column->getField();

if ( ! empty($columns) && ! in_array($key, $model->columns)) {
if (! empty($columns) && ! in_array($key, $model->columns)) {
continue;
}

Expand All @@ -70,14 +70,14 @@ abstract protected function find($table, $delimiters = [], $isForeignKey = false

/**
* Sets the foreign field of the column, if any.
*
*
* @param \CI_Model $model
* @param \Rougin\Describe\Column $column
* @return void
*/
protected function setForeignField(CI_Model $model, Column $column)
{
if ( ! $column->isForeignKey()) {
if (! $column->isForeignKey()) {
return;
}

Expand All @@ -94,7 +94,7 @@ protected function setForeignField(CI_Model $model, Column $column)

/**
* Gets the model class of the said table.
*
*
* @param string|null $table
* @param boolean $isForeignKey
* @return array
Expand All @@ -117,7 +117,7 @@ protected function getModel($table = null, $isForeignKey = false)

/**
* Parses the table name from Describe class.
*
*
* @param string $table
* @param boolean $isForeignKey
* @return string
Expand Down
11 changes: 5 additions & 6 deletions src/Traits/ResultTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* Result Trait
*
*
* @package Wildfire
* @author Rougin Royce Gutib <[email protected]>
*
Expand Down Expand Up @@ -51,15 +51,15 @@ abstract protected function createObject($table, $row, $isForeignKey = false);

/**
* Returns all rows from the specified table.
*
*
* @param string $table
* @return self
*/
abstract public function get($table = '');

/**
* Returns the result.
*
*
* @return object
*/
public function result()
Expand All @@ -72,8 +72,7 @@ public function result()
$this->get();
}

foreach ($data as $row)
{
foreach ($data as $row) {
$object = $this->createObject($this->table, $row);

array_push($result, $object);
Expand All @@ -84,7 +83,7 @@ public function result()

/**
* Gets the data result from the specified query.
*
*
* @return array|object
*/
protected function getQueryResult()
Expand Down
11 changes: 6 additions & 5 deletions src/Wildfire.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Wildfire
*
* Yet another wrapper for CodeIgniter's Query Builder Class.
*
*
* @package Wildfire
* @author Rougin Royce Gutib <[email protected]>
*/
Expand Down Expand Up @@ -46,7 +46,7 @@ public function find($table, $delimiters = [], $isForeignKey = false)
{
list($model, $table) = $this->getModel($table, $isForeignKey);

if ( ! is_array($delimiters)) {
if (! is_array($delimiters)) {
$primaryKey = $this->describe->getPrimaryKey($table);

$delimiters = [ $primaryKey => $delimiters ];
Expand All @@ -65,7 +65,7 @@ public function find($table, $delimiters = [], $isForeignKey = false)

/**
* Returns all rows from the specified table.
*
*
* @param string $table
* @return self
*/
Expand Down Expand Up @@ -93,12 +93,13 @@ public function get($table = '')

/**
* Calls methods from this class in underscore case.
*
*
* @param string $method
* @param mixed $parameters
* @return mixed
*/
public function __call($method, $parameters) {
public function __call($method, $parameters)
{
$method = camelize($method);
$result = $this;

Expand Down
44 changes: 22 additions & 22 deletions tests/TestApp/application/config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -46,7 +46,7 @@
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
$config['uri_protocol'] = 'REQUEST_URI';

/*
|--------------------------------------------------------------------------
Expand All @@ -70,7 +70,7 @@
| than english.
|
*/
$config['language'] = 'english';
$config['language'] = 'english';

/*
|--------------------------------------------------------------------------
Expand All @@ -94,7 +94,7 @@
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
$config['enable_hooks'] = false;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -130,7 +130,7 @@
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
$config['composer_autoload'] = false;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -179,8 +179,8 @@
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['allow_get_array'] = true;
$config['enable_query_strings'] = false;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
Expand Down Expand Up @@ -295,7 +295,7 @@
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
$config['cache_query_string'] = false;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -361,10 +361,10 @@
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_save_path'] = null;
$config['sess_match_ip'] = false;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_regenerate_destroy'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -381,11 +381,11 @@
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = false;
$config['cookie_httponly'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -399,7 +399,7 @@
| (usually \n) and Windows (\r\n).
|
*/
$config['standardize_newlines'] = FALSE;
$config['standardize_newlines'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -413,7 +413,7 @@
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
$config['global_xss_filtering'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -429,11 +429,11 @@
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_protection'] = false;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_regenerate'] = true;
$config['csrf_exclude_uris'] = array();

/*
Expand All @@ -456,7 +456,7 @@
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
$config['compress_output'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -483,7 +483,7 @@
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
$config['rewrite_short_tags'] = false;

/*
|--------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 5feebd5

Please sign in to comment.