Permalink
Browse files

Fix code rules

  • Loading branch information...
1 parent 7d514b5 commit 22b068d716067991e0e47f0991b1ed696972ce6c @v-v-vishnevskiy v-v-vishnevskiy committed Sep 4, 2012
Showing with 7 additions and 18 deletions.
  1. +4 −14 tests/cases/util/SetTest.php
  2. +3 −4 util/Set.php
View
18 tests/cases/util/SetTest.php
@@ -1387,14 +1387,10 @@ public function testAppend() {
$array1 = array(
'ModelOne' => array(
- 'id' => 1001,
- 'field_one' => 's1.0.m1.f1',
- 'field_two' => 's1.0.m1.f2'
+ 'id' => 1001, 'field_one' => 's1.0.m1.f1', 'field_two' => 's1.0.m1.f2'
),
'ModelTwo' => array(
- 'id' => 1002,
- 'field_one' => 's1.0.m2.f1',
- 'field_two' => 's1.0.m2.f2'
+ 'id' => 1002, 'field_one' => 's1.0.m2.f1', 'field_two' => 's1.0.m2.f2'
)
);
$array2 = array(
@@ -1412,16 +1408,10 @@ public function testAppend() {
$expected = array(
'ModelOne' => array(
- 'id' => 1001,
- 'field_one' => 's1.0.m1.f1',
- 'field_two' => 's1.0.m1.f2',
- 'field_three' => 's1.0.m1.f3'
+ 'id' => 1001, 'field_one' => 's1.0.m1.f1', 'field_two' => 's1.0.m1.f2', 'field_three' => 's1.0.m1.f3'
),
'ModelTwo' => array(
- 'id' => 1002,
- 'field_one' => 's1.0.m2.f1',
- 'field_two' => 's1.0.m2.f2',
- 'field_three' => 's1.0.m2.f3'
+ 'id' => 1002, 'field_one' => 's1.0.m2.f1', 'field_two' => 's1.0.m2.f2', 'field_three' => 's1.0.m2.f3'
)
);
$this->assertIdentical($expected, $result);
View
7 util/Set.php
@@ -40,15 +40,14 @@ public static function append(array $array, array $array2) {
$arrays = func_get_args();
$array = array_shift($arrays);
foreach ($arrays as $array2) {
- if (! $array && $array2) {
+ if (!$array && $array2) {
$array = $array2;
continue;
}
foreach ($array2 as $key => $value) {
- if (! array_key_exists($key, $array)) {
+ if (!array_key_exists($key, $array)) {
$array[$key] = $value;
- }
- elseif (is_array($value)) {
+ } elseif (is_array($value)) {
$array[$key] = static::append($array[$key], $array2[$key]);
}
}

0 comments on commit 22b068d

Please sign in to comment.