Validate and process custom signatures (if there are any)
@param XBRL $taxonomy
@return bool
513045
private function validateCustomFunction( $taxonomy )
	{

		// Get any variable sets.  These will be headed by a formula.
		$signatures = $taxonomy->getGenericResource( 'customfunction',  'signature' );
		$implementationResources = $taxonomy->getGenericResource( 'customfunction',  'implementation' );

		// Make sure any implementations have signatures
		if ( $implementationResources )
		{
			foreach ( $implementationResources as $x => $implementationResource )
			{
				// TODO
			}
		}

		if ( ! $signatures ) return true;

		foreach ( $signatures as $signatureKey => $signatureReference )
		{
			/** @var Signature $signature */
			$signature = Signature::fromArray( $signatureReference['customfunction'] );

			// Make sure the signature label has not been used already
			if ( isset( $this->signatures[ $signatureReference['resourceName'] ] ) )
			{
				$this->log->formula_validation( "custom function", "More than one signature has the same label",
					array(
						'error' => 'xbrlcfie:tooManyCFIRelationships',
						'label' => $signatureReference['resourceName']
					)
				);
			}

			$this->signatures[ $signatureReference['resourceName'] ] = $signature;

			if ( ! $signature->validate( null, $this->nsMgr ) )
			{
				return false;
			}

			// Locate the implementation
			$arcs = $taxonomy->getGenericArc( XBRL_Constants::$arcRoleCustomFunctionImplementation, $signatureReference['roleUri'], $signatureReference['resourceName'] );
			$implementations = array();
			foreach ( $arcs as $arc )
			{
				foreach ( $implementationResources as $implementationResourceKey => $implementationResource )
				{
					if ( $implementationResource['resourceName'] !=  $arc['label'] ) continue;
					if ( $implementationResource['roleUri'] !=  $arc['toRoleUri'] ) continue;

					$resource = $implementationResource['customfunction'];
					$resource['linkbase'] = $implementationResource['linkbase'];
					$implementations[] = Implementation::fromArray( $resource );
					unset( $implementationResources[ $implementationResourceKey ] );
				}

			}

			if ( count( $implementations ) > 1 )
			{
				$this->log->formula_validation( "custom function", "More than one signature has the same label",
					array(
						'error' => 'xbrlcfie:tooManyCFIRelationships',
						'label' => $signatureReference['resourceName'],
						'implementations' => implode( ", ", array_reduce( $implementations, function( $carry, $item ) { $carry[] = $item->label; return $carry; }, [] ) ),
					)
				);
			}

			if ( ! count( $implementations ) )
			{
				// If there is no explicit implementation make sure there is an existing function with this signature
				$functionTable = FunctionTable::getInstance();
				$functionDef = $functionTable->Bind( $signature->name['name'], $signature->name['namespace'], count( $signature->inputs ) );
				if ( ! $functionDef )
				{
					$this->log->formula_validation( 'Custom function', 'Missing implementation for signature', array(
						'signature' => $signatureReference['resourceName'],
						// 'error' => 'xbrlcfie:missingCFIRelationship'
					) );

					// return false;
				}
			}

			foreach ( $implementations as $implementation )
			{
				if ( count( $implementation->inputs ) != count( $signature->inputs ) )
				{
					$this->log->formula_validation( 'Custom function', 'Different parameter counts for implementation and signature', array(
						'signature' => $signatureReference['resourceName'],
						'signature count' => count( $signature->inputs ),
						'$implementation count' => count( $implementation->inputs ),
						'error' => 'xbrlcfie:inputMismatch'
					) );

					return false;
				}

				// Add a defintion to the function table
				$functionTable = FunctionTable::getInstance();
				$parameters = $this->parameterQnames;
				$functionTable->AddWithArity( $signature->name['namespace'], $signature->name['name'],  count( $signature->inputs ), $signature->output,
					function( $context, $provider, $args ) use( $implementation, $signature, $parameters )
					{
						return $implementation->execute( $signature, $context, $provider, $args, $parameters );
					}
				);

			}

			$this->signatures[ $signatureReference['resourceName'] ]->implementations = $implementations;
		}

		if ( count( $implementationResources ) )
		{
			$this->log->formula_validation( "custom function", "One or more implementations do not have a signature",
				array(
					'error' => 'xbrlcfie:missingCFIRelationship',
					'implementations' => implode( ", ", array_reduce( $implementations, function( $carry, $item ) { $carry[] = $item->label; return $carry; }, [] ) ),
				)
			);
		}

		return true;
	}
