コード例 #1
0
ファイル: ComplexTest.php プロジェクト: tempbottle/owl
 public function testTrim()
 {
     $target = ['a' => 1, 'b' => null, 'c' => ['d' => 1, 'e' => [], 'f' => ['g' => null], 'h' => ['i' => ''], 'j' => ['k' => [], 'l' => 1]]];
     $this->assertSame(['a' => 1, 'c' => ['d' => 1, 'j' => ['l' => 1]]], Complex::trim($target));
     $target = ['a' => [null, 1, '', 'a']];
     $this->assertSame(['a' => [1, 'a']], Complex::trim($target));
 }
コード例 #2
0
ファイル: Mapper.php プロジェクト: tempbottle/owl
 public function unpack(\Owl\DataMapper\Data $data, array $options = null)
 {
     $record = parent::unpack($data, $options);
     if ($data->isFresh()) {
         $record = Type\Complex::trim($record);
     }
     return $record;
 }