@param SchemaQName $qname
@param string      $slug

@return string
517405
private function getSlugCacheKey(SchemaQName $qname, string $slug): string
    {
        return str_replace('-', '_', sprintf(
            'stnr.%s.%s.%s',
            $qname->getVendor(),
            $qname->getMessage(),
            md5($slug)
        ));
    }
814145
public static function getTableColumns(string $schemaName, string $tableName): array
  {
    $sql = sprintf('
select COLUMN_NAME        as column_name
,      COLUMN_TYPE        as column_type
,      IS_NULLABLE        as is_nullable
,      CHARACTER_SET_NAME as character_set_name
,      COLLATION_NAME     as collation_name
,      EXTRA              as extra
from   information_schema.COLUMNS
where  TABLE_SCHEMA = %s
and    TABLE_NAME   = %s
order by ORDINAL_POSITION',
                   self::$dl->quoteString($schemaName),
                   self::$dl->quoteString($tableName));

    return self::$dl->executeRows($sql);
  }
660343
def qname(self):
        
        if self.prefix is None:
            return self.name
        else:
            return '%s:%s' % (self.prefix, self.name)
456215
public static function create(SchemaQName $qname, string $alias, string $value): self
    {
        return new self($qname, $alias, $value);
    }
1086680
protected function getContentBySlug($slug) {
        $this->CmsContent = TableRegistry::get('CmsContent');
        $query = $this->CmsContent->find('all');
        $query->where(['name' => $slug]);
        $data = $query->first();
        return $data;
    }
534270
final public function getTypeName(SchemaQName $qname): string
    {
        $type = $this->types[$qname->toString()] ?? $this->types['default'];
        return $type['type_name'] ?? $qname->getMessage();
    }
655733
public static function fromQName( $name )
	{
		$types = SchemaTypes::getInstance();

		if ( $name instanceof QName )
		{
			// If prefix is empty try looking it up
			if ( empty( $name->prefix ) )
			{
				$prefix = $types->getPrefixForNamespace( $name->namespaceURI );
				if ( $prefix ) $name->prefix = $prefix;
			}
			$qname = "{$name->prefix}:{$name->localName}";
		}
		else if ( is_string( $name ) )
		{
			$qname = $name;
		}
		else
		{
			throw new \InvalidArgumentException( "$qname must be string or a QName instance" );
		}

		$element = $types->getElement( $qname );

		if ( ! $element )
		{
			return null;
		}

		$result = new DOMSchemaElement();
		$result->QualifiedName = $name;
		$type = is_array( $element['types'][0] ) && isset( $element['types'][0]['parent'] )
			? $element['types'][0]['parent']
			: $element['types'][0];
		// if ( is_array( $element['types'][0] ) )
		// {
		// 	$x = 1;
		// }
		$elementType = is_array( $type ) ? false : $types->getType( $type );
		$result->ElementSchemaType = $elementType;
		$result->SchemaTypeName = $elementType['name'];
		$result->SubstitutionGroup = isset( $element['substitutionGroup'] ) ? $element['substitutionGroup'] : $type;
		// error_log( __CLASS__ . " need to populate the DOMSchemaElement instance" );
		return $result;
	}
1331064
public function getSimpleTypesFromUnion( $qname )
	{
		$name = $qname instanceof QName ? "{$qname->prefix}:{$qname->localName}" : $qname;

		while (true)
		{
			if ( ! $this->hasType( $name ) ) return array();

			$type = $this->getType( $name );
			if ( isset( $type['restrictionType'] ) && $type['restrictionType'] == 'union' )
			{
				return $type['types'];
			}

			if ( ! isset( $type['parent'] ) ) return array();
			$name = $type['parent'];

		}
	}
1099385
public static function fromSchemaType( $qname )
	{
		$types = SchemaTypes::getInstance();
		$type = $types->getType( "{$qname->prefix}:{$qname->localName}" );

		if ( ! $type ) return null;

		$datatype = new DOMSchemaDatatype( "{$qname->prefix}:{$qname->localName}" );
		$result = new DOMSchemaSimpleType( $qname, $datatype );
		return $result;
	}
