lib/Accessible/AutoConstructTrait.php
protected function initializeProperties($properties = null)
    {
        $this->getPropertiesInfo();

        // Initialize the properties that were defined using the Initialize / InitializeObject annotations
        $initializeValueValidationEnabled = Configuration::isInitializeValuesValidationEnabled();
        foreach ($this->_initialPropertiesValues as $propertyName => $initialization) {
            $value = null;
            switch ($initialization['type']) {
                case 'initialize':
                    $value = $initialization['value'];
                    break;
                default:
                    $className = $initialization['value'];
                    $value = new $className();
                    break;
            }

            if ($initializeValueValidationEnabled) {
                $this->assertPropertyValue($propertyName, $value);
            }

            $this->$propertyName = $value;
            $this->updateInitializedPropertyValue($propertyName, $value);
        }

        // Initialize the propeties using given arguments
        if ($this->_initializationNeededArguments !== null && $properties !== null) {
            $numberOfNeededArguments = count($this->_initializationNeededArguments);

            MethodCallManager::assertArgsNumber($numberOfNeededArguments, $properties);

            for ($i = 0; $i < $numberOfNeededArguments; $i++) {
                $propertyName = $this->_initializationNeededArguments[$i];
                $argument = $properties[$i];

                $this->assertPropertyValue($propertyName, $argument);
                $this->$propertyName = $argument;
                $this->updateInitializedPropertyValue($propertyName, $argument);
            }
        }
    }
protected function initializeProperties($properties = null)
    {
        $this->getPropertiesInfo();

        // Initialize the properties that were defined using the Initialize / InitializeObject annotations
        $initializeValueValidationEnabled = Configuration::isInitializeValuesValidationEnabled();
        foreach ($this->_initialPropertiesValues as $propertyName => $initialization) {
            $value = null;
            switch ($initialization['type']) {
                case 'initialize':
                    $value = $initialization['value'];
                    break;
                default:
                    $className = $initialization['value'];
                    $value = new $className();
                    break;
            }

            if ($initializeValueValidationEnabled) {
                $this->assertPropertyValue($propertyName, $value);
            }

            $this->$propertyName = $value;
            $this->updateInitializedPropertyValue($propertyName, $value);
        }

        // Initialize the propeties using given arguments
        if ($this->_initializationNeededArguments !== null && $properties !== null) {
            $numberOfNeededArguments = count($this->_initializationNeededArguments);

            MethodCallManager::assertArgsNumber($numberOfNeededArguments, $properties);

            for ($i = 0; $i < $numberOfNeededArguments; $i++) {
                $propertyName = $this->_initializationNeededArguments[$i];
                $argument = $properties[$i];

                $this->assertPropertyValue($propertyName, $argument);
                $this->$propertyName = $argument;
                $this->updateInitializedPropertyValue($propertyName, $argument);
            }
        }
    }
protected function initializeProperties ( $ properties = null ) { $ this -> getPropertiesInfo ( ) ; // Initialize the properties that were defined using the Initialize / InitializeObject annotations $ initializeValueValidationEnabled = Configuration :: isInitializeValuesValidationEnabled ( ) ; foreach ( $ this -> _initialPropertiesValues as $ propertyName => $ initialization ) { $ value = null ; switch ( $ initialization [ 'type' ] ) { case 'initialize' : $ value = $ initialization [ 'value' ] ; break ; default : $ className = $ initialization [ 'value' ] ; $ value = new $ className ( ) ; break ; } if ( $ initializeValueValidationEnabled ) { $ this -> assertPropertyValue ( $ propertyName , $ value ) ; } $ this -> $ propertyName = $ value ; $ this -> updateInitializedPropertyValue ( $ propertyName , $ value ) ; } // Initialize the propeties using given arguments if ( $ this -> _initializationNeededArguments !== null && $ properties !== null ) { $ numberOfNeededArguments = count ( $ this -> _initializationNeededArguments ) ; MethodCallManager :: assertArgsNumber ( $ numberOfNeededArguments , $ properties ) ; for ( $ i = 0 ; $ i < $ numberOfNeededArguments ; $ i ++ ) { $ propertyName = $ this -> _initializationNeededArguments [ $ i ] ; $ argument = $ properties [ $ i ] ; $ this -> assertPropertyValue ( $ propertyName , $ argument ) ; $ this -> $ propertyName = $ argument ; $ this -> updateInitializedPropertyValue ( $ propertyName , $ argument ) ; } } }
Initializes the object according to its class specification and given arguments.

@param array $properties The values to give to the properties.
Initializes the object according to its class specification and given arguments .