92545
protected function _validateTermsAndConditions()
    {
        $blValid = true;
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if ($oConfig->getConfigParam('blConfirmAGB') && !$oConfig->getRequestParameter('ord_agb')) {
            $blValid = false;
        }

        if ($oConfig->getConfigParam('blEnableIntangibleProdAgreement')) {
            $oBasket = $this->getBasket();

            $blDownloadableProductsAgreement = $oConfig->getRequestParameter('oxdownloadableproductsagreement');
            if ($blValid && $oBasket->hasArticlesWithDownloadableAgreement() && !$blDownloadableProductsAgreement) {
                $blValid = false;
            }

            $blServiceProductsAgreement = $oConfig->getRequestParameter('oxserviceproductsagreement');
            if ($blValid && $oBasket->hasArticlesWithIntangibleAgreement() && !$blServiceProductsAgreement) {
                $blValid = false;
            }
        }

        return $blValid;
    }
375301
public function hasSigned(Signature $signature)
    {
        $key = openssl_pkey_get_public($this->x509Cert);

        try {
            $hasSigned = $signature->isSignedByKey($key);
        } catch (\Excetpion $e) {
            openssl_pkey_free($key);
            throw $e;
        }

        openssl_pkey_free($key);

        return $hasSigned;
    }
29184
public static function setConceptualModelRoles( $taxonomy = null )
	{
		$cmTaxonomy = $taxonomy ? $taxonomy->getTaxonomyForXSD("cm.xsd") : null;
		if ( $cmTaxonomy )
		{
			$nonDimensionalRoleRef = $cmTaxonomy->getNonDimensionalRoleRefs( XBRL_Constants::$defaultLinkRole );
			if ( isset( $nonDimensionalRoleRef[ XBRL_Constants::$defaultLinkRole ] ) )
			{
				$cmArcRoles = $nonDimensionalRoleRef[ XBRL_Constants::$defaultLinkRole ];
				self::$conceptualModelRoles = $cmArcRoles;

				return;
			}
		}

		// Fallback
		self::$conceptualModelRoles = self::$defaultConceptualModelRoles;
	}
1036431
public function isApiSignatureValid(BBUserToken $token, $signaturePresented)
   {
       return StringUtils::equals($this->createSignature($token), $signaturePresented);
   }
412065
public function isPackage()
	{
		// A SEC JSON package has a file called <ciknumber>-manifest.xml
		try
		{
			$manifest = $this->getFile( XBRL_SEC_XML_Package::manifestFilename );
			if ( ! $manifest )
			{
				throw XBRL_TaxonomyPackageException::withError( "tpe:metadataFileNotFound", "The package does not contain a manifest.xml file" );
			}

			return $this->isValidMetaFile();
		}
		catch ( Exception $ex )
		{
			$code = $ex instanceof XBRL_TaxonomyPackageException ? $ex->error : $ex->getCode();
			$this->errors[ $code ] = $ex->getMessage();
		}

		return false;

	}
