Handle initialization of properties from the object data

@param PropertiesInterface $properties
169258
private function initializeObjectDataProperties(PropertiesInterface $properties)
    {
        // get secondary types
        $propertyList = $properties->getProperties();
        if (isset($propertyList[PropertyIds::SECONDARY_OBJECT_TYPE_IDS])) {
            $this->secondaryTypes = [];
            foreach ($propertyList[PropertyIds::SECONDARY_OBJECT_TYPE_IDS]->getValues() as $secondaryTypeId) {
                $type = $this->getSession()->getTypeDefinition($secondaryTypeId);
                if ($type instanceof SecondaryTypeInterface) {
                    $this->secondaryTypes[] = $type;
                }
            }
        }

        $this->properties = $this->getObjectFactory()->convertPropertiesDataToPropertyList(
            $this->getObjectType(),
            (array) $this->getSecondaryTypes(),
            $properties
        );

        $this->extensions[(string) ExtensionLevel::cast(
            ExtensionLevel::PROPERTIES
        )] = $properties->getExtensions();
    }
764203
public void init(Properties properties) {
        staleIfError = Parameters.STALE_IF_ERROR.getValue(properties);
        staleWhileRevalidate = Parameters.STALE_WHILE_REVALIDATE.getValue(properties);
        int maxAsynchronousWorkers = Parameters.MAX_ASYNCHRONOUS_WORKERS.getValue(properties);
        if (staleWhileRevalidate > 0 && maxAsynchronousWorkers == 0) {
            throw new ConfigurationException("You must set a positive value for maxAsynchronousWorkers "
                    + "in order to enable background revalidation (staleWhileRevalidate)");
        }
        ttl = Parameters.TTL.getValue(properties);
        xCacheHeader = Parameters.X_CACHE_HEADER.getValue(properties);
        viaHeader = Parameters.VIA_HEADER.getValue(properties);
        LOG.info("Initializing cache for provider " + Arrays.toString(Parameters.REMOTE_URL_BASE.getValue(properties))
                + " staleIfError=" + staleIfError + " staleWhileRevalidate=" + staleWhileRevalidate + " ttl=" + ttl
                + " xCacheHeader=" + xCacheHeader + " viaHeader=" + viaHeader);
    }
1091748
public static function setPropertiesValues($object, array $propertiesValues)
    {
        /*
         * No properties?
         * Nothing to do
         */
        if (empty($propertiesValues)) {
            return;
        }

        foreach ($propertiesValues as $property => $value) {
            static::setPropertyValue($object, $property, $value);
        }
    }
1151026
public void init(Map<String,Object> properties)
    {
        if (properties == null)
            m_properties = new Hashtable<String,Object>();
        else
            m_properties = properties;
        m_vApplication = new Vector<App>();
    }
452364
protected void setProperties(Properties properties) {
        Properties oldProperties = internalProperties;
        synchronized(this) {
            internalProperties = properties;
        }
        notifyPropertiesChanged(oldProperties);
    }
17577
public function reset($properties = null)
    {
        parent::reset();

        unset($this->family);
        unset($this->edition);

        $this->hidden = false;

        if (is_array($properties)) {
            $this->set($properties);
        }
    }
882915
private function addField(array $properties, FieldInterface $field)
    {
        $fieldName = $field->getName();
        $fieldRoot = &$properties;

        // Read property config from the field.
        $property = $field->getMappingPropertyConfig();

        $fieldPathArray   = explode('.', $fieldName);
        $currentPathArray = [];
        $fieldPathSize    = count($fieldPathArray);

        for ($i = 0; $i < $fieldPathSize - 1; $i++) {
            $currentPathArray[] = $fieldPathArray[$i];
            $currentPath        = implode('.', $currentPathArray);

            if ($field->isNested() && $field->getNestedPath() == $currentPath && !isset($fieldRoot[$fieldPathArray[$i]])) {
                $fieldRoot[$fieldPathArray[$i]] = ['type' => FieldInterface::FIELD_TYPE_NESTED, 'properties' => []];
            } elseif (!isset($fieldRoot[$fieldPathArray[$i]])) {
                $fieldRoot[$fieldPathArray[$i]] = ['type' => FieldInterface::FIELD_TYPE_OBJECT, 'properties' => []];
            }

            $fieldRoot = &$fieldRoot[$fieldPathArray[$i]]['properties'];
        }

        /*
         * Retrieving location where the property has to be copied to.
         * Ex : searchable fields are copied to default "search" field.
         */
        $copyToProperties = $this->getFieldCopyToProperties($field);

        if (!empty($copyToProperties)) {
            // For normal fields, copy_to is append at the property root.
            $copyToRoot = &$property;
            $copyToRoot['copy_to'] = $copyToProperties;
        }

        $fieldRoot[end($fieldPathArray)] = $property;

        return $properties;
    }
