Adds an argument

@param string $arg The command argument

@return ProcessBuilder
976848
public function arg(string $arg): ProcessBuilder
    {
        if ($arg === '') {
            return $this;
        }

        $this->arguments[] = $arg;

        return $this;
    }
675176
protected function processArgumentBoolean(Element $arg) {
		$definition = new stdClass();
		$definition->type = 'value';
		
		if (isset($arg->value)) {
			$definition->value = (trim($arg->value) === 'true');
			return $definition;
		}
		
		$value = $arg->getValue();
		
		if (! empty($value)) {
			$definition->value = (trim($value) === 'true');
			return $definition;
		}
		
		throw new InvalidConfig('Definition of an argument type "boolean" must contain a value as content or the "value" attribute', null, null, $arg);
	}
986971
public function run( $args )
    {
        $this->command = $this->getCommand( $args );

        if ( NULL == $this->command )
        {
            throw new CommandException( 'Command: ' . $args[ 1 ] . ' not found' );
        }

        $this->processArgs( $this->command, $args );

        return $this->command->execute();
    }
34961
public function build(...$args)
    {
        $option = $this->query->getOption();
        $sql = 'select ' . $this->parseDistinct($option->distinct)
                . $this->parseField($option->field)
                . ' from '
                . $option->table
                . $this->parseJoin($option->join)
                . $this->parseWhere($option->where)
                . $this->parseGroup($option->group)
                . $this->parseHaving($option->having)
                . $this->parseOrder($option->order)
                . $this->parseLimit($option->offset, $option->limit)
                ;
        $this->query->bindValues($this->params);
        return $sql;
    }
1338699
public function addArgument($arg, $unique = false)
    {
        if (!is_scalar($arg)) {
            throw new InvalidArgumentException('scalar', 0);
        }

        // escape arguments with spaces
        if (strpos($arg, ' ') !== false && (strpos($arg, '"') === false) ) {
            $arg = "\"$arg\"";
        }

        if (in_array($arg, $this->arguments) && $unique) {
            return $this;
        }

        $this->arguments[] = $arg;

        return $this;
    }
166288
final public function execute(...$args)
    {
        $className = get_class($this);

        if (!method_exists($this, 'process')) {
            throw new RuntimeException(
                sprintf(
                    'Context "%s" should have process method',
                    $className
                )
            );
        }

        $process = new ReflectionMethod($className, 'process');

        if (!$process->isProtected()) {
            throw new RuntimeException('Method "process" should be protected');
        }

        return call_user_func_array([$this, 'process'], $args);
    }
334991
protected function processArgumentNull(Element $arg) {
		$definition = new stdClass();
		
		$definition->type  = 'value';
		$definition->value = null;
		
		return $definition;
	}
1053705
public function setArgsRequired($argData)
    {
        foreach ($argData as $argName => $required) {
            /* @var ArgumentScaffolder $arg */
            $arg = $this->args->find('argName', $argName);
            if (!$arg) {
                throw new InvalidArgumentException(sprintf(
                    'Tried to make arg %s required, but it was not added to %s',
                    $argName,
                    $this->operationName ?: '(unnamed operation)'
                ));
            }

            $arg->setRequired($required);
        }

        return $this;
    }
1136862
public static function start(string $args) : SymfonyProcess
  {
    $process = new SymfonyProcess('php ' . Accessor::$appRoot . 'craftsman ' . $args);
    $process->start();

    return $process;
  }
147733
protected function buildProcess()
    {
        if (!\count($this->arguments)) {
            throw new LogicException('You must add command arguments before the process can build.');
        }

        $process = new Process($this->arguments, $this->workingDirectory);

        $process->setCommandLine($process->getCommandLine());

        return $process;
    }
1220580
public function prependArg($arg)
    {
        Assertion::string($arg);
        $this->args = $this->args->prepend($arg);
    }
79485
public function setUrl($arg) {
        if ($this->type != self::MINI_PROGRAM) {
            $this->setType(self::VIEW);
        }
        $this->url = (string)$arg;
        return $this;
    }
679908
private function cmdClone($args)
    {
        $cmd = new CloneCommand($this->cwd);

        return $cmd->run(array_slice($args, 1));
    }
930005
public function addArgument(Argument $argument) {
        if (isset($this->arguments[$argument->getName()])) {
            throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
        }

        if ($this->hasAnArrayArgument) {
            throw new \LogicException('Cannot add an argument after an array argument.');
        }

        if ($argument->isRequired() && $this->hasOptional) {
            throw new \LogicException('Cannot add a required argument after an optional one.');
        }

        if ($argument->isArray()) {
            $this->hasAnArrayArgument = true;
        }

        if ($argument->isRequired()) {
            ++$this->requiredCount;
        }
        else {
            $this->hasOptional = true;
        }

        $this->arguments[$argument->getName()] = $argument;
    }
553079
public function add(string ...$args): self
    {
        $classes = $this->getClasses();

        $classes = array_values(array_unique(array_merge($classes, $args)));

        $this->html->setAttribute('class', implode(' ', $classes));

        return $this;
    }
