Part of the validation system to report that the content of the linkbase file does not match the role specified

@param array $linkbaseRef An array containing standard linkbase information
@param string $linkbase
@return false
971047
private function reportNoRoleLinks( $linkbaseRef, $linkbase )
	{
		$xml_basename = basename( $linkbaseRef['href'] );

		$this->log()->taxonomy_validation( "4.3.3", "The content of the linkbase file does not match the role specified",
			array(
				'url' => "'$xml_basename'",
				'role' => "'{$linkbaseRef['role']}'",
				'link type' => $linkbase,
			)
		);
		return false;
	}
840403
def IsNameBased(link):
    
    if not link:
        return False

    # trimming the leading "/"
    if link.startswith('/') and len(link) > 1:
        link = link[1:]

    # Splitting the link(separated by "/") into parts 
    parts = link.split('/')

    # First part should be "dbs" 
    if len(parts) == 0 or not parts[0] or not parts[0].lower() == 'dbs':
        return False

    # The second part is the database id(ResourceID or Name) and cannot be empty
    if len(parts) < 2 or not parts[1]:
    	return False

    # Either ResourceID or database name
    databaseID = parts[1]
    	
    # Length of databaseID(in case of ResourceID) is always 8
    if len(databaseID) != 8:
        return True

    return not IsValidBase64String(str(databaseID))
1351574
private function reportMissingArcAttribute( $section, $attributeName, $linkbase ) {
		$this->reportMissingXLinkAttribute( $section, "Arcs MUST include required XLink attributes", $attributeName, $linkbase );
		return false;
	}
267222
protected function getLinkParams($linkName = null, $entityName = null, $isOrmEntityDefs = false, $returns = null)
    {
        if (!isset($linkName)) {
            $linkName = $this->getLinkName();
        }
        if (!isset($entityName)) {
            $entityName = $this->getEntityName();
        }

        $entityDefs = $this->getDefs($isOrmEntityDefs);
        $relationKeyName = $isOrmEntityDefs ? 'relations' : 'links';

        if (isset($entityDefs[$entityName]) && isset($entityDefs[$entityName][$relationKeyName][$linkName])) {
            return $entityDefs[$entityName][$relationKeyName][$linkName];
        }

        return $returns;
    }
445484
private function validateLinkbase( $domElement )
	{
		$linkbasePath = $domElement->getNodePath();
		$this->localLinkbases[ $linkbasePath ] = array( 'roleRef' => array(), 'arcroleRef' => array() );

		// All the children of $domElement should be extended links
		foreach( $domElement->childNodes as $element => /** @var DOMElement $domLink */ $domLink )
		{
			if ( $domLink->nodeType != XML_ELEMENT_NODE ) continue;

			if ( $domLink->localName == 'roleRef' )
			{
				// Create a hash for the roleRef
				$href = $domLink->getAttributeNodeNS( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK], 'href' );
				$roleUri = $domLink->getAttribute("roleURI");
				$hash = $href->nodeValue . $roleUri;
				if ( in_array( $hash, $this->localLinkbases[ $linkbasePath ]['roleRef'] ) )
				{
					$this->log()->taxonomy_validation( "3.5.2.4.5", "Linkbase roleRef has been duplicated",
						array(
							'element' => $domLink->tagName,
							'href' => $href->nodeValue,
							'roleUri' => $roleUri
						)
					);
				}

				$this->localLinkbases[ $linkbasePath ]['roleRef'][] = $hash;
				continue;
			}

			if ( $domLink->localName == 'arcroleRef' )
			{
				// Create a hash for the roleRef
				$href = $domLink->getAttributeNodeNS( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK], 'href' );
				$arcroleUri = $domLink->getAttribute("arcroleURI");
				$hash = $href->nodeValue . $arcroleUri;
				if ( in_array( $hash, $this->localLinkbases[ $linkbasePath ]['arcroleRef'] ) )
				{
					$this->log()->taxonomy_validation( "linkbase", "Linkbase arcroleRef has been duplicated",
						array(
							'element' => $domLink->tagName,
							'href' => $href->nodeValue,
							'arcroleUri' => $arcroleUri
						)
					);
				}

				$this->localLinkbases[ $linkbasePath ]['arcroleRef'][] = $hash;
				continue;
			}

			// Check the xlink:type is extended
			if ( ! $domLink->hasAttributeNS( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK], 'type' ) )
			{
				$this->log()->taxonomy_validation( "linkbase", "Child elements of a linkbase element should be extended links",
					array(
						'element' => $domLink->tagName
					)
				);

				continue;
			}

			if ( ( $domLinkAttribute = $domLink->getAttributeNS( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK], 'type' ) ) != 'extended' )
			{
				$this->log()->taxonomy_validation( "linkbase", "Child elements of a linkbase element should be extended links",
					array(
						'element' => $domLink->tagName,
						'value' => $domLinkAttribute
					)
				);
			}

			// All the children of $domLink should be locators or resources or arcs
			foreach( $domLink->childNodes as $linkElement => /** @var DOMElement $domLinkElement */ $domLinkElement )
			{
				if ( $domLinkElement->nodeType != XML_ELEMENT_NODE ) continue;

				// Check the xlink:type is extended
				if ( ! $domLinkElement->hasAttributeNS( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK], 'type' ) )
				{
					$this->log()->taxonomy_validation( "linkbase", "Child elements of a link element should have an xlink type attribute",
						array(
							'element' => $domLinkElement->tagName
						)
					);

					continue;
				}

				$domLinkElementAttribute = $domLinkElement->getAttributeNS( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK], 'type' );

				if ( ! in_array( $domLinkElementAttribute, array( 'arc', 'locator', 'resource' ) ) )
				{
					$this->log()->taxonomy_validation( "linkbase", "Child elements of a link element should have an xlink type of 'arc' or 'locator' or 'resource'",
						array(
							'element' => $domLinkElement->tagName,
							'value' => $domLinkElementAttribute
						)
					);
				}
			}
		}
	}
