Returns the upload status of form.
It looks 1) in request for passed value and 2) in storage and 3) fallback to default (1).

@param int $value Default value to return.

@author Benjamin Carl <opensource@clickalicious.de>

@return int Upload value
549953
protected function receiveUploadFieldValueFromRequest($value = 0)
    {
        $requestQueryParameter = $this->getRequest()->getQueryParams();
        $requestBody           = $this->getRequest()->getParsedBody();
        $fieldname             = $this->getFieldnameUpload();

        if (
            true === isset($requestQueryParameter[$fieldname]) &&
            1 == $requestQueryParameter[$fieldname]
        ) {
            $value = 1;
        } elseif (
            true === isset($requestBody[$fieldname]) &&
            1 == $requestBody[$fieldname]
        ) {
            $value = 1;
        }

        return $value;
    }
454265
protected function receiveTokenFieldValueFromRequest($value = null)
    {
        $requestQueryParameter = $this->getRequest()->getQueryParams();
        $requestBody           = $this->getRequest()->getParsedBody();
        $fieldname             = $this->getFieldnameToken();

        if (true === isset($requestQueryParameter[$fieldname])) {
            $value = $requestQueryParameter[$fieldname];
        } elseif (true === isset($requestBody[$fieldname])) {
            $value = $requestBody[$fieldname];
        }

        return $value;
    }
279443
public function isValid($value, $file = null)
    {
        if (array_key_exists($value, $this->_files)) {
            $files[$value] = $this->_files[$value];
        } else {
            foreach ($this->_files as $file => $content) {
                if (isset($content['name']) && ($content['name'] === $value)) {
                    $files[$file] = $this->_files[$file];
                }

                if (isset($content['tmp_name']) && ($content['tmp_name'] === $value)) {
                    $files[$file] = $this->_files[$file];
                }
            }
        }

        if (empty($files)) {
            return $this->_throw($file, self::FILE_NOT_FOUND);
        }

        foreach ($files as $file => $content) {
            $this->_value = $file;
            switch($content['error']) {
                case 0:
                    if (!is_uploaded_file($content['tmp_name'])) {
                        $this->_throw($file, self::ATTACK);
                    }
                    break;

                case 1:
                    $this->_throw($file, self::INI_SIZE);
                    break;

                case 2:
                    $this->_throw($file, self::FORM_SIZE);
                    break;

                case 3:
                    $this->_throw($file, self::PARTIAL);
                    break;

                case 4:
                    $this->_throw($file, self::NO_FILE);
                    break;

                case 6:
                    $this->_throw($file, self::NO_TMP_DIR);
                    break;

                case 7:
                    $this->_throw($file, self::CANT_WRITE);
                    break;

                case 8:
                    $this->_throw($file, self::EXTENSION);
                    break;

                default:
                    $this->_throw($file, self::UNKNOWN);
                    break;
            }
        }

        if (count($this->_messages) > 0) {
            return false;
        } else {
            return true;
        }
    }
713665
protected function getDefaultValue($value)
    {
        if ($value instanceof Expression) {
            return $value;
        }

        return is_bool($value)
                    ? "'".(int) $value."'"
                    : "'".(string) $value."'";
    }
500083
private function getDifference($value): ?int
    {
        // Let's prepare the dates...
        $now = (new \DateTime())->setTime(0, 0);
        $date = Date::getDateTime($value);

        // ...and make comparison with "day" as unit
        if ($date instanceof \DateTime) {
            return Date::getDateDifference($now, $date, Date::DATE_DIFFERENCE_UNIT_DAYS);
        }

        return null;
    }
564903
public function status($value, $url = [])
    {
        $icon = $value == true ? 'check' : 'times';
        $contextual = $value == true ? 'success' : 'danger';
        return $this->label('', $contextual, ['icon' => $icon]);
    }
1301681
public function value($value = null)
    {
        if (is_numeric($value)) {
            $this->value = $value >= 0 && $value <= 100 ? $value : $this->value;
            return $this;
        }
        return (int) $this->value;
    }
1080327
public static function integer($value){

		$value = static::_nullValue($value);

		if($value !== null){

			$value = (int) $value;
		}

		return $value;
	}
239416
protected function getValueType($value)
    {
        switch (true) {
            case is_scalar($value):
                $type = gettype($value);
                break;

            case is_array($value):
                $type = 'array';
                break;

            case is_object($value):
                $type = get_class($value);
                break;

            case is_resource($value):
                $type = 'resource';
                break;

            default:
                $type = 'unknown';
                break;
        }

        return $type;
    }
343337
protected function getDataTypeByValue($value)
    {
        if(null === $value)
        {
            return \PDO::PARAM_NULL;
        }
        if(is_bool($value))
        {
            return \PDO::PARAM_BOOL;
        }
        if(is_int($value))
        {
            return \PDO::PARAM_INT;
        }
        return \PDO::PARAM_STR;
    }
1126306
public function validateRequired($value)
    {
        // Check for file!
        if (true === is_array($value) && true === array_key_exists('tmp_name', $value)) {
            // At least it was uploaded its valid in meaning of "required" <= NOT EMPTY
            $valid = ($value['error'] < UPLOAD_ERR_PARTIAL);
        } else {
            // Plain value ...
            $valid = (!is_null($value) && (is_array($value) || is_object($value) || (strlen($value) > 0)));
        }

        return $valid;
    }
372069
protected function getDefaultValue($value)
    {
        if ($value instanceof Expression) {
            return $value;
        }

        return is_bool($value)
            ? "'" . (int) $value . "'"
            : "'" . strval($value) . "'";
    }
1205066
public function find($value): ?int
    {
        $founded = $this->items->find($value);

        if (false === $founded) {
            return null;
        }

        return (int) $founded;
    }
340694
public function countValue($value)
    {
        return count(array_filter($this->data, function ($item) use ($value) {
            return $value === $item;
        }));
    }
33192
public function get($value) {
        //TODO throw exception instead?!
        if (\is_int($value)) {
            $info = $this->getIndexAndMask($value);
            $i = $info["i"];
            $k = $info["k"];

            $flag = 1;
            $flag = $flag << $k;

            if (isset($this->array[$i])) return (($this->array[$i] & $flag) !== 0);
            return false;
        }
        return false;
    }
236427
public static function getDisplayValue($value)
  {
    switch($value)
    {
      case self::ACTIVE:
        return 'Active';
      case self::ARCHIVED:
        return 'Archived';
      case self::PENDING:
        return 'Pending';
      case self::CORRUPT:
        return 'Corrupt';
      default:
        return $value;
    }
  }
942828
private function getValue($value)
    {
        if (!is_string($value)) {
            return $value;
        }

        if ($value[0] != '%' || $value[strlen($value) - 1] != '%')  {
            return $value;
        }

        $parameter = trim($value, '%');
        if ($this->container->hasParameter($parameter)) {
            return $this->container->getParameter($parameter);
        }

        return $value;
    }