@param TreeishInterface|Commit|string $arg
@param array $options

@throws \RuntimeException
@return string
770251
public function reset($arg = null, array $options = array())
    {
        $this->clearAll();
        $this->addCommandName(self::GIT_RESET_COMMAND);
        // if there are options add them.
        if (! is_null($options)) {
            foreach ($options as $option) {
                $this->addCommandArgument($option);
            }
        }
        if($arg!=null){
            $this->addCommandSubject2($arg);
        }

        return $this->getCommand();
    }
436125
public function make($strategy, array $options = [])
    {
        $instance = $this->instantiateClass(
            $this->resolveStrategyClassName($strategy)
        );

        if ( ! ($instance instanceof VariantStrategyInterface)) {
            throw new RuntimeException("Variant strategy created for '{$strategy}' is of incorrect type");
        }

        return $instance->setOptions($options);
    }
518361
public static function findCommandValue($args) {
		$args = explode("|",$args);
		foreach ($args as $arg) {
			if (isset(self::$options[$arg])) {
				return self::$options[$arg];
			}
		}
		return false;
	}
1142818
public function dump(array $options = array())
    {
        if (!class_exists('zxf\Symfony\Component\Yaml\Dumper')) {
            throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.');
        }

        if (null === $this->dumper) {
            $this->dumper = new YmlDumper();
        }

        return $this->container->resolveEnvPlaceholders($this->addParameters()."\n".$this->addServices());
    }
25801
public function _parse($args)
    {
        $this->_values = [];
        $this->_options = [];

        if (in_array(end($args), ['', '-', '--'], true)) {
            array_pop($args);
        }

        while ($args) {
            $o = array_shift($args);
            if ($o[0] !== '-') {
                $this->_values[] = $o;
                continue;
            }

            if (preg_match('#^-((\w)|-([\w-_]+))=(.*)$#', $o, $match)) {
                $this->_options[$match[2]] = $match[4];
                continue;
            }

            if ($o[1] === '-') {
                if (strlen($o) < 3) {
                    throw new ArgumentsException(['long `:option` option is too short', 'option' => $o]);
                }

                $this->_options[substr($o, 2)] = !$args || $args[0] === '-' ? 1 : array_shift($args);
            } elseif (strlen($o) > 2) {
                if (!$args || $args[0][0] === '-') {
                    /** @noinspection PhpParamsInspection */
                    foreach (str_split(substr($o, 1), 1) as $c) {
                        $this->_options[$c] = 1;
                    }
                } else {
                    $this->_options[substr($o, 1)] = array_shift($args);
                }
            } else {
                $this->_options[substr($o, 1)] = !$args || $args[0] === '-' ? 1 : array_shift($args);
            }
        }

        return $this;
    }