34956
public function add(array $args)
    {
        # Establish args.

        $default_args = [
            'auto_prefix'        => true,
            'include_post_types' => [],
            'exclude_post_types' => [],
            'slug'               => '',
            'title'              => '',
            'class'              => '',
            'template_file'      => '',
            'template_dir'       => '',
            'callback'           => null,
            'on_save'            => null,
            'screen'             => null,
            'context'            => 'advanced',
            'priority'           => 'default',
        ];
        $cfg = (object) array_merge($default_args, $args);

        $cfg->auto_prefix        = (bool) $cfg->auto_prefix;
        $cfg->include_post_types = (array) $cfg->include_post_types;
        $cfg->exclude_post_types = (array) $cfg->exclude_post_types;
        $cfg->slug               = (string) $cfg->slug;
        $cfg->title              = (string) $cfg->title;
        $cfg->class              = (string) $cfg->class;
        $cfg->template_file      = (string) $cfg->template_file;
        $cfg->template_dir       = (string) $cfg->template_dir;
        $cfg->context            = (string) $cfg->context;
        $cfg->priority           = (string) $cfg->priority;

        if ($cfg->slug && $cfg->auto_prefix) {
            $cfg->slug = $this->App->Config->©brand['©slug'].'-'.$cfg->slug;
        } elseif (!$cfg->slug) {
            $cfg->slug = $this->App->Config->©brand['©slug'];
        }
        if (!$cfg->title) {
            $cfg->title = $this->App->Config->©brand['©name'];
        }
        $cfg->class .= $cfg->class ? ' ' : '';
        $cfg->class .= $this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-post-meta-box-wrapper';
        $cfg->class .= ' '.$this->App->Config->©brand['©slug'].'-post-meta-box-wrapper';
        $cfg->class .= $cfg->slug !== $this->App->Config->©brand['©slug'] ? ' '.$cfg->slug.'-post-meta-box-wrapper' : '';

        $cfg->nonce['action'] = $cfg->slug.'-save'; // Nonce action ID.
        $cfg->nonce['name']   = '_'.$this->c::slugToVar($cfg->slug).'_nonce';

        $cfg = $this->s::applyFilters('post_meta_box', $cfg, $args, $default_args);

        if (!$cfg->template_file) {
            throw $this->c::issue('Missing template file.');
        }
        $cfg->callback = $cfg->callback ?: function (\WP_Post $WP_Post) use ($cfg) {
            $post_id = (int) $WP_Post->ID;
            $vars    = compact('post_id', 'WP_Post', 'cfg');
            wp_nonce_field($cfg->nonce['action'], $cfg->nonce['name']);
            echo $this->c::getTemplate('s-core/admin/menu-pages/post-meta-box/template.php')->parse($vars);
        };
        # Build meta box sub-routines via closures.

        $on_load_maybe_do_setup = function () use ($cfg) {
            $current_post_type = $this->s::currentMenuPagePostType();

            if ($cfg->include_post_types && !in_array($current_post_type, $cfg->include_post_types, true)) {
                return; // Does not apply to this post type.
            } elseif ($cfg->exclude_post_types && in_array($current_post_type, $cfg->exclude_post_types, true)) {
                return; // Does not apply to this post type.
            }
            $on_add_meta_boxes = function () use ($cfg) {
                add_meta_box($cfg->slug, $cfg->title, $cfg->callback, $cfg->screen, $cfg->context, $cfg->priority);
            };
            $on_save_post = function ($post_id, \WP_Post $WP_Post) use ($cfg) {
                if (!($post_id = (int) $post_id)) {
                    return; // Not possible.
                }
                $_r = $this->c::unslash($_REQUEST);
                $_r = $this->c::mbTrim($_r);

                $nonce_action = $cfg->nonce['action'];
                $nonce_value  = $_r[$cfg->nonce['name']] ?? null;

                $data = $_r[$this->c::slugToVar($cfg->slug)] ?? [];
                $data = is_array($data) ? $data : []; // Force array.
                $data = $this->c::removeKey($data, '___ignore');

                if (!isset($nonce_value)) {
                    return; // Nonce is missing.
                } elseif (!wp_verify_nonce($nonce_value, $nonce_action)) {
                    return; // Nonce is unverifiable.
                } elseif (!current_user_can('edit_post', $post_id)) {
                    return; // Current user not allowed.
                } elseif (wp_is_post_autosave($post_id)) {
                    return; // Not applicable.
                } elseif (wp_is_post_revision($post_id)) {
                    return; // Not applicable.
                }
                foreach ($data as $_key => $_value) {
                    if ($_key && is_string($_key)) {
                        // Slash, because WP will unslash.
                        // This allows for `\` in form submissions.
                        $this->s::updatePostMeta($post_id, $_key, wp_slash($_value));
                    }
                }
                if (($on_save = $cfg->on_save)) {
                    $on_save($post_id, $data);
                }
            };
            add_action('add_meta_boxes', $on_add_meta_boxes);
            add_action('save_post', $on_save_post, 10, 2);
        };
        add_action('load-post.php', $on_load_maybe_do_setup);
        add_action('load-post-new.php', $on_load_maybe_do_setup);
    }
1282292
public void add(final String arg) {
        if (arg != null) {
            final Argument argument = parse(arg);
            add(argument);
        }
    }