Get the sortkey value of an object. Defaults to the object's id, if
the value is null
@param $object The object
@param $valueName The name of the sortkey attribute
@return String
335098
protected function getSortkeyValue($object, $valueName) {
    $value = $object->getValue($valueName);
    if ($value == null) {
      $value = $object->getOID()->getFirstId();
    }
    return $value;
  }
198775
public function get($key = null, $defaultValue = null) {
		$conditions = compact('key');
		if ($key === null) {
			return $this->find('all', $conditions);
		} else {
			$value = $this->field('value', $conditions);
			return $this->find('count', array('conditions' => $conditions)) ? $value : $defaultValue;
		}
	}
1068355
private static function makeValueUrlsRelative(PersistentObject $object, $valueName, $baseUrl) {
    $value = $object->getValue($valueName);

    // find urls in texts
    $urls = StringUtil::getUrls($value);
    // find direct attribute urls
    if (strpos($value, 'http://') === 0 || strpos($value, 'https://') === 0) {
      $urls[] = $value;
    }
    // process urls
    foreach ($urls as $url) {
      // convert absolute urls matching baseUrl
      $urlConv = $url;
      if (strpos($url, $baseUrl) === 0) {
        $urlConv = str_replace($baseUrl, '', $url);
      }
      // replace url
      $value = str_replace($url, $urlConv, $value);
    }
    $object->setValue($valueName, $value);
  }
1371470
public function getSortOrder($newValue, $currentValue = null)
    {
        $sortOrder = $currentValue;

        if ($newValue !== null) {
            $sortOrder = $this->sortConverter->hash2SortOrder($newValue);
        }

        return $sortOrder;
    }
484564
protected function getValueForColumns($object, array $columns)
    {
        $value = $object;

        foreach ($columns as $eachKeyColumn) {
            $keyGetterMethod = 'get' . $eachKeyColumn;
            $value = $value->$keyGetterMethod();
        }

        return $value;
    }
842060
static protected function normalizeArrayValues($key, array $valueList)
    {
        $normalized = '';
        $equal = $key . '=';
        foreach ($valueList as $value) {
            $normalized .= (empty($normalized) ? '' : '&') . $equal . urlencode($value);
        }

        return $normalized;
    }
1257722
protected function getSelectedValue($name, $valueAccessor, $defaultValue)
    {
        return sprintf(" {{ %s == %s ? 'selected' : '' }}", $this->getRawOptionValue($name, $defaultValue), $valueAccessor);
    }
425478
protected function getPropertyValue($object, string $propertyName, $default = null)
    {
        if (!is_object($object)) {
            throw new InvalidArgumentException('The first argument should be an object');
        }

        if (!property_exists($object, $propertyName)) {
            return $default;
        }

        try {
            $reflectionProperty = new ReflectionProperty($object, $propertyName);
            $reflectionProperty->setAccessible(true);

            return $reflectionProperty->getValue($object);
        } catch (ReflectionException $e) {
            return $default;
        }
    }
1273060
public static function getProperty(
        string $property,
        ?object $object,
        $defaultValue = null,
        ?string $classOverride = null
    ) {
        $reflectionClass = self::getReflectionClass($object, $classOverride);
        try {
            $property = $reflectionClass->getProperty($property);
            if ($object === null && !$property->isStatic()) {
                return $defaultValue;
            }
            $property->setAccessible(true);
            return $property->getValue($object);
        } catch (Exception $e) {
            return $defaultValue;
        }
    }
1002663
public function equals(ValueObjectContract $valueObject)
    {
        foreach (get_object_vars($this) as $name => $value) {
            if ($this->{$name} !== $valueObject->{$name}) {
                return false;
            }
        }

        return true;
    }
503169
protected function valueDeserializer()
    {
        return function($subject, array $data, $property, $defaultValue) {
            if (array_key_exists($property, $data)) {
                return $data[$property];
            }
            if (null === $defaultValue) {
                throw new MissingDataException(sprintf(
                    'Data is missing for %s::$%s, received keys: %s',
                    get_class($subject),
                    $property,
                    implode(', ', array_keys($data))
                ));
            }
            return $defaultValue;
        };
    }
652412
public function get($key, $valueDefault = null)
    {
        if (is_array($key)) {
            $values = [];
            foreach ($key as $key) {
                $values[$key] = array_key_exists($key, $_SESSION[$this->name])
                    ? $_SESSION[$this->name][$key] : $valueDefault;
            }
            return $values;
        }

        return array_key_exists($key, $_SESSION[$this->name])
            ? $_SESSION[$this->name][$key] : $valueDefault;
    }
1169742
public function get($keyName, $defaultValue = null)
    {
        $this->initList();
        $keyName = strtolower($keyName);
        if (empty($this->list[$keyName])) {
            return $defaultValue;
        }
        return $this->list[$keyName];
    }
328948
public function getFieldValue($object, $fieldName, $method = null)
    {
        $getters = [];
        // prefer method name given in the code option
        if ($method) {
            $getters[] = $method;
        }

        $camelizedFieldName = self::camelize($fieldName, true);
        $getters[] = 'get'.$camelizedFieldName;
        $getters[] = 'is'.$camelizedFieldName;

        foreach ($getters as $getter) {
            if (method_exists($object, $getter)) {
                return call_user_func([$object, $getter]);
            }
        }

        return '';
    }
129978
private function set($object, $propertyName, $propertyValue)
    {
        $reflectionUser = new \ReflectionClass($object);

        $reflectionProperty = $reflectionUser->getProperty($propertyName);
        $reflectionProperty->setAccessible(true);
        $reflectionProperty->setValue($object, $propertyValue);

        return $object;
    }
1248063
public static function getId($object)
    {
        $tableAnnotation = static::getAnnotation($object, Table::class);
        if(null !== $tableAnnotation)
        {
            return $tableAnnotation->id;
        }
        else
        {
            return null;
        }
    }
303402
public function getStaticPropertyValue($object, $propertyName) {
        $className = $object;

        if(is_object($className)) {
            $className = get_class($object);
        }

        $reflector = new ReflectionClass($className);
        $properties = $reflector->getStaticProperties();

        return (isset($properties[$propertyName])) ? $properties[$propertyName] : NULL;
    }