value分析
@access protected

@param mixed  $value
@param string $field

@return string|array
426571
protected function parseValue($value, $field = '')
    {
        unset($field);
        if (is_string($value)) {
            $value = strpos($value, ':') === 0 && $this->query->isBind(substr($value, 1)) ? $value : $this->connection->quote($value);
        } elseif (is_array($value)) {
            $value = array_map([$this, 'parseValue'], $value);
        } elseif (is_bool($value)) {
            $value = $value ? '1' : '0';
        } elseif (is_null($value)) {
            $value = 'null';
        }
        return $value;
    }
1034762
public function normalizeValue($field, $value)
    {
        if ($value === null || !$this->_types) {
            return $value;
        }

        if (!isset($this->_types[$field])) {
            throw new MisuseException(['`:field` field type is not defined', 'field' => $field]);
        }

        $type = $this->_types[$field];

        if ($type === 'string') {
            return is_string($value) ? $value : (string)$value;
        } elseif ($type === 'int') {
            return is_int($value) ? $value : (int)$value;
        } elseif ($type === 'float') {
            return is_float($value) ? $value : (float)$value;
        } elseif ($type === 'objectid') {
            return is_scalar($type) ? new ObjectId($value) : $value;
        } elseif ($type === 'bool') {
            return is_bool($value) ? $value : (bool)$value;
        } elseif ($type === 'array') {
            return (array)$value;
        } else {
            throw new InvalidValueException(['normalize `:type` type value is not supported', 'type' => $type]);
        }
    }
445085
protected function parseValue(FieldBuilder $field, $value = null)
    {
        $parsedValue = null;

        // No data found, define a default by field type.
        switch ($field->getFieldType())
        {

            case 'checkbox':
            case 'checkboxes': // @todo remove this checkboxes statement for next major update.
            case 'radio':
            case 'select':
            case 'collection':

                $parsedValue = $this->parseArrayable($field, $value);
                break;

            case 'infinite':

                // Check for the registered fields and their default value if one.
                $parsedValue = $this->parseInfinite($field, $value);
                break;

            // Text
            // Textarea
            // Password
            // Media
            // Editor
            default:
                $parsedValue = $this->parseString($field, $value);
        }

        return $parsedValue;
    }
922995
public function parse_value($value) {
        global $COURSE;

        if (strpos($value, '$ToolProxyBinding.custom.url') !== false) {
            if ($COURSE->format == 'site') {
                $this->params['context_type'] = 'Group';
            } else {
                $this->params['context_type'] = 'CourseSection';
            }
            $this->params['context_id'] = $COURSE->id;
            $this->params['vendor_code'] = $this->get_service()->get_tool_proxy()->vendorcode;
            $this->params['product_code'] = $this->get_service()->get_tool_proxy()->guid;
            $value = str_replace('$ToolProxyBinding.custom.url', parent::get_endpoint(), $value);
        }
        return $value;

    }
238300
function get_by($field, $value)
	{
		$q = \Fw\Db::prepare("select * from " . $this->_table . " where " . $field . "=?");
		$q->execute(array($value));
		return $q->fetchAll(\PDO::FETCH_CLASS, $this->_entity);
	}
701966
public function gt($field, $value)
    {
        return function ($object) use ($field, $value) {
            return ClosureExpressionBuilder::getObjectFieldValue($object, $field) > $value;
        };
    }
1211590
public function value($value = null)
    {
        $fieldType = $this->getType();
        if ($value !== null) {
            switch ($fieldType) {
                case self::TYPE_FIELD_TEXT:
                case self::TYPE_FIELD_FILE:
                case self::TYPE_FIELD_TEXT_AREA:
                    if ($fieldType != self::TYPE_FIELD_FILE) {
                        $this->clear();
                    }
                    $params = ['value' => ["{$value}"]];
                    $this->sendCommand('element/:id/value', WebDriver_Command::METHOD_POST, $params);
                    break;
                case self::TYPE_FIELD_SELECT:
                    $this->waitPresent()->child(sprintf("xpath=descendant::option[@value='%s']", $value))
                        ->waitPresent()
                        ->click();
                    break;
            }
            return $this;
        } else {
            $value = null;
            switch ($fieldType) {
                case self::TYPE_FIELD_TEXT:
                case self::TYPE_FIELD_FILE:
                case self::TYPE_FIELD_TEXT_AREA:
                case self::TYPE_FIELD_SELECT:
                    $value = $this->attribute('value');
                    break;
                default:
                    $value = $this->text();
                    if ($this->webDriver->config()->get(WebDriver_Config::TRIM_TEXT_NODE_VALUE)) {
                        $value = trim($value);
                    }
            }
            return $value;
        }
    }