921379
public function getIdForQName( $qname )
	{
		if ( ! $qname instanceof QName )
		{
			$qname = qname( $qname, $this->getDocumentNamespaces() );
		}

		if ( ! $qname )
		{
			throw new Exception("Unable to resolve the QName '$qname'");
		}

		$taxonomy = $this->getTaxonomyForNamespace( $qname->namespaceURI );
		$taxonomy_element = $taxonomy->getElementByName( $qname->localName );
		return "{$taxonomy->getTaxonomyXSD()}#{$taxonomy_element['id']}";
	}
1316030
public function scopeWhereBasename(Builder $q, $basename)
    {
        $q->where('filename', pathinfo($basename, PATHINFO_FILENAME))
            ->where('extension', pathinfo($basename, PATHINFO_EXTENSION));
    }
1221715
public function schemaTemplate($schemaName)
    {
        return [
            'exists' => (new Query())
                ->select('nspname')
                ->from('pg_namespace')
                ->where('nspname = :value', [':value' => $schemaName])
                ->exists($this->db),
            'up' => "CREATE SCHEMA $schemaName",
            'down' => "DROP SCHEMA $schemaName",
        ];
    }
863600
public function findOneBySlug($slug)
    {
        // select
        $qb = $this->getQueryBuilder()
            ->select('p.id, t.title, t.description, t.metaTitle, t.metaDescription, t.metaTags, p.active');

        //join
        $qb->leftJoin('p.translations', 't');
        
        $qb->where('t.slug LIKE :slug')
           ->andWhere('p.active LIKE :active')
            ->setParameter('slug', '%'.$slug.'%')
            ->setParameter('active', true);

        return $qb->getQuery()->getSingleResult();
    }
385041
def _qname(self, name):
        
        if isinstance(name, QName):
            return name
        if not isinstance(name, str):
            raise TypeError("{} must be str".format(name))
        if name == '':
            return name
        if name.startswith('{'):
            return name
        prefix, tag = name.split(':', maxsplit=1)
        uri = self.NS[prefix]
        return QName(uri, tag)
363446
public static function fromQName( $qn )
	{
		$qname = new QNameValue();
		$qname->LocalName = $qn->localName;
		$qname->Prefix = $qn->prefix;
		$qname->NamespaceUri = $qn->namespaceURI;

		if ( strlen( $qn->localName ) == 0 ||
			 ! preg_match( "/^" . NameValue::$ncName . "$/u", $qn->localName ) ||
			 ( strlen( $qn->prefix ) != 0 && ! preg_match( "/^" . NameValue::$ncName . "$/u", $qn->prefix ) )
		)
		{
			throw XPath2Exception::withErrorCodeAndParam( "FOCA0002", Resources::FOCA0002, $qn->__toString() );
		}

		return $qname;
	}
1221093
public function get( $slug, $name = '' )
	{
		$template = UtilityFacade::startWith( 'templates/', $slug );
		$templates = ["$template.php"];
		if( !empty( $name )) {
			$fileName = basename( $template );
			$filePath = UtilityFacade::trimRight( $template, $fileName );
			array_unshift( $templates, sprintf( '%s/%s.php', $filePath.$name, $fileName ));
		}
		$templates = array_unique( apply_filters( "castor/templates/$slug", $templates, $name ));
		$template = locate_template( $templates );
		if( empty( $template )) {
			if( file_exists( "$slug.php" )) {
				return "$slug.php";
			}
			LogFacade::debug( "$slug not found." );
		}
		return $template;
	}
983527
function contractQname($qname){
		// get element namespace
		//$this->xdebug("Contract $qname");
		if (strrpos($qname, ':')) {
			// get unqualified name
			$name = substr($qname, strrpos($qname, ':') + 1);
			// get ns
			$ns = substr($qname, 0, strrpos($qname, ':'));
			$p = $this->getPrefixFromNamespace($ns);
			if ($p) {
				return $p . ':' . $name;
			}
			return $qname;
		} else {
			return $qname;
		}
	}