-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add StyleCI for conforming code to PSR standards
- Loading branch information
Showing
27 changed files
with
128 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
preset: psr2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "0.3-dev" | ||
"dev-master": "0.4-dev" | ||
} | ||
}, | ||
"suggest": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
/** | ||
* Database Trait | ||
* | ||
* | ||
* @package Wildfire | ||
* @author Rougin Royce Gutib <[email protected]> | ||
*/ | ||
|
@@ -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; | ||
} | ||
|
||
|
@@ -43,7 +43,7 @@ protected function getTableName($table, $isForeignKey = false) | |
|
||
/** | ||
* Sets the database class. | ||
* | ||
* | ||
* @param \CI_DB|null $database | ||
* @return self | ||
*/ | ||
|
@@ -67,7 +67,7 @@ public function setDatabase($database = null) | |
|
||
/** | ||
* Sets the query result. | ||
* | ||
* | ||
* @param \CI_DB_result $query | ||
* @return self | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
/** | ||
* Describe Trait | ||
* | ||
* | ||
* @package Wildfire | ||
* @author Rougin Royce Gutib <[email protected]> | ||
*/ | ||
|
@@ -20,7 +20,7 @@ trait DescribeTrait | |
|
||
/** | ||
* Gets the Describe class based on the given database. | ||
* | ||
* | ||
* @param \CI_DB $database | ||
* @return \Rougin\Describe\Describe | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
/** | ||
* Object Trait | ||
* | ||
* | ||
* @package Wildfire | ||
* @author Rougin Royce Gutib <[email protected]> | ||
* | ||
|
@@ -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; | ||
|
@@ -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; | ||
} | ||
|
||
|
@@ -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; | ||
} | ||
|
||
|
@@ -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 | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
/** | ||
* Result Trait | ||
* | ||
* | ||
* @package Wildfire | ||
* @author Rougin Royce Gutib <[email protected]> | ||
* | ||
|
@@ -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() | ||
|
@@ -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); | ||
|
@@ -84,7 +83,7 @@ public function result() | |
|
||
/** | ||
* Gets the data result from the specified query. | ||
* | ||
* | ||
* @return array|object | ||
*/ | ||
protected function getQueryResult() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
* Wildfire | ||
* | ||
* Yet another wrapper for CodeIgniter's Query Builder Class. | ||
* | ||
* | ||
* @package Wildfire | ||
* @author Rougin Royce Gutib <[email protected]> | ||
*/ | ||
|
@@ -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 ]; | ||
|
@@ -65,7 +65,7 @@ public function find($table, $delimiters = [], $isForeignKey = false) | |
|
||
/** | ||
* Returns all rows from the specified table. | ||
* | ||
* | ||
* @param string $table | ||
* @return self | ||
*/ | ||
|
@@ -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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.