1050958
protected function getFieldValue(string $field, string $value): array
    {
        return [
            'type' => $this->searchFields[$field]['type'],
            'operator' => key($this->searchFields[$field]['operators']),
            'value' => $value
        ];
    }
683270
public function makeArrayFieldValue($value)
    {
        $value = $this->_unserializeValue($value);
        if (!$this->_isEncodedArrayFieldValue($value)) {
            $value = $this->_encodeArrayFieldValue($value);
        }

        return $value;
    }
466850
public function eq($field, $value) {
        if (is_array($value)) {
            $this->in($field, $value);

        } else if ($value === null) {
            $this->null($field);

        } else {
            $this->add($field, '=', $value);
        }

        return $this;
    }
1053971
public function values($field)
    {
        $values = [];
        foreach ($this->distinct()->select([$field])->all() as $v) {
            $values[] = $v[$field];
        }

        return $values;
    }
163812
public function value($field)
    {
        if (is_array($field)) {
            $values = array();
            foreach ($field as $key => $value) {
                $values[$key] = $this->value($value);
            }

            return $values;
        }

        return ($this->submitted && isset($this->values[$field])) ? $this->values[$field] : null;
    }
107179
public function oneByIntOrFail(string $field, int $value): Model
    {
        return $this->oneByOrFail($field, $value);
    }
47403
public function set(string $field, $value)
    {
        if ($value === null)
            $value = "";

        switch ($field)
        {
            case "scheme":
                $this->scheme = strtolower($value);
                return $this;
            case "port":
                $value = empty($value) ? null : (int)$value;
            case "username":
            case "password":
            case "fragment":
                $this->$field = $value;
                return $this;
            case "query":
                $this->query = $this->parseQuery($value);
                return $this;
            case "path":
                $this->setPath($value);
                return $this;
            case "host":
                return $this->setHost($value);
        }
        throw new \OutOfRangeException($field);
    }
881173
public function resolveForChecking($field, $value = null)
    {
        if (! is_null($element = $this->findById($field))) {
            return $element;
        }

        $selector = 'input[type=checkbox]';

        if (! is_null($field)) {
            $selector .= "[name='{$field}']";
        }

        if (! is_null($value)) {
            $selector .= "[value='{$value}']";
        }

        return $this->firstOrFail([
            $field, $selector,
        ]);
    }
350323
public function decode($value)
    {
        $json = parent::decode($value);

        $values = json_decode($json, true);

        $this->handleJsonError('Failed to decode group values from JSON');

        return $values;
    }
693331
public function getValue($value = '', $field = 'id', $fieldOutput = '')
    {
        if (!is_array($fieldOutput)) {
            $fieldOutput = [$fieldOutput];
        }
        $db = $this->db->select($fieldOutput)->from($this->table);
        if (is_array($value) && count($value) > 0) {
            foreach ($value as $column => $column_value) {
                if (is_array($column_value)) {
                    $db->whereIn($column, $column_value);
                } else {
                    $db->where($column, self::OPERATOR_EQUAL_TO, $column_value);
                }
            }
        } else {
            $db->where($field, self::OPERATOR_EQUAL_TO, $value);
        }
        $result = $db->execute()->fetch();

        $this->debug->debug(__FUNCTION__, 'GET Result => ' . json_encode($result));
        if (isset($result->$fieldOutput)) {
            return $result->$fieldOutput;
        } else {
            return NULL;
        }
    }