public function getExchangeResult($type, $module)
    {
        if (in_array($module, self::$allowedModules) === false) {
            throw new \Exception('Module '.$module.' not allowed');
        }

        //$found = false;
        $value = 0;
        if (!$this->getXmlData()->exchanges) {
            return 0;
        }
        foreach ($this->getXmlData()->exchanges->exchange as $result) {
            $resultType = $result->referenceToFlowDataSet->shortDescription;
            $resultType = (string) $resultType[0];
            if (preg_match($type, $resultType)) {
                //$found = true;
                foreach ($result->other->amount as $amount) {
                    $resultModule = (string) $amount->attributes()->module;
                    if ($resultModule === $module) {
                        $value = (float) $amount;

                        return $value;
                    }
                }
            } else {
                continue;
            }
        }

        //if (!$found) {
        //    throw new \Exception($type.': Type not found in Exchange result for Module '.$module.' in UUID:'.$this->getUUID());
        //}


        return $value;
    }
public function getExchangeResult($type, $module)
    {
        if (in_array($module, self::$allowedModules) === false) {
            throw new \Exception('Module '.$module.' not allowed');
        }

        //$found = false;
        $value = 0;
        if (!$this->getXmlData()->exchanges) {
            return 0;
        }
        foreach ($this->getXmlData()->exchanges->exchange as $result) {
            $resultType = $result->referenceToFlowDataSet->shortDescription;
            $resultType = (string) $resultType[0];
            if (preg_match($type, $resultType)) {
                //$found = true;
                foreach ($result->other->amount as $amount) {
                    $resultModule = (string) $amount->attributes()->module;
                    if ($resultModule === $module) {
                        $value = (float) $amount;

                        return $value;
                    }
                }
            } else {
                continue;
            }
        }

        //if (!$found) {
        //    throw new \Exception($type.': Type not found in Exchange result for Module '.$module.' in UUID:'.$this->getUUID());
        //}


        return $value;
    }
public function getExchangeResult ( $ type , $ module ) { if ( in_array ( $ module , self :: $ allowedModules ) === false ) { throw new \ Exception ( 'Module ' . $ module . ' not allowed' ) ; } //$found = false; $ value = 0 ; if ( ! $ this -> getXmlData ( ) -> exchanges ) { return 0 ; } foreach ( $ this -> getXmlData ( ) -> exchanges -> exchange as $ result ) { $ resultType = $ result -> referenceToFlowDataSet -> shortDescription ; $ resultType = ( string ) $ resultType [ 0 ] ; if ( preg_match ( $ type , $ resultType ) ) { //$found = true; foreach ( $ result -> other -> amount as $ amount ) { $ resultModule = ( string ) $ amount -> attributes ( ) -> module ; if ( $ resultModule === $ module ) { $ value = ( float ) $ amount ; return $ value ; } } } else { continue ; } } //if (!$found) { //    throw new \Exception($type.': Type not found in Exchange result for Module '.$module.' in UUID:'.$this->getUUID()); //} return $ value ; }
Retrieve the Exchange Result value

@param string $type   the lciaresult type (e.g. EXCHANGERESULT_TYPE_FW)
@param string $module the module type (A1, A2, A3, A1-A3, ...)

@return float
@throws \Exception
Retrieve the Exchange Result value