247338
protected function initializeNodeProperty($name, array &$properties)
    {
        if (empty($properties[$name])) {
            $properties[$name]         = $this->vocabularyCache->expandIRI($name);
            $properties[$name]->values = [];
        }
    }
1058623
public function initAnnotation(array $properties) {
		if (isset ( $properties [0] )) {
			$this->name = $properties [0];
			unset ( $properties [0] );
			if (isset ( $properties [1] )) {
				$this->code = $properties [1];
				unset ( $properties [1] );
			}
		}
		parent::initAnnotation ( $properties );
	}
536683
public function setProperties(array $properties) {
        if (!isset($properties[self::DATA_PROPERTY_REQUIRED])){
            $properties[self::DATA_PROPERTY_REQUIRED] = array();
        }
        if (!isset($properties[self::DATA_PROPERTY_DEFAULTS])){
            $properties[self::DATA_PROPERTY_DEFAULTS] = array();
        }
        $this->properties = $properties;
        return $this;
    }
433421
public void init(String resource, Map<String, String> properties) {

        init(resource, properties, -1, null);
    }
1296175
public function setProperties($properties)
    {
        $obj = $this->excel->getProperties();
        foreach ($properties as $property_name => $value) {
            $method = "set$property_name";
            if (method_exists($obj, $method)) {
                $obj->{$method}($value);
            }
        }

        return $this;
    }
664278
public function initAnnotation(array $properties) {
		if (isset ( $properties [0] )) {
			$this->type = $properties [0];
			unset ( $properties [0] );
			if (isset ( $properties [1] )) {
				if (! is_array ( $properties [1] )) {
					$this->constraints = [ "ref" => $properties [1] ];
				} else {
					$this->constraints = $properties [1];
				}
				unset ( $properties [1] );
			}
		} else {
			throw new \Exception ( 'Validator annotation must have a type' );
		}
		parent::initAnnotation ( $properties );
		if (! isset ( ValidatorsManager::$validatorTypes [$this->type] )) {
			throw new \Exception ( 'This type of annotation does not exists : ' . $this->type );
		}
	}
1162084
protected function initPropertiesFromEnvironment(): void
    {
        foreach ($this->envProperties as $property => $env) {
            if (!property_exists($this, $property)) {
                throw new InvalidPropertyException(
                    sprintf("Property \"%s\" does not exist within the class \"%s\"", $property, get_class($this))
                );
            }

            if (false === ($envSetting = getenv($env))) {
                throw new InvalidEnvironmentException(
                    sprintf("Required environment variable \"%s\" is not set", $env)
                );
            }

            $this->{$property} = $envSetting;
        }
    }
1130554
public function setProperties( $properties )
    {
        if ( ! empty( $properties ) )
        {
            foreach ( $properties as $name => $value )
            {
                switch ( true )
                {
                    case is_array( $value ) &&
                            array_key_exists( 'value', $value ):
                        $value = (object) $value;

                    case is_object( $value ):
                        if ( ! isset( $value->value ) )
                        {
                            $value->value = null;
                        }

                        if ( ! isset( $value->priority ) )
                        {
                            $value->priority = null;
                        }

                        if ( ! isset( $value->name ) )
                        {
                            $value->name = $name;
                        }

                        $this->setProperty(
                            $value->name,
                            $value->value,
                            $value->priority
                        );
                        break;

                    case is_array( $value ):
                        if ( count( $value ) > 2 )
                        {
                            list( $tmpName, $value, $priority ) = $value;
                            $name = $tmpName ?: $name;
                        }
                        else if ( count( $value ) > 1 )
                        {
                            list( $value, $priority ) = $value;
                        }
                        else
                        {
                            $priority   = null;
                            $value      = empty( $value ) ? null : current( $value );
                        }

                        $this->setProperty( $name, $value, $priority );
                        break;

                    default:
                        $this->setProperty( $name, $value );
                        break;
                }
            }
        }

        return $this;
    }
1313258
protected function addChild(PropertyInterface $property)
    {
        if ($property instanceof SectionPropertyInterface) {
            foreach ($property->getChildProperties() as $childProperty) {
                $this->addPropertyTags($childProperty);
            }
        } else {
            $this->addPropertyTags($property);
        }

        $this->properties[$property->getName()] = $property;
    }
1288307
protected function setObjectProperties(array $properties, $data, array &$out = [])
    {
        foreach ($properties as $property) {
            $prop =  $property->getName();

            if (in_array($name = $this->normalize($prop), $this->ignoredAttributes)) {
                continue;
            }

            $out[$prop] = $this->getObjectPropertyValue($property, $prop, $data);
        }
    }