コード例 #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;
 }
コード例 #3
0
ファイル: Data.php プロジェクト: tempbottle/owl
 /**
  * @param string $key
  * @param array|string $path
  * @return mixed|false
  */
 public function getIn($key, $path)
 {
     $target = $this->get($key);
     $path = (array) $path;
     if (!is_array($target)) {
         throw new Exception\UnexpectedPropertyValueException(get_class($this) . ": Property {$key} is not complex type");
     }
     return Type\Complex::getIn($target, $path);
 }
コード例 #4
0
ファイル: PgsqlArray.php プロジェクト: tempbottle/owl
 public function store($value, array $attribute)
 {
     $value = parent::store($value, $attribute);
     return $value ? self::encode($value) : null;
 }