136471
private function processCustomLinkbases( &$linkbaseType )
	{
		// $this->log()->info( "Process definition linkbases: " . $this->namespace );
		foreach ( $linkbaseType as $linkbaseRefkey => &$linkbaseRef )
		{
			$this->processCustomLinkbaseArcRoles( $linkbaseRef );
			$linkbaseRef['processed'] = true;
		}
	}
660923
public function updateGenericResource( $roleUri, $linkbase, $resourceName, $index, $resource )
	{
		$this->genericRoles['roles']
				[ $roleUri ]
				['resources']
				[ $linkbase ]
				[ $resourceName ]
				[ $index ] = $resource;
	}
1226033
private function validateXLinkLabel( $linkbase, $value )
	{
		if ( ! XBRL::isValidating() ) return true;

		if ( preg_match( '/^[\pL_]/', $value ) ) return true;
		// if ( ! empty( $value ) && ( ctype_alpha( $value[0] ) || $value[0] == '_' ) ) return true;

		return $this->reportXLinkTypeError( "3.5.3.7.3", "Error validating linkbase", $linkbase, $value );
	}
122827
public function getLinkTblMap($linkTbl = -3)
    {
        if ($linkTbl <= 0) {
            return [];
        }
        $foreigns = SLFields::select('FldName', 'FldForeignTable')
            ->where('FldDatabase', $this->dbID)
            ->where('FldTable', $linkTbl)
            ->where('FldForeignTable', '>', 0)
            ->orderBy('FldOrd', 'asc')
            ->orderBy('FldEng', 'asc')
            ->get();
        if ($foreigns->isNotEmpty() && $foreigns->count() == 2) {
            if (isset($foreigns[0]->FldForeignTable) && isset($this->tbl[$foreigns[0]->FldForeignTable])
                && isset($foreigns[1]->FldForeignTable) && isset($this->tbl[$foreigns[1]->FldForeignTable])
                && isset($this->tbl[$linkTbl]) && isset($this->tblAbbr[$this->tbl[$linkTbl]]) ) {
                return [
                    $this->tbl[$foreigns[0]->FldForeignTable], 
                    $this->tblAbbr[$this->tbl[$linkTbl]] . $foreigns[0]->FldName, 
                    $this->tbl[$linkTbl], 
                    $this->tblAbbr[$this->tbl[$linkTbl]] . $foreigns[1]->FldName, 
                    $this->tbl[$foreigns[1]->FldForeignTable] 
                ];
            }
        }
        return [];
    }