1297366
static public function treeConfig( $args )
    {
        $returnArray = array(
            'status' => 'success',
            'message' => '',
            'config' => array(
                'hideRootTag' => false,
                'rootTag' => array()
            )
        );

        if ( !isset( $args[1] ) )
        {
            return $returnArray;
        }

        $attributeID = (int)$args[0];
        $version = (int)$args[1];

        $contentAttribute = eZContentObjectAttribute::fetch( $attributeID, $version );
        if ( !$contentAttribute instanceof eZContentObjectAttribute || $contentAttribute->attribute( 'data_type_string' ) !== 'eztags' )
        {
            return $returnArray;
        }

        $tagsIni = eZINI::instance( 'eztags.ini' );
        $classAttribute = $contentAttribute->attribute( 'contentclass_attribute' );
        $rootTagID = (int)$classAttribute->attribute( 'data_int1' );

        if ( $rootTagID > 0 )
        {
            $rootTag = eZTagsObject::fetch( $rootTagID );
            if ( !$rootTag instanceof eZTagsObject )
            {
                return $returnArray;
            }

            $returnArray['config']['rootTag'] = array(
                'id' => (int) $rootTag->attribute( 'id' ),
                'parent' => '#',
                'text' => $rootTag->attribute( 'keyword' ),
                'icon' => eZTagsTemplateFunctions::getTagIcon( $rootTag->getIcon() ),
                'children' => $rootTag->getChildrenCount() > 0 ? true : false,
                'a_attr' => array(
                    'data-id' => (int) $rootTag->attribute( 'id' ),
                    'data-name' => $rootTag->attribute( 'keyword' ),
                    'data-parent_id' => (int) $rootTag->attribute( 'parent_id' ),
                    'data-locale' => $rootTag->attribute( 'current_language' )
                ),
                'state' => array(
                    'opened' => true,
                    'selected' => false
                )
            );
        }
        else
        {
            $returnArray['config']['rootTag'] = array(
                'id' => 0,
                'parent' => '#',
                'text' => ezpI18n::tr( 'extension/eztags/tags/treemenu', 'Top level tags' ),
                'icon' => eZTagsTemplateFunctions::getTagIcon( $tagsIni->variable( 'Icons', 'Default' ) ),
                'children' => true,
                'state' => array(
                    'opened' => true,
                    'disabled' => true,
                    'selected' => false
                )
            );
        }

        $returnArray['config']['hideRootTag'] = (int)$classAttribute->attribute( 'data_int3' ) > 0;

        return $returnArray;
    }
1166786
public function commit($args = array()) {
		foreach ($args as $item) {
			$this->driver->exec($item);
		}
		return $this->driver->commit();
	}
502469
public function execute(array $args, array $options = [])
    {
        $this->writeln("CmlPHP Console " . Cml::VERSION . "\n", ['foregroundColors' => [Colour::GREEN, Colour::HIGHLIGHT]]);
        $format = new Format(['indent' => 2]);

        if (empty($args)) {
            $this->writeln("Usage:");
            $this->writeln($format->format("input 'command [options] [args]' to run command or input 'help command ' to display command help info"));
            $this->writeln('');

            $options = $this->formatOptions();
            $cmdList = $this->formatCommand();

            $this->writeln("Options:");
            $this->formatEcho($format, $options);
            $this->writeln('');

            $this->writeln('Available commands:');
            $this->formatEcho($format, $cmdList[0]);
            $this->formatEcho($format, $cmdList[1]);
        } else {
            $class = new \ReflectionClass($this->console->getCommand($args[0]));
            $property = $class->getDefaultProperties();
            $description = isset($property['description']) ? $property['description'] : '';
            $help = isset($property['help']) ? $property['help'] : false;
            $arguments = isset($property['arguments']) ? $property['arguments'] : [];
            $options = isset($property['options']) ? $property['options'] : [];

            $this->writeln("Usage:");
            $this->writeln($format->format("{$args[0]} [options] [args]"));
            $this->writeln('');

            count($arguments) > 0 && $arguments = $this->formatArguments($arguments);
            $options = $this->formatOptions($options, 'this');

            $this->writeln("Options:");
            $this->formatEcho($format, $options);
            $this->writeln('');

            if (count($arguments)) {
                $this->writeln("Arguments");
                $this->formatEcho($format, $arguments);
                $this->writeln('');
            }

            $this->writeln("Help:");
            $this->writeln($format->format($help ? $help : $description));
        }
        $this->write("\n");
    }
223427
public function executeCommand(array $args, OutputInterface $output, $message)
    {
        $name = $args[0];
        $cmd = $this->getCmd($args);

        $output->writeln('');
        $output->writeln(
            sprintf(
                '<info>Running %s</info>',
                $name
            )
        );

        $output->writeln(
            sprintf(
                '<comment>%s</comment>',
                $cmd
            )
        );

        $this->process->setCommandLine($cmd);
        $this->process->run(
            function ($type, $buffer) use ($output, $cmd) {
                if (Process::ERR === $type) {
                    $output->writeln(
                        sprintf(
                            '<error>%s</error>',
                            $buffer
                        )
                    );
                } else {
                    $output->writeln(
                        sprintf(
                            '<comment>%s</comment>',
                            $buffer
                        )
                    );
                }
            }
        );

        if (!$this->process->isSuccessful()) {
            throw new \RuntimeException($message . '<error>' . $this->process->getErrorOutput() . '</error>');
        }
    }
