Get the database name from a database element.
@param \DOMElement $databaseElement Database element.
@return string Database name.
@throws \LogicException If the database element is unnamed.
186633
protected function getDatabaseFromDatabaseElement(\DOMElement $databaseElement)
    {
        $database = $databaseElement->getAttribute('name');
        if (empty($database)) {
            throw new \LogicException('Unnamed database node.');
        }

        return $database;
    }
1193862
protected function getElementConfig(DOMElement $element)
	{
		$config = [];
		foreach ($element->attributes as $attribute)
		{
			$config[$attribute->name][] = $attribute->value;
		}
		foreach ($element->childNodes as $childNode)
		{
			if ($childNode instanceof DOMElement)
			{
				$config[$childNode->nodeName][] = $this->getValueFromElement($childNode);
			}
		}

		return $this->flattenConfig($this->convertValueTypes($config));
	}
526574
public function getDefaultClause($xmldb_field) {

        $defaultvalue = $this->getDefaultValue ($xmldb_field);

        if ($defaultvalue !== null) {
            return ' DEFAULT ' . $defaultvalue;
        } else {
            return null;
        }
    }
1320105
public static function getElementId(\DOMElement $node)
    {
        if ($node->hasAttribute('dqn_tmp_id')) {
            return $node->getAttribute('dqn_tmp_id');
        }

        $node_id = md5(mt_rand());
        $node->setAttribute('dqn_tmp_id', $node_id);
        return $node_id;
    }
530513
protected function validateTableName($tableName = null)
    {
        $tableName = $tableName === null ? $this->tableName : $tableName;

        if ($tableName === null) {
            throw new DbExporterException('Table name is null');
        }

        return $tableName;
    }
923164
public function getTitle()
    {
        if (empty($this->title)) {
            throw new LogicException(
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'title')
            );
        }
        return $this->title;
    }
256093
public function insert()
    {
        if( !$this->tableName ) {
            throw new LogicException('No table name specified');
        }
        return $this->database->insert()
                ->table($this->tableName);
    }
397916
public static function getChildNodesOfName(\DOMElement $element, $elementName) {
    $result = [];
    foreach ($element->childNodes as $child) {
      if ($child->nodeName == $elementName) {
        $result[] = $child;
      }
    }
    return $result;
  }
1034341
protected function sqlInsert(): string
    {
        $inserts = [];
        foreach ($this->datafields as $fieldname => $field) {
            $value = (array_key_exists($fieldname, $this->values)) ? $this->values[$fieldname] : null;
            $escapedFieldName = $this->dbal->sqlFieldEscape($field['name']);
            $inserts[$escapedFieldName] = $this->dbal->sqlQuote($value, $field['commontype'], true);
        }
        if (! count($inserts)) {
            throw new \LogicException('Recordset: Insert does not have any fields to insert');
        }
        return 'INSERT INTO ' . $this->dbal->sqlTableEscape($this->entity)
        . ' (' . implode(', ', array_keys($inserts)) . ')'
        . ' VALUES (' . implode(', ', $inserts) . ')'
        . ';';
    }
409300
protected function getBlock(\DOMElement $element) {
    $block = '';
    /** @var \DOMNode $node */
    foreach ($element->childNodes as $node) {
      switch ($node->nodeType) {

        case XML_ELEMENT_NODE:
          /** @var \DOMElement $node */
          switch ($node->nodeName) {

            // Explicitly handle these elements.

            case 'i':
            case 'em':
              $block .= '*' . $this->getBlock($node) . '*';
              break;

            case 'b':
            case 'strong':
              $block .= '**' . $this->getBlock($node) . '**';
              break;

            case 'a':
              if ($node->hasAttribute('href')) {
                $block .= '[' . $this->getBlock($node) . ']' .
                  '(' . $node->getAttribute('href') . ')';
              }
              break;

            // Other inline elements.
            default:
              // Recursively handle any descendant elements we care about.
              $block .= $this->getBlock($node);
              break;

          }
          break;

        case XML_TEXT_NODE:
          /** @var \DOMText $node */
          $block .= self::escape($node->textContent);
          break;

      }
    }

    // Handle white-listed elements.
    if (in_array($element->nodeName, $this->white_list)) {
      $tag = $element->cloneNode();
      if (!empty($block)) {
        $tag->appendChild(new \DOMText($block));
      }
      $block = $this->dom->saveXML($tag);
    }

    return $block;
  }