945564
public function isValidCatalogFile()
	{
		if ( $this->catalog || !
			 isset( $this->contents[ key( $this->contents ) ][ XBRL_TaxonomyPackage::metaFolderName ] ) ||
			 ! in_array( XBRL_TaxonomyPackage::catalogFilename, $this->contents[ key( $this->contents ) ][ XBRL_TaxonomyPackage::metaFolderName ] ) ) return true;

		$catalogFilePath = key( $this->contents ) . "/" . XBRL_TaxonomyPackage::metaFolderName . "/" . XBRL_TaxonomyPackage::catalogFilename;

		try
		{
			// The XML should be valid
			$xml = $this->getFileAsXML( $catalogFilePath );
			// Can't access the namespace of an element from SimpleXML so use the DOM version
			$dom = dom_import_simplexml( $xml );
			$namespace = $dom->namespaceURI;
			unset( $dom );

			// The root element should be taxonomyPackage
			if ( $xml->getName() != XBRL_TaxonomyPackage::catalogRootElementNme )
			{
				throw XBRL_TaxonomyPackageException::withError( "tpe:invalidCatalogFile", $ex->getMessage() );
			}

			$this->catalog = $xml;
			$rewriteURIs = array();

			foreach ( $xml->children( $namespace ) as $name => $element )
			{
				switch ( $name )
				{
					case 'rewriteURI':

						$elementAttributes = $element->attributes();
						if ( ! isset( $elementAttributes->rewritePrefix ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:invalidCatalogFile", "The @rewriteURI attribute is missing" );
						}

						if ( ! isset( $elementAttributes->uriStartString ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:invalidCatalogFile", "The @uriStartString attribute is missing" );
						}

						$rewriteURI = (string)$elementAttributes->rewritePrefix ;
						$uriStartString = (string)$elementAttributes->uriStartString ;

						if ( isset( $rewriteURIs[ $uriStartString ] ) )
						{
							throw XBRL_TaxonomyPackageException::withError( "tpe:multipleRewriteURIsForStartString", "There is more than one @uriStartString with the value '$uriStartString'" );
						}

						$rewriteURIs[ $uriStartString ] = $rewriteURI;

						unset( $elementAttributes );
						unset( $rewriteURI );
						unset( $uriStartString );

						break;
				}
			}

			$this->rewriteURIs = $rewriteURIs;

			unset( $name );
			unset( $element );
			unset( $xml );
		}
		catch ( XBRL_TaxonomyPackageException $ex )
		{
			throw $ex;
		}
		catch ( Exception $ex )
		{
			throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", $ex->getMessage() );
		}

		return true;
	}
786630
protected function validateElementWithKeys(
        SignedElement $element,
        \SAML2\Utilities\ArrayCollection $pemCandidates
    ) : bool {
        $lastException = null;
        foreach ($pemCandidates as $index => $candidateKey) {
            $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, ['type' => 'public']);
            $key->loadKey($candidateKey->getCertificate());

            try {
                /*
                 * Make sure that we have a valid signature on either the response or the assertion.
                 */
                $result = $element->validate($key);
                if ($result) {
                    $this->logger->debug(sprintf('Validation with key "#%d" succeeded', $index));
                    return true;
                }
                $this->logger->debug(sprintf('Validation with key "#%d" failed without exception.', $index));
            } catch (\Exception $e) {
                $this->logger->debug(sprintf(
                    'Validation with key "#%d" failed with exception: %s',
                    $index,
                    $e->getMessage()
                ));

                $lastException = $e;
            }
        }

        if ($lastException !== null) {
            throw $lastException;
        } else {
            return false;
        }
    }
532884
public function validateDFR( $formulas )
	{
		$log = XBRL_Log::getInstance();

		// Makes sure they are reset in case the same taxonomy is validated twice.
		$this->calculationNetworks = array();
		$this->presentationNetworks = array();
		$this->definitionNetworks = $this->getAllDefinitionRoles();

		foreach ( $this->definitionNetworks as $elr => &$roleRef )
		{
			$roleRef = $this->getDefinitionRoleRef( $elr );

			if ( property_exists( $this, 'definitionRoles' ) && ! in_array( $elr, $this->definitionRoles ) )
			{
				unset( $this->definitionNetworks[ $elr ] );
				continue;
			}

			// Capture primary items
			$this->definitionPIs[ $elr ] = array_filter( array_keys( $roleRef['primaryitems'] ), function( $label )
			{
				$taxonomy = $this->getTaxonomyForXSD( $label );
				$element = $taxonomy->getElementById( $label );
				return ! $element['abstract' ];
			} );

			sort( $this->definitionPIs[ $elr ] );

			// Check members
			foreach ( $roleRef['members'] as $memberLabel => $member )
			{
				$memberTaxonomy = $this->getTaxonomyForXSD( $memberLabel );
				$memberElement = $memberTaxonomy->getElementById( $memberLabel );

				if ( ! $memberElement['abstract' ] )
				{
					$log->business_rules_validation('Model Structure Rules', 'All dimension member elements MUST be abstract',
						array(
							'member' => $memberLabel,
							'role' => $elr,
							'error' => 'error:MemberRequiredToBeAbstract'
						)
					);
				}

				// BMS 2019-03-23 TODO typed members MUST NOT use complex types

				unset( $memberTaxonomy );
				unset( $memberElement );
			}

			// Check hypercube
			foreach ( $roleRef['hypercubes'] as $hypercubeLabel => $hypercube )
			{
				foreach ( $hypercube['parents'] as $primaryItemLabel => $primaryItem )
				{
					if ( ! $primaryItem['closed'] )
					{
						if ( ! isset( $this->definitionNetworks[ $elr ]['primaryitems'][ $primaryItemLabel ]['parents']  ) ) // Only report the error on the line items node
						{
							$log->business_rules_validation('Model Structure Rules', 'All line items to hypercubes MUST be closed',
								array(
									'hypercube' => $hypercubeLabel,
									'primary item' => $primaryItemLabel,
									'role' => $elr,
									'error' => 'error:HypercubesRequiredToBeClosed'
								)
							);
						}
					}

					if ( $primaryItem['arcrole'] == XBRL_Constants::$arcRoleNotAll )
					{
						$log->business_rules_validation('Model Structure Rules', 'All line items to hypercubes MUST be \'all\'',
							array(
								'hypercube' => $hypercubeLabel,
								'primary item' => $primaryItemLabel,
								'role' => $elr,
								'error' => 'error:HypercubeMustUseAllArcrole'
							)
						);
					}

					if ( $primaryItem['contextElement'] != XBRL_Constants::$xbrliSegment )
					{
						$log->business_rules_validation('Model Structure Rules', 'Dimensions in contexts MUST use the segment container',
							array(
								'hypercube' => $hypercubeLabel,
								'primary item' => $primaryItemLabel,
								'role' => $elr,
								'error' => 'error:DimensionsMustUseSegmentContainer'
							)
						);
					}
				}
			}
		}

		unset( $roleRef );

		$this->calculationNetworks = $this->getCalculationRoleRefs();
		$this->calculationNetworks = array_filter( $this->calculationNetworks, function( $roleRef ) { return isset( $roleRef['calculations'] ); } );
		foreach ( $this->calculationNetworks as $elr => $role )
		{
			if ( property_exists( $this, 'calculationRoles' ) && ! in_array( $elr, $this->calculationRoles ) )
			{
				unset( $this->calculationNetworks[ $elr ] );
				continue;
			}

			if ( ! isset( $role['calculations'] ) ) continue;

			foreach ( $role['calculations'] as $totalLabel => $components )
			{
				$calculationELRPIs = array_keys( $components );
				$calculationELRPIs[] = $totalLabel;

				$this->calculationPIs[ $elr ] = isset( $this->calculationPIs[ $elr ] )
					? array_merge( $this->calculationPIs[ $elr ], $calculationELRPIs )
					: $calculationELRPIs;
			}

			unset( $calculationELRPIs );
		}

		$this->presentationNetworks = &$this->getPresentationRoleRefs();

		if ( property_exists( $this, 'presentationRoles' ) )
		foreach ( $this->presentationNetworks as $elr => $role )
		{
			if ( in_array( $elr, $this->presentationRoles ) ) continue;
			unset( $this->presentationNetworks[ $elr ] );
		}

		// Check the definition and presentation roles are consistent then make sure the calculation roles are a sub-set
		if ( $this->definitionNetworks && array_diff_key( $this->presentationNetworks, $this->definitionNetworks ) || array_diff_key( $this->definitionNetworks, $this->presentationNetworks ) )
		{
			$log->business_rules_validation('Model Structure Rules', 'Networks in defintion and presentation linkbases MUST be the same',
				array(
					'presentation' => implode( ', ', array_keys( array_diff_key( $this->presentationNetworks, $this->definitionNetworks ) ) ),
					'definition' => implode( ', ', array_keys( array_diff_key( $this->definitionNetworks, $this->presentationNetworks ) ) ),
					'error' => 'error:NetworksMustBeTheSame'
				)
			);
		}
		else
		{
			if ( array_diff_key( $this->calculationNetworks, $this->presentationNetworks ) )
			{
				$log->business_rules_validation('Model Structure Rules', 'Networks in calculation linkbases MUST be a sub-set of those in definition and presentation linkbases',
					array(
						'calculation' => implode( ', ', array_keys( array_diff_key( $this->calculationNetworks, $this->presentationNetworks ) ) ),
						'error' => 'error:NetworksMustBeTheSame'
					)
				);
			}
		}

		$presentationRollupPIs = array();

		foreach ( $this->presentationNetworks as $elr => &$role )
		{
			$this->presentationPIs[$elr] = array();

			foreach ( $role['locators'] as $id => $label )
			{
				$taxonomy = $this->getTaxonomyForXSD( $label );
				$element = $taxonomy->getElementById( $label );

				if ( $element['abstract'] || $element['type'] == 'nonnum:domainItemType' ) continue;

				// One or more of the labels may include the preferred label role so convert all PIs back to their id
				$this->presentationPIs[$elr][] = $taxonomy->getTaxonomyXSD() . "#{$element['id']}";

				// BMS 2019-03-23 TODO Check the concept is not a tuple
			}

			// If there were preferred label roles in any of the PIs then there will be duplicates.  This also sorts the list.
			$this->presentationPIs[ $elr ] = array_unique( $this->presentationPIs[ $elr ] );

			// This set of closures will become methods in a class
			$formulasForELR = array();
			if ( $formulas )
			{
				$variableSets = $formulas->getVariableSets();
				foreach ( $variableSets as $variableSetQName => $variableSetForQName )
				{
					foreach ( $variableSetForQName as /** @var ValueAssertion $variableSet */ $variableSet )
					{
						if ( $variableSet->extendedLinkRoleUri != $elr ) continue;
						if ( ! $variableSet instanceof ValueAssertion ) continue;
						$formulasForELR[] = $variableSet;
					}
				}
			}

			$calculationELRPIs = isset( $this->calculationPIs[ $elr ] ) ? $this->calculationPIs[ $elr ] : array();

			$axes = array();
			$lineItems = array();
			$tables = array();
			$concepts = array();

			$this->processNodes( $role['hierarchy'], null, false, $this->allowed['cm.xsd#cm_Network'], false, $calculationELRPIs, $elr, $presentationRollupPIs, $tables, $lineItems, $axes, $concepts, $formulasForELR );

			if ( isset( $this->definitionNetworks[ $elr ] ) )
			{
				if ( count( $tables ) != 1 )
				{
					XBRL_Log::getInstance()->business_rules_validation('Model Structure Rules', 'There MUST be one and only one table per network',
						array(
							'tables' => $tables ? implode( ', ', $tables ) : 'There is no table',
							'role' => $elr,
							'error' => 'error:MustBeOnlyOneTablePerNetwork'
						)
					);
				}

				if (  count( $lineItems ) != 1 )
				{
					XBRL_Log::getInstance()->business_rules_validation('Model Structure Rules', 'There MUST be one and only one line items node per table',
						array(
							'lineitems' => $lineItems ? implode( ', ', $lineItems ) : 'There is no line item node',
							'role' => $elr,
							'error' => 'error:OneAndOnlyOneLineItems'
						)
					);
				}
			}
			else if ( $tables )
			{
				// If there are tables defined in the presentation but no tables in the defintion then drop the presentation
				unset( $this->presentationNetworks['$elr'] );
			}

			$role['axes'] = $axes;
			$role['tables'] = $tables;
			$role['lineitems'] = $lineItems;
			$role['concepts'] = $concepts;
		}

		unset( $role );


		// The set of line items used in calculation, definition and presentation linkbases should be the same
		// First check there are consistent networks
		$commonRoles = array_intersect_key( $this->definitionPIs, $this->presentationPIs );

		foreach ( $commonRoles as $elr => $role )
		{
			if ( isset( $presentationRollupPIs[ $elr ] ) )
			{
				$diff = array_unique( array_merge( array_diff( $presentationRollupPIs[ $elr ], $this->calculationPIs[ $elr ] ), array_diff( $this->calculationPIs[ $elr ], $presentationRollupPIs[ $elr ] ) ) );
				if ( $diff )
				{
					$log->business_rules_validation('Model Structure Rules', 'Calculation primary items MUST be the same as presentation items that are used in rollup blocks',
						array(
							'primary item' => implode( ',', $diff ),
							'role' => $elr,
							'error' => 'error:CalculationRelationsMissingConcept'
						)
					);
				}
			}

			$diff = array_unique( array_diff( $this->definitionPIs[ $elr ], $this->presentationPIs[ $elr ] ) );
			if ( $diff )
			{
				$log->business_rules_validation('Model Structure Rules', 'Presentation primary items MUST be the same as definition primary items',
					array(
						'primary item' => implode( ',', $diff ),
						'role' => $elr,
						'error' => 'error:PresentationRelationsMissingConcept'
					)
				);
			}

			$diff = array_unique( array_diff( $this->presentationPIs[ $elr ], $this->definitionPIs[ $elr ] ) );
			if ( $diff )
			{
				$log->business_rules_validation('Model Structure Rules', 'Definition primary items MUST be the same as presentation primary items',
					array(
						'primary item' => implode( ',', $diff ),
						'role' => $elr,
						'error' => 'error:DefinitionRelationsMissingConcept'
					)
				);
			}
		}

		return $this->presentationNetworks;
	}
318843
private function checkSignature($request)
	{
		if($clientInfo = $this->getClientInfo($request['appId'])){
			if($this->getSign($clientInfo['token'],$request['nonce'],$request['timestamp']) == $request['signature'])
				return true;
			return false;
		}else{
			return false;
		}
	}
829664
private function validateGeneralSpecial( XBRL_Types &$types )
	{
		$roles =& $this->getInstanceTaxonomy()->getGeneralSpecialRoleRefs();

		/* ---------------------------------------------------------
		 * Look for directed cycles
		 * ---------------------------------------------------------
		 */

		/**
		 * Examine the arcs recursively to look for directed cycles.
		 * If there are directed cyles then the $alias of an arc will appear in the list of $parents
		 *
		 * @var function $detectDirected
		 * @param string $source
		 * @param array $parents
		 * @return bool
		 */
		$detectDirected = function( $roleKey, $source, $parents = array() ) use( &$detectDirected, &$roles )
		{
			foreach ( $roles[ $roleKey ]['rules'][ $source ] as $target => $details )
			{
				if ( $target == $source || in_array( $target, $parents ) )
				{
					XBRL_Log::getInstance()->instance_validation( "5.2.6.2.1", "The general special arcs contain directed cycles",
						array(
							'path' => implode( '->', array_merge( $parents, array( $target ) ) ),
						)
					);
					return true;
				}

				if ( ! isset( $roles[ $roleKey ]['rules'][ $target ] ) ) continue;

				if ( $detectDirected( $roleKey, $target, array_merge( $parents, array( $source ) ) ) ) return true;
			}

			return false;
		};

		foreach ( $roles as $roleKey => $role )
		{
			if ( ! isset( $role['rules'] ) ) continue;

			foreach ( $role['rules'] as $from => $items )
			{
				if ( $detectDirected( $roleKey, $from ) )
				{
					break;
				}
			}
		}

	}
1301956
public function validate($xsd = null)
    {
        if (!$xsd) {
            $xsdPath = __DIR__ . '/../../../resources/xsd/';
            $xsd = $xsdPath . 'rampage/core/ModuleManifest.xsd';
        }

        try {
            $dom = new DOMDocument();
            $dom->loadXML($this->getXml()->asXML());

            $result = $dom->schemaValidate($xsd);
            unset($dom);
        } catch (\Exception $e) {
            return false;
        }

        return $result;
    }
494726
private function isValidMetaFile()
	{
		if ( $this->metaFile ) return true;

		try
		{
			$this->metaFile = $this->getFileAsXML( XBRL_SEC_XML_Package::manifestFilename );
			$this->processElement( $this->metaFile->children() );
			$xbrlFilings = $this->metaFile->children('http://www.sec.gov/Archives/edgar')->xbrlFiling;
			$this->processElement( $xbrlFilings->children( XBRL_SEC_XML_Package::edgarNamespace ) );
			$xbrlFiles = $xbrlFilings->xbrlFiles;
			$this->processXBRLFiles( $xbrlFiles->children( XBRL_SEC_XML_Package::edgarNamespace ) );

			$schemaFileList = array_filter( $this->files, function( $item ) {
				return XBRL::endsWith( $item, '.xsd' );
			} );

			if ( count( $schemaFileList ) != 1 )
			{
				throw XBRL_TaxonomyPackageException::withError( "tpe:schemaFileNotFound", "The package does not contain a schema (.xsd) file" );
			}

			// $this->schemaFile = reset( $schemaFileList );
			$this->determineSchemaFile();
		}
		catch ( XBRL_TaxonomyPackageException $ex )
		{
			throw $ex;
		}
		catch ( Exception $ex )
		{
			throw XBRL_TaxonomyPackageException::withError( "tpe:invalidMetaDataFile", $ex->getMessage() );
		}

		return true;
	}
1334917
private function check_signature(){
        if (!isset($this->config['token']) || empty($this->config['token'])) throw new \Exception('token is not defined!');
        $signature = $_GET["signature"];
        $timestamp = $_GET["timestamp"];
        $nonce = $_GET["nonce"];
        $tmp = [$this->config['token'],$timestamp,$nonce];
        sort($tmp,SORT_STRING);
        $tmp_str = implode($tmp);
        $tmp_str = sha1($tmp_str);
        if ($tmp_str == $signature) return true;
        return false;
    }
1317980
public function create($taxonomy)
    {
        if (!($taxonomy instanceof stdClass)) {
            $taxonomy = get_taxonomy($taxonomy);
        }

        return new Taxonomy($taxonomy, $this->termFactory);
    }
1290528
protected function isValidTag(string $tag, Message $message = null): void
    {
        $allowedTag = $this->getAllowedTag();
        if (!\in_array($tag, $allowedTag, true)) {
            throw new InvalidKeyException(sprintf(
                'tag must be either "%s".',
                implode(', ', $allowedTag)
            ));
        }

        if ($tag === SendInterface::TAG_ISSUE_RESOLUTION && $message !== null && !$message instanceof GenericTemplate) {
            throw new InvalidClassException(sprintf(
                'message must be an instance of %s if tag is set to %s.',
                GenericTemplate::class,
                SendInterface::TAG_ISSUE_RESOLUTION
            ));
        }
    }
1263906
protected function validateTag($version)
    {
        try {
            if (!strpos($version, '/')) {
                return false;
            }
            return $this->versionParser->normalize(
                $this->_getBranchWithoutNamespace($version)
            );
        } catch (\Exception $e) {
            return false;
        }
    }