Example #1
0
 public function testArrayTrim()
 {
     $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]]], \Owl\array_trim($target));
     $target = ['a' => [null, 1, '', 'a']];
     $this->assertSame(['a' => [1, 'a']], \Owl\array_trim($target));
 }
Example #2
0
 public function validateValue($value, array $attribute)
 {
     if ($attribute['schema']) {
         $value = \Owl\array_trim($value);
         (new \Owl\Parameter\Validator())->execute($value, $attribute['schema']);
     }
 }
Example #3
0
 public function unpack(\Owl\DataMapper\Data $data, array $options = null)
 {
     $record = parent::unpack($data, $options);
     if ($data->isFresh()) {
         $record = \Owl\array_trim($record);
     }
     return $record;
 }