189718
function checkLink($link, $id)
    {
        $result = $this->db->query('SELECT link 
                                      FROM '.$this->articleTable.' 
                                      WHERE link = :link 
                                      AND id != :id',

                              [':link'=>$link,
                               ':id'=>0+$id]);
        if (isset($result[0])) {
            return $result[0]->get('link');
        }
        
            $this->db->query('UPDATE '.$this->articleTable.'
                            SET link = :link
                            WHERE id = :id',

                    [':link'=>$link,
                     ':id'=>0+$id]);
            return false;
    }
325620
function is_link($new = null, $return_entity = false)
    {
        if (isset($new) && ($this->_attributes['is_link'] != $new)){
            $this->change('is_link', (bool)$new);
        }
        if ($return_entity){
            if (!isset($this->_link)){
                if (empty($this->_attributes['is_link'])){
                    $this->_link = false;
                }else
                if (($this->_link = $this->proto(null, true))){
                    if ($p = $this->_link->is_link(null, true)) $this->_link = $p;
                }
            }
            return $this->_link;
        }
        return $this->_attributes['is_link'];
    }
464773
private function calculateFilesReferencingFile(Codebase $codebase, $file)
    {
        $referenced_files = [];

        $file_classes = ClassLikeAnalyzer::getClassesForFile($codebase, $file);

        foreach ($file_classes as $file_class_lc => $_) {
            if (isset(self::$file_references_to_classes[$file_class_lc])) {
                $referenced_files = array_merge(
                    $referenced_files,
                    array_keys(self::$file_references_to_classes[$file_class_lc])
                );
            }
        }

        return array_unique($referenced_files);
    }
854325
public function setLink(string $name, LinkObject $link)
    {
        if (isset($this->links[$name])) {
            throw new LinkOverrideException($this, $name);
        }

        $this->links[$name] = $link;
    }
193326
protected function isValidBase($base) {
    return strlen($base) > 1 && isset($this->partOfSpeech->getWordsList()[$base]) && $this->partOfSpeech->getWordsList()[$base] === $base;
  }
1053375
private function getLinkRoleDescription( $role, $roleType, $roleTitle )
	{
		$href = parse_url( $role['href'] );
		$basename = basename( $href['path'] );
		$roleTypes = $this->getRoleTypes( $role['href'] );
		if ( $roleTypes === false )
		{
			$this->log()->warning( "A role type cannot be found for '$basename'" );
			return false;
		}

		if ( ! isset( $roleTypes[ $roleType ] ) )
		{
			$this->log()->warning( "The role type corresponding to href '$basename' does not include one used on a $roleTitle.'" );
			return false;
		}

		$linkRoleType = $roleTypes[ $roleType ];
		if ( ! isset( $linkRoleType[ $role['roleUri'] ] ) )
		{
			$fragment = isset( $href['fragment'] ) ? $href['fragment'] : "";
			$this->log()->warning( "The $roleTitle of the role type corresponding to href '$basename' does not include an Id with fragment '$fragment'." );
			return false;
		}

		$link = $linkRoleType[ $role['roleUri'] ];
		return isset( $link['definition'] ) ? trim( $link['definition'] ) : $role['roleUri'];
	}
1174497
public function appendLinkObject($key, LinkObject $linkObject) {
		Validator::checkMemberName($key);
		
		if (isset($this->links[$key]) === false) {
			$this->addLinksArray($key, new LinksArray());
		}
		elseif ($this->links[$key] instanceof LinksArray === false) {
			throw new DuplicateException('can not add to key "'.$key.'", it is not an array of links');
		}
		
		$this->links[$key]->addLinkObject($linkObject);
	}
923281
public function validateMetadataEmbeds(EmbedInterface $metadata, MetadataFactory $mf)
    {
        foreach ($metadata->getEmbeds() as $key => $embeddedProp) {
            $this->validateMetadataAttributes($embeddedProp->embedMeta, $mf);
            if ($metadata !== $embeddedProp->embedMeta) {
                // Only re-validate if the embedded prop reference isn't the same as the parent.
                $this->validateMetadataEmbeds($embeddedProp->embedMeta, $mf);
            }
        }
        return true;
    }