src/Analyse/Code/Codegen.php
public function generateSource(Model $model)
    {
        if ($this->allowCodegen === true) {
            // We handle the first one special, because we need to add the original
            // variable name to the source generation.
            if ($this->firstRun === true) {
                $this->firstRun = false;
                return $this->concatenation($model);
            }

            // Test for constants.
            // They have no connectors, but are marked as such.
            // although this is meta stuff, we need to add the stop info here.
            if ($model->getIsMetaConstants() === true) {
                // We must only take the stuff from the constant itself
                return ';stop;';
            }

            $connectors = $model->getConnectorLeft() . $model->getConnectorRight();
            if (empty($connectors) === true) {
                // No connectors, no nothing. We must be dealing with meta stuff.
                // We will ignore this one.
                return '';
            }

            // Debug methods are always public.
            if ($model->getType() === static::TYPE_DEBUG_METHOD) {
                return $this->concatenation($model);
            }

            // Multi line code generation starts here.
            if ($model->getMultiLineCodeGen() === static::ITERATOR_TO_ARRAY) {
                return 'iterator_to_array(;firstMarker;)' . $this->concatenation($model);
            }

            // Test for private or protected access.
            if ($model->getIsPublic() === true) {
                return $this->concatenation($model);
            }

            // Test if we are inside the scope. Everything within our scope is reachable.
            if ($this->pool->scope->testModelForCodegen($model) === true) {
                // We are inside the scope, this value, function or class is reachable.
                return $this->concatenation($model);
            }

            // We are still here? Must be a protected method or property.
            // The '. . .' will tell the code generation to stop in it's tracks
            // and do nothing.
        }

        // No code generation in this path.
        // We must prevent code generation when copying stuff here by recursion
        // resolving by adding these dots.
        return static::UNKNOWN_VALUE;
    }
public function generateSource(Model $model)
    {
        if ($this->allowCodegen === true) {
            // We handle the first one special, because we need to add the original
            // variable name to the source generation.
            if ($this->firstRun === true) {
                $this->firstRun = false;
                return $this->concatenation($model);
            }

            // Test for constants.
            // They have no connectors, but are marked as such.
            // although this is meta stuff, we need to add the stop info here.
            if ($model->getIsMetaConstants() === true) {
                // We must only take the stuff from the constant itself
                return ';stop;';
            }

            $connectors = $model->getConnectorLeft() . $model->getConnectorRight();
            if (empty($connectors) === true) {
                // No connectors, no nothing. We must be dealing with meta stuff.
                // We will ignore this one.
                return '';
            }

            // Debug methods are always public.
            if ($model->getType() === static::TYPE_DEBUG_METHOD) {
                return $this->concatenation($model);
            }

            // Multi line code generation starts here.
            if ($model->getMultiLineCodeGen() === static::ITERATOR_TO_ARRAY) {
                return 'iterator_to_array(;firstMarker;)' . $this->concatenation($model);
            }

            // Test for private or protected access.
            if ($model->getIsPublic() === true) {
                return $this->concatenation($model);
            }

            // Test if we are inside the scope. Everything within our scope is reachable.
            if ($this->pool->scope->testModelForCodegen($model) === true) {
                // We are inside the scope, this value, function or class is reachable.
                return $this->concatenation($model);
            }

            // We are still here? Must be a protected method or property.
            // The '. . .' will tell the code generation to stop in it's tracks
            // and do nothing.
        }

        // No code generation in this path.
        // We must prevent code generation when copying stuff here by recursion
        // resolving by adding these dots.
        return static::UNKNOWN_VALUE;
    }
public function generateSource ( Model $ model ) { if ( $ this -> allowCodegen === true ) { // We handle the first one special, because we need to add the original // variable name to the source generation. if ( $ this -> firstRun === true ) { $ this -> firstRun = false ; return $ this -> concatenation ( $ model ) ; } // Test for constants. // They have no connectors, but are marked as such. // although this is meta stuff, we need to add the stop info here. if ( $ model -> getIsMetaConstants ( ) === true ) { // We must only take the stuff from the constant itself return ';stop;' ; } $ connectors = $ model -> getConnectorLeft ( ) . $ model -> getConnectorRight ( ) ; if ( empty ( $ connectors ) === true ) { // No connectors, no nothing. We must be dealing with meta stuff. // We will ignore this one. return '' ; } // Debug methods are always public. if ( $ model -> getType ( ) === static :: TYPE_DEBUG_METHOD ) { return $ this -> concatenation ( $ model ) ; } // Multi line code generation starts here. if ( $ model -> getMultiLineCodeGen ( ) === static :: ITERATOR_TO_ARRAY ) { return 'iterator_to_array(;firstMarker;)' . $ this -> concatenation ( $ model ) ; } // Test for private or protected access. if ( $ model -> getIsPublic ( ) === true ) { return $ this -> concatenation ( $ model ) ; } // Test if we are inside the scope. Everything within our scope is reachable. if ( $ this -> pool -> scope -> testModelForCodegen ( $ model ) === true ) { // We are inside the scope, this value, function or class is reachable. return $ this -> concatenation ( $ model ) ; } // We are still here? Must be a protected method or property. // The '. . .' will tell the code generation to stop in it's tracks // and do nothing. } // No code generation in this path. // We must prevent code generation when copying stuff here by recursion // resolving by adding these dots. return static :: UNKNOWN_VALUE ; }
Generates PHP sourcecode.

From the 2 connectors and from the name of name/key of the attribute
we can generate PHP code to actually reach the corresponding value.
This function generates this code.

@param \Brainworxx\Krexx\Analyse\Model $model
The model, which hosts all the data we need.

@return string
The generated PHP source.
Generates PHP sourcecode .