1310915
public static function getDatabaseConfig($database)
    {
        $cached = self::$cache[$database] ?? null;
        if ($cached !== null) {
            return $cached;
        }

        if (self::$config === null) {
            throw new \BadMethodCallException('Config was not loaded');
        }
        if (!array_key_exists($database, self::$config['databases'])) {
            throw new \LogicException("Unknown database '$database'");
        }

        $data = self::$config['databases'][$database];
        if (is_string($data)) {
            $data = ['database_name' => $data];
        }

        $server = $data['server'] ?? 'default';
        $servers = self::$config['servers'] ?? [];
        if (array_key_exists($server, $servers)) {
            unset($data['server']);
            $data = array_merge($servers[$server], $data);
        }

        self::$cache[$database] = $data;
        return $data;
    }
257994
protected function getElementAttribute(DomElement $element, $attributeName)
    {
        // First try to return for link
        if ($element->localName === 'link') {
            return $element->getAttribute($attributeName);
        }

        // Second return for embed
        return $element->getAttribute(EmbedLinking::TEMP_PREFIX . $attributeName);
    }
310540
protected function initGlobalDatabaseElement($database)
    {
        if (\in_array($database, $this->databases)) {
            return;
        }

        $databaseDocument = new \DOMDocument(static::$GLOBAL_SCHEMA_XML_VERSION, static::$GLOBAL_SCHEMA_XML_ENCODING);

        $databaseElement = $databaseDocument->createElement('database');

        $databaseElement->setAttribute('name', $database);

        $identifierQuotingNoticeComment = $databaseElement->ownerDocument->createComment(
            "Attribute 'identifierQuoting' generated"
        );
        $databaseElement->appendChild($identifierQuotingNoticeComment);
        $databaseElement->setAttribute('identifierQuoting', 'true');

        $databaseDocument->appendChild($databaseElement);

        $this->databases[] = $database;
        $this->globalDatabaseElements[$database] = $databaseElement;
        $this->sourceDatabaseElements[$database] = [];
        $this->externalSchemaDatabaseElements[$database] = [];
    }
541603
public function getDatabaseName()
    {
        if ($this->isSlave() && ! $this->database_name) {
            return $this->_master->getDatabaseName();
        }

        // sqlite data file
        if ($this->driver instanceof SqliteDriver) {
            if ($this->isUseMemory()) {
                return ':memory:';
            }
            if ($this->database_dir && $this->database_name[0] !== '/') {
                return $this->database_dir . '/' . $this->database_name;
            }
        }
        
        return $this->database_name;
    }
188138
public function getName()
    {
        switch ($this->ofWeek) {
            case Carbon::MONDAY:
                $name = 'Monday';
                break;

            case Carbon::TUESDAY:
                $name = 'Tuesday';
                break;

            case Carbon::WEDNESDAY:
                $name = 'Wednesday';
                break;

            case Carbon::THURSDAY:
                $name = 'Thursday';
                break;

            case Carbon::FRIDAY:
                $name = 'Friday';
                break;

            case Carbon::SATURDAY:
                $name = 'Saturday';
                break;

            case Carbon::SUNDAY:
                $name = 'Sunday';
                break;

            default:
                throw new LogicException;
        }

        return $name;
    }
823813
public static function getFullColumnName($column, $table = null)
    {
        // Get target table name
        if ($table === null) {
            // Make sure, the getTableName() is defined in calling class
            if (method_exists(get_called_class(), 'getTableName')) {
                $table = static::getTableName();
            } else {
                throw new LogicException(
                    sprintf('The method getTableName() is not declared in %s, therefore a full column name cannot be generated', get_called_class())
                );
            }
        }

        return sprintf('%s.%s', $table, $column);
    }
482928
protected function getValueFromElement(DOMElement $element)
	{
		return (!$element->attributes->length && $element->childNodes->length === 1 && $element->firstChild->nodeType === XML_TEXT_NODE)
		     ? $element->nodeValue
		     : $this->getElementConfig($element);
	}