Пример #1
0
 public function bind(Data $data) : BindResult
 {
     if (!$data->filter(function (string $value, string $key) {
         if ($key !== $this->key && 0 !== strpos($key, $this->key . '[')) {
             return false;
         }
         if ('' === $value) {
             return false;
         }
         return true;
     })->isEmpty()) {
         $bindResult = $this->wrappedMapping->bind($data);
         if ($bindResult->isSuccess()) {
             return $this->applyConstraints($bindResult->getValue(), $this->key);
         }
         return $bindResult;
     }
     return $this->applyConstraints(null, $this->key);
 }