113114
public function handle(Args $args, IO $io)
    {
        $criteria = array();

        if ($args->isOptionSet('path')) {
            $criteria['path'] = $args->getOption('path');
            $criteria['language'] = $args->getOption('language');
        }

        if ($args->isOptionSet('name')) {
            if (isset($criteria['path'])) {
                throw new RuntimeException('The options --name and --path cannot be combined.');
            }

            $criteria['path'] = '/**/'.$args->getOption('name');
            $criteria['language'] = $args->getOption('language');
        }

        if ($args->isOptionSet('class')) {
            $criteria['class'] = $args->getOption('class');
        }

        if ($args->isOptionSet('type')) {
            $criteria['bindingType'] = $args->getOption('type');
        }

        if (empty($criteria)) {
            throw new RuntimeException('No search criteria specified.');
        }

        return $this->listMatches($io, $criteria);
    }
280729
public function handleDelete(Args $args)
    {
        $typeName = $args->getArgument('name');

        if (!$this->discoveryManager->hasRootTypeDescriptor($typeName)) {
            throw new RuntimeException(sprintf(
                'The type "%s" does not exist in the module "%s".',
                $typeName,
                $this->modules->getRootModuleName()
            ));
        }

        $this->discoveryManager->removeRootTypeDescriptor($typeName);

        return 0;
    }
15265
public static function write($options)
    {
        $defaults = [
            'file' => null
        ];
        $options += $defaults;

        if (!$options['file']) {
            throw new RuntimeException("Missing file name");
        }

        return file_put_contents($options['file'], static::export($options));
    }
261362
public function create($filename = null, array $options = [], array $plugins = [])
    {
        try {
            $thumb = new PHPThumb($filename, $options, $plugins);
        } catch (\Exception $exc) {
            throw new Exception\RuntimeException($exc->getMessage(), $exc->getCode(), $exc);
        }

        return $thumb;
    }
560282
public static function encode($value, $options = 0)
    {
        $result = json_encode($value, (int) $options);
        // @codeCoverageIgnoreStart
        if ($result === false) {
            throw new \RuntimeException(static::$errorMessages[json_last_error()]);
        }
        // @codeCoverageIgnoreEnd

        return $result;
    }
999581
public function executeHello(array $args, array $options = array())
    {
        $name = 'unknown';
        if (empty($args)) {
            $dialog = new Dialog($this->console);
            $name = $dialog->ask('What is your name?', $name);
        } else {
            $name = $args[0];
        }
        $this->writeln(sprintf('hello %s!', $name));
    }
1006140
private function processOptions(RawArgs $args, Command $currentCommand, array $optionsToTest)
    {
        foreach ($optionsToTest as $option) {
            $commands = $currentCommand->getNamedSubCommands();

            if (!$commands->contains($option)) {
                continue;
            }

            $nextCommand = $commands->get($option);

            if (!$nextCommand->getConfig() instanceof OptionCommandConfig) {
                break;
            }

            $currentCommand = $nextCommand;
        }

        return $this->processDefaultSubCommands($args, $currentCommand);
    }
1355519
public function setOptions($options)
    {
        // Valid Options
        $validOptions = ['delete', 'update', 'constraint'];
        foreach ($options as $option => $value) {
            if (!in_array($option, $validOptions, true)) {
                throw new \RuntimeException(sprintf('"%s" is not a valid foreign key option.', $option));
            }

            // handle $options['delete'] as $options['update']
            if ('delete' === $option) {
                $this->setOnDelete($value);
            } elseif ('update' === $option) {
                $this->setOnUpdate($value);
            } else {
                $method = 'set' . ucfirst($option);
                $this->$method($value);
            }
        }

        return $this;
    }