Override default

{@inheritDoc}
433703
protected function setFormatter(FormatterInterface $formatter = null)
    {
        if ($this->color) {
            $this->formatter = new AnsiColorFormatter($formatter);
        } else {
            $this->formatter = $formatter;
        }
        return $this;
    }
898963
public static function defaultCommandFactory(DescriptionInterface $description)
    {
        return function (
            $name,
            array $args = [],
            ServiceClientInterface $client
        ) use ($description) {
            $operation = null;

            if ($description->hasOperation($name)) {
                $operation = $description->getOperation($name);
            } else {
                $name = ucfirst($name);
                if ($description->hasOperation($name)) {
                    $operation = $description->getOperation($name);
                }
            }

            if (!$operation) {
                return null;
            }

            return new Command($name, $args, ['emitter' => clone $client->getEmitter()]);
        };
    }
1048386
protected function setupDefaults()
    {
        $this->addTransformer('html', function ($value) {
            return new Markup($value, 'UTF-8');
        });
        $this->addTransformer('text', function ($value) {
            return new Markup($value, 'UTF-8');
        });
        $this->addTransformer('textarea', function ($value) {
            return new Markup($value, 'UTF-8');
        });
        $this->addTransformer('markdown', function ($value) {
            $markdown = new ParsedownExtra();
            $value = $markdown->text($value);

            return new Markup($value, 'UTF-8');
        });

        $this->addTransformer('repeater', function ($value) {
            /** @var FieldCollection $collection */
            foreach ($value as $collection) {
                foreach ($collection as $field) {
                    $field->setValue($this->transform($field->getValue(), $field->getFieldType()));
                }
            }

            return $value;
        });

        $this->addTransformer('block', function ($value) {
            return $this->transform($value, 'repeater');
        });
    }
747448
public function inheritFields(&$element, &$rootDoc, &$package)
    {
        $fields =& $element->fields();
        if ($fields) {
            ksort($fields);
            $num = count($fields); $foo = 0;
            echo '<table class="inherit">', "\n";
            echo '<tr><th colspan="2">Fields inherited from ', $element->qualifiedName(), "</th></tr>\n";
            echo '<tr><td>';
            foreach ($fields as $field) {
                echo '<a href="', str_repeat('../', $this->_depth), $field->asPath(), '">', $field->name(), '</a>';
                if (++$foo < $num) {
                    echo ', ';
                }
            }
            echo '</td></tr>';
            echo "</table>\n\n";
            if ($element->superclass()) {
                $superclass =& $rootDoc->classNamed($element->superclass());
                if ($superclass) {
                    $this->inheritFields($superclass, $rootDoc, $package);
                }
            }
        }
    }
803559
function addFunc(FunctionEntity $func, $includeSee=false)
    {
        $this->fullClassName = $func->getClass();

        $str = '<strong>';

        if( $this->declareAbstraction && $func->isAbstract() )
            $str .= 'abstract ';

        $str .=  $func->getName().'(';

        if( $func->hasParams() ) {
            $params = [];
            foreach($func->getParams() as $param) {
                $paramStr = '<em>'.$param->getType().'</em> <strong>'.$param->getName();
                if( $param->getDefault() ) {
                    $paramStr .= '='.$param->getDefault();
                }
                $paramStr .= '</strong>';
                $params[] = $paramStr;
            }
            $str .= '</strong>'.implode(', ', $params) .')';
        } else {
            $str .= ')';
        }

        $str .= '</strong> : <em>'.$func->getReturnType().'</em>';

        if( $func->isDeprecated() ) {
            $str = '<strike>'.$str.'</strike>';
            $str .= '<br /><em>DEPRECATED - '.$func->getDeprecationMessage().'</em>';
        } elseif( $func->getDescription() ) {
            $str .= '<br /><em>'.$func->getDescription().'</em>';
        }
        if ($func->getSee() && $includeSee) {
            $str .= '<br /><em>&nbsp;&nbsp;&nbsp;&nbsp;See: ' .
                implode(', ', $func->getSee()) . '</em>';
        }

        $str = str_replace(['</strong><strong>', '</strong></strong> '], ['','</strong>'], trim($str));

        if( $func->getExample() )
            $this->examples[$func->getName()] = $func->getExample();

        $firstCol =  $func->getVisibility() . ($func->isStatic() ? ' static':'');
        $markDown = '| '.$firstCol.' | '.$str.' |';

        $this->add($markDown);
        return $markDown;
    }
