Skip to content

Commit 392d36e

Browse files
committed
Update code to match PSR-12 code style
1 parent d55cd49 commit 392d36e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Data.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public function append(string $key, $value = null): void
5959
}
6060

6161
$endKey = array_pop($keyPath);
62-
for ( $i = 0; $i < count($keyPath); $i++ ) {
62+
for ($i = 0; $i < count($keyPath); $i++) {
6363
$currentKey =& $keyPath[$i];
64-
if ( ! isset($currentValue[$currentKey]) ) {
64+
if (! isset($currentValue[$currentKey])) {
6565
$currentValue[$currentKey] = [];
6666
}
6767
$currentValue =& $currentValue[$currentKey];
@@ -97,7 +97,7 @@ public function set(string $key, $value = null): void
9797
}
9898

9999
$endKey = array_pop($keyPath);
100-
for ( $i = 0; $i < count($keyPath); $i++ ) {
100+
for ($i = 0; $i < count($keyPath); $i++) {
101101
$currentKey =& $keyPath[$i];
102102
if (!isset($currentValue[$currentKey])) {
103103
$currentValue[$currentKey] = [];
@@ -129,7 +129,7 @@ public function remove(string $key): void
129129
}
130130

131131
$endKey = array_pop($keyPath);
132-
for ( $i = 0; $i < count($keyPath); $i++ ) {
132+
for ($i = 0; $i < count($keyPath); $i++) {
133133
$currentKey =& $keyPath[$i];
134134
if (!isset($currentValue[$currentKey])) {
135135
return;
@@ -149,9 +149,9 @@ public function get(string $key, $default = null)
149149
$currentValue = $this->data;
150150
$keyPath = explode('.', $key);
151151

152-
for ( $i = 0; $i < count($keyPath); $i++ ) {
152+
for ($i = 0; $i < count($keyPath); $i++) {
153153
$currentKey = $keyPath[$i];
154-
if (!isset($currentValue[$currentKey]) ) {
154+
if (!isset($currentValue[$currentKey])) {
155155
return $default;
156156
}
157157
if (!is_array($currentValue)) {
@@ -173,7 +173,7 @@ public function has(string $key): bool
173173
$currentValue = &$this->data;
174174
$keyPath = explode('.', $key);
175175

176-
for ( $i = 0; $i < count($keyPath); $i++ ) {
176+
for ($i = 0; $i < count($keyPath); $i++) {
177177
$currentKey = $keyPath[$i];
178178
if (
179179
!is_array($currentValue) ||

src/Util.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Util
2727
*/
2828
public static function isAssoc(array $arr): bool
2929
{
30-
return !count($arr) || count(array_filter(array_keys($arr),'is_string')) == count($arr);
30+
return !count($arr) || count(array_filter(array_keys($arr), 'is_string')) == count($arr);
3131
}
3232

3333
/**
@@ -43,7 +43,7 @@ public static function isAssoc(array $arr): bool
4343
*/
4444
public static function mergeAssocArray($to, $from, $clobber = true)
4545
{
46-
if ( is_array($from) ) {
46+
if (is_array($from)) {
4747
foreach ($from as $k => $v) {
4848
if (!isset($to[$k])) {
4949
$to[$k] = $v;

tests/DataTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testAppend()
8888

8989
public function testSet()
9090
{
91-
$data = new Data;
91+
$data = new Data();
9292

9393
$this->assertNull($data->get('a'));
9494
$this->assertNull($data->get('b.c'));
@@ -111,7 +111,7 @@ public function testSet()
111111

112112
public function testSetClobberStringInPath()
113113
{
114-
$data = new Data;
114+
$data = new Data();
115115

116116
$data->set('a.b.c', 'Should not be able to write to a.b.c.d.e');
117117

0 commit comments

Comments
 (0)