Get a default schema value, if any is available

@return Builder|null A default schema value or Null if no default value is available
167169
public function getDefaultSchema(): ?Builder
    {
        // By default, the schema facade depends upon a
        // database connection being available. Therefore,
        // we need to ensure that this is true, before
        // attempting to return the facade-root
        $manager = DB::getFacadeRoot();
        if (isset($manager) && ! is_null($manager->connection())) {
            return Schema::getFacadeRoot();
        }
        return $manager;
    }
517907
public function getDefaults()
    {
        $this->initInternals();

        if (null === $this->defaults) {
            $this->defaults = $this->blueprintSchema->getDefaults();
        }

        return $this->defaults;
    }
455729
public function getDefault()
    {
        // get the memoized default
        if ($this->default) {
            return $this->get($this->default);
        }

        // no configurations available
        // check for existing connections
        if (0 === count($this->config)) {
            if (1 === count($this->connections)) {
                $this->default = array_keys($this->connections)[0];

                return $this->get($this->default);
            } elseif (count($this->connections) > 1) {
                throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.');
            }

            throw new JAQBException('The default connection is not available because no configurations have been supplied.');
        }

        // handle the case where there is a single configuration
        if (1 === count($this->config)) {
            $this->default = array_keys($this->config)[0];

            return $this->get($this->default);
        }

        // handle multiple configurations
        foreach ($this->config as $k => $v) {
            if (array_value($v, 'default')) {
                $this->default = $k;

                return $this->get($this->default);
            }
        }

        throw new JAQBException('There is no default connection.');
    }
694828
public function getValue()
    {
        $value = parent::getValue();
        return $value === null || $value === [] ? $this->getDefaultValue() : $value;
    }
1275886
public function getSchemaDataDefaults()
    {
        return [
            'name' => $this->getName(),
            'id' => $this->ID(),
            'type' => $this->getInputType(),
            'schemaType' => $this->getSchemaDataType(),
            'component' => $this->getSchemaComponent(),
            'holderId' => $this->HolderID(),
            'title' => $this->obj('Title')->getSchemaValue(),
            'source' => null,
            'extraClass' => $this->extraClass(),
            'description' => $this->obj('Description')->getSchemaValue(),
            'rightTitle' => $this->obj('RightTitle')->getSchemaValue(),
            'leftTitle' => $this->obj('LeftTitle')->getSchemaValue(),
            'readOnly' => $this->isReadonly(),
            'disabled' => $this->isDisabled(),
            'customValidationMessage' => $this->getCustomValidationMessage(),
            'validation' => $this->getSchemaValidation(),
            'attributes' => [],
            'autoFocus' => $this->isAutofocus(),
            'data' => [],
        ];
    }
359971
public function getSchemaManager(){
        if($this->schemamanger == null){
            $this->schemamanger = new common_persistence_sql_pdo_pgsql_SchemaManager($this);
        }
        return $this->schemamanger;
    }
256519
public function getDefaultValue()
    {
        if (1 != $this->parameters->get('defaultValueIsNull')) {
            $defaultValue = $this->parameters->get('defaultValue');
            if (strlen($defaultValue) && 'NULL' != $defaultValue) {
                return trim($defaultValue, '\'"');
            }
        }
    }
1127181
public function schema($key = null, $value = null)
    {
        $numArgs = func_num_args();
        if (0 === $numArgs) {
            return $this->schema;
        } elseif (1 === $numArgs) {
            if (is_array($key)) {
                $this->schema = new NObject($key);
            } elseif ($this->schema->offsetExists($key)) {
                return $this->schema[$key];
            }
        } else {
            $this->schema[$key] = $value;
        }
    }
403483
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();

        $root = $treeBuilder->root('form');
        $root
            ->children()
                ->arrayNode('themes')
                    ->fixXmlConfig('themes')
                    ->addDefaultChildrenIfNoneSet()
                    ->prototype('scalar')->defaultValue('default')->end()
                    ->validate()
                        ->ifTrue(function ($v) {
                            return !in_array('default', $v);
                        })
                        ->then(function ($v) {
                            return array_merge(['default'], $v);
                        })
                    ->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
930746
public function defaultValue()
    {
        if ($this->default === null) {
            return null;
        }

        $default = $this->default;

        if (strstr($this->default, '{{') && strstr($this->default, '}}')) {
            // Parse special replacements (if we have one)
            $default = str_replace("{{CURRENT_TIME}}", date('c', time()), $default);
        }

        return $default;
    }
1232057
public function loadSchemaFile(): Schema
    {
        if (!file_exists($this->schemaFile)) {
            return new Schema();
        }

        $content = file_get_contents($this->schemaFile);
        $desc = Yaml::parse($content);
        if (empty($desc)) {
            return new Schema();
        }

        $builder = new SchemaBuilder();
        return $builder->build($desc['schema']);
    }
1120321
public function pkValue()
    {
        if ($args = func_get_args()) {
            !is_array($args[0]) || $args = array_shift($args);
            $args = array_values($args);
            foreach ($args as $key=>$arg)
                $this->{$this->_properties['primary_key'][$key]} = $arg;

            return $this;
        }

        $pk = array_intersect_key($this->_schema['values'],
            array_fill_keys($this->_properties['primary_key'], null));

        return count($pk)==0?null:(count($pk)==1?array_shift($pk):$pk);
    }
187342
protected function _schemaDefault($parts)
    {
        $table = $this->_getTable($parts);
        if ($table === false) {
            return null;
        }
        $field = end($parts);
        $defaults = $table->getSchema()->defaultValues();
        if (!array_key_exists($field, $defaults)) {
            return null;
        }

        return $defaults[$field];
    }
1093917
protected function _schemaDefault($field)
    {
        $field = $this->_form->schema()->field($field);
        if ($field) {
            return $field['default'];
        }

        return null;
    }
263424
private function getSchema(): ?SchemaInterface
    {
        if (!empty($this->schema)) {
            return $this->schema;
        }

        if (!empty($this->options['schema'])) {
            //TODO check instance of
            $this->schema = $this->options['schema'];
            return $this->schema;
        }

        if (!empty($this->options['subSchema'])) {

            //TODO this is a dirty way of receiving the service
            $receiver = null;
            if ($this->serviceManager->has($this->options['subSchema'])) {
                $receiver = $this->serviceManager->get($this->options['subSchema']);
            }

            if (empty($receiver)) {
                foreach (\array_keys($this->serviceManager->getServiceManagerConfig()->getSubManagers()) as $subManager) {
                    if ($this->serviceManager->get($subManager)->has($this->options['subSchema'])) {
                        $receiver = $this->serviceManager->get($subManager)->get($this->options['subSchema']);
                        break;
                    }
                }
            }

            if (!($receiver instanceof SubSchemaReceiverInterface)) {
                throw new \Exception($this->options['subSchema'] . " must implement " . SubSchemaReceiverInterface::class);
            }

            $this->schema = $receiver->receiveSchema($this->options['subSchemaName'], $this->builder);
            return $this->schema;
        }

        //TODO Exception
    }
694032
public static function getConditionBuilder()
    {
        $result = null;

        switch (static::getDriver()) {
            default:
                $result = new \pwf\components\querybuilder\adapters\SQL\ConditionBuilder();
        }

        return $result;
    }
144459
public function getSchema()
    {
        $schema = new Schema(['adapter' => $this->_adapter]);
        $tables = $this->getTables();
        foreach ($tables as $tableName) {
            $schema->addTable($this->getTable($tableName));
        }

        return $schema;
    }