1186881
public function override($pattern, $func, $method, $overrideWith = 'GET')
    {
        /*
         * We will bind static routes to callable
         *
         * closure object
         * @return object
         */
        $callable = function () use ($func) {
            return $this->callStaticRoute($func);
        };

        $requestMethod = $this->request->server->get('REQUEST_METHOD');

        if ($method !== false) {
            if ($requestMethod == $method) {
                $overrideWith = $requestMethod;
            }
        }

        return $this->match($overrideWith, $pattern, $callable);
    }
885891
def override_spec(cls, **kwargs):
        """"""
        cls._default_spec.set(**kwargs)
        cls.spec.set(**kwargs)
682726
public function heredocRealOverride($matches)
    {
        $this->record($matches[0], null);
        $this->posShift(strlen($matches[0]));
        // don't need this anymore
        $this->removePattern('HEREDOC_NL');
        assert($this->heredoc !== null);
        $delim = preg_quote($this->heredoc);
        $substr = $this->scanUntil('/^' . $delim . '\\b/m');
        if ($substr !== null) {
            $this->record($substr, 'HEREDOC');
            $delim_ = $this->scan('/' . $delim . '/');
            assert($delim !== null);
            $this->record($delim_, 'DELIMITER');
        } else {
            $this->record($this->rest(), 'HEREDOC');
            $this->terminate();
        }
    }
542888
public function setDefault($default = null)
    {
        if (self::REQUIRED === $this->mode && null !== $default) {
            throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
        }

        if ($this->isArray()) {
            if (null === $default) {
                $default = [];
            } elseif (!\is_array($default)) {
                throw new LogicException('A default value for an array argument must be an array.');
            }
        }

        $this->default = $default;
    }
1339559
public function default()
	{
		$file = Antvel::langPath() . DIRECTORY_SEPARATOR . "en" . DIRECTORY_SEPARATOR . $this->templatesFile . ".php";

		$templates = (new Filesystem)->getRequire($file);

		return Arr::get($templates, $this->source);
	}
386871
def override(self, obj):
        """"""
        for field in obj.__class__.export_fields:
            setattr(self, field, getattr(obj, field))
1086604
public function setAttributeOverride($fieldName, array $overrideMapping)
    {
        if ( ! isset($this->fieldMappings[$fieldName])) {
            throw MappingException::invalidOverrideFieldName($this->name, $fieldName);
        }

        $mapping = $this->fieldMappings[$fieldName];

        if (isset($mapping['id'])) {
            $overrideMapping['id'] = $mapping['id'];
        }

        if ( ! isset($overrideMapping['type']) || $overrideMapping['type'] === null) {
            $overrideMapping['type'] = $mapping['type'];
        }

        if ( ! isset($overrideMapping['fieldName']) || $overrideMapping['fieldName'] === null) {
            $overrideMapping['fieldName'] = $mapping['fieldName'];
        }

        if ($overrideMapping['type'] !== $mapping['type']) {
            throw MappingException::invalidOverrideFieldType($this->name, $fieldName);
        }

        unset($this->fieldMappings[$fieldName]);
        unset($this->fieldNames[$mapping['columnName']]);
        unset($this->columnNames[$mapping['fieldName']]);
        $this->_validateAndCompleteFieldMapping($overrideMapping);

        $this->fieldMappings[$fieldName] = $overrideMapping;
    }
