@@ -21,12 +21,12 @@ |
||
| 21 | 21 | public function getData($name) |
| 22 | 22 | { |
| 23 | 23 | foreach (json_decode($this->all()) as $key) { |
| 24 | - return $key->$name; |
|
| 24 | + return $key->$name; |
|
| 25 | 25 | } |
| 26 | - } |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function getCount() |
|
| 29 | - { |
|
| 28 | + public function getCount() |
|
| 29 | + { |
|
| 30 | 30 | return sizeof($this->value); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | trait Inflector |
| 40 | 40 | { |
| 41 | 41 | /** |
| 42 | - * Pluralizes English nouns. |
|
| 43 | - * |
|
| 44 | - * @access public |
|
| 45 | - * @static |
|
| 46 | - * @param string $word English noun to pluralize |
|
| 47 | - * @return string Plural noun |
|
| 48 | - */ |
|
| 42 | + * Pluralizes English nouns. |
|
| 43 | + * |
|
| 44 | + * @access public |
|
| 45 | + * @static |
|
| 46 | + * @param string $word English noun to pluralize |
|
| 47 | + * @return string Plural noun |
|
| 48 | + */ |
|
| 49 | 49 | public static function pluralize($word) |
| 50 | 50 | { |
| 51 | 51 | $plural = array( |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * Singularizes English nouns. |
|
| 106 | - * |
|
| 107 | - * @access public |
|
| 108 | - * @static |
|
| 109 | - * @param string $word English noun to singularize |
|
| 110 | - * @return string Singular noun. |
|
| 111 | - */ |
|
| 105 | + * Singularizes English nouns. |
|
| 106 | + * |
|
| 107 | + * @access public |
|
| 108 | + * @static |
|
| 109 | + * @param string $word English noun to singularize |
|
| 110 | + * @return string Singular noun. |
|
| 111 | + */ |
|
| 112 | 112 | public function singularize($word) |
| 113 | 113 | { |
| 114 | 114 | $singular = array ( |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $lowercased_word = strtolower($word); |
| 83 | 83 | |
| 84 | - foreach ($uncountable as $_uncountable){ |
|
| 85 | - if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){ |
|
| 84 | + foreach ($uncountable as $_uncountable) { |
|
| 85 | + if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) { |
|
| 86 | 86 | return $word; |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - foreach ($irregular as $_plural=> $_singular){ |
|
| 90 | + foreach ($irregular as $_plural=> $_singular) { |
|
| 91 | 91 | if (preg_match('/('.$_plural.')$/i', $word, $arr)) { |
| 92 | - return preg_replace('/('.$_plural.')$/i', substr($arr[0],0,1).substr($_singular,1), $word); |
|
| 92 | + return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function singularize($word) |
| 113 | 113 | { |
| 114 | - $singular = array ( |
|
| 114 | + $singular = array( |
|
| 115 | 115 | '/(quiz)zes$/i' => "$1", |
| 116 | 116 | '/(matr)ices$/i' => "$1ix", |
| 117 | 117 | '/(vert|ind)ices$/i' => "$1ex", |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | 'move' => 'moves'); |
| 153 | 153 | |
| 154 | 154 | $lowercased_word = strtolower($word); |
| 155 | - foreach ($uncountable as $_uncountable){ |
|
| 156 | - if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){ |
|
| 155 | + foreach ($uncountable as $_uncountable) { |
|
| 156 | + if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) { |
|
| 157 | 157 | return $word; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - foreach ($irregular as $_plural=> $_singular){ |
|
| 161 | + foreach ($irregular as $_plural=> $_singular) { |
|
| 162 | 162 | if (preg_match('/('.$_singular.')$/i', $word, $arr)) { |
| 163 | - return preg_replace('/('.$_singular.')$/i', substr($arr[0],0,1).substr($_plural,1), $word); |
|
| 163 | + return preg_replace('/('.$_singular.')$/i', substr($arr[0], 0, 1).substr($_plural, 1), $word); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * SugarORM\Schema manages the creation of database table. |
|
| 4 | - * |
|
| 5 | - * @package Ibonly\SugarORM\Schema |
|
| 6 | - * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | - * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | - */ |
|
| 3 | + * SugarORM\Schema manages the creation of database table. |
|
| 4 | + * |
|
| 5 | + * @package Ibonly\SugarORM\Schema |
|
| 6 | + * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | + * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace Ibonly\PotatoORM; |
| 11 | 11 | |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | public function field($type, $fieldName, $length=NULL) |
| 29 | 29 | { |
| 30 | 30 | if(is_null($length)){ |
| 31 | - $this->fieldDescription[] = $type ." ".$fieldName; |
|
| 31 | + $this->fieldDescription[] = $type ." ".$fieldName; |
|
| 32 | 32 | }else |
| 33 | 33 | { |
| 34 | - $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
|
| 34 | + $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return array |
| 27 | 27 | */ |
| 28 | - public function field($type, $fieldName, $length=NULL) |
|
| 28 | + public function field($type, $fieldName, $length = NULL) |
|
| 29 | 29 | { |
| 30 | - if(is_null($length)){ |
|
| 31 | - $this->fieldDescription[] = $type ." ".$fieldName; |
|
| 32 | - }else |
|
| 30 | + if (is_null($length)) { |
|
| 31 | + $this->fieldDescription[] = $type." ".$fieldName; |
|
| 32 | + } else |
|
| 33 | 33 | { |
| 34 | - $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
|
| 34 | + $this->fieldDescription[] = $type." ".$fieldName." ".$length; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | $callback = function($fieldName) use (&$query) |
| 50 | 50 | { |
| 51 | 51 | $e = explode(" ", $fieldName); |
| 52 | - if(sizeof($e) == 2) |
|
| 52 | + if (sizeof($e) == 2) |
|
| 53 | 53 | { |
| 54 | - $query .= $this->$e[0]($e[1], 20) .", ".PHP_EOL; |
|
| 55 | - }else |
|
| 54 | + $query .= $this->$e[0]($e[1], 20).", ".PHP_EOL; |
|
| 55 | + } else |
|
| 56 | 56 | { |
| 57 | - $query .= $this->$e[0]($e[1], $e[2]) .", ".PHP_EOL; |
|
| 57 | + $query .= $this->$e[0]($e[1], $e[2]).", ".PHP_EOL; |
|
| 58 | 58 | } |
| 59 | 59 | }; |
| 60 | 60 | array_walk($this->fieldDescription, $callback); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function createTable($tablename, $connection = NULL) |
| 84 | 84 | { |
| 85 | - if(is_null($connection)) |
|
| 85 | + if (is_null($connection)) |
|
| 86 | 86 | { |
| 87 | 87 | $connection = DatabaseQuery::connect(); |
| 88 | 88 | } |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $sqlQuery = self::sanitizeQuery($tablename); |
| 92 | 92 | $query = $connection->prepare($sqlQuery); |
| 93 | - if($query->execute()) |
|
| 93 | + if ($query->execute()) |
|
| 94 | 94 | { |
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | - }catch(PDOException $e){ |
|
| 97 | + } catch (PDOException $e) { |
|
| 98 | 98 | return $e->getMessage(); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function strings($value, $length) |
| 118 | 118 | { |
| 119 | - return $value ." varchar (".$length.") NOT NULL"; |
|
| 119 | + return $value." varchar (".$length.") NOT NULL"; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -201,6 +201,6 @@ discard block |
||
| 201 | 201 | $apend = 'timestamp'; |
| 202 | 202 | break; |
| 203 | 203 | } |
| 204 | - return $value . " " . $apend . " NOT NULL"; |
|
| 204 | + return $value." ".$apend." NOT NULL"; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | if(is_null($length)){ |
| 31 | 31 | $this->fieldDescription[] = $type ." ".$fieldName; |
| 32 | - }else |
|
| 32 | + } else |
|
| 33 | 33 | { |
| 34 | 34 | $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
| 35 | 35 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if(sizeof($e) == 2) |
| 53 | 53 | { |
| 54 | 54 | $query .= $this->$e[0]($e[1], 20) .", ".PHP_EOL; |
| 55 | - }else |
|
| 55 | + } else |
|
| 56 | 56 | { |
| 57 | 57 | $query .= $this->$e[0]($e[1], $e[2]) .", ".PHP_EOL; |
| 58 | 58 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | - }catch(PDOException $e){ |
|
| 97 | + } catch(PDOException $e){ |
|
| 98 | 98 | return $e->getMessage(); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Defining Interface for class DatabaseQueryInterface. |
|
| 4 | - * |
|
| 5 | - * @package Ibonly\PotatoORM\DatabaseQueryInterface |
|
| 6 | - * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | - * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | - */ |
|
| 3 | + * Defining Interface for class DatabaseQueryInterface. |
|
| 4 | + * |
|
| 5 | + * @package Ibonly\PotatoORM\DatabaseQueryInterface |
|
| 6 | + * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | + * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace Ibonly\PotatoORM; |
| 11 | 11 | |
@@ -11,9 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | interface DatabaseQueryInterface |
| 13 | 13 | { |
| 14 | - public function checkTableExist($table, $con=NULL); |
|
| 14 | + public function checkTableExist($table, $con = NULL); |
|
| 15 | 15 | |
| 16 | - public static function checkTableName($table, $dbConnection=NULL); |
|
| 16 | + public static function checkTableName($table, $dbConnection = NULL); |
|
| 17 | 17 | |
| 18 | 18 | public static function selectQuery($tableName, $field, $value, $connection); |
| 19 | 19 | |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Defining Interface for class GetData. |
|
| 4 | - * |
|
| 5 | - * @package Ibonly\PotatoORM\ModelInterface |
|
| 6 | - * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | - * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | - */ |
|
| 3 | + * Defining Interface for class GetData. |
|
| 4 | + * |
|
| 5 | + * @package Ibonly\PotatoORM\ModelInterface |
|
| 6 | + * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | + * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace Ibonly\PotatoORM; |
| 11 | 11 | |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Defining Interface for class Model. |
|
| 4 | - * |
|
| 5 | - * @package Ibonly\PotatoORM\ModelInterface |
|
| 6 | - * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | - * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | - */ |
|
| 3 | + * Defining Interface for class Model. |
|
| 4 | + * |
|
| 5 | + * @package Ibonly\PotatoORM\ModelInterface |
|
| 6 | + * @author Ibraheem ADENIYI <[email protected]> |
|
| 7 | + * @license MIT <https://opensource.org/licenses/MIT> |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace Ibonly\PotatoORM; |
| 11 | 11 | |