@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @covers JWT::__construct |
| 21 | 21 | */ |
| 22 | 22 | public static function setUpBeforeClass(): void { |
| 23 | - self::$ci =& get_instance(); |
|
| 23 | + self::$ci = & get_instance(); |
|
| 24 | 24 | } |
| 25 | 25 | /** |
| 26 | 26 | * [testLoadPackage description] |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @date 2019-11-02 |
| 12 | 12 | * @param array $payload [description] |
| 13 | 13 | */ |
| 14 | - public function __construct($payload=[]) |
|
| 14 | + public function __construct($payload = []) |
|
| 15 | 15 | { |
| 16 | 16 | $this->payload = $payload; |
| 17 | 17 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function switchPayload(&$payload):void |
| 71 | 71 | { |
| 72 | - $this->payload =& $payload; |
|
| 72 | + $this->payload = & $payload; |
|
| 73 | 73 | } |
| 74 | 74 | /** |
| 75 | 75 | * [toArray description] |
@@ -20,20 +20,20 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public const PACKAGE = 'francis94c/refactor-ci'; |
| 22 | 22 | |
| 23 | - function __construct($params=null) |
|
| 23 | + function __construct($params = null) |
|
| 24 | 24 | { |
| 25 | - $this->ci =& get_instance(); |
|
| 25 | + $this->ci = & get_instance(); |
|
| 26 | 26 | $this->ci->load->config("refactor", false, true); |
| 27 | 27 | $this->ci->load->splint('francis94c/jsonp', '+JSONP', null, 'jsonp'); |
| 28 | 28 | $this->init($params == null ? [] : $params); |
| 29 | 29 | |
| 30 | 30 | spl_autoload_register(function($name) { |
| 31 | 31 | if ($name == 'RefactorPayload') { |
| 32 | - require(APPPATH . 'splints/' . self::PACKAGE . '/libraries/RefactorPayload.php'); |
|
| 32 | + require(APPPATH.'splints/'.self::PACKAGE.'/libraries/RefactorPayload.php'); |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $oldPath = set_include_path(APPPATH . 'libraries/refactor/'); |
|
| 36 | + $oldPath = set_include_path(APPPATH.'libraries/refactor/'); |
|
| 37 | 37 | |
| 38 | 38 | require("$name.php"); |
| 39 | 39 | |
@@ -125,24 +125,24 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | // Bools |
| 127 | 127 | if (isset($rule['bools'])) { |
| 128 | - foreach($rule['bools'] as $boolKey) { |
|
| 128 | + foreach ($rule['bools'] as $boolKey) { |
|
| 129 | 129 | $object[$boolKey] = $object[$boolKey] == 1 || $object[$boolKey] == 'true'; |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | // Cast |
| 133 | - if (isset($rule['cast'])) { |
|
| 133 | + if (isset($rule['cast'])) { |
|
| 134 | 134 | $this->cast_fields($object, $rule); |
| 135 | 135 | } |
| 136 | 136 | // Inflate |
| 137 | 137 | if (isset($rule['inflate'])) { |
| 138 | - foreach($rule['inflate'] as $field => $data) { |
|
| 138 | + foreach ($rule['inflate'] as $field => $data) { |
|
| 139 | 139 | $ids = json_decode($object[$field], true); |
| 140 | 140 | if (is_scalar($ids)) { |
| 141 | 141 | // JSON Array wasn't supplied. Let's treat it as a scaler ID. |
| 142 | 142 | $this->ci->db->where($this->primaryKey, $ids); |
| 143 | 143 | $query = $this->ci->db->get($data['table']); |
| 144 | 144 | if ($query->num_rows() == 0) { |
| 145 | - $object[$field] = json_encode (json_decode ("{}")); |
|
| 145 | + $object[$field] = json_encode(json_decode("{}")); |
|
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | $object[$field] = $query->result_array()[0]; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | $object[$field] = []; |
| 171 | 171 | if ($ids == null) return; |
| 172 | - foreach($ids as $id) { |
|
| 172 | + foreach ($ids as $id) { |
|
| 173 | 173 | $this->ci->db->where($this->primaryKey, $id); |
| 174 | 174 | $query = $this->ci->db->get($data['table']); |
| 175 | 175 | if ($query->num_rows() == 0) { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * associative array. |
| 196 | 196 | */ |
| 197 | 197 | private function unset_values(array &$object, &$rule):void { |
| 198 | - foreach($rule['unset'] as $key) { |
|
| 198 | + foreach ($rule['unset'] as $key) { |
|
| 199 | 199 | unset($object[$key]); |
| 200 | 200 | } |
| 201 | 201 | } |