1016319
public function setDefault($default = null)
    {
        if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
            throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
        }

        if ($this->isArray()) {
            if (null === $default) {
                $default = array();
            } elseif (!is_array($default)) {
                throw new LogicException('A default value for an array option must be an array.');
            }
        }

        $this->default = $this->acceptValue() ? $default : false;
    }
15359
protected function inheritDocs($class)
    {
        // inherit for properties
        foreach ($class->properties as $p) {
            if ($p->hasTag('inheritdoc') && ($inheritTag = $p->getFirstTag('inheritdoc')) !== null) {
                $inheritedProperty = $this->inheritPropertyRecursive($p, $class);
                if (!$inheritedProperty) {
                    $this->errors[] = [
                        'line' => $p->startLine,
                        'file' => $class->sourceFile,
                        'message' => "Method {$p->name} has no parent to inherit from in {$class->name}.",
                    ];
                    continue;
                }

                // set all properties that are empty.
                foreach (['shortDescription', 'type', 'types'] as $property) {
                    if (empty($p->$property) || is_string($p->$property) && trim($p->$property) === '') {
                        $p->$property = $inheritedProperty->$property;
                    }
                }
                // descriptions will be concatenated.
                $p->description = trim($p->description) . "\n\n"
                    . trim($inheritedProperty->description) . "\n\n"
                    . $inheritTag->getContent();

                $p->removeTag('inheritdoc');
            }
        }

        // inherit for methods
        foreach ($class->methods as $m) {
            if ($m->hasTag('inheritdoc') && ($inheritTag = $m->getFirstTag('inheritdoc')) !== null) {
                $inheritedMethod = $this->inheritMethodRecursive($m, $class);
                if (!$inheritedMethod) {
                    $this->errors[] = [
                        'line' => $m->startLine,
                        'file' => $class->sourceFile,
                        'message' => "Method {$m->name} has no parent to inherit from in {$class->name}.",
                    ];
                    continue;
                }
                // set all properties that are empty.
                foreach (['shortDescription', 'return', 'returnType', 'returnTypes', 'exceptions'] as $property) {
                    if (empty($m->$property) || is_string($m->$property) && trim($m->$property) === '') {
                        $m->$property = $inheritedMethod->$property;
                    }
                }
                // descriptions will be concatenated.
                $m->description = trim($m->description) . "\n\n"
                    . trim($inheritedMethod->description) . "\n\n"
                    . $inheritTag->getContent();

                foreach ($m->params as $i => $param) {
                    if (!isset($inheritedMethod->params[$i])) {
                        $this->errors[] = [
                            'line' => $m->startLine,
                            'file' => $class->sourceFile,
                            'message' => "Method param $i does not exist in parent method, @inheritdoc not possible in {$m->name} in {$class->name}.",
                        ];
                        continue;
                    }
                    if (empty($param->description) || trim($param->description) === '') {
                        $param->description = $inheritedMethod->params[$i]->description;
                    }
                    if (empty($param->type) || trim($param->type) === '') {
                        $param->type = $inheritedMethod->params[$i]->type;
                    }
                    if (empty($param->types)) {
                        $param->types = $inheritedMethod->params[$i]->types;
                    }
                }
                $m->removeTag('inheritdoc');
            }
        }
    }
192262
private function optDefaultArg($o) {
		$o = $this->opt($o);
		if (isset($this->spec[$o][4])) {
			return $this->spec[$o][4];
		}
		return null;
	}
15229
function overrideConfig() {
    _.merge(Elixir.config, require(path.join(process.cwd(), 'elixirConfig.js')));
}
965504
protected function overrideConfig($fileName, $method = 'array_replace_recursive')
    {
        /** @var Repository $config */
        $config = $this->app->make('config');
        $fileName = Str::ensureRight($fileName, '.php');
        $filePath = path_join($this->resolvePath('configPath'), $fileName);
        $overrides = Filesystem::create()->getRequire($filePath);

        foreach ($overrides as $k => $v) {
            if ($config->has($k) && is_array($config->get($k))) {
                $v = call_user_func($method, $config->get($k, []), $v);
            }
            $config->set($k, $v);
        }
    }