protected function selectValue(PropertyInterface $property, array $data)
    {
        $errors = [];
        $key = $property->getName();
        $value = array_key_exists($key, $data) ? $data[$key] : null;

        if ($value === null && $property->isRequired()) {
            if (!array_key_exists($key, $data)) {
                $errors[] = Error::MISSING_KEY;
            }
            $errors[] = Error::MISSING_VALUE;
        }

        return empty($errors) ? Ok::unit($value) : Error::unit($errors);
    }
protected function selectValue(PropertyInterface $property, array $data)
    {
        $errors = [];
        $key = $property->getName();
        $value = array_key_exists($key, $data) ? $data[$key] : null;

        if ($value === null && $property->isRequired()) {
            if (!array_key_exists($key, $data)) {
                $errors[] = Error::MISSING_KEY;
            }
            $errors[] = Error::MISSING_VALUE;
        }

        return empty($errors) ? Ok::unit($value) : Error::unit($errors);
    }
protected function selectValue ( PropertyInterface $ property , array $ data ) { $ errors = [ ] ; $ key = $ property -> getName ( ) ; $ value = array_key_exists ( $ key , $ data ) ? $ data [ $ key ] : null ; if ( $ value === null && $ property -> isRequired ( ) ) { if ( ! array_key_exists ( $ key , $ data ) ) { $ errors [ ] = Error :: MISSING_KEY ; } $ errors [ ] = Error :: MISSING_VALUE ; } return empty ( $ errors ) ? Ok :: unit ( $ value ) : Error :: unit ( $ errors ) ; }
Returns the property's corresponding value from the given data array.

@param PropertyInterface $property
@param array $data

@return ResultInterface If the value does not exist an error is returned; otherwise Ok is returned.
Returns the property s corresponding value from the given data array .